Class PEActionLocalizer
- java.lang.Object
-
- jpicedt.ui.action.PEActionLocalizer
-
- All Implemented Interfaces:
ActionLocalizer
public class PEActionLocalizer extends java.lang.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
Fields Modifier and Type Field Description protected java.util.ResourceBundleresBundlethe ResourceBundle that feeds this localizer with localized Strings
-
Constructor Summary
Constructors Constructor Description PEActionLocalizer(java.util.ResourceBundle resBundle)Construct a new PEActionLocalizer from the given ResourceBundle.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.KeyStrokegetActionAccelerator(java.lang.String actionName)java.lang.StringgetActionHelper(java.lang.String actionName)javax.swing.IcongetActionIcon(java.lang.String actionName)java.lang.IntegergetActionMnemonic(java.lang.String actionName)java.lang.StringgetActionName(java.lang.String actionName)java.lang.StringgetActionTooltip(java.lang.String actionName)java.util.ResourceBundlegetResourceBundle()
-
-
-
Method Detail
-
getResourceBundle
public java.util.ResourceBundle getResourceBundle()
- Returns:
- the ResourceBundle that feeds this localizer with localized Strings
-
getActionName
public java.lang.String getActionName(java.lang.String actionName)
- Specified by:
getActionNamein interfaceActionLocalizer- 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 java.lang.String getActionTooltip(java.lang.String actionName)
- Specified by:
getActionTooltipin interfaceActionLocalizer- 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 java.lang.String getActionHelper(java.lang.String actionName)
- Specified by:
getActionHelperin interfaceActionLocalizer- Returns:
- a localized Action helper (ie Swing Action.LONG_DESCRIPTION)
This will return the value for the key build from : actionName + ".helper".
-
getActionMnemonic
public java.lang.Integer getActionMnemonic(java.lang.String actionName)
- Specified by:
getActionMnemonicin interfaceActionLocalizer- 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 javax.swing.KeyStroke getActionAccelerator(java.lang.String actionName)
- Specified by:
getActionAcceleratorin interfaceActionLocalizer- 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 javax.swing.Icon getActionIcon(java.lang.String actionName)
- Specified by:
getActionIconin interfaceActionLocalizer- 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.
-
-