org.apache.cocoon.forms.formmodel
Class WidgetState

java.lang.Object
  extended by org.apache.commons.lang.enums.Enum
      extended by org.apache.commons.lang.enums.ValuedEnum
          extended by org.apache.cocoon.forms.formmodel.WidgetState
All Implemented Interfaces:
Serializable, Comparable

public class WidgetState
extends org.apache.commons.lang.enums.ValuedEnum

The state of a widget. States are ordered from the most featured ("active") to the most constrained ("invisible"), so that state combinations can be computed: a widget's combined state is the strictest between the widget's own state and its parent state.

Version:
$Id: WidgetState.html 1304258 2012-03-23 10:09:27Z ilgrosso $
See Also:
Serialized Form

Field Summary
static WidgetState ACTIVE
          Active state.
static WidgetState DISABLED
          Disabled state, value is displayed but user input is ignored.
static WidgetState INVISIBLE
          Invisible state.
static WidgetState OUTPUT
          Output state, value is displayed but user input is ignored.
 
Fields inherited from class org.apache.commons.lang.enums.Enum
iToString
 
Method Summary
 boolean isAcceptingInputs()
          Does this state accept user inputs?
 boolean isDisplayingValues()
          Does this state display widget values?
 boolean isValidatingValues()
          Does this state validate widget values?
static WidgetState stateForName(String name)
          Get a state given its name.
 boolean stricterThan(WidgetState other)
          Test if the current state is stricter than another one.
static WidgetState strictest(WidgetState one, WidgetState two)
          Determine the strictest of two states.
 
Methods inherited from class org.apache.commons.lang.enums.ValuedEnum
compareTo, getEnum, getValue, toString
 
Methods inherited from class org.apache.commons.lang.enums.Enum
equals, getEnum, getEnumClass, getEnumList, getEnumMap, getName, hashCode, iterator, readResolve
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVE

public static final WidgetState ACTIVE
Active state. This is the default state, where widgets read their values from the request and display them.


DISABLED

public static final WidgetState DISABLED
Disabled state, value is displayed but user input is ignored. The widget should be rendered in a manner that indicates that this widget could be active, but is currently not.


OUTPUT

public static final WidgetState OUTPUT
Output state, value is displayed but user input is ignored. The widget should be rendered as plain text, giving no indication that it could be input.


INVISIBLE

public static final WidgetState INVISIBLE
Invisible state. Values are not displayed and user input is ignored.

Method Detail

stateForName

public static WidgetState stateForName(String name)
Get a state given its name. Valid names are "active", "disabled", "invisible".

Parameters:
name - the state name
Returns:
the state, or null if name doesn't denote a known state name

strictest

public static WidgetState strictest(WidgetState one,
                                    WidgetState two)
Determine the strictest of two states. "invisible" is stricter than "disabled" which is stricter than "active"

Parameters:
one - a state
two - another state
Returns:
the strictes of one and two

stricterThan

public boolean stricterThan(WidgetState other)
Test if the current state is stricter than another one.

Parameters:
other - a state
Returns:
true if this is stricter than other

isAcceptingInputs

public boolean isAcceptingInputs()
Does this state accept user inputs?

Returns:
true if this state accepts user inputs.

isDisplayingValues

public boolean isDisplayingValues()
Does this state display widget values?

Returns:
true if this state displays widget values.

isValidatingValues

public boolean isValidatingValues()
Does this state validate widget values?

Returns:
true if this state validates widget values.


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.