Class AbstractLayoutControl

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, io.clogr.Clogged, Component, CompositeComponent, Control, InputFocusableComponent, LayoutComponent, LayoutControl, Displayable, Enableable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
AbstractLayoutValueControl

public abstract class AbstractLayoutControl extends AbstractLayoutComponent implements LayoutControl
An abstract implementation of a layout component that is also a control.
Author:
Garret Wilson
  • Constructor Details

    • AbstractLayoutControl

      public AbstractLayoutControl(Layout<?> layout)
      Layout constructor with a default info model and enableable.
      Parameters:
      layout - The layout definition for the layout component.
      Throws:
      NullPointerException - if the given layout is null.
    • AbstractLayoutControl

      public AbstractLayoutControl(InfoModel infoModel, Enableable enableable, Layout<?> layout)
      Info model, enableable, and layout constructor.
      Parameters:
      infoModel - The component info model.
      enableable - The enableable object in which to store enabled status.
      layout - The layout definition for the layout component.
      Throws:
      NullPointerException - if the given info model, enableable, and/or layout is null.
  • Method Details

    • getEnableable

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

      protected void enabledPropertyChange(boolean oldValue, boolean newValue)
      Called when the enabled property changes. Child versions should call this version. This version clears any notifications and updates the valid status.
      Parameters:
      oldValue - The old value of the property.
      newValue - The new value of the property.
      See Also:
    • 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: