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
 
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 i18nKey, javax.swing.Icon icon)
          Basic I18NAction.
 
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.
 java.lang.Object getValue(java.lang.String key)
           
 void localeChanged(LocaleEvent event)
          Updates Action.NAME when a LocaleEvent is fired.
 void putValue(java.lang.String key, java.lang.Object newValue)
          Allow the use of a customized i18n resource bundle.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, isEnabled, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 i18nKey,
                  javax.swing.Icon icon)
Basic I18NAction.

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

putValue

public void putValue(java.lang.String key,
                     java.lang.Object newValue)
Allow the use of a customized i18n resource bundle.

Specified by:
putValue in interface javax.swing.Action

getValue

public java.lang.Object getValue(java.lang.String key)
Specified by:
getValue in interface javax.swing.Action

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