Class AbstractLayoutComponent

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

public abstract class AbstractLayoutComponent extends AbstractListCompositeComponent implements LayoutComponent
Abstract implementation of a layout component. Iterating over child components is thread safe.
Author:
Garret Wilson
  • Constructor Details

    • AbstractLayoutComponent

      public AbstractLayoutComponent(Layout<? extends Constraints> layout)
      Layout constructor with a default info model.
      Parameters:
      layout - The layout definition for the container.
      Throws:
      NullPointerException - if the given layout is null.
    • AbstractLayoutComponent

      public AbstractLayoutComponent(InfoModel infoModel, Layout<? extends Constraints> layout)
      Info model and layout constructor.
      Parameters:
      infoModel - The component info model.
      layout - The layout definition for the container.
      Throws:
      NullPointerException - if the given info model and/or layout is null.
  • Method Details

    • addComponent

      protected void addComponent(int index, Component childComponent)
      Description copied from class: AbstractListCompositeComponent
      Adds a child component at the specified index. This version adds the component to the component list. Any class that overrides this method must call this version.
      Overrides:
      addComponent in class AbstractListCompositeComponent
      Parameters:
      index - The index at which the component should be added.
      childComponent - The component to add to this component.
    • removeComponent

      protected void removeComponent(Component childComponent)
      Description copied from class: AbstractListCompositeComponent
      Removes a child component. This version removes the component from the component set. Any class that overrides this method must call this version.

      This version removes the component from the component list.

      Overrides:
      removeComponent in class AbstractListCompositeComponent
      Parameters:
      childComponent - The component to remove from this component.
    • 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 constraints.
      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:
    • resetTheme

      public void resetTheme()
      Description copied from class: AbstractCompositeComponent
      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.

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

      public void updateTheme() throws IOException
      Description copied from class: AbstractCompositeComponent
      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.

      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
      Description copied from interface: Component
      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.
      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)
      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.

      This version applies the theme to the current layout.

      Specified by:
      applyTheme in interface Component
      Overrides:
      applyTheme in class AbstractComponent
      Parameters:
      theme - The theme to apply to the object.