Class AbstractActionControl

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, ActionControl, Component, Control, InputFocusableComponent, LabelDisplayableComponent, ActionListenable, ActionModel, Displayable, Enableable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
AbstractActionValueControl, AbstractButtonControl, AbstractLinkControl, AbstractSelectActionControl

public abstract class AbstractActionControl extends AbstractControl implements ActionControl, LabelDisplayableComponent
Abstract control with an action model.
Author:
Garret Wilson
  • Constructor Details

    • AbstractActionControl

      public AbstractActionControl(InfoModel infoModel, ActionModel actionModel, Enableable enableable)
      Info model, action model, and enableable object constructor.
      Parameters:
      infoModel - The component info model.
      actionModel - The component action model.
      enableable - The enableable object in which to store enabled status.
      Throws:
      NullPointerException - if the given info model, action model, and/or enableable object is null.
  • Method Details

    • getActionModel

      protected ActionModel getActionModel()
      Returns:
      The action model used by this component.
    • isIconDisplayed

      public boolean isIconDisplayed()
      Specified by:
      isIconDisplayed in interface LabelDisplayableComponent
      Returns:
      Whether the icon is displayed.
    • setIconDisplayed

      public void setIconDisplayed(boolean newIconDisplayed)
      Description copied from interface: LabelDisplayableComponent
      Sets whether the icon is displayed. This is a bound property of type Boolean.
      Specified by:
      setIconDisplayed in interface LabelDisplayableComponent
      Parameters:
      newIconDisplayed - true if the icon should be displayed, else false if the icon should not be displayed and take up no space.
      See Also:
    • isLabelDisplayed

      public boolean isLabelDisplayed()
      Specified by:
      isLabelDisplayed in interface LabelDisplayableComponent
      Returns:
      Whether the label is displayed.
    • setLabelDisplayed

      public void setLabelDisplayed(boolean newLabelDisplayed)
      Description copied from interface: LabelDisplayableComponent
      Sets whether the label is displayed. This is a bound property of type Boolean.
      Specified by:
      setLabelDisplayed in interface LabelDisplayableComponent
      Parameters:
      newLabelDisplayed - true if the label should be displayed, else false if the label should not be displayed and take up no space.
      See Also:
    • isRollover

      public boolean isRollover()
      Specified by:
      isRollover in interface ActionControl
      Returns:
      Whether the component is in a rollover state.
    • setRollover

      public void setRollover(boolean newRollover)
      Description copied from interface: ActionControl
      Sets whether the component is in a rollover state. This is a bound property of type Boolean.
      Specified by:
      setRollover in interface ActionControl
      Parameters:
      newRollover - true if the component should be in a rollover state, else false.
      See Also:
    • addActionListener

      public void addActionListener(ActionListener actionListener)
      Description copied from interface: ActionListenable
      Adds an action listener.
      Specified by:
      addActionListener in interface ActionListenable
      Parameters:
      actionListener - The action listener to add.
    • removeActionListener

      public void removeActionListener(ActionListener actionListener)
      Description copied from interface: ActionListenable
      Removes an action listener.
      Specified by:
      removeActionListener in interface ActionListenable
      Parameters:
      actionListener - The action listener to remove.
    • getActionListeners

      public Iterable<ActionListener> getActionListeners()
      Specified by:
      getActionListeners in interface ActionModel
      Returns:
      all registered action listeners.
    • performAction

      public void performAction()
      Description copied from interface: ActionModel
      Performs the action with default force and default option. An ActionEvent is fired to all registered ActionListeners. This method delegates to ActionModel.performAction(int, int).
      Specified by:
      performAction in interface ActionModel
    • performAction

      public void performAction(int force, int option)
      Description copied from interface: ActionModel
      Performs the action with the given force and option. An ActionEvent is fired to all registered ActionListeners.
      Specified by:
      performAction in interface ActionModel
      Parameters:
      force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
      option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiated by a mouse right button click.
    • fireActionPerformed

      protected void fireActionPerformed(int force, int option)
      Fires an action event to all registered action listeners. This method delegates to fireActionPerformed(ActionEvent).
      Parameters:
      force - The zero-based force, such as 0 for no force or 1 for an action initiated by from a mouse single click.
      option - The zero-based option, such as 0 for an event initiated by a mouse left button click or 1 for an event initiated by a mouse right button click.
      See Also:
    • fireActionPerformed

      protected void fireActionPerformed(ActionEvent actionEvent)
      Fires a given action event to all registered action listeners.
      Parameters:
      actionEvent - The action event to fire.