Class 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.ResourceBundle resBundle
      the 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.
    • Field Detail

      • resBundle

        protected java.util.ResourceBundle resBundle
        the ResourceBundle that feeds this localizer with localized Strings
    • Constructor Detail

      • PEActionLocalizer

        public PEActionLocalizer​(java.util.ResourceBundle resBundle)
        Construct a new PEActionLocalizer from the given ResourceBundle.
    • 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:
        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 java.lang.String getActionTooltip​(java.lang.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 java.lang.String getActionHelper​(java.lang.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 java.lang.Integer getActionMnemonic​(java.lang.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 javax.swing.KeyStroke getActionAccelerator​(java.lang.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 javax.swing.Icon getActionIcon​(java.lang.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.