de.caff.gimmicks.swing

## Class ResourcedAction

- java.lang.Object
- - javax.swing.AbstractAction
  - - de.caff.gimmicks.swing.ResourcedAction

- All Implemented Interfaces:
    Localizable, java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action

      public abstract class ResourcedAction
      extends javax.swing.AbstractAction
      implements Localizable

  An action which knows about resources.
  Author:
    Rammi
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ACCELERATOR_KEY_RESOURCE` The key for accelerator resources.
    `static java.lang.String` | `ACTION_COMMAND_KEY_RESOURCE` The key for action command resources.
    `(package private) static boolean` | `I18N_DEBUG` Show base names on action debug?
    `protected static java.lang.String` | `ICON_PREFIX` Use this as a prefix for resources of icon pathes, so they are updated automatically on locale changes.
    `static java.lang.String` | `LONG_DESCRIPTION_RESOURCE` The key for long description resources.
    `static java.lang.String` | `MNEMONIC_KEY_RESOURCE` The key for mnemonic resources.
    `static java.lang.String` | `NAME_RESOURCE` The key for name resources.
    `static java.lang.String` | `POPUP_PROPERTY` Boolean property for providing a popup menu, see `hasPopup()`.
    `protected static java.lang.String` | `RESOURCE_PREFIX` Use this as a prefix for resources of standard names, so they are updated automatically on locale changes.
    `static java.lang.String` | `SHORT_DESCRIPTION_RESOURCE` The key for short description resources.
    `static java.lang.String` | `SMALL_ICON_RESOURCE` The key for small icon path resources.

    - ### Fields inherited from class javax.swing.AbstractAction

      `changeSupport, enabled`

    - ### 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`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ResourcedAction(java.lang.String baseTag)` Create a resourced action with the default locale.
    `protected` | `ResourcedAction(java.lang.String baseTag, java.util.Locale l)` Create a resourced action.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected java.lang.Object` | `clone()` Clones the abstract action.
    `java.lang.String` | `getBaseTag()` Get the basic I18n tag.
    `java.util.Locale` | `getLocale()` Get the current locale of this action.
    `boolean` | `hasPopup()` Does this state provide a popup menu?
    `void` | `putValue(java.lang.String key, java.lang.Object newValue)` Sets the `Value` associated with the specified key.
    `void` | `setLocale(java.util.Locale l)` Set the locale.

    - ### Methods inherited from class javax.swing.AbstractAction

      `addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, removePropertyChangeListener, setEnabled`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

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

      `actionPerformed`

