@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 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 expressionPane = getProductExpressionPane(currentProduct); expressionPane.setCode((String) binding.getPropertyValue()); if (expressionPane.showModalDialog(null, "Expression Editor") == ModalDialog.ID_OK) { binding.setPropertyValue(expressionPane.getCode()); } } });
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; }
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 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; }
@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(); } };
@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(); } };
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(); }; }
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);