private void updateBinningFormModel() { VariableConfig[] variableConfigs = new VariableConfig[variableItems.size()]; for (int i = 0; i < variableItems.size(); i++) { VariableItem variableItem = variableItems.get(i); variableConfigs[i] = variableItem.variableConfig; } try { binningFormModel.setVariableConfigs(variableConfigs); } catch (ValidationException e) { AbstractDialog.showErrorDialog(grid, e.getMessage(), "Aggregator Configuration"); } }
private void showWarningMessage(String message) { AbstractDialog.showWarningDialog(scrollPane, message, "Reprojection"); }
static void showNotApplicableInfo(Component parent) { AbstractDialog.showInformationDialog(parent, "Log display is not applicable!\nThe color palette must contain only positive slider values.", "Information"); }
/** * Shows the dialog. Overrides shall call {@code super.show()} at the end. * * @return the identifier of the last button pressed or zero if this is a modeless dialog. */ public int show() { setButtonID(0); if (!shown) { dialog.pack(); center(); } dialog.setVisible(true); shown = true; return getButtonID(); }
/** * Shows an information dialog on top of this dialog. * * @param infoMessage The message. */ public void showInformationDialog(String infoMessage) { showInformationDialog(infoMessage, getJDialog().getTitle()); }
/** * Shows a warning dialog on top of this dialog. * * @param warningMessage The message. */ public void showWarningDialog(String warningMessage) { showWarningDialog(warningMessage, getJDialog().getTitle()); }
collectButtons(buttons); String text = (String) otherItem; JButton otherButton = new JButton(text); otherButton.setName(getQualifiedPropertyName(text)); otherButton.addActionListener(e -> { setButtonID(ID_OTHER); if (verifyUserInput()) { onOther(); AbstractButton otherButton = (AbstractButton) otherItem; otherButton.addActionListener(e -> { setButtonID(ID_OTHER); if (verifyUserInput()) { onOther(); JButton button = new JButton("OK"); button.setMnemonic('O'); button.setName(getQualifiedPropertyName("ok")); button.addActionListener(e -> { setButtonID(ID_OK); if (verifyUserInput()) { onOK(); getJDialog().getRootPane().setDefaultButton(button); registerButton(ID_OK, button); button.setName(getQualifiedPropertyName("yes")); button.addActionListener(e -> {
String expression = variableItem.variableConfig.getExpr() != null ? variableItem.variableConfig.getExpr().trim() : ""; if (StringUtils.isNullOrEmpty(expression)) { AbstractDialog.showInformationDialog(getParent(), "The source band could not be created. The expression is empty.", "Information"); return false; AbstractDialog.showInformationDialog(getParent(), "The source band could not be created. The name is empty.", "Information"); return false; AbstractDialog.showInformationDialog(getParent(), message, "Information"); return false; } catch (ParseException e) { String errorMessage = "The source band could not be created.\nThe expression could not be parsed:\n" + e.getMessage(); /*I18N*/ AbstractDialog.showErrorDialog(getParent(), errorMessage, "Error"); return false;
/** * Shows an error dialog on top of this dialog. * * @param errorMessage The message. */ public void showErrorDialog(String errorMessage) { showErrorDialog(errorMessage, getJDialog().getTitle()); }
@Override public void windowClosing(WindowEvent e) { close(); } });
@Override public void showErrorDialog(String message) { final String dialogTitle; final AssistantPage currentPage = getCurrentPage(); if (currentPage != null) { dialogTitle = currentPage.getPageTitle(); } else { dialogTitle = "Unexpected Error"; } AbstractDialog.showErrorDialog(dialog, message, dialogTitle); }
private void handleError(final String message) { SwingUtilities.invokeLater(() -> { AbstractDialog.showWarningDialog(window, message, "Error"); }); } }
@Override public void actionPerformed(ActionEvent e) { File currentDirectory = getBandSetsDataDir(); JFileChooser fileChooser = new JFileChooser(currentDirectory); if (fileChooser.showOpenDialog(component.getParent()) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); try { BufferedReader reader = new BufferedReader(new FileReader(file)); List<String> bandNameList = new ArrayList<>(); String readBandName; while ((readBandName = reader.readLine()) != null) { bandNameList.add(readBandName); } reader.close(); String[] bandNames = bandNameList.toArray(new String[bandNameList.size()]); component.setReadRasterDataNodeNames(bandNames); } catch (IOException e1) { AbstractDialog.showInformationDialog(component.getParent(), "Could not load configuration", "Information"); } } } }
@Override public void actionPerformed(ActionEvent event) { JFileChooser fileChooser = new JFileChooser(); FileNameExtensionFilter parameterFileFilter = createParameterFileFilter(); fileChooser.addChoosableFileFilter(parameterFileFilter); fileChooser.setFileFilter(parameterFileFilter); fileChooser.setDialogTitle(TITLE); fileChooser.setDialogType(JFileChooser.OPEN_DIALOG); applyCurrentDirectory(fileChooser); int response = fileChooser.showDialog(parentComponent, "Load"); if (JFileChooser.APPROVE_OPTION == response) { try { preserveCurrentDirectory(fileChooser); readFromFile(fileChooser.getSelectedFile()); } catch (Exception e) { Debug.trace(e); AbstractDialog.showErrorDialog(parentComponent, "Could not load parameters.\n" + e.getMessage(), TITLE); } } }
private void showWarningMessage(String message) { AbstractDialog.showWarningDialog(getParent(), message, "Reprojection"); }
private boolean editVariableItem(VariableItem variableItem, int rowIndex) { final Product contextProduct = binningFormModel.getContextProduct(); if (contextProduct == null) { AbstractDialog.showInformationDialog(grid, "At least one source product must be set first", "Information"); return false;
private void saveSettings(Component parent, File settingsFile) { if (settingsFile == null) { settingsFile = getFile(parent, this.settingsFile, false); if (settingsFile == null) { return; } } try { try (FileWriter writer = new FileWriter(settingsFile)) { writer.write(createXStream().toXML(interactor.getModel())); } this.settingsFile = settingsFile; undoContext.getUndoManager().discardAllEdits(); interactor.setModelModified(false); interactor.updateForm(); } catch (IOException e) { String msg = MessageFormat.format("Failed to safe settings:\n{0}", e.getMessage()); AbstractDialog.showErrorDialog(parent, msg, "I/O Error"); } }
/** * Called if the help button has been clicked. * Clients should override this method to implement a different behaviour. */ protected void onHelp() { if (helpId == null || !new HelpCtx(helpId).display()) { showWarningDialog(String.format(Bundle.CTL_AbstractDlg_NoHelpIDShowingStandard(), helpId)); } }
AbstractDialog.showInformationDialog(window, "Use the geometry tools to add new points, lines or polygons.\n" + "You can then use the select tool to select and modify the shape\n" +
profile.store(file); } catch (IOException e) { AbstractDialog.showErrorDialog(this, "Failed to save RGB-profile '" + file.getName() + "':\n" + e.getMessage(),