Class AbstractMultipleCompositeComponent

All Implemented Interfaces:
com.globalmentor.beans.PropertyBindable, com.globalmentor.beans.PropertyConstrainable, io.clogr.Clogged, Component, CompositeComponent, Displayable, InfoModel, LabelModel, Model, PresentationModel, DepictedObject
Direct Known Subclasses:
AbstractArrayCompositeComponent, AbstractCompositeStateComponent, AbstractListCompositeComponent

public abstract class AbstractMultipleCompositeComponent extends AbstractCompositeComponent
An abstract implementation of a composite component that can contain multiple components. Every child component must be added or removed using addComponent(Component) and removeComponent(Component), although other actions may take place. The component's validity is updated whenever a child comonent is added or removed from the component.
Author:
Garret Wilson
  • Constructor Details

    • AbstractMultipleCompositeComponent

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

    • hasChildComponents

      public boolean hasChildComponents()
      Returns:
      Whether this component has childh components.
    • getChildComponents

      public Iterable<Component> getChildComponents()
      Returns:
      An iterable to child components.
    • addComponent

      protected void addComponent(Component childComponent)
      Adds a child component. This version adds the component to the component set. Any class that overrides this method must call this version.
      Parameters:
      childComponent - The component to add to this component.
      Throws:
      IllegalArgumentException - if the component already has a parent or if the component is already a child of this composite component.
    • removeComponent

      protected void removeComponent(Component childComponent)
      Removes a child component. This version removes the component from the component set. Any class that overrides this method must call this version.
      Parameters:
      childComponent - The component to remove from this component.
      Throws:
      IllegalArgumentException - if the component does not recognize this composite component as its parent or the component is not a member of this composite component.