public GraphBuilderDialog(final AppContext theAppContext, final String title, final String helpID, final boolean allowGraphBuilding) { super(theAppContext.getApplicationWindow(), title, 0, helpID); this.allowGraphBuilding = allowGraphBuilding; appContext = theAppContext; graphEx = new GraphExecuter(); graphEx.addObserver(this); String lastDir = SnapApp.getDefault().getPreferences().get(LAST_GRAPH_PATH, ResourceUtils.getGraphFolder("").toFile().getAbsolutePath()); if (new File(lastDir).exists()) { SnapApp.getDefault().getPreferences().put(LAST_GRAPH_PATH, lastDir); } initUI(); }
public MultiGraphDialog(final AppContext theAppContext, final String title, final String helpID, final boolean useSourceSelector) { super(theAppContext.getApplicationWindow(), title, ID_APPLY_CLOSE_HELP, helpID); appContext = theAppContext;
wktArea.setText(wkt); final JScrollPane scrollPane = new JScrollPane(wktArea); final ModalDialog dialog = new ModalDialog(appContext.getApplicationWindow(), "Coordinate reference system as well known text", scrollPane,
wktArea.setText(wkt); final JScrollPane scrollPane = new JScrollPane(wktArea); final ModalDialog dialog = new ModalDialog(appContext.getApplicationWindow(), "Coordinate reference system as well known text", scrollPane,
@Override public void actionPerformed(ActionEvent e) { ProductChooser productChooser = new ProductChooser(appContext.getApplicationWindow(), "Add product", ModalDialog.ID_OK_CANCEL, null, filterProducts()); if (productChooser.show() != ModalDialog.ID_OK) { return; } try { if (productChooser.getSelectedProducts().size() > 0) { listModel.addElements(productChooser.getSelectedProducts().toArray()); } } catch (ValidationException ve) { Debug.trace(ve); } }
final BandChooser bandChooser = new BandChooser(appContext.getApplicationWindow(), "Band Chooser", null,
protected SingleTargetProductDialog(AppContext appContext, String title, int buttonMask, String helpID, TargetProductSelectorModel model, boolean alwaysWriteOutput) { super(appContext.getApplicationWindow(), title, buttonMask, helpID); this.appContext = appContext; targetProductSelector = new TargetProductSelector(model, alwaysWriteOutput); String homeDirPath = SystemUtils.getUserHomeDir().getPath(); String saveDir = appContext.getPreferences().getPropertyString(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath); targetProductSelector.getModel().setProductDir(new File(saveDir)); if (!alwaysWriteOutput) { targetProductSelector.getOpenInAppCheckBox().setText("Open in " + appContext.getApplicationName()); } targetProductSelector.getModel().getValueContainer().addPropertyChangeListener(evt -> { if (evt.getPropertyName().equals("saveToFileSelected") || evt.getPropertyName().equals("openInAppSelected")) { updateRunButton(); } }); AbstractButton button = getButton(ID_APPLY); button.setText("Run"); button.setMnemonic('R'); updateRunButton(); }
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 ToolAdaptersManagementDialog(AppContext appContext, String title, String helpID) { super(appContext.getApplicationWindow(), title, 0, helpID); this.appContext = appContext; JPanel contentPanel = createContentPanel(); setContent(contentPanel); super.getJDialog().setMinimumSize(contentPanel.getPreferredSize()); EscapeAction.register(super.getJDialog()); ToolAdapterRegistry.INSTANCE.addListener(new ToolAdapterListener() { @Override public void adapterAdded(ToolAdapterOperatorDescriptor operatorDescriptor) { refreshContent(); } @Override public void adapterRemoved(ToolAdapterOperatorDescriptor operatorDescriptor) { refreshContent(); } @Override public void adapterUpdated(ToolAdapterOperatorDescriptor operatorDescriptor) { ((OperatorsTableModel) operatorsTable.getModel()).fireTableDataChanged(); } }); }
private AbstractButton createOutputDirChooserButton(final Property outputFileProperty) { AbstractButton button = new JButton("..."); button.addActionListener(e -> { FolderChooser folderChooser = new FolderChooser(); folderChooser.setCurrentDirectory(new File(getDefaultOutputPath(appContext))); folderChooser.setDialogTitle("Select output directory"); folderChooser.setMultiSelectionEnabled(false); int result = folderChooser.showDialog(appContext.getApplicationWindow(), "Select"); /*I18N*/ if (result != JFileChooser.APPROVE_OPTION) { return; } File selectedFile = folderChooser.getSelectedFile(); setOutputDirPath(selectedFile.getAbsolutePath()); try { outputFileProperty.setValue(selectedFile); appContext.getPreferences().setPropertyString(PROPERTY_NAME_LAST_OPEN_OUTPUT_DIR, selectedFile.getAbsolutePath()); } catch (ValidationException ve) { // not expected to ever come here appContext.handleError("Invalid input path", ve); } }); return button; }
ModuleSuiteDialog(AppContext appContext, String title, String helpID, Set<ToolAdapterOperatorDescriptor> selection) { super(appContext.getApplicationWindow(), title, ID_OK | ID_CANCEL, helpID); this.descriptor = new ModuleSuiteDescriptor(); this.descriptor.setAuthors(System.getProperty("user.name"));
final Window parent = appContext.getApplicationWindow();
@Override public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { switch (column) { case 0: lastEditor = null; return delButton; case 1: lastEditor = getDefaultEditor(Boolean.class); return lastEditor.getTableCellEditorComponent(table, value, isSelected, row, column); case 3: SystemVariable variable = variables.get(row); if (variable instanceof SystemDependentVariable) { lastEditor = new SystemDependentVariableCellEditor(appContext.getApplicationWindow(), (SystemDependentVariable)variable, null); return lastEditor.getTableCellEditorComponent(table, value, isSelected, row, column); } else { lastEditor = getDefaultEditor(String.class); return lastEditor.getTableCellEditorComponent(table, value, isSelected, row, column); } default: lastEditor = getDefaultEditor(String.class); return lastEditor.getTableCellEditorComponent(table, value, isSelected, row, column); } }
public BatchGraphDialog(final AppContext theAppContext, final String title, final String helpID, final boolean closeOnDone) { super(theAppContext.getApplicationWindow(), title, ID_YES | ID_APPLY_CLOSE_HELP, helpID); this.appContext = theAppContext; this.baseTitle = title; this.closeOnDone = closeOnDone; openProcessedProducts = true; setContent(createUI()); if (getJDialog().getJMenuBar() == null) { final GraphsMenu operatorMenu = new GraphsMenu(getJDialog(), this); getJDialog().setJMenuBar(operatorMenu.createDefaultMenu()); } super.getJDialog().setMinimumSize(new Dimension(400, 300)); }
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; }
public ToolParameterEditorDialog(AppContext appContext, ToolAdapterOperatorDescriptor operator, ToolParameterDescriptor inputParameter) { super(appContext.getApplicationWindow(), inputParameter.getName(), ID_OK_CANCEL, helpID); this.operator = operator; this.oldParameter = inputParameter; this.parameter = new ToolParameterDescriptor(inputParameter); this.parameter.setDeprecated(inputParameter.isDeprecated()); // copy the value this.container = PropertyContainer.createObjectBacked(this.parameter); this.valuesContext = new BindingContext(this.container); addComponents(); EscapeAction.register(getJDialog()); }
final ModalDialog outputParametersDialog = new OutputParametersDialog(appContext.getApplicationWindow(), sourceProduct, workCopy); outputParametersDialog.setContent(form);
final ModalDialog outputParametersDialog = new OutputParametersDialog(appContext.getApplicationWindow(), sourceProduct, workCopy); outputParametersDialog.setContent(form);
public TemplateParameterEditorDialog(AppContext appContext, TemplateParameterDescriptor parameter, ToolAdapterOperatorDescriptor parent) { super(appContext.getApplicationWindow(), parameter.getName(), ID_OK_CANCEL, "");