Class AbstractCompositeStateComponent<T,​S extends AbstractCompositeStateComponent.ComponentState>

    • Constructor Detail

      • AbstractCompositeStateComponent

        public AbstractCompositeStateComponent​(InfoModel infoModel)
        Info model constructor.
        Parameters:
        infoModel - The component info model.
        Throws:
        java.lang.NullPointerException - if the given info model is null.
    • Method Detail

      • getComponentStates

        protected java.lang.Iterable<S> getComponentStates()
        Returns:
        An iterable of component states.
      • getComponentState

        protected S getComponentState​(T object)
        Retrieves a component state for the given object.
        Parameters:
        object - The object for which a representation component should be returned.
        Returns:
        The state of the child component to represent the given object, or null if there is no component for the given object.
      • putComponentState

        protected S putComponentState​(T object,
                                      S componentState)
        Stores a child component state for the given object. The component's theme will be updated immediately, as the component state is likely to be generated dynamically during component view update.
        Parameters:
        object - The object with which the component state is associated.
        componentState - The child component state to represent the given object, or null if there is no component for the given object.
        Returns:
        The child component that previously represented the given tree node, or null if there was previously no component for the given object.
        See Also:
        Component.updateTheme()
      • removeComponentState

        protected AbstractCompositeStateComponent.ComponentState removeComponentState​(T object)
        Removes the child component state for the given object.
        Parameters:
        object - The object with which the representation component is associated.
        Returns:
        The child component state that previously represented the given object, or null if there was previously no component for the given object.
      • clearComponentStates

        protected void clearComponentStates()
        Removes all child component states.
      • getComponent

        protected Component getComponent​(T object)
        Retrieves the component for the given object. If no component yet exists for the given object, one will be created.
        Parameters:
        object - The object for which a representation component should be returned.
        Returns:
        The child component representing the given object.
        Throws:
        java.lang.IllegalArgumentException - if the given object is not an appropriate object for a component to be created.
      • getObject

        protected T getObject​(Component component)
        Retrieves the object for the given component.
        Parameters:
        component - The child component representing an object.
        Returns:
        The object the child component represents.
        Throws:
        java.lang.NullPointerException - if the given component is null.
        java.lang.IllegalArgumentException - if the given component does not represent any object.
      • createComponentState

        protected abstract S createComponentState​(T object)
        Creates a component state to represent the given object.
        Parameters:
        object - The object with which the component state is to be associated.
        Returns:
        The component state to represent the given object.
        Throws:
        java.lang.IllegalArgumentException - if the given object is not an appropriate object for a component state to be created.