org.argouml.ui.explorer
Class PerspectiveManager

java.lang.Object
  extended by org.argouml.ui.explorer.PerspectiveManager

public final class PerspectiveManager
extends java.lang.Object

Provides a model and event management for perspectives(views) of the Explorer.

This class defines the complete list of perspective rules, and knows the default perspectives and their contents.

Since:
0.15.2

Method Summary
 void addAllPerspectives(java.util.Collection<ExplorerPerspective> newPerspectives)
           
 void addListener(PerspectiveManagerListener listener)
           
 void addPerspective(ExplorerPerspective perspective)
           
 void addRule(org.argouml.ui.explorer.rules.PerspectiveRule rule)
          Add a rule to the list of rules.
 java.util.Collection<ExplorerPerspective> getDefaultPerspectives()
           
static PerspectiveManager getInstance()
           
 java.util.List<ExplorerPerspective> getPerspectives()
           
 java.util.Collection<org.argouml.ui.explorer.rules.PerspectiveRule> getRules()
           
 void loadDefaultPerspectives()
          Loads a pre-defined default set of perspectives.
 void loadRules()
          Get the predefined rules.
 void loadUserPerspectives()
          Tries to load user defined perspectives, if it can't it loads the (predefined) default perspectives.
 void removeAllPerspectives()
          Remove all perspectives.
 void removeListener(PerspectiveManagerListener listener)
           
 void removePerspective(ExplorerPerspective perspective)
           
 void removeRule(org.argouml.ui.explorer.rules.PerspectiveRule rule)
          Remove a rule from the list.
 void saveUserPerspectives()
          Save the user perspectives in the ArgoUML configuration.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getInstance

public static PerspectiveManager getInstance()
Returns:
the instance (singleton)

addListener

public void addListener(PerspectiveManagerListener listener)
Parameters:
listener - the listener to be added

removeListener

public void removeListener(PerspectiveManagerListener listener)
Parameters:
listener - the listener to be removed

addPerspective

public void addPerspective(ExplorerPerspective perspective)
Parameters:
perspective - the perspective to be added

addAllPerspectives

public void addAllPerspectives(java.util.Collection<ExplorerPerspective> newPerspectives)
Parameters:
newPerspectives - the collection of perspectives to be added

removePerspective

public void removePerspective(ExplorerPerspective perspective)
Parameters:
perspective - the perspective to be removed

removeAllPerspectives

public void removeAllPerspectives()
Remove all perspectives.


getPerspectives

public java.util.List<ExplorerPerspective> getPerspectives()
Returns:
the list of all perspectives

loadUserPerspectives

public void loadUserPerspectives()
Tries to load user defined perspectives, if it can't it loads the (predefined) default perspectives.


loadDefaultPerspectives

public void loadDefaultPerspectives()
Loads a pre-defined default set of perspectives.


getDefaultPerspectives

public java.util.Collection<ExplorerPerspective> getDefaultPerspectives()
Returns:
a collection of default perspectives (i.e. the predefined ones)

loadRules

public void loadRules()
Get the predefined rules.

This is a hard coded rules library for now, since it is quite a lot of work to get all possible rule names in "org.argouml.ui.explorer.rules" from the classpath (which would also not allow adding rules from other locations).


addRule

public void addRule(org.argouml.ui.explorer.rules.PerspectiveRule rule)
Add a rule to the list of rules.

Parameters:
rule - the PerspectiveRule to be added

removeRule

public void removeRule(org.argouml.ui.explorer.rules.PerspectiveRule rule)
Remove a rule from the list.

Parameters:
rule - the PerspectiveRule to be removed

getRules

public java.util.Collection<org.argouml.ui.explorer.rules.PerspectiveRule> getRules()
Returns:
the collection of rules

saveUserPerspectives

public void saveUserPerspectives()
Save the user perspectives in the ArgoUML configuration.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
string representation of the perspectives in the same format as saved in the user properties.
See Also:
Object.toString()


ArgoUML © 1996-2006ArgoUML HomepageArgoUML Cookbook