net.sf.taverna.t2.lang.ui
Class ModelMap

java.lang.Object
  extended by net.sf.taverna.t2.lang.ui.ModelMap
All Implemented Interfaces:
Observable<ModelMap.ModelMapEvent>

public class ModelMap
extends java.lang.Object
implements Observable<ModelMap.ModelMapEvent>

Map of the models present in the workbench associated with their names, together with the ability to manipulate this. Contains, from version 1.5 onwards, methods to set and notify components of changes to the underlying set of named models. A 'model' can be any Object that has an effect on the UI.

Author:
Stuart Owen, Tom Oinn, Stian Soiland-Reyes

Nested Class Summary
static class ModelMap.ModelChangedEvent
           
static class ModelMap.ModelCreatedEvent
           
static class ModelMap.ModelDestroyedEvent
           
static class ModelMap.ModelMapEvent
           
 
Method Summary
 void addObserver(Observer<ModelMap.ModelMapEvent> observer)
          Register an Observer
static ModelMap getInstance()
           
 java.lang.Object getModel(java.lang.String modelName)
           
 java.util.List<Observer<ModelMap.ModelMapEvent>> getObservers()
          A list of all the currently registered Observers
 void removeObserver(Observer<ModelMap.ModelMapEvent> observer)
          Remove a class who is currently observing
 void setModel(java.lang.String modelName, java.lang.Object model)
          Manipulate the current model map
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ModelMap getInstance()

addObserver

public void addObserver(Observer<ModelMap.ModelMapEvent> observer)
Description copied from interface: Observable
Register an Observer

Specified by:
addObserver in interface Observable<ModelMap.ModelMapEvent>
Parameters:
observer - the class who wants notified of changes

getModel

public java.lang.Object getModel(java.lang.String modelName)

getObservers

public java.util.List<Observer<ModelMap.ModelMapEvent>> getObservers()
Description copied from interface: Observable
A list of all the currently registered Observers

Specified by:
getObservers in interface Observable<ModelMap.ModelMapEvent>
Returns:

removeObserver

public void removeObserver(Observer<ModelMap.ModelMapEvent> observer)
Description copied from interface: Observable
Remove a class who is currently observing

Specified by:
removeObserver in interface Observable<ModelMap.ModelMapEvent>
Parameters:
observer - the class who no longer wants notified

setModel

public void setModel(java.lang.String modelName,
                     java.lang.Object model)
Manipulate the current model map

Parameters:
modelName - name of the model to act on
model - null to destroy the model or a reference to the new model to set. If it didn't already exist a modelCreated event will be fired otherwise modelChanged is called.