private void refreshGraph() { if(graphPanel != null) { graphPanel.repaint(); } }
/** * Handles menu item pressed events * * @param event the action event */ public void actionPerformed(ActionEvent event) { final String name = event.getActionCommand(); if (name.equals("Delete")) { graphEx.removeOperator(selectedNode); repaint(); } }
/** * Handle mouse dragged event * * @param e the mouse event */ public void mouseDragged(MouseEvent e) { if (selectedNode != null && !connectingSourceFromHead && !connectingSourceFromTail) { final Point p = new Point(e.getX() - (lastMousePos.x - selectedNode.getPos().x), e.getY() - (lastMousePos.y - selectedNode.getPos().y)); selectedNode.setPos(p); lastMousePos = e.getPoint(); repaint(); } if (connectingSourceFromHead || connectingSourceFromTail) { connectingSourcePos = e.getPoint(); repaint(); } }
void AddOperatorAction(String name) { final GraphNode newGraphNode = graphEx.addOperator(name); newGraphNode.setPos(lastMousePos); repaint(); }
void AutoConnectGraph() { if (!graphEx.getGraphNodeList().isGraphComplete()) { graphEx.autoConnectGraph(); repaint(); } }
selectedNode = n; repaint(); showHeadHotSpot = true; connectSourceTargetNode = selectedNode; repaint(); } else if (isWithinRect(tailPoint, hotspotSize, hotspotSize, e.getPoint())) { showTailHotSpot = true; connectSourceTargetNode = selectedNode; repaint(); } else if (showHeadHotSpot || showTailHotSpot) { showHeadHotSpot = false; showTailHotSpot = false; repaint();
void RemoveSourceAction(String id) { if (selectedNode != null) { final GraphNode source = graphEx.getGraphNodeList().findGraphNode(id); selectedNode.disconnectOperatorSources(source.getID()); repaint(); } }
/** * 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(); }