org.jvnet.substance
Enum ComponentState

java.lang.Object
  extended by java.lang.Enum<ComponentState>
      extended by org.jvnet.substance.ComponentState
All Implemented Interfaces:
Serializable, Comparable<ComponentState>

public enum ComponentState
extends Enum<ComponentState>

This enum is used in order to provide uniform transition effects on mouse events. The effects include different visual appearance of the corresponding control when the mouse hovers over it (rollover), when it's pressed or selected, disabled etc.
Each enum value represents a single state and contains information that is used by the UI delegates in order to correctly paint the corresponding controls.

Author:
Kirill Grouchnikov

Nested Class Summary
static class ComponentState.ColorSchemeKind
          Enum for color scheme kind.
 
Enum Constant Summary
ACTIVE
          Active.
DEFAULT
          Default state.
DISABLED_ACTIVE
          Disabled active.
DISABLED_SELECTED
          Disabled selected.
DISABLED_UNSELECTED
          Disabled and not selected.
PRESSED_SELECTED
          Pressed selected.
PRESSED_UNSELECTED
          Pressed and not selected.
ROLLOVER_SELECTED
          Selected and rolled over.
ROLLOVER_UNSELECTED
          Not selected and rolled over.
SELECTED
          Selected.
 
Method Summary
 ComponentState.ColorSchemeKind getColorSchemeKind()
          Returns the corresponding color scheme kind
 int getCycleCount()
          Returns the corresponding cycle count.
static ComponentState getState(ButtonModel model, AbstractButton button)
          Retrieves component state based on the button model (required parameter) and button itself (optional parameter).
 boolean isEnabled()
          Returns the indication of whether a component with this state is enabled.
 boolean isSelected()
          Returns the indication of whether a component with this state is selected.
static ComponentState valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ComponentState[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

DISABLED_ACTIVE

public static final ComponentState DISABLED_ACTIVE
Disabled active. Used for disabled buttons that have been marked as default.


ACTIVE

public static final ComponentState ACTIVE
Active. Used for enabled buttons that have been marked as default.


DISABLED_SELECTED

public static final ComponentState DISABLED_SELECTED
Disabled selected.


DISABLED_UNSELECTED

public static final ComponentState DISABLED_UNSELECTED
Disabled and not selected.


PRESSED_SELECTED

public static final ComponentState PRESSED_SELECTED
Pressed selected.


PRESSED_UNSELECTED

public static final ComponentState PRESSED_UNSELECTED
Pressed and not selected.


SELECTED

public static final ComponentState SELECTED
Selected.


ROLLOVER_SELECTED

public static final ComponentState ROLLOVER_SELECTED
Selected and rolled over.


ROLLOVER_UNSELECTED

public static final ComponentState ROLLOVER_UNSELECTED
Not selected and rolled over.


DEFAULT

public static final ComponentState DEFAULT
Default state.

Method Detail

values

public static final ComponentState[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(ComponentState c : ComponentState.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static ComponentState valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

getColorSchemeKind

public ComponentState.ColorSchemeKind getColorSchemeKind()
Returns the corresponding color scheme kind

Returns:
Corresponding color scheme kind

getCycleCount

public int getCycleCount()
Returns the corresponding cycle count.

Returns:
Corresponding cycle count.

isEnabled

public boolean isEnabled()
Returns the indication of whether a component with this state is enabled.

Returns:
Indication of whether a component with this state is enabled.

isSelected

public boolean isSelected()
Returns the indication of whether a component with this state is selected.

Returns:
Indication of whether a component with this state is selected.

getState

public static ComponentState getState(ButtonModel model,
                                      AbstractButton button)
Retrieves component state based on the button model (required parameter) and button itself (optional parameter).

Parameters:
model - Button model (required).
button - Button (optional).
Returns:
The matching component state.