/** * Paints the panel component * * @param g The Graphics */ @Override protected void paintComponent(java.awt.Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); DrawGraph(g2, graphEx.GetGraphNodes()); }
public void autoConnectGraph() { final List<GraphNode> nodeList = Arrays.asList(GetGraphNodes()); Collections.sort(nodeList, new GraphNodePosComparator()); final GraphNode[] nodes = nodeList.toArray(new GraphNode[nodeList.size()]); for (int i = 0; i < nodes.length - 1; ++i) { if (!nodes[i].HasSources()) { nodes[i].connectOperatorSource(nodes[i + 1].getID()); } } notifyConnection(); }
final StringBuilder errorMsg = new StringBuilder(100); final StringBuilder warningMsg = new StringBuilder(100); for (GraphNode n : graphEx.GetGraphNodes()) { try { final UIValidation validation = n.validateParameterMap();
private GraphNode findNode(Point p) { for (GraphNode n : graphEx.GetGraphNodes()) { if (isWithinRect(n.getPos(), n.getWidth(), n.getHeight(), p)) return n; } return null; }
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()); } } }
@Test public void testClear() { graphEx.addOperator("testOp"); GraphNode[] nodeList = graphEx.GetGraphNodes(); assertEquals(1, nodeList.length); graphEx.ClearGraph(); assertEquals(0, graphEx.GetGraphNodes().length); }
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"); } } }
@Test public void testRemoveOperator() { GraphNode node = graphEx.addOperator("testOp"); GraphNode[] nodeList = graphEx.GetGraphNodes(); assertEquals(1, nodeList.length); updateValue = ""; graphEx.removeOperator(node); assertEquals(0, graphEx.GetGraphNodes().length); assertEquals(updateValue, "Remove"); }
@Test public void testAddOperator() { updateValue = ""; graphEx.addOperator("testOp"); GraphNode[] nodeList = graphEx.GetGraphNodes(); assertEquals(1, nodeList.length); assertEquals(updateValue, "Add"); }