Examples of GraphElementsController


Examples of org.gephi.datalab.api.GraphElementsController

        this.nodes = nodes;
    }

    public void execute() {
        if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(DeleteNodes.class, "DeleteNodes.confirmation.message"), getName(), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
            gec.deleteNodes(nodes);
        }
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

        this.nodes = nodes;
    }

    public void execute() {
        if (group != null) {
            GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
            gec.moveNodesToGroup(nodes, group);
        }
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

    /**
     * Can group nodes so it can be all moved to a group (at least 1 available)
     */
    public boolean canExecute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        boolean canGroup = gec.canGroupNodes(nodes);
        if (canGroup) {
            availableGroupsToMoveNodes = gec.getAvailableGroupsToMoveNodes(nodes);
            return availableGroupsToMoveNodes != null && availableGroupsToMoveNodes.length > 0;
        } else {
            return false;
        }
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

    public void setup(Node[] nodes, Node clickedNode) {
        this.nodes = nodes;
    }

    public void execute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        gec.ungroupNodesRecursively(nodes);//At least 1 node is a group. And we don't have to check now every node because the ungroupNodesRecursively method does it for us.
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

    public String getDescription() {
        return NbBundle.getMessage(Ungroup.class, "UngroupRecursively.description");
    }

    public boolean canExecute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        for (Node n : nodes) {
            if (gec.canUngroupNode(n)) {
                return true;//If any of the nodes can be ungrouped, then allow to execute this action.
            }
        }
        return false;
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

    public void setup(Node[] nodes, Node clickedNode) {
        this.nodes=nodes;
    }

    public void execute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        gec.groupNodes(nodes);
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

    public String getDescription() {
        return "";
    }

    public boolean canExecute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        return gec.canGroupNodes(nodes);
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

*/
@ServiceProvider(service = GraphContextMenuItem.class)
public class Free extends BasicItem {

    public void execute() {
        GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
        gec.setNodesFixed(nodes, false);
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

        this.edges = edges;
    }

    public void execute() {
        if (JOptionPane.showConfirmDialog(null, NbBundle.getMessage(DeleteEdges.class, "DeleteEdges.confirmation.message"), getName(), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
            GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
            gec.deleteEdges(edges);
        }
    }
View Full Code Here

Examples of org.gephi.datalab.api.GraphElementsController

                    columnsList.add(addAttributeColumn(nodesTable, columnNames[i], columnTypes[i]));
                }
            }

            //Create nodes:
            GraphElementsController gec = Lookup.getDefault().lookup(GraphElementsController.class);
            Graph graph = Lookup.getDefault().lookup(GraphController.class).getModel().getGraph();
            String id = null;
            Node node;
            Attributes nodeAttributes;
            reader = new CsvReader(new FileInputStream(file), separator, charset);
            reader.readHeaders();
            while (reader.readRecord()) {
                //Prepare the correct node to assign the attributes:
                if (idColumn != null) {
                    id = reader.get(idColumn);
                    if (id == null || id.isEmpty()) {
                        node = gec.createNode(null);//id null or empty, assign one
                    } else {
                        graph.readLock();
                        node = graph.getNode(id);
                        graph.readUnlock();
                        if (node != null) {//Node with that id already in graph
                            if (assignNewNodeIds) {
                                node = gec.createNode(null);
                            }
                        } else {
                            node = gec.createNode(null, id);//New id in the graph
                        }
                    }
                } else {
                    node = gec.createNode(null);
                }
                //Assign attributes to the current node:
                nodeAttributes = node.getNodeData().getAttributes();
                for (AttributeColumn column : columnsList) {
                    setAttributeValue(reader.get(column.getTitle()), nodeAttributes, column);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.