@Override protected void onApply() { if (isProcessing) return; ioPanel.onApply(); try { DoProcessing(); } catch (Exception e) { statusLabel.setText(e.getMessage()); } }
@Override public void hide() { ioPanel.releaseProducts(); super.hide(); }
public void setTargetProductNameSuffix(final String suffix) { ioPanel.setTargetProductNameSuffix(suffix); }
public void setTargetProductName(final String name) { final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel(); targetProductSelectorModel.setProductName(name + getTargetProductNameSuffix()); }
@Override public int show() { ioPanel.initProducts(); setContent(mainPanel); initGraphs(); return super.show(); }
@Override public void done() { if (!errorOccured) { final Date now = Calendar.getInstance().getTime(); final long diff = (now.getTime() - executeStartTime.getTime()) / 1000; if (diff > 120) { final float minutes = diff / 60f; statusLabel.setText("Processing completed in " + minutes + " minutes"); } else { statusLabel.setText("Processing completed in " + diff + " seconds"); } SystemUtils.freeAllMemory(); if (ioPanel.isOpenInAppSelected()) { final GraphExecuter graphEx = graphExecuterList.get(graphExecuterList.size() - 1); openTargetProducts(graphEx.getProductsToOpenInDAT()); } } cleanUpTempFiles(); }
mainPanel.add(tabbedPane, BorderLayout.CENTER); ioPanel = new IOPanel(appContext, tabbedPane, useSourceSelector);
private boolean ValidateAllNodes() { if (isProcessing) return false; if (ioPanel == null || graphExecuterList.isEmpty()) return false; boolean result; statusLabel.setText(""); try { // check the all files have been saved final Product srcProduct = ioPanel.getSelectedSourceProduct(); if (srcProduct != null && (srcProduct.isModified() || srcProduct.getFileLocation() == null)) { throw new OperatorException("The source product has been modified. Please save it before using it in " + getTitle()); } assignParameters(); // first graph must pass result = graphExecuterList.get(0).InitGraph(); } catch (Exception e) { statusLabel.setText(e.getMessage()); result = false; } return result; }
public void selectionChanged(SelectionChangeEvent event) { final Product selectedProduct = (Product) event.getSelection().getSelectedValue(); if (selectedProduct != null) { final TargetProductSelectorModel targetProductSelectorModel = targetProductSelector.getModel(); targetProductSelectorModel.setProductName(selectedProduct.getName() + getTargetProductNameSuffix()); } } });
/** * For running graphs in unit tests * * @throws Exception when failing validation */ public void testRunGraph() throws Exception { ioPanel.initProducts(); initGraphs(); if (ValidateAllNodes()) { for (GraphExecuter graphEx : graphExecuterList) { final String desc = graphEx.getGraphDescription(); if (desc != null && !desc.isEmpty()) System.out.println("Processing " + graphEx.getGraphDescription()); graphEx.InitGraph(); graphEx.executeGraph(ProgressMonitor.NULL); graphEx.disposeGraphContext(); } cleanUpTempFiles(); } else { throw new OperatorException(statusLabel.getText()); } }