/** * Loads a new graph from a file * * @param executer the GraphExcecuter * @param graphFile the graph file to load * @param addUI add a user interface */ protected void LoadGraph(final GraphExecuter executer, final File file, final boolean addUI) { try { executer.loadGraph(new FileInputStream(file), file, addUI, true); } catch (Exception e) { showErrorDialog(e.getMessage()); } }
/** * Validates the input and then call the GPF to execute the graph */ private void DoProcessing() { if (ValidateAllNodes()) { SystemUtils.freeAllMemory(); progressBar.setValue(0); final SwingWorker<Boolean, Object> processThread = new ProcessThread(progBarMonitor); processThread.execute(); } else { if (statusLabel.getText() != null && !statusLabel.getText().isEmpty()) showErrorDialog(statusLabel.getText()); } }
@Override public void done() { if (!errorOccured) { if (openProcessedProducts) { openTargetProducts(); } bottomStatusLabel.setText(""); } if (!errMsgs.isEmpty()) { final StringBuilder msg = new StringBuilder("The following errors occurred:\n"); for (String errStr : errMsgs) { msg.append(errStr); msg.append('\n'); } showErrorDialog(msg.toString()); } cleanUpTempFiles(); notifyMSG(BatchProcessListener.BatchMSG.DONE); if (closeOnDone) { close(); } if (SnapApp.getDefault().getPreferences().getBoolean(GPF.BEEP_AFTER_PROCESSING_PROPERTY, false)) { Toolkit.getDefaultToolkit().beep(); } }
private void openTargetProducts() { final File[] fileList = getAllBatchProcessedTargetProducts(); if (fileList != null && fileList.length > 0) { for (File file : fileList) { try { final Product product = CommonReaders.readProduct(file); if (product != null) { appContext.getProductManager().addProduct(product); } } catch (IOException e) { showErrorDialog(e.getMessage()); } } } }