Interface Component

All Superinterfaces:
Cloneable, Serializable
All Known Subinterfaces:
Container
All Known Implementing Classes:
AbstractComponent, AbstractContainer, Button, Checkbox, ComparableComponent, DivComponent, DropdownList, FieldSet, FileChooser, FormContainer, HiddenField, Image, Label, Link, PasswordField, RadioButton, RadioGroup, SelectList, SortableLink, SubmitButton, TableContainer, Tabs, Text, Textarea, Textfield, XHTMLPage

public interface Component extends Cloneable, Serializable
interface for any component the component is an elementary part of any view see the composite pattern [GoF95] for any details
  • Field Details

  • Method Details

    • init

      void init(Element root)
      initialize the component with a jdom-tree
      Parameters:
      root - - the root-element of the tree, must not be null
    • init

      void init(String name, String id, String className)
      initialize the component with a jdom-tree
      Parameters:
      name - - the name of the root element
      id - - the id of the component
      className - - the name of the component class
    • setAttribute

      Component setAttribute(String name, String value)
      sets the attribute to the component
      Parameters:
      name - - the name of the attribute
      value - - the value of the attribute
      Returns:
      the updated component
    • getAttribute

      String getAttribute(String name)
      returs the value of an attribute
      Parameters:
      name - - the name of the attribute
      Returns:
      - the value of the attribute
    • removeAttribute

      boolean removeAttribute(String name)
      removes the attribute
      Parameters:
      name - - the name of the attribute
      Returns:
      - true, if the attribute was found
    • setId

      void setId(String id)
      set the unique identifier to a given value. Handle with care!
      Parameters:
      id - the new id of this component
    • getId

      String getId()
      Returns:
      - the unique identifier of the component
    • setName

      void setName(String name)
      set the name to a given value.
      Parameters:
      name - - the new name of this component
    • getName

      String getName()
      Returns:
      - the name of the component
    • setLabel

      void setLabel(Label c)
      sets the label component
      Parameters:
      c - - the label component
    • getLabel

      Label getLabel()
      Returns:
      - the label component of the component
    • setParent

      void setParent(Container parent)
      sets the parent continer
      Parameters:
      parent - - the parent element of the container
    • getParent

      Container getParent()
      Returns:
      - the parent container of the component
    • setParentElement

      void setParentElement(Element parent)
      sets the parent element of the components root
      Parameters:
      parent - - the parent element
    • getParentElement

      Element getParentElement()
      Returns:
      - the parent element of the components root
    • setViewMode

      void setViewMode(short mode)
      sets the viewMode
      Parameters:
      mode - - the new viewMode
    • getViewMode

      short getViewMode()
      Returns:
      - the viewMode of the component
    • setBrowserMode

      void setBrowserMode(short mode)
      sets the browserMode
      Parameters:
      mode - - the new browserMode
    • getBrowserMode

      short getBrowserMode()
      Returns:
      - the browserMode of the component
    • setStyle

      void setStyle(String style)
      sets the style
      Parameters:
      style - - the new style
    • getStyle

      String getStyle()
      Returns:
      - the style of the component
    • setActionListener

      void setActionListener(String event, String action)
      sets the style
      Parameters:
      event - - the event to listen
      action - - the action to perform
    • show

      String show()
      method for rendering the component as string
      Returns:
      the rendered component as string
    • show

      void show(PrintWriter output)
      prints the rendered component to a PrintWriter
      Parameters:
      output - - the Printwriter
    • toString

      String toString()
      Overrides:
      toString in class Object
      Returns:
      - the rendered component as string
    • clone

      Object clone()
      returns a copy of the Component object
      Returns:
      the Component clone
    • getRoot

      Element getRoot()
      returns the root element of the internal JDOM
      Returns:
      the (root) Element object
    • setContent

      void setContent(Object o)
      sets the content of the component
      Parameters:
      o - any object where the string representation is used for rendering
    • getContent

      Object getContent()
      Returns:
      - the content object of the component
    • toggleClass

      Component toggleClass(String clazz, boolean add)
      remove or add the given CSS class(es) from the list of existing CSS-classes depending on a condition
      Parameters:
      clazz - blank separated list of CSS classes to be added/removed
      add - - condition to add (true) or remove (false) the classes
      Returns:
      the current CSS classes
    • removeClass

      Component removeClass(String clazz)
      remove the given CSS class(es) from the list of existing CSS-classes
      Parameters:
      clazz - blank separated list of CSS classes to be removed
      Returns:
      the current CSS classes
    • addClass

      Component addClass(String clazz)
      add the given CSS class(es) to the list of existing CSS-classes
      Parameters:
      clazz - blank separated list of CSS classes to be added
      Returns:
      the current CSS classes
    • setClass

      Component setClass(String clazz)
      set the CSS-class attribute to the given value
      Parameters:
      clazz - blank separated list of CSS classes to be assigned
      Returns:
      the current CSS classes