Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tonbeller.wcf.form
Class XmlComponent

    java.lang.Object
      com.tonbeller.wcf.component.ComponentSupport
          com.tonbeller.wcf.form.XmlComponent

All Implemented Interfaces:
  Bookmarkable, Component, java.util.EventListener, Form, FormListener, javax.servlet.http.HttpSessionBindingListener, LifeCycle, Renderable, RequestListener, RoleExprHolder, Visible

Direct Known Subclasses:
  FormComponent

public class XmlComponent
extends ComponentSupport

Implementation of a Comonent with support for NodeHandlers. The DOM Document is kept in memory.

The DOM may contain Elements with a handler attribute that contain the class names of NodeHandlers. Example

       <myelem>
         <my-other-elem handler="my.pkg.ClassName"/>
       </myelem>

XmlComponent will create an instance of my.pkg.ClassName and call its initialize() method with the my-other-elem Element as parameter. The NodeHandler may then choose to register itself as FormListener or RequestListener with the Environment.

Author:
  av

Field Summary

Fields inherited from interface com.tonbeller.wcf.bookmarks.Bookmarkable
`EXTENSIONAL, INTENSIONAL`

Constructor Summary
`XmlComponent(java.lang.String id, Component parent, org.w3c.dom.Document document)` creates a Component

Method Summary
`void` | `destroy(javax.servlet.http.HttpSession session)` called on session timeout or when the component is not used any more
`java.util.List` | `getChildren(NodeHandler handler)`
`org.w3c.dom.Document` | `getDocument()` returns the current DOM
`org.w3c.dom.Element` | `getElement(NodeHandler handler)` return the Element that NodeHandler associated with, or null if there is no such element
`org.w3c.dom.Element` | `getElement(java.lang.String id)`
`NodeHandler` | `getHandler(org.w3c.dom.Element element)` return the NodeHandler associated with element or null, if there is no such handler
`NodeHandler` | `getHandler(java.lang.String id)` return the NodeHandler whose element contains an Attribute "id"
`NodeHandler` | `getParent(NodeHandler handler)` returns NodeHandler of the parent DOM Element
`void` | `initialize(RequestContext context)` called once when the component is created.
`org.w3c.dom.Document` | `render(RequestContext context)` renders the component

Methods inherited from class com.tonbeller.wcf.component.ComponentSupport
`addFormListener, getBookmarkState, getDispatcher, getForm, getId, getLocale, getNextView, getParent, getRoleExpr, isAutoValidate, isListeningTo, isVisible, removeFormListener, request, revert, setAutoValidate, setBookmarkState, setId, setNextView, setParent, setRoleExpr, setVisible, validate, valueBound, valueUnbound`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XmlComponent

    public XmlComponent(java.lang.String id,
                        Component parent,
                        org.w3c.dom.Document document)

  creates a Component

Parameters:
  `document` - the document to use.

Method Detail

### initialize

    public void initialize(RequestContext context)
                    throws java.lang.Exception

  Description copied from class: `ComponentSupport`
  called once when the component is created. Sets the locale of this component. Called by the doEndTag of the ComponentTag, i.e. nested tags have been initialized.

  Specified by:
    `initialize` in interface `LifeCycle`
  Overrides:
    `initialize` in class `ComponentSupport`
  Throws:
    `java.lang.Exception`
  See Also:
    `ComponentSupport.destroy(javax.servlet.http.HttpSession)`, `ComponentSupport.valueBound(javax.servlet.http.HttpSessionBindingEvent)`, `ComponentTag.doEndTag()`

### destroy

    public void destroy(javax.servlet.http.HttpSession session)
                 throws java.lang.Exception

  Description copied from class: `ComponentSupport`
  called on session timeout or when the component is not used any more

  Specified by:
    `destroy` in interface `LifeCycle`
  Overrides:
    `destroy` in class `ComponentSupport`
  Throws:
    `java.lang.Exception`
  See Also:
    `ComponentSupport.initialize(com.tonbeller.wcf.controller.RequestContext)`, `ComponentSupport.valueUnbound(javax.servlet.http.HttpSessionBindingEvent)`

### render

    public org.w3c.dom.Document render(RequestContext context)
                                throws java.lang.Exception

  Description copied from interface: `Renderable`
  renders the component

  Throws:
    `java.lang.Exception`
  See Also:
    `Renderable.render(RequestContext)`

### getParent

    public NodeHandler getParent(NodeHandler handler)

  returns NodeHandler of the parent DOM Element

### getChildren

    public java.util.List getChildren(NodeHandler handler)

### getDocument

    public org.w3c.dom.Document getDocument()

  returns the current DOM

### getHandler

    public NodeHandler getHandler(org.w3c.dom.Element element)

  return the NodeHandler associated with element or null, if there is no such handler

  Parameters:
    `element` -
  Returns:
    NodeHandler

### getHandler

    public NodeHandler getHandler(java.lang.String id)

  return the NodeHandler whose element contains an Attribute "id"

  Parameters:
    `id` - value of the id attribute
  Returns:
    NodeHandler associated with that element or null

### getElement

    public org.w3c.dom.Element getElement(NodeHandler handler)

  return the Element that NodeHandler associated with, or null if there is no such element

  Returns:
    NodeHandler

### getElement

    public org.w3c.dom.Element getElement(java.lang.String id)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD