de.caff.gimmicks.swing

## Interface State

- All Superinterfaces:
    javax.swing.Action, java.awt.event.ActionListener, java.util.EventListener, ToolBarElement
  All Known Implementing Classes:
    AbstractState, AbstractToggleState, VisibleState

      public interface State
      extends javax.swing.Action, ToolBarElement

  State is an interface for states, especially in GUIs. It is similar to the Action interface of Swing.
  Author:
    Rammi

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ACTIVATION_PROPERTY` Property identifier for activation.
    `static java.lang.String` | `ACTIVE_ICON_PROPERTY` Property name for active icon.
    `static java.lang.String` | `DISABLED_ICON_PROPERTY` Property name for disabled icon.
    `static java.lang.String` | `ENABLE_PROPERTY` Property identifier for enable state.
    `static java.lang.String` | `INACTIVE_ICON_PROPERTY` Property name for inactive icon.
    `static java.lang.String` | `LABEL_TEXT_PROPERTY` Property name for label text.
    `static java.lang.String` | `POPUP_PROPERTY` Property name for the possibility to show a popup menu.
    `static java.lang.String` | `TOOLTIP_TEXT_PROPERTY` Property name for tooltip text property.

    - ### Fields inherited from interface javax.swing.Action

      `ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `activate()` Activate this state.
    `void` | `addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)` Add a property change listener for a special property.
    `void` | `deactivate()` Deactivate this state.
    `boolean` | `hasPopup()` Does this state provide a popup menu?
    `boolean` | `isActivated()` Is this state activated?
    `boolean` | `isToggleEnabled()` Is it possible to switch this state off by clicking on it with the mouse?
    `void` | `refresh()` Refresh state.
    `void` | `removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)` Remove a property change listener for a special property.
    `void` | `setManager(StateManager stateManager)` Set the state manager which handles this state.
    `void` | `showPopup(java.awt.Component comp, int x, int y)` Show a popup menu.

    - ### Methods inherited from interface javax.swing.Action

      `addPropertyChangeListener, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled`

    - ### Methods inherited from interface java.awt.event.ActionListener

      `actionPerformed`

    - ### Methods inherited from interface de.caff.gimmicks.swing.ToolBarElement

      `addToToolBar, addToToolBar`

- - ### Field Detail

    - #### ENABLE_PROPERTY

          static final java.lang.String ENABLE_PROPERTY

      Property identifier for enable state.
      See Also:
        Constant Field Values

    - #### ACTIVATION_PROPERTY

          static final java.lang.String ACTIVATION_PROPERTY

      Property identifier for activation.
      See Also:
        Constant Field Values

    - #### ACTIVE_ICON_PROPERTY

          static final java.lang.String ACTIVE_ICON_PROPERTY

      Property name for active icon.
      See Also:
        Constant Field Values

    - #### INACTIVE_ICON_PROPERTY

          static final java.lang.String INACTIVE_ICON_PROPERTY

      Property name for inactive icon.
      See Also:
        Constant Field Values

    - #### DISABLED_ICON_PROPERTY

          static final java.lang.String DISABLED_ICON_PROPERTY

      Property name for disabled icon.
      See Also:
        Constant Field Values

    - #### LABEL_TEXT_PROPERTY

          static final java.lang.String LABEL_TEXT_PROPERTY

      Property name for label text.
      See Also:
        Constant Field Values

    - #### TOOLTIP_TEXT_PROPERTY

          static final java.lang.String TOOLTIP_TEXT_PROPERTY

      Property name for tooltip text property.
      See Also:
        Constant Field Values

    - #### POPUP_PROPERTY

          static final java.lang.String POPUP_PROPERTY

      Property name for the possibility to show a popup menu.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setManager

          void setManager(@NotNull
                          StateManager stateManager)

      Set the state manager which handles this state.
      Parameters:
        `stateManager` - state manager

    - #### addPropertyChangeListener

          void addPropertyChangeListener(@NotNull
                                         java.lang.String property,
                                         @NotNull
                                         java.beans.PropertyChangeListener listener)

      Add a property change listener for a special property.
      Parameters:
        `property` - property identifier
        `listener` - listener to add

    - #### removePropertyChangeListener

          void removePropertyChangeListener(@NotNull
                                            java.lang.String property,
                                            @NotNull
                                            java.beans.PropertyChangeListener listener)

      Remove a property change listener for a special property.
      Parameters:
        `property` - property identifier
        `listener` - listener to remove

    - #### activate

          boolean activate()

      Activate this state.
      Returns:
        `true` if the activation was possible, `false` otherwise

    - #### isActivated

          boolean isActivated()

      Is this state activated?
      Returns:
        the answer

    - #### deactivate

          void deactivate()

      Deactivate this state.

    - #### isToggleEnabled

          boolean isToggleEnabled()

      Is it possible to switch this state off by clicking on it with the mouse?
      Returns:
        the answer

    - #### showPopup

          void showPopup(@NotNull
                         java.awt.Component comp,
                         int x,
                         int y)

      Show a popup menu. Implementations are free to do nothing.
      Parameters:
        `comp` - component where to show the popup menu
        `x` - x position in component
        `y` - y position in component
      See Also:
        `hasPopup()`

    - #### hasPopup

          boolean hasPopup()

      Does this state provide a popup menu? If the answer is `true` `showPopup(java.awt.Component, int, int)` is expected to display a popup menu.
      Returns:
        the answer
      See Also:
        `POPUP_PROPERTY`

    - #### refresh

          void refresh()

      Refresh state.