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; }
@Before public void setUp() throws Exception { node = new Node("id", "readOp"); final XppDomElement parameters = new XppDomElement("parameters"); node.setConfiguration(parameters); graphNode = new GraphNode(node); }
GraphNode newGraphNode = new GraphNode(newNode); graphNodeList.add(newGraphNode); toRemove.add(newGraphNode);
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)); } } }
@Test public void testSourceConnection() { final Node sourceNode = new Node("sourceID", "testSourceNodeOp"); final XppDomElement parameters = new XppDomElement("parameters"); sourceNode.setConfiguration(parameters); GraphNode sourceGraphNode = new GraphNode(sourceNode); // test connect graphNode.connectOperatorSource(sourceGraphNode.getID()); NodeSource ns = node.getSource(0); assertNotNull(ns); assertEquals(ns.getSourceNodeId(), sourceNode.getId()); // test disconnect graphNode.disconnectOperatorSources(sourceGraphNode.getID()); NodeSource[] nsList = node.getSources(); assertEquals(nsList.length, 0); } }