org.workingfrog.i18n.swing
Class I18NAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byorg.workingfrog.i18n.swing.I18NAction
All Implemented Interfaces:
javax.swing.Action, java.awt.event.ActionListener, java.lang.Cloneable, java.util.EventListener, LocaleListener, java.io.Serializable
Direct Known Subclasses:
I18NActionWrapper

public class I18NAction
extends javax.swing.AbstractAction
implements LocaleListener

i18n version of javax.swing.AbstractAction

Author:
Jean-Hugues de Raigniac
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
static java.lang.String ACTION
          will probably be removed later
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
I18NAction()
          Default constructor for children.
I18NAction(java.lang.String i18nKey)
          Basic I18NAction.
I18NAction(java.lang.String bundle, java.lang.String i18nKey)
          Basic I18NAction.
I18NAction(java.lang.String bundle, java.lang.String i18nKey, javax.swing.Icon icon)
          I18NAction with an icon.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Must be implemented by children.
 java.lang.String getKey()
          Used when Action.NAME needs an update.
 void localeChanged(LocaleEvent event)
          Updates Action.NAME when a LocaleEvent is fired.
 void setBundle(java.lang.String bundle)
          Allow the use of a customized i18n resource bundle.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION

public static final java.lang.String ACTION
will probably be removed later

See Also:
Constant Field Values
Constructor Detail

I18NAction

public I18NAction()
Default constructor for children.


I18NAction

public I18NAction(java.lang.String i18nKey)
Basic I18NAction. Use default bundle

Parameters:
i18nKey - when I18NAction receive a LocaleEvent Action.NAME value is updated with it

I18NAction

public I18NAction(java.lang.String bundle,
                  java.lang.String i18nKey)
Basic I18NAction.

Parameters:
bundle - where to find the i18nKey
i18nKey - when I18NAction receive a LocaleEvent Action.NAME value is updated with it

I18NAction

public I18NAction(java.lang.String bundle,
                  java.lang.String i18nKey,
                  javax.swing.Icon icon)
I18NAction with an icon.

Parameters:
bundle - where to find the i18nKey
i18nKey - when I18NAction receive a LocaleEvent Action.NAME value is updated with it
icon - Action.SMALL_ICON value
Method Detail

setBundle

public void setBundle(java.lang.String bundle)
Allow the use of a customized i18n resource bundle.

Parameters:
bundle - bundle binding

getKey

public java.lang.String getKey()
Used when Action.NAME needs an update.

Returns:
a String containing the i18nKey of this I18NAction

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Must be implemented by children.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The event fired

localeChanged

public void localeChanged(LocaleEvent event)
Updates Action.NAME when a LocaleEvent is fired.

Specified by:
localeChanged in interface LocaleListener
Parameters:
event - contains the new Locale