Interface Workspace

  • All Superinterfaces:
    org.openide.util.Lookup.Provider

    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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void add​(Object instance)
      Adds an instance to this workspaces lookup.
      int getId()
      Returns the workspace unique identifier
      org.openide.util.Lookup getLookup()
      Get any instance in the current lookup.
      Project getProject()
      Returns the project this workspace belong to
      void remove​(Object instance)
      Removes an instance from this workspaces lookup.
    • Method Detail

      • add

        void add​(Object instance)
        Adds an instance to this workspaces lookup.
        Parameters:
        instance - the instance that is to be pushed to the lookup
      • remove

        void remove​(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:

        • GraphModel
        • LayoutModel
        • StatisticsModel
        • FiltersModel
        • PreviewModel
        • VizModel
        • ...
        Specified by:
        getLookup in interface org.openide.util.Lookup.Provider
        Returns:
        the workspace's lookup
      • getProject

        Project getProject()
        Returns the project this workspace belong to
        Returns:
        the workspace's project
      • getId

        int getId()
        Returns the workspace unique identifier
        Returns:
        the workspace id