@Override public void actionPerformed(ActionEvent e) { ProductExpressionPane pep = ProductExpressionPane.createBooleanExpressionPane(new Product[]{activeProduct}, activeProduct, appContext.getPreferences()); pep.setCode(expressionArea.getText()); final int i = pep.showModalDialog(parentWindow, "Expression Editor"); if (i == ModalDialog.ID_OK) { expressionArea.setText(pep.getCode()); } } }
@Override public void actionPerformed(ActionEvent e) { ProductExpressionPane expressionPane = ProductExpressionPane.createGeneralExpressionPane(new Product[]{contextProduct}, contextProduct, null); expressionPane.setCode(variableItem.variableConfig.getExpr()); int status = expressionPane.showModalDialog(getJDialog(), "Expression Editor"); if (status == ModalDialog.ID_OK) { bindingContext.getBinding(PROPERTY_EXPRESSION).setPropertyValue(expressionPane.getCode()); } expressionPane.dispose(); } };
public void actionPerformed(ActionEvent e) { ProductExpressionPane expressionPane = getProductExpressionPane(currentProduct); expressionPane.setCode((String) binding.getPropertyValue()); if (expressionPane.showModalDialog(null, "Expression Editor") == ModalDialog.ID_OK) { binding.setPropertyValue(expressionPane.getCode()); } } });
@Override ProductExpressionPane getProductExpressionPane(Product currentProduct) { return ProductExpressionPane.createBooleanExpressionPane( new Product[]{currentProduct}, currentProduct, null); } }
@Override ProductExpressionPane getProductExpressionPane(Product currentProduct) { return ProductExpressionPane.createGeneralExpressionPane( new Product[]{currentProduct}, currentProduct, null); } }
private void invokeExpressionEditor() { SnapApp snapApp = SnapApp.getDefault(); final Window window = SwingUtilities.getWindowAncestor(snapApp.getMainFrame()); final ExpressionPane pane = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product, snapApp.getPreferencesPropertyMap()); pane.setCode(validMaskField.getText()); final int status = pane.showModalDialog(window, "Edit Valid Mask Expression"); if (status == ID_OK) { validMaskField.setText(pane.getCode()); validMaskField.setCaretPosition(0); } }
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 String getCode(ActionEvent e) { Product product = getMaskForm().getProduct(); ProductExpressionPane expressionPane = ProductExpressionPane.createBooleanExpressionPane( new Product[]{product}, product, null); expressionPane.setEmptyExpressionAllowed(false); expressionPane.setCode(""); if (expressionPane.showModalDialog(null, "New Logical Band Maths Expression") == AbstractDialog.ID_OK) { final String code = expressionPane.getCode(); if (!code.isEmpty()) { return code; } } return null; }
public void actionPerformed(ActionEvent e) { ProductExpressionPane pep = ProductExpressionPane.createGeneralExpressionPane(getCompatibleProducts(), targetProduct, appContext.getPreferences()); pep.setCode(paramExpression.getValueAsText()); int status = pep.showModalDialog(SwingUtilities.getWindowAncestor(panel), "Arithmetic Expression Editor"); if (status == ModalDialog.ID_OK) { paramExpression.setValue(pep.getCode(), null); Debug.trace("BandArithmetikDialog: expression is: " + pep.getCode()); bandDesc.expression = paramExpression.getValueAsText(); } pep.dispose(); pep = null; } };
private String editExpression(String expression) { final Product product = binningFormModel.getContextProduct(); if (product == null) { return null; } final ProductExpressionPane expressionPane; expressionPane = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product, appContext.getPreferences()); expressionPane.setCode(expression); final int i = expressionPane.showModalDialog(appContext.getApplicationWindow(), "Expression Editor"); if (i == ModalDialog.ID_OK) { return expressionPane.getCode(); } return null; }
private ActionListener createEditExpressionButtonListener() { return e -> { Product[] compatibleProducts = getCompatibleProducts(); ProductExpressionPane pep = ProductExpressionPane.createGeneralExpressionPane(compatibleProducts, targetProduct, SnapApp.getDefault().getPreferencesPropertyMap()); pep.setCode(getExpression()); int status = pep.showModalDialog(getJDialog(), "Band Maths Expression Editor"); if (status == ModalDialog.ID_OK) { bindingContext.getBinding(PROPERTY_NAME_EXPRESSION).setPropertyValue(pep.getCode()); } pep.dispose(); }; }
@Override public void actionPerformed(ActionEvent e) { ProductExpressionPane expressionPane = ProductExpressionPane.createBooleanExpressionPane(new Product[]{contextProduct}, contextProduct, null); expressionPane.setCode(variableItem.variableConfig.getValidExpr()); int status = expressionPane.showModalDialog(getJDialog(), "Valid Expression Editor"); if (status == ModalDialog.ID_OK) { bindingContext.getBinding(PROPERTY_VALID_EXPRESSION).setPropertyValue(expressionPane.getCode()); } expressionPane.dispose(); } };
private int editExpression(String[] value, final boolean booleanExpected) { Product product; try { product = mosaicModel.getReferenceProduct(); } catch (IOException ioe) { appContext.handleError(ioe.getMessage(), ioe); return 0; } if (product == null) { final String msg = "No source product specified."; appContext.handleError(msg, new IllegalStateException(msg)); return 0; } final ProductExpressionPane pep; if (booleanExpected) { pep = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product, appContext.getPreferences()); } else { pep = ProductExpressionPane.createGeneralExpressionPane(new Product[]{product}, product, appContext.getPreferences()); } pep.setCode(value[0]); final int i = pep.showModalDialog(appContext.getApplicationWindow(), value[0]); if (i == ModalDialog.ID_OK) { value[0] = pep.getCode(); } return i; }
private int editExpression(String[] value, final boolean booleanExpected) { Product product; try { product = mosaicModel.getReferenceProduct(); } catch (IOException ioe) { appContext.handleError(ioe.getMessage(), ioe); return 0; } if (product == null) { final String msg = "No source product specified."; appContext.handleError(msg, new IllegalStateException(msg)); return 0; } final ProductExpressionPane pep; if (booleanExpected) { pep = ProductExpressionPane.createBooleanExpressionPane(new Product[]{product}, product, appContext.getPreferences()); } else { pep = ProductExpressionPane.createGeneralExpressionPane(new Product[]{product}, product, appContext.getPreferences()); } pep.setCode(value[0]); final int i = pep.showModalDialog(appContext.getApplicationWindow(), value[0]); if (i == ModalDialog.ID_OK) { value[0] = pep.getCode(); } return i; }
if (type == Mask.BandMathsType.INSTANCE) { Product product = getMaskForm().getProduct(); ProductExpressionPane expressionPane = ProductExpressionPane.createBooleanExpressionPane( new Product[]{product}, product, null); expressionPane.setEmptyExpressionAllowed(false); expressionPane.setCode(selectedMaskConfig.getValue("expression")); if (expressionPane.showModalDialog(window, "Edit Band Maths Mask") == AbstractDialog.ID_OK) { String code = expressionPane.getCode(); selectedMaskConfig.setValue("expression", code); selectedMask.setDescription(code);