org.jvnet.substance.api
Enum ComponentState

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

public enum ComponentState
extends java.lang.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.
ARMED
          Armed.
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_ARMED
          Armed and rolled over.
ROLLOVER_SELECTED
          Selected and rolled over.
ROLLOVER_UNSELECTED
          Not selected and rolled over.
SELECTED
          Selected.
 
Method Summary
static ComponentState[] getActiveStates()
          Returns all active component states.
 ComponentState.ColorSchemeKind getColorSchemeKind()
          Returns the corresponding color scheme kind
 float getCyclePosition()
          Returns the corresponding cycle count.
static ComponentState getState(javax.swing.AbstractButton button)
          Returns the state of the specified button.
static ComponentState getState(boolean isEnabled, boolean isRollover, boolean isSelected)
          Returns the component state that matches the specified parameters.
static ComponentState getState(javax.swing.ButtonModel model, javax.swing.JComponent component)
          Retrieves component state based on the button model (required parameter) and component itself (optional parameter).
static ComponentState getState(javax.swing.ButtonModel model, javax.swing.JComponent component, boolean toIgnoreSelection)
          Retrieves component state based on the button model (required parameter) and button itself (optional parameter).
 boolean isKindActive(org.jvnet.lafwidget.animation.FadeKind fadeKind)
          Returns indication whether this component state is "active" under the specified fade kind.
static ComponentState valueOf(java.lang.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 are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
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.


ARMED

public static final ComponentState ARMED
Armed.


ROLLOVER_ARMED

public static final ComponentState ROLLOVER_ARMED
Armed 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 ComponentState[] values()
Returns an array containing the constants of this enum type, in the order they are 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 are declared

valueOf

public static ComponentState valueOf(java.lang.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:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getColorSchemeKind

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

Returns:
Corresponding color scheme kind

getCyclePosition

public float getCyclePosition()
Returns the corresponding cycle count.

Returns:
Corresponding cycle count.

isKindActive

public boolean isKindActive(org.jvnet.lafwidget.animation.FadeKind fadeKind)
Returns indication whether this component state is "active" under the specified fade kind. For example, ROLLOVER_SELECTED will return true for both FadeKind.ROLLOVER and FadeKind.SELECTION.

Parameters:
fadeKind - Fade kind.
Returns:
true if this component state is "active" under the specified fade kind (for example, ROLLOVER_SELECTED will return true for both FadeKind.ROLLOVER and FadeKind.SELECTION), false otherwise.

getActiveStates

public static ComponentState[] getActiveStates()
Returns all active component states.

Returns:
All active component states.

getState

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

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

getState

public static ComponentState getState(javax.swing.AbstractButton button)
Returns the state of the specified button.

Parameters:
button - Button.
Returns:
The state of the specified button.

getState

public static ComponentState getState(javax.swing.ButtonModel model,
                                      javax.swing.JComponent component,
                                      boolean toIgnoreSelection)
Retrieves component state based on the button model (required parameter) and button itself (optional parameter).

Parameters:
model - Button model (required).
component - Component (optional).
toIgnoreSelection - If true, the ButtonModel.isSelected() will not be checked. This can be used for tracking transitions on menu items that use armed state instead, when we don't want to use different rollover themes for selected and unselected checkbox and radio button menu items (to preserve consistent visual appearence of highlights).
Returns:
The matching component state.

getState

public static ComponentState getState(boolean isEnabled,
                                      boolean isRollover,
                                      boolean isSelected)
Returns the component state that matches the specified parameters.

Parameters:
isEnabled - Enabled flag.
isRollover - Rollover flag.
isSelected - Selected flag.
Returns:
The component state that matches the specified parameters.