/** * For coregistration * * @param graphEx the graph executer * @param productSetID the product set reader * @param masterFile master file * @param slaveFiles slave file list */ protected static void setSlaveIO(final GraphExecuter graphEx, final String productSetID, final File masterFile, final File[] slaveFiles) { final GraphNode productSetNode = graphEx.getGraphNodeList().findGraphNodeByOperator(productSetID); if (productSetNode != null) { StringBuilder str = new StringBuilder(masterFile.getAbsolutePath()); for (File slaveFile : slaveFiles) { str.append(','); str.append(slaveFile.getAbsolutePath()); } graphEx.setOperatorParam(productSetNode.getID(), "fileList", str.toString()); } }
void AutoConnectGraph() { if (!graphEx.getGraphNodeList().isGraphComplete()) { graphEx.autoConnectGraph(); repaint(); } }
/** * pass in a file list for a ProductSetReader * * @param productFileList the product files */ public void setInputFiles(final File[] productFileList) { final GraphNode productSetNode = graphEx.getGraphNodeList().findGraphNodeByOperator("ProductSet-Reader"); if (productSetNode != null) { ProductSetReaderOpUI ui = (ProductSetReaderOpUI) productSetNode.GetOperatorUI(); ui.setProductFileList(productFileList); } }
if (!graphEx.getGraphNodeList().isGraphComplete()) { final JMenuItem connectItem = new JMenuItem("Connect Graph", null); connectItem.setHorizontalTextPosition(JMenuItem.RIGHT);
protected void setIO(final GraphExecuter graphEx, final String readID, final File readPath, final String writeID, final File writePath, final String format) { final GraphNode readNode = graphEx.getGraphNodeList().findGraphNodeByOperator(readID); if (readNode != null) { graphEx.setOperatorParam(readNode.getID(), "file", readPath.getAbsolutePath()); } if (replaceWritersWithUniqueTargetProduct && writeID != null) { final GraphNode writeNode = graphEx.getGraphNodeList().findGraphNodeByOperator(writeID); if (writeNode != null) { if (format != null) graphEx.setOperatorParam(writeNode.getID(), "formatName", format); graphEx.setOperatorParam(writeNode.getID(), "file", writePath.getAbsolutePath()); } } }
/** * Update the nodes in the graph with the given reader file and writer file */ public static void setGraphIO(final GraphExecuter graphEx, final String readID, final File readPath, final String writeID, final File writePath, final String format) { final GraphNode readNode = graphEx.getGraphNodeList().findGraphNode(readID); if (readNode != null) { graphEx.setOperatorParam(readNode.getID(), "file", readPath.getAbsolutePath()); } if (writeID != null) { final GraphNode writeNode = graphEx.getGraphNodeList().findGraphNode(writeID); if (writeNode != null) { graphEx.setOperatorParam(writeNode.getID(), "formatName", format); graphEx.setOperatorParam(writeNode.getID(), "file", writePath.getAbsolutePath()); } } }
void RemoveSourceAction(String id) { if (selectedNode != null) { final GraphNode source = graphEx.getGraphNodeList().findGraphNode(id); selectedNode.disconnectOperatorSources(source.getID()); repaint(); } }
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()); } } }
/** * pass in a file list for a ProductSetReader * * @param product the product files */ public void setInputFile(final Product product) { final GraphNode readerNode = graphEx.getGraphNodeList().findGraphNodeByOperator( ReadOp.Spi.getOperatorAlias(ReadOp.class)); if (readerNode != null) { SourceUI ui = (SourceUI) readerNode.GetOperatorUI(); ui.setSourceProduct(product); ValidateAllNodes(); } }
/** * Handle mouse released event * * @param e the mouse event */ public void mouseReleased(MouseEvent e) { checkPopup(e); if (connectingSourceFromHead) { final GraphNode n = findNode(e.getPoint()); if (n != null && selectedNode != n) { connectSourceTargetNode.connectOperatorSource(n.getID()); } } else if (connectingSourceFromTail) { final GraphNode n = findNode(e.getPoint()); if (n != null && selectedNode != n) { n.connectOperatorSource(connectSourceTargetNode.getID()); } } connectingSourceFromHead = false; connectingSourceFromTail = false; connectSourceTargetNode = null; if (graphEx.getGraphNodeList().isGraphComplete()) { graphEx.notifyConnection(); } repaint(); }
final NodeSource[] nSources = n.getNode().getSources(); for (NodeSource nSource : nSources) { final GraphNode srcNode = graphEx.getGraphNodeList().findGraphNode(nSource.getSourceNodeId()); if (srcNode != null) n.drawConnectionLine(g, srcNode);
@Test public void testFindGraphNode() { GraphNode lostNode = graphEx.addOperator("lostOp"); GraphNode foundNode = graphEx.getGraphNodeList().findGraphNode(lostNode.getID()); assertTrue(foundNode.equals(lostNode)); graphEx.ClearGraph(); }