/** * **********Private methods : *********** */ private Graph getCurrentGraph() { return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph(); }
@Override public void loop(GraphView window, Interval interval) { Graph graph = graphModel.getGraph(window); int count = graph.getNodeCount(); graphModel.getGraphVisible().setAttribute(NB_NODES, count, interval.getLow()); graphModel.getGraphVisible().setAttribute(NB_NODES, count, interval.getHigh()); counts.put(interval.getLow(), count); counts.put(interval.getHigh(), count); }
@Override public void execute() { if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(ClearGraph.class, "ClearGraph.dialog.text"), NbBundle.getMessage(ClearGraph.class, "ClearGraph.name"), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) { Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph().clear(); } }
@Override public void loop(GraphView window, Interval interval) { Graph graph = graphModel.getGraph(window); int count = graph.getEdgeCount(); graphModel.getGraphVisible().setAttribute(NB_EDGES, count, interval.getLow()); graphModel.getGraphVisible().setAttribute(NB_EDGES, count, interval.getHigh()); counts.put(interval.getLow(), count); counts.put(interval.getHigh(), count); }
public void delete() { Graph g = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph(); g.removeAllNodes(Arrays.asList(nodes)); } }
@Override public void execute() { Graph graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph(); GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class); for (List<Node> nodes : duplicateGroups) { gec.mergeNodes(graph, nodes.toArray(new Node[0]), nodes.get(0), columns, mergeStrategies, deleteMergedNodes); } NbPreferences.forModule(MergeNodeDuplicates.class).putBoolean(DELETE_MERGED_NODES_SAVED_PREFERENCES, deleteMergedNodes); NbPreferences.forModule(MergeNodeDuplicates.class).putBoolean(CASE_SENSITIVE_SAVED_PREFERENCES, caseSensitive); }
@Override public void execute() { Graph graph = Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph(); GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class); Node newNode = gec.mergeNodes(graph, nodes, selectedNode, columns, mergeStrategies, deleteMergedNodes); Lookup.getDefault().lookup(DataTablesController.class).setNodeTableSelection(new Node[]{newNode}); NbPreferences.forModule(MergeNodes.class).putBoolean(DELETE_MERGED_NODES_SAVED_PREFERENCES, deleteMergedNodes); }
/** * Used for iterating through all edges of the graph * * @return Array with all graph edges */ private Edge[] getEdgesArray() { return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph().getEdges().toArray(); }
@Override public boolean init(Graph graph) { partition = appearanceModel.getEdgePartition(graph.getModel().getGraph(), column); return partition != null; } }
@Override public boolean init(Graph graph) { partition = appearanceModel.getNodePartition(graph.getModel().getGraph(), column); return partition != null; }
@Override public boolean init(Graph graph) { partition = appearanceModel.getNodePartition(graph.getModel().getGraph(), column); return partition != null; } }
@Override public boolean init(Graph graph) { partition = appearanceModel.getEdgePartition(graph.getModel().getGraph(), column); return partition != null; } }
@Override public boolean init(Graph graph) { partition = appearanceModel.getNodePartition(graph.getModel().getGraph(), column); return partition != null; } }
public Collection getEdgeTypeLabels() { Graph graph = graphModel.getGraph(); Object[] labels = graphModel.getEdgeTypeLabels(); ArrayList<Object> col = new ArrayList<>(labels.length); for (Object l : labels) { if (graph.getEdgeCount(graphModel.getEdgeType(l)) > 0) { col.add(l); } } return col; }
/** * Used for iterating through all nodes of the graph * * @return Array with all graph nodes */ private Node[] getNodesArray() { return Lookup.getDefault().lookup(GraphController.class).getGraphModel().getGraph().getNodes().toArray(); }
@Override public boolean init(Graph graph) { partition = appearanceModel.getNodePartition(graph.getModel().getGraph(), column); return partition != null; }
public AppearanceModelImpl(Workspace workspace) { this.workspace = workspace; this.graphModel = Lookup.getDefault().lookup(GraphController.class).getGraphModel(workspace); this.defaultInterpolator = Interpolator.LINEAR; this.functionLock = new Object(); this.transformerUIs = initTransformerUIs(); this.nodeTransformers = initNodeTransformers(); this.edgeTransformers = initEdgeTransformers(); //Functions functionsMain = new FunctionsModel(graphModel.getGraph()); refreshFunctions(graphModel.getGraph()); }
public Collection<Function> getFunctions() { Graph graph = graphController.getGraphModel(appearanceModel.getWorkspace()).getGraph(); List<Function> functions = new ArrayList<>(); for (Function func : selectedElementClass.equalsIgnoreCase(AppearanceUIController.NODE_ELEMENT) ? appearanceModel.getNodeFunctions(graph) : appearanceModel.getEdgeFunctions(graph)) { TransformerUI ui = func.getUI(); if (ui != null && ui.getDisplayName().equals(getSelectedTransformerUI().getDisplayName())) { if (ui.getCategory().equals(selectedCategory.get(selectedElementClass))) { functions.add(func); } } } return functions; }
public synchronized boolean refreshSelectedFunction() { Graph graph = graphController.getGraphModel(appearanceModel.getWorkspace()).getGraph(); Function sFunction = getSelectedFunction(); if (sFunction != null && sFunction.isAttribute()) { for (Function func : getSelectedElementClass().equals(AppearanceUIController.NODE_ELEMENT) ? appearanceModel.getNodeFunctions(graph) : appearanceModel.getEdgeFunctions(graph)) { if (func.equals(sFunction)) { return false; } } } return true; }
public synchronized void initialize() { if (graphObserver != null) { return; } graphObserver = graphModel.createGraphObserver(graphModel.getGraph(), false); nodesTableObserver = graphModel.getNodeTable().createTableObserver(true); edgesTableObserver = graphModel.getEdgeTable().createTableObserver(true); for (Column column : graphModel.getNodeTable()) { createColumnObserver(column); } for (Column column : graphModel.getEdgeTable()) { createColumnObserver(column); } workspace.add(new LatestVisibleView(graphModel.getVisibleView())); }