public void actionPerformed(ActionEvent e) { JComboBox<?> cb = (JComboBox<?>) e.getSource(); graph_index = cb.getSelectedIndex(); vv.getNodeSpatial().clear(); vv.getEdgeSpatial().clear(); vv.getModel().setNetwork(g_array[graph_index]); } }
public void actionPerformed(ActionEvent e) { pickedEdgeState.pick(edge, false); graph.removeEdge(edge); vv.getEdgeSpatial().recalculate(); vv.repaint(); } });
@Override public void mouseClicked(MouseEvent e) { MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer(); Point2D layoutPoint = multiLayerTransformer.inverseTransform(e.getX(), e.getY()); Object edge = vv.getEdgeSpatial().getClosestElement(layoutPoint); if (edge != null) { vv.getPickedEdgeState().clear(); vv.getPickedEdgeState().pick(edge, true); } } });
VisualizationViewer<N, E> vv = (VisualizationViewer<N, E>) e.getSource(); vv.getNodeSpatial().setActive(false); vv.getEdgeSpatial().setActive(false); if (locked == false) {
/** * If startNode is non-null, and the mouse is released over an existing node, create an edge from * startNode to the node under the mouse pointer. */ @SuppressWarnings("unchecked") public void mouseReleased(MouseEvent e) { if (checkModifiers(e)) { final VisualizationViewer<N, E> vv = (VisualizationViewer<N, E>) e.getSource(); final LayoutModel<N> layoutModel = vv.getModel().getLayoutModel(); final Point2D p = e.getPoint(); if (createMode == Creating.EDGE) { NetworkElementAccessor<N, E> pickSupport = vv.getPickSupport(); N node = null; // TODO: how does it make any sense for pickSupport to be null in this scenario? if (pickSupport != null) { node = pickSupport.getNode(layoutModel, p.getX(), p.getY()); } if (node != null) { edgeSupport.endEdgeCreate(vv, node); vv.getEdgeSpatial().recalculate(); } else { edgeSupport.abort(vv); } } else if (createMode == Creating.NODE) { nodeSupport.endNodeCreate(vv, e.getPoint()); vv.getNodeSpatial().recalculate(); } } createMode = Creating.UNDETERMINED; }
vv.getEdgeSpatial().setActive(true); MultiLayerTransformer multiLayerTransformer = vv.getRenderContext().getMultiLayerTransformer();