Class ImageActionControl

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, ActionControl, Component, Control, ImageComponent, InputFocusableComponent, ActionListenable, ActionModel, Displayable, Enableable, ImageModel, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
PendingImageActionControl

public class ImageActionControl extends AbstractImageComponent implements ActionControl
An image component that is also an action control.
Author:
Garret Wilson
  • Constructor Details

    • ImageActionControl

      public ImageActionControl()
      Default constructor.
    • ImageActionControl

      public ImageActionControl(ImageModel imageModel)
      Image model constructor.
      Parameters:
      imageModel - The component image model.
    • ImageActionControl

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

      public ImageActionControl(ActionPrototype actionPrototype)
      Prototype constructor.
      Parameters:
      actionPrototype - The prototype on which this component should be based.
      Throws:
      NullPointerException - if the given prototype is null.
  • Method Details

    • getActionModel

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

      protected Enableable getEnableable()
      Returns:
      The enableable object decorated by this component.
    • 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:
    • getStatus

      public Control.Status getStatus()
      Specified by:
      getStatus in interface Control
      Returns:
      The status of the current user input, or null if there is no status to report.
    • setStatus

      protected void setStatus(Control.Status newStatus)
      Sets the status of the current user input. This is a bound property.
      Parameters:
      newStatus - The new status of the current user input, or null if there is no status to report.
      See Also:
    • updateStatus

      protected void updateStatus()
      Rechecks user input status of this component, and updates the status.
      See Also:
    • determineStatus

      protected Control.Status determineStatus()
      Checks the user input status of the control. If the component has a notification of Notification.Severity.WARN, the status is determined to be Control.Status.WARNING. If the component has a notification of Notification.Severity.ERROR, the status is determined to be Control.Status.ERROR. Otherwise, this version returns null. If the control is disabled null is returned.
      Returns:
      The current user input status of the control.
    • updateValid

      protected void updateValid()
      Rechecks user input validity of this component and all child components, and updates the valid state. This implementation only updates the valid property if the property is already initialized or there is at least one listener to the Component.VALID_PROPERTY.

      This version also updates the status.

      Overrides:
      updateValid in class AbstractComponent
      See Also:
    • setNotification

      public void setNotification(Notification newNotification)
      Description copied from interface: Component
      Sets the component notification. This is a bound property. The notification is also fired as a NotificationEvent on this component if a new notification is given. Parents are expected to refire the notification event up the hierarchy.
      Specified by:
      setNotification in interface Component
      Overrides:
      setNotification in class AbstractComponent
      Parameters:
      newNotification - The notification for the component, or null if no notification is associated with this component.
      See Also:
    • reset

      public void reset()
      Resets the control to its default value.

      This version clears any notification.

      Specified by:
      reset in interface Control
      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 initiaged 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.
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface Enableable
      Returns:
      Whether the object is enabled and can receive user input.
    • setEnabled

      public void setEnabled(boolean newEnabled)
      Description copied from interface: Enableable
      Sets whether the object is enabled and can receive user input. This is a bound property of type Boolean.
      Specified by:
      setEnabled in interface Enableable
      Parameters:
      newEnabled - true if the object should indicate and accept user input.
      See Also: