protected void showOpenInAppInfo() { final String message = MessageFormat.format( "<html>The target product has successfully been created and opened in {0}.<br><br>" + "Actual processing of source to target data will be performed only on demand,<br>" + "for example, if the target product is saved or an image view is opened.", appContext.getApplicationName() ); showSuppressibleInformationDialog(message, "openInAppInfo"); }
private void updateExpressionComponents() { final boolean useExpressionSelected = useExpressionCheckBox.isSelected(); editExpressionButton.setEnabled(useExpressionSelected && activeProduct != null); String toolTip = null; if (activeProduct == null) { toolTip = String.format("Editor can only be used with a product opened in %s.", appContext.getApplicationName()); } editExpressionButton.setToolTipText(toolTip); expressionArea.setEnabled(useExpressionSelected); expressionNoteLabel.setEnabled(useExpressionSelected); expressionAsFilterButton.setEnabled(useExpressionSelected); exportExpressionResultButton.setEnabled(useExpressionSelected); }
@Override public JComponent CreateOpTab(String operatorName, Map<String, Object> parameterMap, AppContext appContext) { initializeOperatorUI(operatorName, parameterMap); final JComponent panel = createPanel(); initParameters(); divisionBy.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent event) { updateDivisionBy(); } }); File saveDir = null; final Object value = paramMap.get(FILE_PARAMETER); if (value != null) { final File file = (File) value; saveDir = file.getParentFile(); } if (saveDir == null) { final String homeDirPath = SystemUtils.getUserHomeDir().getPath(); final String savePath = SnapApp.getDefault().getPreferences().get(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath); saveDir = new File(savePath); } targetProductSelector.getModel().setProductDir(saveDir); targetProductSelector.getOpenInAppCheckBox().setText("Open in " + appContext.getApplicationName()); return panel; }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
private void showSaveAndOpenInAppInfo(long saveTime) { File productFile = getTargetProductSelector().getModel().getProductFile(); final String message = MessageFormat.format( "<html>The target product has been successfully written to<br>" + "<p>{0}</p><br>" + "and has been opened in {1}.<br><br>" + "Total time spend for processing: {2}<br>", formatFile(productFile), appContext.getApplicationName(), formatDuration(saveTime) ); showSuppressibleInformationDialog(message, "saveAndOpenInAppInfo"); }
panel.setLayout(layout); panel.add(new JLabel("<html>" + SnapApp.getDefault().getAppContext().getApplicationName() + " can interpret the imported point data in various ways.<br>" + "Please select:<br><br></html>"));
private void updateRunButton() { AbstractButton button = getButton(ID_APPLY); boolean save = targetProductSelector.getModel().isSaveToFileSelected(); boolean open = targetProductSelector.getModel().isOpenInAppSelected(); String toolTipText = ""; boolean enabled = true; if (save && open) { toolTipText = "Save target product and open it in " + getAppContext().getApplicationName(); } else if (save) { toolTipText = "Save target product"; } else if (open) { toolTipText = "Open target product in " + getAppContext().getApplicationName(); } else { enabled = false; } button.setToolTipText(toolTipText); button.setEnabled(enabled); }
final String saveDir = SnapApp.getDefault().getPreferences().get(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath); targetProductSelector.getModel().setProductDir(new File(saveDir)); targetProductSelector.getOpenInAppCheckBox().setText("Open in " + theAppContext.getApplicationName());
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(); }
"<html>A product with the name ''{0}'' is already opened in {1}.<br><br>" + "Do you want to continue?", productName, appContext.getApplicationName() ); final int answer = JOptionPane.showConfirmDialog(getJDialog(), message,
public ProductSetPanel(final AppContext theAppContext, final String title, final FileTable fileTable, final boolean incTrgProduct, final boolean incButtonPanel) { super(new BorderLayout()); this.appContext = theAppContext; this.productSetTable = fileTable; setBorderTitle(title); final JPanel productSetContent = createComponent(productSetTable); if (incButtonPanel) { buttonPanel = createButtonPanel(productSetTable); productSetContent.add(buttonPanel, BorderLayout.EAST); } this.add(productSetContent, BorderLayout.CENTER); if (incTrgProduct) { targetProductSelector = new TargetFolderSelector(); final String homeDirPath = SystemUtils.getUserHomeDir().getPath(); final String saveDir = SnapApp.getDefault().getPreferences().get(SaveProductAsAction.PREFERENCES_KEY_LAST_PRODUCT_DIR, homeDirPath); targetProductSelector.getModel().setProductDir(new File(saveDir)); targetProductSelector.getOpenInAppCheckBox().setText("Open in " + theAppContext.getApplicationName()); targetProductSelector.getOpenInAppCheckBox().setVisible(false); this.add(targetProductSelector.createPanel(), BorderLayout.SOUTH); } else { targetProductSelector = null; } fileTable.getModel().addTableModelListener(this); updateComponents(); }