Class BooleanValueControlSelectControl<V>

Type Parameters:
V - The type of values to select.
All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, com.globalmentor.model.MutableValued<V>, com.globalmentor.model.Valued<V>, io.clogr.Clogged, Component, CompositeComponent, Control, InputFocusableComponent, LayoutComponent, ListSelectControl<V>, SelectControl<V>, ValueControl<V>, ValuedComponent<V>, ListListenable<V>, Displayable, Enableable, InfoModel, LabelModel, ListSelectModel<V>, Model, SelectModel<V>, PresentationModel, ValueModel<V>, DepictedObject, Iterable<V>, Collection<V>, List<V>

public class BooleanValueControlSelectControl<V> extends AbstractListSelectControl<V> implements LayoutComponent, ListSelectControl<V>
A list select control that uses child components to show the list items. Only ValueControls of type Boolean will be recognized as able to receive user input to select items in the list. Only a Layout that supports default constraints can be used.
Author:
Garret Wilson
  • Field Details

    • componentValueChangeListener

      protected final com.globalmentor.beans.GenericPropertyChangeListener<Boolean> componentValueChangeListener
      The listener that detects changes to a child component's Boolean value and updates the control's selected values accordingly.
    • synchronizingValuesFlag

      protected final AtomicBoolean synchronizingValuesFlag
      The atomic flag that allows us to know whether we're synchronizing values, either from the list to the child controls or vice versa.
  • Constructor Details

    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass)
      Value class constructor with a default data model to represent a given type with multiple selection and a FlowLayout with Flow.PAGE flow.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      Throws:
      NullPointerException - if the given value class is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      Value class and value representation strategy constructor with a default data model to represent a given type with multiple selection and a FlowLayout with Flow.PAGE flow.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      Throws:
      NullPointerException - if the given value class and/or value representation strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, ListSelectionPolicy<V> selectionStrategy)
      Value class and selection strategy constructor with a default data model to represent a given type and a FlowLayout with Flow.PAGE flow.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      selectionStrategy - The strategy for selecting values in the model.
      Throws:
      NullPointerException - if the given value class and/or selection strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, ListSelectionPolicy<V> selectionStrategy, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      Value class, selection strategy, and value representation strategy constructor with a default data model to represent a given type and a FlowLayout with Flow.PAGE flow.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      selectionStrategy - The strategy for selecting values in the model.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      Throws:
      NullPointerException - if the given value class, selection strategy, and/or value representation strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(ListSelectModel<V> listSelectModel)
      List select model constructor with a FlowLayout with Flow.PAGE flow.
      Parameters:
      listSelectModel - The component list select model.
      Throws:
      NullPointerException - if the given list select model is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(ListSelectModel<V> listSelectModel, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      List select model and value representation strategy constructor with a FlowLayout with Flow.PAGE flow.
      Parameters:
      listSelectModel - The component list select model.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      Throws:
      NullPointerException - if the given list select model and/or value representation strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, Layout<?> layout)
      Value class and layout constructor with a default data model to represent a given type with multiple selection.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      layout - The layout definition for the component.
      Throws:
      NullPointerException - if the given value class and/or layout is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, Layout<?> layout, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      Value class, layout, and value representation strategy constructor with a default data model to represent a given type with multiple selection.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      layout - The layout definition for the component.
      Throws:
      NullPointerException - if the given value class, layout, and/or value representation strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, ListSelectionPolicy<V> selectionStrategy, Layout<?> layout)
      Value class, selection strategy, and layout constructor with a default data model to represent a given type.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      selectionStrategy - The strategy for selecting values in the model.
      layout - The layout definition for the component.
      Throws:
      NullPointerException - if the given value class, selection strategy, and/or layout is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(Class<V> valueClass, ListSelectionPolicy<V> selectionStrategy, Layout<?> layout, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      Value class, selection strategy, layout, and value representation strategy constructor with a default data model to represent a given type.
      Parameters:
      valueClass - The class indicating the type of value held in the model.
      selectionStrategy - The strategy for selecting values in the model.
      layout - The layout definition for the component.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      Throws:
      NullPointerException - if the given value class, selection strategy, layout, and/or value representation strategy is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(ListSelectModel<V> listSelectModel, Layout<?> layout)
      List select model and layout constructor.
      Parameters:
      listSelectModel - The component list select model.
      layout - The layout definition for the component.
      Throws:
      NullPointerException - if the given list select model and/or layout is null.
    • BooleanValueControlSelectControl

      public BooleanValueControlSelectControl(ListSelectModel<V> listSelectModel, Layout<?> layout, ListSelectControl.ValueRepresentationStrategy<V> valueRepresentationStrategy)
      List select model, layout, and value representation strategy constructor.
      Parameters:
      listSelectModel - The component list select model.
      layout - The layout definition for the component.
      valueRepresentationStrategy - The strategy to create label models to represent this model's values.
      Throws:
      NullPointerException - if the given list select model, layout, and/or value representation strategy is null.
  • Method Details

    • getLayout

      public Layout<? extends Constraints> getLayout()
      Specified by:
      getLayout in interface LayoutComponent
      Returns:
      The layout definition for the container.
    • setLayout

      protected <T extends Constraints> void setLayout(Layout<T> newLayout)
      Sets the layout definition for the component. This is a bound property. The layout is marked as not yet having a theme applied, as the specific theme rules applied to the layout may depend on the layout's owner.
      Type Parameters:
      T - The type of the constraint.
      Parameters:
      newLayout - The new layout definition for the container.
      Throws:
      NullPointerException - if the given layout is null.
      See Also:
    • isLayoutThemeApplied

      public boolean isLayoutThemeApplied()
      Specified by:
      isLayoutThemeApplied in interface LayoutComponent
      Returns:
      Whether a theme has been applied to this component's layout.
    • setLayoutThemeApplied

      public void setLayoutThemeApplied(boolean newLayoutThemeApplied)
      Description copied from interface: LayoutComponent
      Sets whether a theme has been applied to this component's layout. This is a bound property of type Boolean.
      Specified by:
      setLayoutThemeApplied in interface LayoutComponent
      Parameters:
      newLayoutThemeApplied - true if a theme has been applied to this component's layout, else false.
      See Also:
    • getChildComponents

      public Iterable<Component> getChildComponents()

      This version returns the children in the same order as the list values.

      Specified by:
      getChildComponents in interface CompositeComponent
      Overrides:
      getChildComponents in class AbstractMultipleCompositeComponent
      Returns:
      An iterable to child components.
    • getValuePolicyModelGroup

      protected ValuePolicyModelGroup<Boolean> getValuePolicyModelGroup()
      Returns:
      The value policy model group for boolean value models, or null if there is no value policy model group in use.
    • addComponent

      protected void addComponent(Component childComponent)
      Description copied from class: AbstractMultipleCompositeComponent
      Adds a child component. This version adds the component to the component set. Any class that overrides this method must call this version.
      Overrides:
      addComponent in class AbstractMultipleCompositeComponent
      Parameters:
      childComponent - The component to add to this component.
    • removeComponent

      protected void removeComponent(Component childComponent)
      Description copied from class: AbstractMultipleCompositeComponent
      Removes a child component. This version removes the component from the component set. Any class that overrides this method must call this version.
      Overrides:
      removeComponent in class AbstractMultipleCompositeComponent
      Parameters:
      childComponent - The component to remove from this component.
    • updateListSelectedValues

      protected void updateListSelectedValues()
      Updates the list selected values based upon the current values of the child controls.
    • updateChildControlValues

      protected void updateChildControlValues()
      Updates the values of child controls based upon the current state of the list selected values.
    • resetTheme

      public void resetTheme()
      Resets this object's theme. This method sets to false the state of whether a theme has been applied to this object. This method is called for any child components resetting its own theme. No new theme is actually loaded. There is normally no need to override this method or to call this method directly by applications.

      This version recursively calls the AbstractCompositeComponent.resetTheme() method of all child components before resetting the theme of this component.

      This version resets the theme of the given layout.

      Specified by:
      resetTheme in interface Component
      Overrides:
      resetTheme in class AbstractCompositeComponent
      See Also:
    • updateTheme

      public void updateTheme() throws IOException
      Updates this object's theme. This method checks whether a theme has been applied to this object. If a theme has not been applied to this object this method calls Component.applyTheme(). This method is called for any child components before applying the theme to the component itself, to assure that child theme updates have already occurred before theme updates occur for this component. There is normally no need to override this method or to call this method directly by applications.

      This version recursively calls the AbstractCompositeComponent.updateTheme() method of all child components before updating the theme of this component.

      This version checks to see if the theme needs to be applied to the given layout.

      Specified by:
      updateTheme in interface Component
      Overrides:
      updateTheme in class AbstractCompositeComponent
      Throws:
      IOException - if there was an error loading or applying a theme.
      See Also:
    • applyTheme

      public void applyTheme() throws IOException
      Applies the theme to this object. Themes are only applied of the application is themed. This method may be overridden to effectively override theme settings by ensuring the state of important properties after the theme has been set. If the theme is successfully applied, this method updates the theme applied status.

      This version applies the theme to the current layout and updates the layout theme applied status.

      Specified by:
      applyTheme in interface Component
      Overrides:
      applyTheme in class AbstractComponent
      Throws:
      IOException - if there was an error loading or applying a theme.
      See Also:
    • applyTheme

      public void applyTheme(Theme theme)
      Description copied from interface: Component
      Applies a theme and its parents to this object. The theme's rules will be applied to this object and any related objects. Theme application occurs unconditionally, regardless of whether themes have been applied to this component before. There is normally no need to call this method directly by applications.
      Specified by:
      applyTheme in interface Component
      Overrides:
      applyTheme in class AbstractComponent
      Parameters:
      theme - The theme to apply to the object.