http://www.jpicedt.org

jpicedt.ui.action
Class PEActionLocalizer

java.lang.Object
  extended byjpicedt.ui.action.PEActionLocalizer
All Implemented Interfaces:
ActionLocalizer

public class PEActionLocalizer
extends Object
implements ActionLocalizer

A class that can feed PEAction's with localized properties (e.g. tooltip,...) provided by a properties file through a ResourceBundle.

Each method takes a unique String argument, namely the non-localized Action name used in PEAction constructor, and builds other Action's properties from this String.

If there's no associated value for this String in the associated ResourceBundle, methods catch the associated MissingResourceException and return a null value.

Since:
jPicEdt
Version:
$Id: PEActionLocalizer.java,v 1.7.2.1 2007/09/02 11:56:30 reynal Exp $
Author:
Sylvain Reynal

Field Summary
protected  ResourceBundle resBundle
          the ResourceBundle that feeds this localizer with localized Strings
 
Constructor Summary
PEActionLocalizer(ResourceBundle resBundle)
          Construct a new PEActionLocalizer from the given ResourceBundle.
 
Method Summary
 KeyStroke getActionAccelerator(String actionName)
           
 String getActionHelper(String actionName)
           
 Icon getActionIcon(String actionName)
           
 Integer getActionMnemonic(String actionName)
           
 String getActionName(String actionName)
           
 String getActionTooltip(String actionName)
           
 ResourceBundle getResourceBundle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resBundle

protected ResourceBundle resBundle
the ResourceBundle that feeds this localizer with localized Strings

Constructor Detail

PEActionLocalizer

public PEActionLocalizer(ResourceBundle resBundle)
Construct a new PEActionLocalizer from the given ResourceBundle.

Method Detail

getResourceBundle

public ResourceBundle getResourceBundle()
Returns:
the ResourceBundle that feeds this localizer with localized Strings

getActionName

public String getActionName(String actionName)
Specified by:
getActionName in interface ActionLocalizer
Returns:
a localized Action name (ie Swing Action.NAME property) for the given name
This in effect will return the value associated with "actionName" in the ResourceBundle associated with the localizer.

getActionTooltip

public String getActionTooltip(String actionName)
Specified by:
getActionTooltip in interface ActionLocalizer
Returns:
a localized Action tooltip for the given name (ie Swing Action.SHORT_DESCRIPTION)

This will return the value for the key build from : actionName + ".tooltip".


getActionHelper

public String getActionHelper(String actionName)
Specified by:
getActionHelper in interface ActionLocalizer
Returns:
a localized Action helper (ie Swing Action.LONG_DESCRIPTION)

This will return the value for the key build from : actionName + ".helper".


getActionMnemonic

public Integer getActionMnemonic(String actionName)
Specified by:
getActionMnemonic in interface ActionLocalizer
Returns:
a localized Action mnemonic (ie Swing Action.MNEMONIC_KEY)

This will return a Character initialized from the first character of the value associated with the key : actionName + ".mnemonic".


getActionAccelerator

public KeyStroke getActionAccelerator(String actionName)
Specified by:
getActionAccelerator in interface ActionLocalizer
Returns:
a localized Action accelerator keystroke (ie Swing Action.ACCELERATOR_KEY)

This will return a KeyStroke parsed from the following String: actionName + ".accelerator".

See Also:
KeyStroke.getKeyStroke(String)

getActionIcon

public Icon getActionIcon(String actionName)
Specified by:
getActionIcon in interface ActionLocalizer
Returns:
a localized Icon (ie Swing Action.SMALL_ICON)

This will return an ImageIcon initialized from a GIF file with path : "/jpicedt/images/"+actionName+".gif"
Return null if the GIF file doesn't exist.


http://www.jpicedt.org

Submit a bug : syd@jpicedt.org