- - ### Field Detail

    - #### I18N_DEBUG

          static final boolean I18N_DEBUG

      Show base names on action debug?

    - #### RESOURCE_PREFIX

          protected static final java.lang.String RESOURCE_PREFIX

      Use this as a prefix for resources of standard names, so they are updated automatically on locale changes.
      See Also:
        Constant Field Values

    - #### ICON_PREFIX

          protected static final java.lang.String ICON_PREFIX

      Use this as a prefix for resources of icon pathes, so they are updated automatically on locale changes.
      See Also:
        Constant Field Values

    - #### ACCELERATOR_KEY_RESOURCE

          public static final java.lang.String ACCELERATOR_KEY_RESOURCE

      The key for accelerator resources. Compare `Action.ACCELERATOR_KEY`
      See Also:
        Constant Field Values

    - #### ACTION_COMMAND_KEY_RESOURCE

          public static final java.lang.String ACTION_COMMAND_KEY_RESOURCE

      The key for action command resources. Compare `Action.ACTION_COMMAND_KEY`
      See Also:
        Constant Field Values

    - #### LONG_DESCRIPTION_RESOURCE

          public static final java.lang.String LONG_DESCRIPTION_RESOURCE

      The key for long description resources. Compare `Action.LONG_DESCRIPTION`
      See Also:
        Constant Field Values

    - #### MNEMONIC_KEY_RESOURCE

          public static final java.lang.String MNEMONIC_KEY_RESOURCE

      The key for mnemonic resources. Compare `Action.MNEMONIC_KEY`
      See Also:
        Constant Field Values

    - #### NAME_RESOURCE

          public static final java.lang.String NAME_RESOURCE

      The key for name resources. Compare `Action.NAME`
      See Also:
        Constant Field Values

    - #### SHORT_DESCRIPTION_RESOURCE

          public static final java.lang.String SHORT_DESCRIPTION_RESOURCE

      The key for short description resources. Compare `Action.SHORT_DESCRIPTION`
      See Also:
        Constant Field Values

    - #### SMALL_ICON_RESOURCE

          public static final java.lang.String SMALL_ICON_RESOURCE

      The key for small icon path resources. Compare `Action.SMALL_ICON`
      See Also:
        Constant Field Values

    - #### POPUP_PROPERTY

          public static final java.lang.String POPUP_PROPERTY

      Boolean property for providing a popup menu, see `hasPopup()`.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### ResourcedAction

          protected ResourcedAction(@NotNull
                                    java.lang.String baseTag)

      Create a resourced action with the default locale.
      Parameters:
        `baseTag` - basic i18n tag.The settings of this action are tried to set by evaluating this resource tag with one of the following suffixes:
        - `I18n.SUFFIX_TEXT`
        - `I18n.SUFFIX_TOOLTIP`
        - `I18n.SUFFIX_DESCRIPTION`
        - `I18n.SUFFIX_ACCELERATOR`
        - `I18n.SUFFIX_MNEMONIC`

    - #### ResourcedAction

          protected ResourcedAction(@NotNull
                                    java.lang.String baseTag,
                                    @Nullable
                                    java.util.Locale l)

      Create a resourced action.
      Parameters:
        `baseTag` - basic i18n tag.The settings of this action are tried to set by evaluating this resource tag with one of the following suffixes:
        - `I18n.SUFFIX_TEXT`
        - `I18n.SUFFIX_TOOLTIP`
        - `I18n.SUFFIX_DESCRIPTION`
        - `I18n.SUFFIX_ACCELERATOR`
        - `I18n.SUFFIX_MNEMONIC`
        `l` - locale to use

  - ### Method Detail

    - #### getBaseTag

          @NotNull
          public java.lang.String getBaseTag()

      Get the basic I18n tag.
      Returns:
        base tag

    - #### setLocale

          public void setLocale(java.util.Locale l)

      Set the locale. This updates all internal resources which depend on locales.
      Specified by:
        `setLocale` in interface `Localizable`
      Parameters:
        `l` - new locale

    - #### getLocale

          public java.util.Locale getLocale()

      Get the current locale of this action.
      Specified by:
        `getLocale` in interface `Localizable`
      Returns:
        current locale

    - #### putValue

          public void putValue(@NotNull
                               java.lang.String key,
                               java.lang.Object newValue)

      Sets the `Value` associated with the specified key. This takes care of setting depending keys for localized keys.
      Specified by:
        `putValue` in interface `javax.swing.Action`
      Overrides:
        `putValue` in class `javax.swing.AbstractAction`
      Parameters:
        `key` - the `String` that identifies the stored object
        `newValue` - the `Object` to store using this key
      See Also:
        `Action.putValue(java.lang.String, java.lang.Object)`

    - #### clone

          protected java.lang.Object clone()
                                    throws java.lang.CloneNotSupportedException

      Clones the abstract action. This gives the clone its own copy of the key/value list, which is not handled for you by `Object.clone()`.
      Overrides:
        `clone` in class `javax.swing.AbstractAction`
      Throws:
        `java.lang.CloneNotSupportedException`

    - #### hasPopup

          public boolean hasPopup()

      Does this state provide a popup menu?
      Returns:
        the answer
      See Also:
        `POPUP_PROPERTY`