com.jgoodies.uif.application
Class ActionReader

java.lang.Object
  extended by com.jgoodies.uif.application.ActionReader

public final class ActionReader
extends Object

Sets Action properties from values that are specified in a ResourceMap. Looks up the action's name, icon, short and long descriptions, mnemonic, and mnemonic index. Values may be specialized for different platforms using a platform suffix. Currently only the .mac suffix for Mac OS X is supported.

Find below the resource key suffixes used to read values

SuffixValueTypeDefault
.labelnamemandatorynone
.acceleratoraccelerator keyoptionalnone
.tooltipshort descriptionoptionalname
.helptextlong descriptionoptionalshort description
.iconsmall iconoptionalnull
.largeIconlarge iconoptionalnull

The action name may contain the mnemonic marker character & to indicate the mnemonic and mnemonic index. The & character itself can be described by a double ampersand, &&. Find below an example of properties used to describe three actions:

 print.label=&Print
 print.icon=images/print.gif

 openPrintDialog.label=&Print?
 openPrintDialog.icon=images/print.gif
 openPrintDialog.tooltip=Open print dialog

 openHelpContents.label=&Contents
 openHelpContents.label.mac=JDiskReport Help
 openHelpContents.icon=images/help.gif
 openHelpContents.tooltip=Show Help Contents
 openHelpContents.helptext=Opens the help viewer and shows the help contents.
 

This class is used by the Actions class to initialize Actions that are looked up from methods annotated with the Action annotation. The icon lookup and conversion from icon paths to icons is done by a ResourceMap.

Since:
1.9
Version:
$Revision: 1.7 $
Author:
Karsten Lentzsch
See Also:
Action, Action, Actions, ResourceMap

Method Summary
static boolean getPlatformResourcesEnabled()
           
static void readAndPutValues(Action action, ResourceMap map, String prefix)
          Reads action properties for prefix in map and sets the associated values in the given action.
static void setPlatformResourcesEnabled(boolean b)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPlatformResourcesEnabled

public static boolean getPlatformResourcesEnabled()

setPlatformResourcesEnabled

public static void setPlatformResourcesEnabled(boolean b)

readAndPutValues

public static void readAndPutValues(Action action,
                                    ResourceMap map,
                                    String prefix)
Reads action properties for prefix in map and sets the associated values in the given action.

Parameters:
action - the Action to be initialized
map - the ResourceMap used to resolve texts and paths
prefix - the prefix used for the resource map lookup
Throws:
MissingResourceException - if the action name and the action icon are missing


Copyright © 2000-2008 JGoodies Karsten Lentzsch. All Rights Reserved.