Package com.portal.pfc.ui
Class PFCAction
java.lang.Object
javax.swing.AbstractAction
com.portal.pfc.ui.PFCAction
- All Implemented Interfaces:
ActionListener
,Serializable
,Cloneable
,EventListener
,Action
Subclass PFCAction to implement functionality that is triggered by
a menu entry or a toolbar button.
PFCAction is configured by a set of properties. See section PJF AppCenter FnS section 4.7.1 for the properties definitions. (We'll move it here later.)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Constant used to store accelerator property information in the action class.static final String
Constant used to store icon disabled information in action classstatic final String
Constant used to store icon property information in the action class.static final String
Constant used to store mnemonic property information in the action class.static final String
Suffix of the token that defines the action accelerator in the resource file.static final String
Suffix of the token that defines the action description in the resource file.static final String
Suffix of the token that defines the action icon in the resource file.static final String
Suffix of the token that defines the action disabled icon in the resource file.static final String
Suffix of the token that defines the action pressed icon in the resource file.static final String
Suffix of the token that defines the action mnemonic in the resource file.static final String
Suffix of the token that defines the name in the resource file.static final String
Suffix of the token that defines the action toolbar label in the resource file.static final String
Suffix of the token that defines the action tooltip in the resource file.static final String
Suffix of the token that defines the action type in the resource file.static final String
Constant used to indicate the label that should appear for a toolbar button.static final String
Constant used to store type information in action classFields inherited from class javax.swing.AbstractAction
changeSupport, enabled
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
-
Constructor Summary
ConstructorsConstructorDescriptionZero-arg constructor that does no initialization.PFCAction
(String token, Properties props, ResourceBundle resbndl) Creates a PFCAction. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
Override this method to implement the functionality that this action provides.Override this method to return a custom control when this action is used in a toolbar.getToken()
boolean
Check if this action is configured.void
setConfigured
(boolean configured) Sets the configured property for the action.Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Field Details
-
ACCEL
Constant used to store accelerator property information in the action class.- See Also:
-
RES_ACCEL
Suffix of the token that defines the action accelerator in the resource file.- See Also:
-
MNEM
Constant used to store mnemonic property information in the action class.- See Also:
-
RES_MNEM
Suffix of the token that defines the action mnemonic in the resource file.- See Also:
-
ICON_DISABLED
Constant used to store icon disabled information in action class- See Also:
-
RES_ICON_DISABLED
Suffix of the token that defines the action disabled icon in the resource file.- See Also:
-
ICON_PRESSED
Constant used to store icon property information in the action class.- See Also:
-
RES_ICON_PRESSED
Suffix of the token that defines the action pressed icon in the resource file.- See Also:
-
TOOLBAR_LABEL
Constant used to indicate the label that should appear for a toolbar button. When using ACToolBar, PFCAction.TOOLBAR_LABEL will be used first. If it's not set, Action.NAME will be used. Menu items will still refer to Action.NAME - this allows you to use one action in both widgets and not have a label appear in the toolbar unless you explicitely want it to.- See Also:
-
RES_TOOLBAR_LABEL
Suffix of the token that defines the action toolbar label in the resource file.- See Also:
-
RES_NAME
Suffix of the token that defines the name in the resource file.- See Also:
-
RES_TOOLTIP
Suffix of the token that defines the action tooltip in the resource file.- See Also:
-
RES_DESCRIPTION
Suffix of the token that defines the action description in the resource file.- See Also:
-
RES_ICON
Suffix of the token that defines the action icon in the resource file.- See Also:
-
TYPE
Constant used to store type information in action class- See Also:
-
RES_TYPE
Suffix of the token that defines the action type in the resource file.- See Also:
-
-
Constructor Details
-
PFCAction
public PFCAction()Zero-arg constructor that does no initialization. Typically used when an action is utilized outside the context of a menubar or toolbar (i.e. reuse of code that is available in a tool/menubar and elsewhere). -
PFCAction
Creates a PFCAction.- Parameters:
token
- Action token of the form <appname>.action.<actiontoken>. Must not be null.props
- Properties object that contains action definitions. Must not be null.resbndl
- Contains action resources for name, icon, accelerator, etc. Must not be null.
-
-
Method Details
-
getToken
-
setConfigured
public void setConfigured(boolean configured) Sets the configured property for the action. Actions that are not configured (configured == false) are not added to the menubar and toolbar.An action should check in its constructor whether it should be available to the user and set this value as appropriate. An action should not be available (configured == false) if some dependency required by the action is not present.
'Un/Configured' should not be confused with 'En/Disabled'. Disabled actions are visible on the toolbar/menubar but are inactive. Unconfigured actions do not even show up.
- Parameters:
configured
- Specifies whether the action should be available to the user on the menubar and toolbar. Should be set in the action constructor. Defaults to 'true'.
-
isConfigured
public boolean isConfigured()Check if this action is configured.- Returns:
- true if configured, false otherwise
-
getCustomToolbarComponent
Override this method to return a custom control when this action is used in a toolbar. If this returns null, a regular toolbar button will be used. Note that the action will be responsible for the labels, icons, etc. associated with this custom control. None of the normal action attributes will be applied.- Returns:
- The control to place in the toolbar
-
actionPerformed
Override this method to implement the functionality that this action provides.
-