@Override public int show() { strategy.updateCheckBoxStates(); return super.show(); }
@Override public int show() { updateUI(); return super.show(); }
@Override public int show() { createUI(); return super.show(); }
public int showModalDialog(Window parent, String title) { ModalDialog dialog = new ExpressionPaneDialog(parent, title); return dialog.show(); }
static private VectorDataLayer showSelectLayerDialog(ProductSceneView productSceneView, List<Layer> layers) { String[] layerNames = new String[layers.size()]; for (int i = 0; i < layerNames.length; i++) { layerNames[i] = layers.get(i).getName(); } JList<String> listBox = new JList<>(layerNames); JPanel panel = new JPanel(new BorderLayout(4, 4)); panel.add(new JLabel("Please select a vector data container:"), BorderLayout.NORTH); panel.add(new JScrollPane(listBox), BorderLayout.CENTER); ModalDialog dialog = new ModalDialog(SwingUtilities.getWindowAncestor(productSceneView), "Select Vector Data Container", ModalDialog.ID_OK_CANCEL_HELP, ""); dialog.setContent(panel); int i = dialog.show(); if (i == ModalDialog.ID_OK) { final int index = listBox.getSelectedIndex(); if (index >= 0) { return (VectorDataLayer) layers.get(index); } } return null; }
@Override public int show() { final int button = super.show(); if (button == ID_OK) { final String text = getPattern(); if (text == null || text.length() == 0) { showErrorDialog(getParent(), "Pattern field may not be empty.", "File/Directory Selection Pattern"); return ID_CANCEL; } } return button; } }
public boolean showDialog(Window parent, String title, String helpId) { ModalDialog modalDialog = new ModalDialog(parent, title, ModalDialog.ID_OK_CANCEL_HELP, helpId); modalDialog.setContent(this); final int status = modalDialog.show(); modalDialog.getJDialog().dispose(); return status == ModalDialog.ID_OK; }
private void showInformationDialog(String title, Component component) { final ModalDialog modalDialog = new ModalDialog(UIUtils.getRootWindow(parentComponent), title, AbstractDialog.ID_OK, null); /*I18N*/ modalDialog.setContent(component); modalDialog.show(); } }
private void showInformationDialog(String title, Component component) { final ModalDialog modalDialog = new ModalDialog(UIUtils.getRootWindow(parentComponent), title, AbstractDialog.ID_OK, null); /*I18N*/ modalDialog.setContent(component); modalDialog.show(); }
@Override public int show() { createParameter(); createUI(); updateUI(); return super.show(); }
@Override public int show() { getJDialog().revalidate(); if (this.currentOperation == OperationType.FORCED_EDIT) { if (BundleInstaller.isBundleFileAvailable(this.oldOperatorDescriptor.getBundle())) { SwingUtilities.invokeLater(() -> { Dialogs.Answer answer = Dialogs.requestDecision("Bundle Available", "A bundle has been configured for this adapter.\n" + "Do you want to proceed with bundle download/installation?", false, null); if (answer == Dialogs.Answer.YES) { if (downloadAction != null) { try { downloadAction.call(); } catch (Exception e) { logger.warning(e.getMessage()); } } } else { onOK(); } }); } else { SwingUtilities.invokeLater(this::onOK); } } return super.show(); }
private void invokeExpressionEditor(final int colorIndex) { final Window window = SwingUtilities.getWindowAncestor(this); final String title = "Edit " + getComponentName(colorIndex) + " Expression"; if (product != null) { final ExpressionPane pane; final Product[] products = getCompatibleProducts(product, openedProducts); pane = ProductExpressionPane.createGeneralExpressionPane(products, product, preferences); pane.setCode(getExpression(colorIndex)); int status = pane.showModalDialog(window, title); if (status == ModalDialog.ID_OK) { setExpression(colorIndex, pane.getCode()); } } else { final JTextArea textArea = new JTextArea(8, 48); textArea.setFont(EXPRESSION_FONT); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setText(getExpression(colorIndex)); final ModalDialog modalDialog = new ModalDialog(window, title, ModalDialog.ID_OK_CANCEL, ""); final JPanel panel = new JPanel(new BorderLayout(2, 2)); panel.add(new JLabel("Expression:"), BorderLayout.NORTH); panel.add(new JScrollPane(textArea), BorderLayout.CENTER); modalDialog.setContent(panel); final int status = modalDialog.show(); if (status == ModalDialog.ID_OK) { setExpression(colorIndex, textArea.getText()); } } }
@Override public int show() { setContent(createUI()); this.getJDialog().getRootPane().registerKeyboardAction(e -> close(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW); getJDialog().setResizable(false); return super.show(); }
ID_OK, null); dialog.getJDialog().setResizable(false); dialog.show();
modalDialog.setContent(contentPanel); modalDialog.center(); modalDialog.show();
@Override public void actionPerformed(ActionEvent e) { final String operationName = model.operationWrapper.getName(); final ModalDialog modalDialog = new ModalDialog(parent, operationName + " - Parameters", ModalDialog.ID_OK_CANCEL, null); final ParameterValueGroup workCopy = model.parameters.clone(); final PropertyContainer propertyContainer = createValueContainer(workCopy); modalDialog.setContent(new PropertyPane(propertyContainer).createPanel()); if (modalDialog.show() == AbstractDialog.ID_OK) { vc.setValue(PARAMETERS, workCopy); } } }
private void showResults(MaskAreaStatistics areaStatistics) { final double roundFactor = 10000.0; final double maskAreaR = MathUtils.round(areaStatistics.getMaskArea(), roundFactor); final double meanPixelAreaR = MathUtils.round(areaStatistics.getMaskArea() / areaStatistics.getNumPixels(), roundFactor); final double pixelAreaMinR = MathUtils.round(areaStatistics.getPixelAreaMin(), roundFactor); final double pixelAreaMaxR = MathUtils.round(areaStatistics.getPixelAreaMax(), roundFactor); final JPanel content = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.WEST; gbc.insets.right = 4; gbc.gridy = 0; gbc.weightx = 0; gbc.insets.top = 2; addField(content, gbc, "Number of Mask pixels:", String.format("%15d", areaStatistics.getNumPixels()), ""); addField(content, gbc, "Mask area:", String.format("%15.3f", maskAreaR), "km^2"); addField(content, gbc, "Mean pixel area:", String.format("%15.3f", meanPixelAreaR), "km^2"); addField(content, gbc, "Minimum pixel area:", String.format("%15.3f", pixelAreaMinR), "km^2"); addField(content, gbc, "Maximum pixel area:", String.format("%15.3f", pixelAreaMaxR), "km^2"); gbc.insets.top = 8; addField(content, gbc, "Mean earth radius:", String.format("%15.3f", areaStatistics.getEarthRadius()), "km"); final ModalDialog dialog = new ModalDialog(SnapApp.getDefault().getMainFrame(), Bundle.CTL_ComputeMaskAreaAction_DialogTitle() + " - " + mask.getDisplayName(), content, ModalDialog.ID_OK | ModalDialog.ID_HELP, getHelpCtx().getHelpID()); dialog.show(); }
sourceProduct, workCopy); outputParametersDialog.setContent(form); if (outputParametersDialog.show() == ModalDialog.ID_OK) { outputGeometryModel = workCopy; updateProductSize();
private boolean editAggregatorItem(AggregatorItem aggregatorItem, int rowIndex) { Product contextProduct = binningFormModel.getContextProduct(); if (contextProduct == null) { Dialogs.showInformation("Please select source products before adding aggregators."); return false; } String[] varNames = getVariableNames(binningFormModel.getVariableConfigs()); String[] bandNames = contextProduct.getBandNames(); String[] tiePointGridNames = contextProduct.getTiePointGridNames(); String[] maskNames = contextProduct.getMaskGroup().getNodeNames(); String[] sourceNames = StringUtils.addArrays(varNames, bandNames); sourceNames = StringUtils.addArrays(sourceNames, tiePointGridNames); sourceNames = StringUtils.addArrays(sourceNames, maskNames); boolean isNewAggregatorItem = rowIndex < 0; ModalDialog aggregatorDialog = new AggregatorItemDialog(SwingUtilities.getWindowAncestor(grid), sourceNames, aggregatorItem, isNewAggregatorItem); int result = aggregatorDialog.show(); if (result == ModalDialog.ID_OK) { if (isNewAggregatorItem) { addDataRow(aggregatorItem); } else { updateDataRow(aggregatorItem, rowIndex); } return true; } return false; }
@Override public void actionPerformed(ActionEvent e) { ProductNode productNode = SnapApp.getDefault().getSelectedProductNode(SnapApp.SelectionSourceHint.VIEW); if (productNode == null) { return; } Product product = productNode.getProduct(); if (product != null) { DialogData dialogData = new DialogData(product.getVectorDataGroup()); PropertySet propertySet = PropertyContainer.createObjectBacked(dialogData); propertySet.getDescriptor("name").setNotNull(true); propertySet.getDescriptor("name").setNotEmpty(true); propertySet.getDescriptor("name").setValidator(new NameValidator(product)); propertySet.getDescriptor("description").setNotNull(true); final PropertyPane propertyPane = new PropertyPane(propertySet); JPanel panel = propertyPane.createPanel(); panel.setPreferredSize(new Dimension(400, 100)); ModalDialog dialog = new MyModalDialog(propertyPane); dialog.setContent(panel); int i = dialog.show(); if (i == ModalDialog.ID_OK) { createDefaultVectorDataNode(product, dialogData.name, dialogData.description); } } }