Oculus Layout System API Documentation
November 25, 2002

com.oculustech.layout
Class SelectionActions

java.lang.Object
  |
  +--com.oculustech.layout.SelectionActions

public class SelectionActions
extends java.lang.Object

Provides system for over-ridable actions, to be used, for instance to determine the actions to use for particular menu items based on the view, selection, etc. Can dynamically inherit said actions from another instance of SelectionActions, in case actions set is only partially overridden (i.e., text selected in a text widget doesn't change the fact that a certain module is being viewed).

This class works best when used in conjunction with the DynamicallyPropertiedComponent system's accumulated properties. In this case, instances of this class will be dynamically accumulated up the swing component tree. Accumulation consists of setting superActions on a child's SelectionAction's to its parent's actions, if applicable. Behavior between competing siblings over SelectionActions is undefined; since there is only one selection for any given level of specificity, there should be no instances in which two sibling components compete over SelectionActions. This enables any component in the component tree to override an action being referred to by the top-level Frame, which presumably controls menus, toolbars, etc.

Note that when used as a dynamically accumulated property, the result of getDynamicallyAccumulatedProperty will be the root of the SelectionActions hierarchy, whereas you want to call getAction() on the most-derived child of the hierarchy. You therefore should call getMostDerivedActions() on the return value of getDynamicallyAccumulatedProperty and use the result to get your actions.

The SelectionActions accumulated property should be set to null when a component has no selection (or corresponding actions).


Field Summary
protected  java.util.HashMap actions
           
protected  SelectionActions childActions
           
protected  java.lang.String debugName
           
protected static java.io.PrintStream debugOut
           
protected  SelectionActions superActions
           
 
Constructor Summary
SelectionActions(java.lang.String debugName, javax.swing.Action[] actionsList)
          Construct a new SelectionActions instance with the given debugging name, and the given actionsMap.
SelectionActions(java.lang.String debugName, java.util.Map actionsMap)
          Construct a new SelectionActions instance with the given debugging name, and the given actionsMap.
SelectionActions(java.lang.String debugName, java.lang.Object[] actionsList)
          Construct a new SelectionActions instance with the given debugging name, and the given actionsList.
 
Method Summary
 void addAction(javax.swing.Action action)
          Add given action to SelectionActions instance.
 void addAction(ActionIdentifier actionId, javax.swing.Action action)
          Add given action to SelectionActions instance.
 void addActions(javax.swing.Action[] actionsList)
          Adds given actions to SelectionActions instance.
 void addActions(java.lang.Object[] actionsList)
          Adds given actions to SelectionActions instance.
 void clearLinkages()
          Clears this.childActions and this.superActions
 javax.swing.Action getAction(ActionIdentifier actionId)
          Gets action for given identifier.
 java.util.Map getActions()
          returns a Map mapping ActionIdentifier->Action representing all the actions in this SelectionActions instance.
 SelectionActions getChildActions()
          Returns the child-SelectionActions of this object.
 SelectionActions getMostDerivedActions()
          Returns the most-derived successor (child) SelectionActions of this object.
 java.lang.String getSelectionActionsHierarchy()
          Returns a string describing the dynamic ancestory and descendency of the SelectionActions hierarchy of which this instance is a part.
 SelectionActions getSuperActions()
          Returns super-SelectionActions of this object.
 void removeAction(ActionIdentifier actionId)
          Removes given action from this SelectionActions instance, if present.
 void setChildActions(SelectionActions actions)
          Sets child-SelectionActions of this object, and changes super-SelectionActions of given actions object correspondingly.
 void setDebugName(java.lang.String debugName)
          Sets the debugging name of this instance.
static void setDebugOutStream(java.io.PrintStream ps)
          Sets the PrintStream to which debugging information regarding SelectionActions may be printed.
 void setSuperActions(SelectionActions actions)
          Sets super-SelectionActions of this object, and changes child-SelectionActions of given actions object correspondingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debugOut

protected static java.io.PrintStream debugOut

debugName

protected java.lang.String debugName

actions

protected java.util.HashMap actions

superActions

protected SelectionActions superActions

childActions

protected SelectionActions childActions
Constructor Detail

SelectionActions

public SelectionActions(java.lang.String debugName,
                        java.lang.Object[] actionsList)
Construct a new SelectionActions instance with the given debugging name, and the given actionsList. ActionsList should be an array where the first element is an ActionIdentifier, the second the corresponding Action, the third another ActionIdentifier, and so on.

SelectionActions

public SelectionActions(java.lang.String debugName,
                        java.util.Map actionsMap)
Construct a new SelectionActions instance with the given debugging name, and the given actionsMap. ActionsMap should map a set of ActionIdentifiers to their corresponding Actions.

SelectionActions

public SelectionActions(java.lang.String debugName,
                        javax.swing.Action[] actionsList)
Construct a new SelectionActions instance with the given debugging name, and the given actionsMap. ActionsList should be a set of Actions all of which have their ActionIdentifier property set to their corresponding identifier.
Method Detail

addActions

public void addActions(java.lang.Object[] actionsList)
Adds given actions to SelectionActions instance. If action of given ActionIdentifier already exists in this SelectionActions instance, the old value will be replaced with the newly given value. ActionsList should be an array where the first element is an ActionIdentifier, the second the corresponding Action, the third another ActionIdentifier, and so on.

addActions

public void addActions(javax.swing.Action[] actionsList)
Adds given actions to SelectionActions instance. If action of given ActionIdentifier already exists in this SelectionActions instance, the old value will be replaced with the newly given value. ActionsList should be a set of Actions all of which have their ActionIdentifier property set to their corresponding identifier.

addAction

public void addAction(javax.swing.Action action)
Add given action to SelectionActions instance. If action of given ActionIdentifier already exists in this SelectionActions instance, the old value will be replaced with the newly given value.

addAction

public void addAction(ActionIdentifier actionId,
                      javax.swing.Action action)
Add given action to SelectionActions instance. If action of given ActionIdentifier already exists in this SelectionActions instance, the old value will be replaced with the newly given value.

removeAction

public void removeAction(ActionIdentifier actionId)
Removes given action from this SelectionActions instance, if present.

setDebugName

public void setDebugName(java.lang.String debugName)
Sets the debugging name of this instance.

setDebugOutStream

public static void setDebugOutStream(java.io.PrintStream ps)
Sets the PrintStream to which debugging information regarding SelectionActions may be printed. Defaults to null.

getActions

public java.util.Map getActions()
returns a Map mapping ActionIdentifier->Action representing all the actions in this SelectionActions instance. Does NOT include actions from super-SelectionActions.

setSuperActions

public void setSuperActions(SelectionActions actions)
Sets super-SelectionActions of this object, and changes child-SelectionActions of given actions object correspondingly.

setChildActions

public void setChildActions(SelectionActions actions)
Sets child-SelectionActions of this object, and changes super-SelectionActions of given actions object correspondingly.

clearLinkages

public void clearLinkages()
Clears this.childActions and this.superActions

getChildActions

public SelectionActions getChildActions()
Returns the child-SelectionActions of this object.

getMostDerivedActions

public SelectionActions getMostDerivedActions()
Returns the most-derived successor (child) SelectionActions of this object.

getSuperActions

public SelectionActions getSuperActions()
Returns super-SelectionActions of this object.

getSelectionActionsHierarchy

public java.lang.String getSelectionActionsHierarchy()
Returns a string describing the dynamic ancestory and descendency of the SelectionActions hierarchy of which this instance is a part. Primarily used for debugging.

getAction

public javax.swing.Action getAction(ActionIdentifier actionId)
Gets action for given identifier. If the given action isn't defined in this instance, passes call through to super-SelectionActions.

Oculus Layout System API Documentation
November 25, 2002

Copyright 2001-2002 Oculus Technologies Corporation. 103 Broad Street, 5th Floor,
Boston, Massachusetts, 02110, U.S.A. All Rights Reserved.