Class PFCAction

java.lang.Object
javax.swing.AbstractAction
com.portal.pfc.ui.PFCAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action

public abstract class PFCAction extends AbstractAction
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 Details

    • ACCEL

      public static final String ACCEL
      Constant used to store accelerator property information in the action class.
      See Also:
    • RES_ACCEL

      public static final String RES_ACCEL
      Suffix of the token that defines the action accelerator in the resource file.
      See Also:
    • MNEM

      public static final String MNEM
      Constant used to store mnemonic property information in the action class.
      See Also:
    • RES_MNEM

      public static final String RES_MNEM
      Suffix of the token that defines the action mnemonic in the resource file.
      See Also:
    • ICON_DISABLED

      public static final String ICON_DISABLED
      Constant used to store icon disabled information in action class
      See Also:
    • RES_ICON_DISABLED

      public static final String RES_ICON_DISABLED
      Suffix of the token that defines the action disabled icon in the resource file.
      See Also:
    • ICON_PRESSED

      public static final String ICON_PRESSED
      Constant used to store icon property information in the action class.
      See Also:
    • RES_ICON_PRESSED

      public static final String RES_ICON_PRESSED
      Suffix of the token that defines the action pressed icon in the resource file.
      See Also:
    • TOOLBAR_LABEL

      public static final String 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

      public static final String RES_TOOLBAR_LABEL
      Suffix of the token that defines the action toolbar label in the resource file.
      See Also:
    • RES_NAME

      public static final String RES_NAME
      Suffix of the token that defines the name in the resource file.
      See Also:
    • RES_TOOLTIP

      public static final String RES_TOOLTIP
      Suffix of the token that defines the action tooltip in the resource file.
      See Also:
    • RES_DESCRIPTION

      public static final String RES_DESCRIPTION
      Suffix of the token that defines the action description in the resource file.
      See Also:
    • RES_ICON

      public static final String RES_ICON
      Suffix of the token that defines the action icon in the resource file.
      See Also:
    • TYPE

      public static final String TYPE
      Constant used to store type information in action class
      See Also:
    • RES_TYPE

      public static final String 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

      public PFCAction(String token, Properties props, ResourceBundle resbndl)
      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

      public String 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

      public Component 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

      public abstract void actionPerformed(ActionEvent ae)
      Override this method to implement the functionality that this action provides.