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);
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations