Search in sources :

Example 1 with GraphController

use of org.gephi.graph.api.GraphController in project gephi by gephi.

the class SearchReplaceControllerImpl method canReplace.

@Override
public boolean canReplace(SearchResult result) {
    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
    Table table;
    Column column;
    if (result.getFoundNode() != null) {
        table = gc.getGraphModel().getNodeTable();
        column = table.getColumn(result.getFoundColumnIndex());
    } else {
        table = gc.getGraphModel().getEdgeTable();
        column = table.getColumn(result.getFoundColumnIndex());
    }
    return Lookup.getDefault().lookup(AttributeColumnsController.class).canChangeColumnData(column);
}
Also used : Table(org.gephi.graph.api.Table) Column(org.gephi.graph.api.Column) AttributeColumnsController(org.gephi.datalab.api.AttributeColumnsController) GraphController(org.gephi.graph.api.GraphController)

Example 2 with GraphController

use of org.gephi.graph.api.GraphController in project gephi by gephi.

the class NodePencil method getListeners.

@Override
public ToolEventListener[] getListeners() {
    listeners = new ToolEventListener[1];
    listeners[0] = new MouseClickEventListener() {

        @Override
        public void mouseClick(int[] positionViewport, float[] position3d) {
            color = nodePencilPanel.getColor();
            size = nodePencilPanel.getNodeSize();
            GraphController gc = Lookup.getDefault().lookup(GraphController.class);
            GraphModel gm = gc.getGraphModel();
            Graph graph = gm.getGraph();
            Node node = gm.factory().newNode();
            node.setX(position3d[0]);
            node.setY(position3d[1]);
            node.setSize(size);
            node.setColor(color);
            graph.addNode(node);
        }
    };
    return listeners;
}
Also used : MouseClickEventListener(org.gephi.tools.spi.MouseClickEventListener) Graph(org.gephi.graph.api.Graph) GraphModel(org.gephi.graph.api.GraphModel) Node(org.gephi.graph.api.Node) GraphController(org.gephi.graph.api.GraphController)

Example 3 with GraphController

use of org.gephi.graph.api.GraphController in project gephi by gephi.

the class ExporterGDF method execute.

@Override
public boolean execute() {
    GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
    GraphModel graphModel = graphController.getGraphModel(workspace);
    Graph graph = exportVisible ? graphModel.getGraphVisible() : graphModel.getGraph();
    graph.readLock();
    try {
        exportData(graph, graphModel);
    } catch (Exception e) {
        Logger.getLogger(ExporterGDF.class.getName()).log(Level.SEVERE, null, e);
    } finally {
        graph.readUnlock();
        Progress.finish(progressTicket);
    }
    return !cancel;
}
Also used : Graph(org.gephi.graph.api.Graph) GraphModel(org.gephi.graph.api.GraphModel) GraphController(org.gephi.graph.api.GraphController)

Example 4 with GraphController

use of org.gephi.graph.api.GraphController in project gephi by gephi.

the class ExporterGraphML method execute.

@Override
public boolean execute() {
    GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
    GraphModel graphModel = graphController.getGraphModel(workspace);
    Graph graph = exportVisible ? graphModel.getGraphVisible() : graphModel.getGraph();
    graph.readLock();
    try {
        exportData(createDocument(), graph);
    } catch (Exception e) {
        Logger.getLogger(ExporterGraphML.class.getName()).log(Level.SEVERE, null, e);
    } finally {
        graph.readUnlock();
        Progress.finish(progressTicket);
    }
    return !cancel;
}
Also used : Graph(org.gephi.graph.api.Graph) GraphModel(org.gephi.graph.api.GraphModel) GraphController(org.gephi.graph.api.GraphController) TransformerException(javax.xml.transform.TransformerException) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException)

Example 5 with GraphController

use of org.gephi.graph.api.GraphController in project gephi by gephi.

the class StatisticsControllerImpl method execute.

@Override
public void execute(Statistics statistics) {
    if (statistics instanceof DynamicStatistics) {
        executeDynamic((DynamicStatistics) statistics, null);
    } else {
        GraphController graphController = Lookup.getDefault().lookup(GraphController.class);
        GraphModel graphModel = graphController.getGraphModel();
        statistics.execute(graphModel);
        model.addReport(statistics);
    }
}
Also used : GraphModel(org.gephi.graph.api.GraphModel) DynamicStatistics(org.gephi.statistics.spi.DynamicStatistics) GraphController(org.gephi.graph.api.GraphController)

Aggregations

GraphController (org.gephi.graph.api.GraphController)28 GraphModel (org.gephi.graph.api.GraphModel)19 Graph (org.gephi.graph.api.Graph)13 Node (org.gephi.graph.api.Node)9 Edge (org.gephi.graph.api.Edge)8 Column (org.gephi.graph.api.Column)5 TimeFormat (org.gephi.graph.api.TimeFormat)4 ArrayList (java.util.ArrayList)3 MouseClickEventListener (org.gephi.tools.spi.MouseClickEventListener)3 NodeClickEventListener (org.gephi.tools.spi.NodeClickEventListener)3 AbstractShortestPathAlgorithm (org.gephi.algorithms.shortestpath.AbstractShortestPathAlgorithm)2 BellmanFordShortestPathAlgorithm (org.gephi.algorithms.shortestpath.BellmanFordShortestPathAlgorithm)2 DijkstraShortestPathAlgorithm (org.gephi.algorithms.shortestpath.DijkstraShortestPathAlgorithm)2 AttributeColumnsController (org.gephi.datalab.api.AttributeColumnsController)2 GraphFactory (org.gephi.graph.api.GraphFactory)2 GraphView (org.gephi.graph.api.GraphView)2 Issue (org.gephi.io.importer.api.Issue)2 DynamicStatistics (org.gephi.statistics.spi.DynamicStatistics)2 NotifyDescriptor (org.openide.NotifyDescriptor)2 Color (java.awt.Color)1