Class ComponentWrapper

java.lang.Object
ch.tocco.nice2.model.form.api.components.ComponentWrapper
All Implemented Interfaces:
Component
Direct Known Subclasses:
LabeledComponentWrapper

@Deprecated public class ComponentWrapper extends Object implements Component
Deprecated.
  • Field Details

  • Constructor Details

  • Method Details

    • getChildren

      public Collection<? extends Component> getChildren()
      Deprecated.
      Description copied from interface: Component
      Returns the children. If Component.isLeaf() is false, it has to return at least one Component, otherwise it has to return an empty iterator
      Specified by:
      getChildren in interface Component
      Returns:
      iterator
    • getChild

      public Component getChild(String name)
      Deprecated.
      Description copied from interface: Component
      Returns the child with the given name, or null.
      Specified by:
      getChild in interface Component
      Parameters:
      name - The component's name.
    • hideChild

      protected boolean hideChild(Component component)
      Deprecated.
    • createCopy

      public <T extends Component> T createCopy()
      Deprecated.
      Modified delegate method: return type convertion to (T).
      Specified by:
      createCopy in interface Component
      Returns:
      the copy
    • createCopy

      public <T extends Component> T createCopy(Component newParent)
      Deprecated.
      Modified delegate method: return type convertion to (T).
      Specified by:
      createCopy in interface Component
      Parameters:
      newParent - the new parent
      Returns:
      the copy
    • getName

      public String getName()
      Deprecated.
      Specified by:
      getName in interface Component
      Returns:
      the component's name
    • getDataNavigationType

      public Component.DataNavigationType getDataNavigationType()
      Deprecated.
      Specified by:
      getDataNavigationType in interface Component
      Returns:
      Tells what kind of component it is in relation to data.
    • findByName

      public List<Component> findByName(String pattern)
      Deprecated.
      Description copied from interface: Component
      Walks through the component tree and compares the component's name with the pattern.
      Specified by:
      findByName in interface Component
      Parameters:
      pattern - The name of the component we search (regular expressions are supported)
      Returns:
      ordered list of components (flat structure).
    • findFirstByName

      @Nullable public @Nullable Component findFirstByName(String pattern)
      Deprecated.
      Specified by:
      findFirstByName in interface Component
    • setScopes

      public void setScopes(Set<String> scopes)
      Deprecated.
      Specified by:
      setScopes in interface Component
      Parameters:
      scopes - No null values, strings in lower case!
    • getScopes

      public Set<String> getScopes()
      Deprecated.
      Description copied from interface: Component
      Returns the scopes as defined in the component, or an empty set if none were defined which means that this component is meant for all scopes.
      Specified by:
      getScopes in interface Component
      Returns:
      Unmodifiable set with the strings in lower case.
    • find

      public List<Component> find(Component.ComponentFilter filter)
      Deprecated.
      Description copied from interface: Component
      Returns all components that match the given filter.

      Iterates the component tree, doing children recursively of each item first.

      Specified by:
      find in interface Component
      Parameters:
      filter - your own component filter
      Returns:
      ordered list of components (flat structure).
    • findFirst

      public Component findFirst(Component.ComponentFilter filter)
      Deprecated.
      Description copied from interface: Component
      Returns the first component that match the given filter.

      Iterates the component tree, doing children recursively of each item first.

      Specified by:
      findFirst in interface Component
      Parameters:
      filter - your own component filter
    • findByType

      public List<Component> findByType(Class<? extends Component> type)
      Deprecated.
      Description copied from interface: Component
      Returns all components that match the given class.

      Iterates the component tree, doing children recursively of each item first.

      Matching is determined by: type.isAssignableFrom( component.getClass() )

      Specified by:
      findByType in interface Component
      Parameters:
      type - component type, eg InputComponent.class
      Returns:
      ordered list of components (flat structure) it may be, that you can access components in the list through the Component.getChildren() method aswell.
    • getType

      public Class<? extends Component> getType()
      Deprecated.
      Specified by:
      getType in interface Component
    • isLeaf

      public boolean isLeaf()
      Deprecated.
      Description copied from interface: Component
      Tells if this component is at an end of the tree.

      More precise, it means the component has no children. It also returns true if the component is not meant to be a leaf, but happens to have no children, or the children are disabled or something (wrapper). This could even happen to a Form component.

      Specified by:
      isLeaf in interface Component
    • getDisplayType

      public Component.DisplayType getDisplayType()
      Deprecated.
      Specified by:
      getDisplayType in interface Component
    • isForceEditable

      public boolean isForceEditable()
      Deprecated.
      Specified by:
      isForceEditable in interface Component
    • isReplace

      public boolean isReplace()
      Deprecated.
      Specified by:
      isReplace in interface Component
    • getParent

      @Nullable public @Nullable Component getParent()
      Deprecated.
      Description copied from interface: Component
      Every component has a reference to its parent except for the root-components (forms, templates).

      So this condition has to be true:
      for(Compoent child : parent.getChildren())
        assert child.getParent().equals(parent);
      }
      Specified by:
      getParent in interface Component
      Returns:
      null if root-component
      See Also:
    • getParentOrEx

      public Component getParentOrEx() throws IllegalStateException
      Deprecated.
      Description copied from interface: Component
      Returns the parent, or an exception for root components (forms, templates).
      Specified by:
      getParentOrEx in interface Component
      Returns:
      The parent, or an ex if it is null.
      Throws:
      IllegalStateException - When the parent is null.
      See Also:
    • hasParent

      public boolean hasParent()
      Deprecated.
      Specified by:
      hasParent in interface Component
      Returns:
      Tells if this component has a parent or not.
      See Also:
    • getForm

      @Nullable public @Nullable Form getForm()
      Deprecated.
      Description copied from interface: Component
      Returns the parent form, if any. This loops all all parents until it either finds a form, or arrives at the top.
      Specified by:
      getForm in interface Component
    • overrideParent

      public void overrideParent(@Nullable @Nullable Component parent)
      Deprecated.
      Description copied from interface: Component
      Overrides the parent.

      Originally this was not possible, the parent was final. But it is required for dynamically wrapping components in other components, see the table as an example which wraps fields in columns.

      Specified by:
      overrideParent in interface Component
      Parameters:
      parent - The new one.
    • collectDataParts

      public Map<List<String>,Set<String>> collectDataParts()
      Deprecated.
      Specified by:
      collectDataParts in interface Component
    • collectDataParts

      public void collectDataParts(List<String> path, Map<List<String>,Set<String>> collector)
      Deprecated.
      Description copied from interface: Component
      Internal method for recursive loops.
      Specified by:
      collectDataParts in interface Component
      Parameters:
      path - .
      collector - .
    • setChildren

      public void setChildren(Collection<Component> children)
      Deprecated.
      Description copied from interface: Component
      Set the children explicit
      Specified by:
      setChildren in interface Component
      Parameters:
      children - childern
    • setName

      public void setName(String name)
      Deprecated.
      Specified by:
      setName in interface Component
      Parameters:
      name - name
    • addComponent

      public void addComponent(Component component)
      Deprecated.
      Description copied from interface: Component
      Add a (child) component, only possible if Component.isLeaf() is false.
      Specified by:
      addComponent in interface Component
      Parameters:
      component - Child to add.
    • addComponent

      public void addComponent(Component component, int index)
      Deprecated.
      Description copied from interface: Component
      Adds a child component to the child-list of this component at the specified index.
      Specified by:
      addComponent in interface Component
    • removeComponent

      public boolean removeComponent(String name)
      Deprecated.
      Description copied from interface: Component
      Removes a component by its name, return false if the component couldn't be found
      Specified by:
      removeComponent in interface Component
      Parameters:
      name - The component-name
    • replaceComponent

      public void replaceComponent(Component oldComponent, Component newComponent)
      Deprecated.
      Description copied from interface: Component
      Replaces oldComponent with newComponent.
      Specified by:
      replaceComponent in interface Component
      Parameters:
      oldComponent - Component to remove.
      newComponent - Component to add (on position of the old one)
    • replaceComponent

      public void replaceComponent(String oldComponentName, Component newComponent)
      Deprecated.
      Specified by:
      replaceComponent in interface Component
    • setDisplayType

      public void setDisplayType(Component.DisplayType displayType)
      Deprecated.
      Specified by:
      setDisplayType in interface Component
    • setForceEditable

      public void setForceEditable(boolean forceEditable)
      Deprecated.
      Specified by:
      setForceEditable in interface Component
    • setReplace

      public void setReplace(boolean replace)
      Deprecated.
      Specified by:
      setReplace in interface Component
    • getPosition

      public Component.Position getPosition()
      Deprecated.
      Specified by:
      getPosition in interface Component
      Returns:
      the position
    • getRelativeToPositionName

      @Nullable public @Nullable String getRelativeToPositionName()
      Deprecated.
      Description copied from interface: Component
      Get the name of the component this component has its relative-position to.
      Specified by:
      getRelativeToPositionName in interface Component
      Returns:
      name or null.
    • setPosition

      public void setPosition(Component.Position pos)
      Deprecated.
      Specified by:
      setPosition in interface Component
    • setRelativeToPositionName

      public void setRelativeToPositionName(String name)
      Deprecated.
      Specified by:
      setRelativeToPositionName in interface Component
    • getExtProps

      @Nullable public @Nullable Map<String,Object> getExtProps()
      Deprecated.
      Specified by:
      getExtProps in interface Component
    • setExtProps

      public void setExtProps(Map<String,Object> extProps)
      Deprecated.
      Specified by:
      setExtProps in interface Component
    • getAttributeProps

      @Nullable public @Nullable Map<String,Object> getAttributeProps()
      Deprecated.
      Specified by:
      getAttributeProps in interface Component
    • setAttributeProps

      public void setAttributeProps(Map<String,Object> attributeProps)
      Deprecated.
      Specified by:
      setAttributeProps in interface Component
    • setEventHandler

      public void setEventHandler(@Nullable @Nullable String eventHandler)
      Deprecated.
      Specified by:
      setEventHandler in interface Component
    • getEventHandler

      public String getEventHandler()
      Deprecated.
      Specified by:
      getEventHandler in interface Component
    • wrap

      public Component wrap(ComponentWrapperHandler handler)
      Deprecated.
      Description copied from interface: Component
      Wraps the component with the given interceptor handler.

      Feel free to add an unwrap() method when needed.

      Specified by:
      wrap in interface Component