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()); } } }
private void addGraphTabs(final String title, final boolean addUI) { if (graphExecutorList.isEmpty()) { return; } tabbedPane.setSelectedIndex(0); while (tabbedPane.getTabCount() > 1) { tabbedPane.remove(tabbedPane.getTabCount() - 1); } final GraphExecuter graphEx = graphExecutorList.get(0); for (GraphNode n : graphEx.GetGraphNodes()) { if (n.GetOperatorUI() == null) continue; if (n.getNode().getOperatorName().equals("Read") || (replaceWritersWithUniqueTargetProduct && n.getNode().getOperatorName().equals("Write")) || n.getNode().getOperatorName().equals("ProductSet-Reader")) { n.setOperatorUI(null); continue; } if (addUI) { String tabTitle = title; if (tabTitle.isEmpty()) tabTitle = n.getOperatorName(); tabbedPane.addTab(tabTitle, null, n.GetOperatorUI().CreateOpTab(n.getOperatorName(), n.getParameterMap(), appContext), n.getID() + " Operator"); } } }
static GraphNode createNewGraphNode(final Graph graph, final GraphNodeList graphNodeList, final String opName, final String id) { final Node newNode = new Node(id, opName); final XppDomElement parameters = new XppDomElement("parameters"); newNode.setConfiguration(parameters); graph.addNode(newNode); final GraphNode newGraphNode = new GraphNode(newNode); graphNodeList.add(newGraphNode); newGraphNode.setOperatorUI(OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName())); return newGraphNode; }
private GraphNode createNewGraphNode(final Graph graph, final String opName, final String id) { final Node newNode = new Node(id, opName); final XppDomElement parameters = new XppDomElement("parameters"); newNode.setConfiguration(parameters); graph.addNode(newNode); final GraphNode newGraphNode = new GraphNode(newNode); graphNodeList.add(newGraphNode); newGraphNode.setOperatorUI(OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName())); moveWriterToLast(graph); return newGraphNode; }
private void replaceProductSetWithReaders(final GraphNode sourceNode, final String id, final String value) { final GraphNode newReaderNode = GraphExecuter.createNewGraphNode(graph, graphNodeList, OperatorSpi.getOperatorAlias(ReadOp.class), id); newReaderNode.setOperatorUI(null); final DomElement config = newReaderNode.getNode().getConfiguration(); final DomElement fileParam = new XppDomElement("file"); fileParam.setValue(value); config.addChild(fileParam); final String format = CommonReaders.findCommonProductFormat(new File(value)); if(format != null) { final DomElement formatParam = new XppDomElement("formatName"); formatParam.setValue(format); config.addChild(formatParam); } graphNodeList.switchConnections(sourceNode, newReaderNode.getID()); }
public void setGraph(final Graph graphFromFile, final boolean addUI) throws GraphException { if (graphFromFile != null) { graph = graphFromFile; graphNodeList.clear(); final XppDom presentationXML = graph.getApplicationData("Presentation"); if (presentationXML != null) { // get graph description final XppDom descXML = presentationXML.getChild("Description"); if (descXML != null && descXML.getValue() != null) { graphDescription = descXML.getValue(); } } final Node[] nodes = graph.getNodes(); for (Node n : nodes) { final GraphNode newGraphNode = new GraphNode(n); if (presentationXML != null) newGraphNode.setDisplayParameters(presentationXML); graphNodeList.add(newGraphNode); if (addUI) { OperatorUI ui = OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName()); if (ui == null) { throw new GraphException("Unable to load " + newGraphNode.getOperatorName()); } newGraphNode.setOperatorUI(ui); } notifyGraphEvent(new GraphEvent(events.ADD_EVENT, newGraphNode)); } } }