item.addActionListener(this); final NodeSource[] sources = selectedNode.getNode().getSources(); if (sources.length > 0) { final JMenu removeSourcedMenu = new JMenu("Remove Source");
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"); } } }
public void restore() { for (GraphNode multiSrcNode : savedProductSetList) { final List<GraphNode> nodesToRemove = new ArrayList<>(); for (GraphNode n : graphNodeList.getGraphNodes()) { final String id = n.getID(); if (id.startsWith("inserted--" + multiSrcNode.getID()) && id.contains(multiSrcNode.getID())) { graphNodeList.switchConnections(n, multiSrcNode.getID()); nodesToRemove.add(n); } } for (GraphNode r : nodesToRemove) { removeNode(r); } graphNodeList.add(multiSrcNode); graph.addNode(multiSrcNode.getNode()); } }
public void restore() { for (GraphNode savedNode : savedSubGraphList) { final GraphNode[] nodesToRemove = subGraphNodesToRemoveMap.get(savedNode); for (GraphNode n : nodesToRemove) { final GraphNode[] connectedNodes = graphNodeList.findConnectedNodes(n); for (GraphNode node : connectedNodes) { node.connectOperatorSource(savedNode.getID()); final String name = node.getSourceName(n.getID()); node.setSourceName(name, savedNode.getNode().getId()); } removeNode(n); } graphNodeList.add(savedNode); graph.addNode(savedNode.getNode()); } }
void updateGraphNodes(final GraphContext graphContext) throws GraphException { if (graphContext != null) { for (GraphNode n : nodeList) { final NodeContext context = graphContext.getNodeContext(n.getNode()); if(context.getOperator() != null) { n.setSourceProducts(context.getSourceProducts()); } n.updateParameters(); } } }
private void moveWriterToLast(final Graph graph) { final String writeOperatorAlias = OperatorSpi.getOperatorAlias(WriteOp.class); final GraphNode writerNode = graphNodeList.findGraphNode(writeOperatorAlias); if (writerNode != null) { removeNode(writerNode); graphNodeList.add(writerNode); graph.addNode(writerNode.getNode()); } }
final NodeSource[] nSources = n.getNode().getSources(); for (NodeSource nSource : nSources) { final GraphNode srcNode = graphEx.getGraphNodeList().findGraphNode(nSource.getSourceNodeId());
final GraphNode[] connectedNodes = graphNodeList.findConnectedNodes(subGraphOpNode); final NodeSource[] sources = subGraphOpNode.getNode().getSources(); for (NodeSource source : sources) {
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()); }
/** * Implements the functionality of Observer participant of Observer Design Pattern to define a one-to-many * dependency between a Subject object and any number of Observer objects so that when the * Subject object changes state, all its Observer objects are notified and updated automatically. * <p> * Defines an updating interface for objects that should be notified of changes in a subject. * * @param subject The Observerable subject * @param data optional data */ public void update(java.util.Observable subject, Object data) { GraphExecuter.GraphEvent event = (GraphExecuter.GraphEvent) data; GraphNode node = (GraphNode) event.getData(); String opID = node.getNode().getId(); if (event.getEventType() == GraphExecuter.events.ADD_EVENT) { updateValue = "Add"; } else if (event.getEventType() == GraphExecuter.events.REMOVE_EVENT) { updateValue = "Remove"; } else if (event.getEventType() == GraphExecuter.events.SELECT_EVENT) { updateValue = "Selected"; } } }
@Test public void testNode() { assertEquals(node, graphNode.getNode()); assertEquals(node.getId(), graphNode.getID()); assertEquals(node.getOperatorName(), graphNode.getOperatorName()); }