Interface ComponentStore

  • All Known Implementing Classes:
    ComponentStoreImpl

    public interface ComponentStore

    Definition of an interface for objects that are able to manage entities related to a Form object.

    Objects implementing this interface are able to store FieldHandlers, ComponentHandlers, and simple components. All these entities can also be accessed by name.

    This interface is especially useful when a Form object is constructed. If this is done by a builder, all components created during the builder operation must be collected. It is even possible that multiple component stores are involved, e.g. if there are complex components, which create their own sub forms. In such cases having multiple - even different - implementations of the ComponentStore interface can be helpful.

    Version:
    $Id: ComponentStore.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Method Detail

      • add

        void add​(String name,
                 Object component)
        Adds the specified component to this component store under the given name.
        Parameters:
        name - the name of the component
        component - the component itself
      • addComponentHandler

        void addComponentHandler​(String name,
                                 ComponentHandler<?> handler)
        Adds the specified component handler to this component store under the given name.
        Parameters:
        name - the name of the component
        handler - the component handler
      • addFieldHandler

        void addFieldHandler​(String name,
                             FieldHandler fldHandler)
        Adds the specified field handler to this component store. The caller is responsible for adding the associated ComponentHandler manually.
        Parameters:
        name - the name of the component
        fldHandler - the field handler to be added
      • findComponent

        Object findComponent​(String name)
        Returns the component with the given name. If no such component can be found, null is returned.
        Parameters:
        name - the name of the desired component
        Returns:
        the component
      • findComponentHandler

        ComponentHandler<?> findComponentHandler​(String name)
        Returns the component handler with the given name. This handler must have been added before using addComponentHandler(String, ComponentHandler). If no such component handler can be found, null is returned.
        Parameters:
        name - the name of the desired component handler
        Returns:
        the corresponding handler
      • findFieldHandler

        FieldHandler findFieldHandler​(String name)
        Returns the field handler with the given name. This handler must have been added before using addFieldHandler(String, FieldHandler). If no such field handler can be found, null is returned.
        Parameters:
        name - the name of the desired field handler
        Returns:
        the corresponding handler
      • getComponentNames

        Set<String> getComponentNames()
        Returns a set with the names of all components that are contained in this store.
        Returns:
        a set with the names of the components in this store
      • getComponentHandlerNames

        Set<String> getComponentHandlerNames()
        Returns a set with the names of all component handlers that are contained in this store.
        Returns:
        a set with the names of the component handlers in this store
      • getFieldHandlerNames

        Set<String> getFieldHandlerNames()
        Returns a set with the names of all field handlers that are contained in this store.
        Returns:
        a set with the names of the field handlers in this store