chrriis.uihierarchy
Class Accessor

java.lang.Object
  extended bychrriis.uihierarchy.Accessor
Direct Known Subclasses:
SingleLevelAccessor

public class Accessor
extends Object

An accessor to access and manipulate the hierarchy.

Version:
1.0 2003.12.02
Author:
Christopher Deckers (chrriis@brainlex.com)

Method Summary
 void forceEnabled()
          Force the components to be enabled.
 void forceHEnabled()
          Force the hierarchy of components to be enabled.
 Component[] getComponents()
          Get the components at these hierarchy levels.
 boolean getEnabledState()
          Indicate if the components are maybe enabled, considering all the disabling IDs in effect.
 boolean isEnabled()
          Indicate if the components are maybe enabled, using -1 as the default disabling ID.
 boolean isEnabled(int id)
          Indicate if the components or hierarchy of components are/is maybe enabled with regard to a specific ID.
 boolean isHEnabled()
          Indicate if the hierarchy of components are maybe enabled, using -1 as the default disabling ID.
 boolean isVisible()
          Indicate if the components of the levels may be visible.
 void remove()
          Remove the manipulated levels from their hierarchy.
 Object[] run(AccessorRunnable accessorRunnable)
          Run an action on all the components of the levels of this accessor.
 Object[] runTraversing(AccessorRunnable accessorRunnable)
          Run an action on all the components of the levels of this accessor, and their sub hierarchies.
 void setEnabled(boolean isEnabled)
          Set whether the components are enabled, using the default disabling ID of 1.
 void setEnabled(boolean isEnabled, int id)
          Set whether the components are enabled with regard to the disabling ID.
 void setHEnabled(boolean isHEnabled)
          Set whether the hierarchy is enabled.
 void setHEnabled(boolean isHEnabled, int id)
          Set whether the hierarchy is enabled.
 void setVisible(boolean isVisible)
          Set the visibility of the manipulated levels.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getComponents

public Component[] getComponents()
Get the components at these hierarchy levels.

Returns:
The components.

forceEnabled

public void forceEnabled()
Force the components to be enabled. This discards all the disabled states set using some disabling IDs.


forceHEnabled

public void forceHEnabled()
Force the hierarchy of components to be enabled. This discards all the disabled states set using some disabling IDs.


setEnabled

public void setEnabled(boolean isEnabled)
Set whether the components are enabled, using the default disabling ID of 1. The components are enabled when all the groups that set the state set it to enabled.

Parameters:
isEnabled - True if the component is to be enabled.

setEnabled

public void setEnabled(boolean isEnabled,
                       int id)
Set whether the components are enabled with regard to the disabling ID. The components are enabled when all the groups that set the state set it to enabled.

Parameters:
isEnabled - True if the component is to be enabled.
id - The disabling ID.

setHEnabled

public void setHEnabled(boolean isHEnabled)
Set whether the hierarchy is enabled. Enabling/disabling the hierarchy has the same effect as calling the setEnabled method on the sub-levels recursively, using the default disabling ID of -1.

Parameters:
isHEnabled - True if the hierarchy is to be enabled.

setHEnabled

public void setHEnabled(boolean isHEnabled,
                        int id)
Set whether the hierarchy is enabled. Enabling/disabling the hierarchy has the same effect as calling the setEnabled method on the sub-levels recursively.

Parameters:
isHEnabled - True if the hierarchy is to be enabled.
id - The disabling ID.

isEnabled

public boolean isEnabled()
Indicate if the components are maybe enabled, using -1 as the default disabling ID. If the accessor manipulates more than one level, this is just an indication as some levels may be configured using the same IDs from other accessors.

Returns:
The state of the components.

isHEnabled

public boolean isHEnabled()
Indicate if the hierarchy of components are maybe enabled, using -1 as the default disabling ID. If the accessor manipulates more than one level, this is just an indication as some levels may be configured using the same IDs from other accessors.

Returns:
The state of the hierarchy of components.

getEnabledState

public boolean getEnabledState()
Indicate if the components are maybe enabled, considering all the disabling IDs in effect. If the accessor manipulates more than one level, this is just an indication as some levels may be configured from other accessors.

Returns:
The state of the components.

isEnabled

public boolean isEnabled(int id)
Indicate if the components or hierarchy of components are/is maybe enabled with regard to a specific ID. If the accessor manipulates more than one level, this is just an indication as some levels may be configured using the same IDs from other accessors.

Parameters:
id - The disabling ID.
Returns:
The state of the components or hierarchy of components.

setVisible

public void setVisible(boolean isVisible)
Set the visibility of the manipulated levels.

Parameters:
isVisible - True if the levels should be shown.

isVisible

public boolean isVisible()
Indicate if the components of the levels may be visible. If the accessor manipulates more than one level, this is just an indication as the levels may be configured inconsistently.

Returns:
The visibility of the components.

runTraversing

public Object[] runTraversing(AccessorRunnable accessorRunnable)
Run an action on all the components of the levels of this accessor, and their sub hierarchies.

Parameters:
accessorRunnable - The action to run.
Returns:
An array of the results generated by the calls on the levels of this accessor, but not the sub levels.

run

public Object[] run(AccessorRunnable accessorRunnable)
Run an action on all the components of the levels of this accessor.

Parameters:
accessorRunnable - The action to run.
Returns:
An array of the results generated by the calls on the levels of this accessor.

remove

public void remove()
Remove the manipulated levels from their hierarchy. This operation clears the constraints that were set for the levels, so they will have to be redeclared when adding to a new hierarchy.