private void batchProcess(final ProductEntry[] productEntryList, final Map<File, File[]> slaveFileMap, final File outputFolder, final File graphFile) { final BatchGraphDialog batchDlg = new BatchGraphDialog(SnapApp.getDefault().getAppContext(), "Batch Processing", "batchProcessing", closeOnDone); batchDlg.addListener(batchListener); batchDlg.setInputFiles(productEntryList); batchDlg.setTargetFolder(outputFolder); batchDlg.setSlaveFileMap(slaveFileMap); if (graphFile != null) { batchDlg.LoadGraph(graphFile); } batchDlg.show(); if (autoApply) batchDlg.onApply(); }
public void LoadGraph(final File file) { try { graphFile = file; initGraphs(); addGraphTabs("", true); setTitle(file.getName()); } catch (Exception e) { SnapApp.getDefault().handleError("Unable to load graph " + file.toString(), e); } }
public void LoadGraph() { if (isProcessing) return; final File file = getFilePath(this.getContent(), "Graph File"); if (file != null) { LoadGraph(file); } }
private void batchProcess(final ProductEntry[] productEntryList, final File graphFile) { final BatchGraphDialog batchDlg = new BatchGraphDialog(SnapApp.getDefault().getAppContext(), "Batch Processing", "batchProcessing", false); batchDlg.setInputFiles(productEntryList); if (graphFile != null) { batchDlg.LoadGraph(graphFile); } batchDlg.show(); } }
@Override public void actionPerformed(final ActionEvent event) { final BatchGraphDialog dialog = new BatchGraphDialog(SnapApp.getDefault().getAppContext(), "Batch Processing", "batchProcessing", false); dialog.show(); }
@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(); } }
/** * OnLoad */ @Override protected void onYes() { LoadGraph(); }
private boolean ValidateAllNodes() { if (isProcessing) return false; if (productSetPanel == null) return false; if (graphExecutorList.isEmpty()) return false; boolean result; statusLabel.setText(""); try { cloneGraphs(); assignParameters(); // first graph must pass result = graphExecutorList.get(0).InitGraph(); } catch (Exception e) { statusLabel.setText(e.getMessage()); bottomStatusLabel.setText(""); result = false; } return result; }
/** * 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 protected void onClose() { CancelProcessing(); super.onClose(); }
@Override public void onApply() { if (isProcessing) return; productSetPanel.onApply(); skipExistingTargetFiles = productSetPanel.isSkippingExistingTargetFiles(); try { DoProcessing(); } catch (Exception e) { statusLabel.setText(e.getMessage()); bottomStatusLabel.setText(""); } }
void createGraphs() throws GraphException { try { final GraphExecuter graphEx = new GraphExecuter(); LoadGraph(graphEx, graphFile, true); graphExecutorList.add(graphEx); } catch (Exception e) { throw new GraphException(e.getMessage()); } }
protected void cloneGraphs() throws Exception { final GraphExecuter graphEx = graphExecutorList.get(0); for (int graphIndex = 1; graphIndex < graphExecutorList.size(); ++graphIndex) { final GraphExecuter cloneGraphEx = graphExecutorList.get(graphIndex); cloneGraphEx.ClearGraph(); } graphExecutorList.clear(); graphExecutorList.add(graphEx); final File[] fileList = productSetPanel.getFileList(); for (int graphIndex = 1; graphIndex < fileList.length; ++graphIndex) { final GraphExecuter cloneGraphEx = new GraphExecuter(); LoadGraph(cloneGraphEx, graphFile, false); graphExecutorList.add(cloneGraphEx); // copy UI parameter to clone final GraphNode[] cloneGraphNodes = cloneGraphEx.GetGraphNodes(); for (GraphNode cloneNode : cloneGraphNodes) { final GraphNode node = graphEx.getGraphNodeList().findGraphNode(cloneNode.getID()); if (node != null) cloneNode.setOperatorUI(node.GetOperatorUI()); } } }