Gephi Toolkit Javadoc

org.gephi.project.api
Interface Workspace

All Superinterfaces:
org.openide.util.Lookup.Provider
All Known Implementing Classes:
WorkspaceImpl

public interface Workspace
extends org.openide.util.Lookup.Provider

Workspace interface that internally stores, through its Lookup, various information and instances.

Workpace is a top concept in Gephi because all models that modules possesses are usually divided by workspace, for instance one GraphModel per workspace. Therefore this class has a Lookup mechanism to let modules store their model in the workspace's lookup and query it when needed.

To know how you can manage loading and saving data in Gephi project files, see WorkspacePersistenceProvider.

How to associate new data model to the workspace

In your new module, listen to WorkspaceListener and call add() method when initialize:
public void initialize(Workspace workspace) {
      workspace.add(new MyDataModel())
}
 
When a workspace is selected, retrieve the workspace's data model:
public void select(Workspace workspace) {
      MyDataModel model = workspace.getLookup().lookup(MyDataModel.class);
}
 

Author:
Mathieu Bastian

Method Summary
 void add(java.lang.Object instance)
          Adds an instance to this workspaces lookup.
 org.openide.util.Lookup getLookup()
          Get any instance in the current lookup.
 void remove(java.lang.Object instance)
          Removes an instance from this workspaces lookup.
 

Method Detail

add

void add(java.lang.Object instance)
Adds an instance to this workspaces lookup.

Parameters:
instance - the instance that is to be pushed to the lookup

remove

void remove(java.lang.Object instance)
Removes an instance from this workspaces lookup.

Parameters:
instance - the instance that is to be removed from the lookup

getLookup

org.openide.util.Lookup getLookup()
Get any instance in the current lookup. All important API in Gephi are storing models in this lookup.

May contains:

  1. GraphModel
  2. AttributeModel
  3. LayoutModel
  4. StatisticsModel
  5. FiltersModel
  6. PreviewModel
  7. VizModel
  8. ...

Specified by:
getLookup in interface org.openide.util.Lookup.Provider
Returns:
the workspace's lookup

Gephi Toolkit Javadoc