Class AbstractContainer

java.lang.Object
com.groiss.gui.AbstractComponent
com.groiss.gui.AbstractContainer
All Implemented Interfaces:
Component, Container, Serializable, Cloneable
Direct Known Subclasses:
Button, DivComponent, FieldSet, FormContainer, Label, TableContainer, Tabs, XHTMLPage

public abstract class AbstractContainer extends AbstractComponent implements Container
Abstract implementation of the container interface. with some common code for subclasses
See Also:
  • Field Details

  • Constructor Details

    • AbstractContainer

      public AbstractContainer()
      Constructs a new container from an existing JDOM. the root element must have an id attribute
    • AbstractContainer

      public AbstractContainer(Element root)
      Constructs a new container from an existing JDOM. the root element must have an id attribute
    • AbstractContainer

      public AbstractContainer(String name, String id, String className)
      Constructs a new empty container and creates an internal JDOM that consists of an empty root element.
      Parameters:
      name - - the name of the root element
      id - - the id of the container
      className - - the name of the container class
    • AbstractContainer

      public AbstractContainer(String name)
  • Method Details

    • add

      public Component add(Component c)
      Add a component.
      Specified by:
      add in interface Container
      Parameters:
      c - - the component to add
      Returns:
      - the replaced component or null
    • remove

      public Component remove(String id)
      Remove a component.
      Specified by:
      remove in interface Container
      Parameters:
      id - - the id of the component
      Returns:
      - the removed component with the given id or null
    • substitute

      public Component substitute(String id, Component c)
      Specified by:
      substitute in interface Container
      Parameters:
      id - - the id of the component which should be substituted
      c - - the new component
      Returns:
      - the substituted component or null, if no component with the given id was found
    • getComponents

      protected void getComponents(Element element, Element par)
      Search the JDOM for components and collect them. /* @param element - the root-element of the JDOM (or any other element in recursive calls)
    • init

      public void init(Element element)
      Description copied from class: AbstractComponent
      Initialize the component with a jdom-tree.
      Specified by:
      init in interface Component
      Overrides:
      init in class AbstractComponent
      Parameters:
      element - - the root-element of the tree, must not be null
    • get

      public <T extends Component> T get(String id)
      Specified by:
      get in interface Container
      Parameters:
      id - - the id of the component
      Returns:
      - the component with the given id or null
    • getWithParent

      protected Pair<Component,Container> getWithParent(String id)
    • getByName

      public <T extends Component> T getByName(String name)
      Specified by:
      getByName in interface Container
      Parameters:
      name - - the name of the component
      Returns:
      - the first found component with the given name or null
    • getAll

      public Collection<Component> getAll()
      Specified by:
      getAll in interface Container
      Returns:
      - all components of the container
    • getAllDeep

      public Collection<Component> getAllDeep()
      Specified by:
      getAllDeep in interface Container
      Returns:
      - all components of the container recursively
    • getAll

      public Collection<Component> getAll(String name)
      Specified by:
      getAll in interface Container
      Returns:
      - all direct components of the container with the given name
    • setBrowserMode

      public void setBrowserMode(short mode)
      Description copied from class: AbstractComponent
      sets the browserMode
      Specified by:
      setBrowserMode in interface Component
      Overrides:
      setBrowserMode in class AbstractComponent
      Parameters:
      mode - - the new browserMode