@Override public void setup(Node[] nodes, Node clickedNode) { this.nodes = nodes; this.sourceNode = clickedNode;//Choose clicked node as source by default (but the user can select it or other one in the UI) GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel(); if (graphModel != currentGraphModel) {//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls directed = currentGraphModel.isDirected() || currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed graphModel = currentGraphModel; } }
@Override public ManipulatorUI getUI() { GraphModel currentGraphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel(); if (graphModel != null && graphModel != currentGraphModel) {//If graph model has changed since last execution, change default mode for edges to create in UI, else keep this parameter across calls directed = currentGraphModel.isDirected() || currentGraphModel.isMixed();//Get graph directed state. Set to true if graph is directed or mixed graphModel = currentGraphModel; source = null; } return new AddEdgeToGraphUI(); }
private void updatePanel() { if (edgePencilPanel != null) { GraphController gc = Lookup.getDefault().lookup(GraphController.class); if (gc.getGraphModel() != null) { edgePencilPanel.setType(gc.getGraphModel().isDirected() || gc.getGraphModel().isMixed()); } sourceNode = null; edgePencilPanel.setStatus(NbBundle.getMessage(EdgePencil.class, "EdgePencil.status1")); } }
previewModel.getProperties().putValue(PreviewProperty.DIRECTED, graphModel.isDirected() || graphModel.isMixed());