Class CheckControl

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, com.globalmentor.model.MutableValued<Boolean>, com.globalmentor.model.Valued<Boolean>, Component, Control, EditComponent, InputFocusableComponent, ValueControl<Boolean>, ValuedComponent<Boolean>, EditListenable, Displayable, Enableable, InfoModel, LabelModel, Model, PresentationModel, ValueModel<Boolean>, DepictedObject

public class CheckControl extends AbstractEditValueControl<Boolean>
Control accepting boolean input rendered as a check, either a checked square or a circle.

If no check type is specified, the check type will automatically determined dynamically. If there is a MutualExclusionPolicyModelGroup value listener, indicating that this is a mutual exclusion control, a CheckControl.CheckType.ELLIPSE check type will be used. Otherwise, a CheckControl.CheckType.RECTANGLE check type will be used.

The default model used by a check control defaults to a value of Boolean.FALSE, as a check control does not have the capability of indicating null.

A check control automatically installs a ValueRequiredValidator, as a check control does not have the capability of indicating null.

Author:
Garret Wilson
  • Field Details

    • CHECK_TYPE_PROPERTY

      public static final String CHECK_TYPE_PROPERTY
      The check type bound property.
  • Constructor Details

    • CheckControl

      public CheckControl()
      Default constructor with a default info model and a default value model.
    • CheckControl

      public CheckControl(CheckControl.CheckType checkType)
      Check type constructor with a default info model and value model.
      Parameters:
      checkType - The type of check area presented to the user, or null if the check type should be determined automatically.
    • CheckControl

      public CheckControl(String label)
      Label constructor.
      Parameters:
      label - The text of the label, or null if there should be no label.
    • CheckControl

      public CheckControl(String label, URI icon)
      Label and icon constructor.
      Parameters:
      label - The text of the label, or null if there should be no label.
      icon - The icon URI, which may be a resource URI, or null if there is no icon URI.
    • CheckControl

      public CheckControl(InfoModel infoModel)
      Info model constructor.
      Parameters:
      infoModel - The component info model.
      Throws:
      NullPointerException - if the given info model is null.
    • CheckControl

      public CheckControl(InfoModel infoModel, ValueModel<Boolean> valueModel)
      Info model and value model constructor.
      Parameters:
      infoModel - The component info model.
      valueModel - The component value model.
      Throws:
      NullPointerException - if the given info model and/or value model is null.
    • CheckControl

      public CheckControl(ValueModel<Boolean> valueModel)
      Value model constructor.
      Parameters:
      valueModel - The component value model.
      Throws:
      NullPointerException - if the given value model is null.
    • CheckControl

      public CheckControl(ValueModel<Boolean> valueModel, CheckControl.CheckType checkType)
      Value model and check type constructor.
      Parameters:
      valueModel - The component value model.
      checkType - The type of check area presented to the user, or null if the check type should be determined automatically.
      Throws:
      NullPointerException - if the given value model is null.
    • CheckControl

      public CheckControl(InfoModel infoModel, ValueModel<Boolean> valueModel, CheckControl.CheckType checkType)
      Info model, value model and check type constructor.
      Parameters:
      infoModel - The component info model.
      valueModel - The component value model.
      checkType - The type of check area presented to the user, or null if the check type should be determined automatically.
      Throws:
      NullPointerException - if the given value model, and/or info model is null.
    • CheckControl

      public CheckControl(InfoModel infoModel, ValueModel<Boolean> valueModel, Enableable enableable, CheckControl.CheckType checkType)
      Info model, value model, enableable object, and check type constructor.
      Parameters:
      infoModel - The component info model.
      valueModel - The component value model.
      enableable - The enableable object in which to store enabled status.
      checkType - The type of check area presented to the user, or null if the check type should be determined automatically.
      Throws:
      NullPointerException - if the given value model and/or info model is null.
    • CheckControl

      public CheckControl(ValuePrototype<Boolean> valuePrototype)
      Prototype constructor.
      Parameters:
      valuePrototype - The prototype on which this component should be based.
      Throws:
      NullPointerException - if the given prototype is null.
  • Method Details

    • getCheckType

      public CheckControl.CheckType getCheckType()
      Returns:
      The type of check area presented to the user, or null if the check type should be determined automatically.
    • setCheckType

      public void setCheckType(CheckControl.CheckType newCheckType)
      Sets the type of check area to present to the user. This is a bound property.
      Parameters:
      newCheckType - The type of check area to use, or null if the check type should be determined automatically.
      See Also: