The Meta-Environment API

nl.cwi.sen1.visbase.factbrowser.data
Class FactBrowserDataManager

java.lang.Object
  extended by nl.cwi.sen1.visbase.factbrowser.data.FactBrowserDataManager

public class FactBrowserDataManager
extends java.lang.Object

This class is the dataManager for the different visualizationPlugins and the RStoreFactTypes (like ) which are registered. It also caches the different visualisationPlugins and RStoreFactTypes. Relational representation of in memory data structure This dataManager holds an in memory representation of the RStore with it's children facts. Also it tracks all different types of RStoreFactTypes which are sent. Every visualisationPlugin which is sent should be coupled with a RStoreFactType. When a visualisationPlugin registers itself to a cached or new RStoreFactType a signal is sent to all children facts of the RStores which are RStoreFactType compatible.

Author:
Renze de Vries

Field Summary
private static FactBrowserDataManager dataManagerInstance
           
private  java.util.ArrayList<RStoreFactType> factTypes
           
private  java.util.ArrayList<VisualisationPlugin> visPlugins
           
 
Constructor Summary
private FactBrowserDataManager()
          Default constructor where the caching containers for the FactTypes and the Plugins are initialized.
 
Method Summary
 RStoreFactType addFactType(java.lang.String newType)
          This method is to register an RStoreFactType.
private  VisualisationPlugin addVisualisation(VisualisationPlugin visNewPlugin)
          This method is to add the Visualisation Plugin to the cache or if already present give the already present VisualisationPlugin instance back
 boolean checkValidRStore(javax.swing.tree.DefaultMutableTreeNode selectedNode)
           
 boolean checkValidRStoreFact(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method checks if the given selectedNode from the visual factBrowser tree was a RStoreFact.
 boolean checkValidVisualisationPlugin(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method checks if the given selectedNode from the visual factBrowser tree was really a visualisationPlugin.
private  void coupleVisualisation(VisualisationPlugin visPlugin, RStoreFactType visFactType)
          This method couples the visualisationPlugin to the nessecary RStoreFactTypes.
 void createVisualisation(VisualisationPlugin visNewPlugin, RStoreFactType visFactType)
          This method is a method which directs the creation of a new Visualisation plugin and couples it to the different FactTypes
 int getFactID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method gets the Fact Identifier of a RStoreFact.
 nl.cwi.sen1.relationstores.types.RType getFactRType(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method returns the RType of a selectedNode from the visualtree.
static FactBrowserDataManager getInstance()
          This method makes it possible to centrally access the dataManager and only create it once.
 int getRStoreID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method gets the RStore Identifier based on a selected VisualisationPlugin from the visual tree.
 int getVisPluginID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
          This method returns the identifier of the visualisationPlugin.
 void resetDataManager()
          This method makes it possible to reset all the elements so we can if nessecary start with a clean in memory list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataManagerInstance

private static FactBrowserDataManager dataManagerInstance

factTypes

private java.util.ArrayList<RStoreFactType> factTypes

visPlugins

private java.util.ArrayList<VisualisationPlugin> visPlugins
Constructor Detail

FactBrowserDataManager

private FactBrowserDataManager()
Default constructor where the caching containers for the FactTypes and the Plugins are initialized. This is also private so it can only be instantiated from within this class.

Method Detail

getInstance

public static FactBrowserDataManager getInstance()
This method makes it possible to centrally access the dataManager and only create it once. This is the method which enforces the singleton pattern.

Returns:
The instance of the DataManager

resetDataManager

public void resetDataManager()
This method makes it possible to reset all the elements so we can if nessecary start with a clean in memory list.


createVisualisation

public void createVisualisation(VisualisationPlugin visNewPlugin,
                                RStoreFactType visFactType)
This method is a method which directs the creation of a new Visualisation plugin and couples it to the different FactTypes

Parameters:
visNewPlugin - This is the new Visualisation Plugin to be created
visFactType - This is the FactType this plugin can display

addVisualisation

private VisualisationPlugin addVisualisation(VisualisationPlugin visNewPlugin)
This method is to add the Visualisation Plugin to the cache or if already present give the already present VisualisationPlugin instance back

Parameters:
visNewPlugin - This is the Visualisation Plugin we want to add
Returns:
the instance of the Visualisation plugin which is or newly created or from the cache

coupleVisualisation

private void coupleVisualisation(VisualisationPlugin visPlugin,
                                 RStoreFactType visFactType)
This method couples the visualisationPlugin to the nessecary RStoreFactTypes. When this happens the facts which are a member of the RStoreFactType will be notified.

Parameters:
visPlugin - The VisualisationPlugin to add to the specific FactType
visFactType - The FactType this visualisationPlugin applies to

addFactType

public RStoreFactType addFactType(java.lang.String newType)
This method is to register an RStoreFactType. It will check if the RStoreFactType was already in the cache and if so return that instance. If not present create such an RStoreFactType and register it in the cache and return the created instance.

Parameters:
newFactType - The FactType we want to add

checkValidVisualisationPlugin

public boolean checkValidVisualisationPlugin(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method checks if the given selectedNode from the visual factBrowser tree was really a visualisationPlugin.

Parameters:
selectedNode - The selectedNode from the visual tree
Returns:
true if it was a visualisation plugin else false

checkValidRStoreFact

public boolean checkValidRStoreFact(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method checks if the given selectedNode from the visual factBrowser tree was a RStoreFact.

Parameters:
selectedNode - The selectedNode from the visual Tree
Returns:
true if it was a RStoreFact plugin else false

checkValidRStore

public boolean checkValidRStore(javax.swing.tree.DefaultMutableTreeNode selectedNode)

getFactID

public int getFactID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method gets the Fact Identifier of a RStoreFact. It does this by a given selected visualisationPlugin and gathers from the in memory tree the identifier.

Parameters:
selectedNode - The selectedNode from the visualTree
Returns:
The RStoreFact Identifier

getRStoreID

public int getRStoreID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method gets the RStore Identifier based on a selected VisualisationPlugin from the visual tree. It gathers the identifiers from the in memory tree.

Parameters:
selectedNode - The selectedNode from the visualTree
Returns:
The RStore identifier

getVisPluginID

public int getVisPluginID(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method returns the identifier of the visualisationPlugin.

Parameters:
selectedNode - The given selectedNode from the visual tree
Returns:
The identifier of the visualisationPlugin

getFactRType

public nl.cwi.sen1.relationstores.types.RType getFactRType(javax.swing.tree.DefaultMutableTreeNode selectedNode)
This method returns the RType of a selectedNode from the visualtree. For this to work it must be a selected RStoreFact.

Parameters:
selectedNode - The selectedNode from the visual tree
Returns:
The RType of the RStoreFact

The Meta-Environment API