The tricky part was to realize that it was necessary to: [java]import org.openide.util.Lookup;[/java]
GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
for (Node n : graphModel.getGraph().getNodes()) {
System.out.println(n.getNodeData());
}
Index terms:
Task: Get Graph Model for the Panel
Solution:
The trick
Add the following code:ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);Workspace workspace = pc.getCurrentWorkspace();ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); Workspace workspace = pc.getCurrentWorkspace();
Add import:import org.openide.util.Lookup;Here is my web history for keyword purposes10:07pm spacer Searched for web history - Viewed 1 resultViewed 1 result spacer spacer Not starred Web History - google.com - Viewed 15 times - Bookmark: edit – remove Labels: Notes: www.google.com/psearch 9:54pm spacer Searched for gephi get graph api - Viewed 2 resultsViewed 2 results spacer spacer Not starred http://gephi.org/docs/api/org/gephi/graph/api/package-summary… - Bookmark: edit – remove Labels: Notes: gephi.org/docs/api/org/gephi/graph/api/package-summary.html spacer spacer Not starred Graph API – Gephi:Wiki - gephi.org - Bookmark: edit – remove Labels: Notes: wiki.gephi.org/index.php?title=Graph_API 9:54pm spacer Searched for gephi get graph 9:45pm spacer Searched for WorkspaceProvider getCurrentWorkspace gephi - Viewed 3 resultsViewed 3 results spacer spacer Not starred http://forum.gephi.org/viewtopic.php?t=370 - Bookmark: edit – remove Labels: Notes: forum.gephi.org/viewtopic.php?t=370 spacer spacer Not starred http://gephi.org/docs/toolkit/org/gephi/dynamic/api/DynamicMo… - Bookmark: edit – remove Labels: Notes: gephi.org/docs/toolkit/org/gephi/dynamic/api/DynamicModel.html spacer spacer Not starred http://gephigsoc.wikispaces.com/Workspace - Bookmark: edit – remove Labels: Notes: gephigsoc.wikispaces.com/Workspace 9:45pm spacer Searched for WorkspaceProvider getCurrentWorkspace 9:42pm spacer Searched for gephi lookup - Viewed 1 resultViewed 1 result spacer spacer Not starred Gephi Toolkit Tutorial - slideshare.net - Bookmark: edit – remove Labels: Notes: www.slideshare.net/gephi/gephi-toolkit-tutorialtoolkit 9:38pm spacer Searched for gephi Lookup.getDefault().lookup - Viewed 1 resultViewed 1 result spacer spacer Not starred http://wiki.gephi.org/index.php/Toolkit_-_Manipulate_attributes - Bookmark: edit – remove Labels: Notes: wiki.gephi.org/index.php/Toolkit_-_Manipulate_attributes 9:31pm spacer Searched for gephi WorkspaceProvider - Viewed 1 resultViewed 1 result spacer spacer Not starred http://www.flickr.com/photos/psychemedia/4613347708/ - Bookmark: edit – remove Labels: Notes: www.flickr.com/photos/psychemedia/4613347708/ 9:28pm spacer Searched for workspace.getLookup add 9:21pm spacer Searched for gephi workspace.getLookup - Viewed 1 resultViewed 1 result spacer spacer Not starred http://wiki.gephi.org/index.php/HowTo_design_a_new_feature - Bookmark: edit – remove Labels: Notes: wiki.gephi.org/index.php/HowTo_design_a_new_feature 9:21pm spacer Searched for gephi workspace.get 9:18pm spacer Searched for gephi toolkit - Viewed 1 resultViewed 1 result spacer spacer Not starred Announcing the Gephi Toolkit | Gephi - gephi.org - Bookmark: edit – remove Labels: Notes: gephi.org/2010/announcing-the-gephi-toolkit/ 9:18pm spacer Searched for package org.gephi.graph.api does not exist 9:14pm spacer Searched for gephi panel get graphmodel
Pingback: Gephi: Unit Tests (JUnit) | Active Intelligence