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 FormComponent

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

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

Direct Known Subclasses:
  LogForm, TablePropertiesFormComponent

public class FormComponent
extends XmlComponent
implements FormListener, WizardPage

Manges a DOM that contains xoplon controls like <textField> etc

Author:
  av

Nested Class Summary

Nested classes inherited from class com.tonbeller.wcf.wizard.WizardPage
`WizardPage.WizardPagePosition`

Field Summary

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

Constructor Summary
`FormComponent(java.lang.String id, Component parent, org.w3c.dom.Document document)` creates a FormComponent with beanModel == this
`FormComponent(java.lang.String id, Component parent, org.w3c.dom.Document document, java.lang.Object bean)`

Method Summary
`void` | `addPageListener(PageListener l)`
`void` | `clearErrors()` clears all error attributes in the DOM
`protected void` | `clearErrors(org.w3c.dom.NodeList list)`
`java.lang.Object` | `getBean()` Returns the beanModel.
`java.lang.Object` | `getBookmarkState(int levelOfDetail)` adds all editable properties to the bookmark state.
`void` | `initialize(RequestContext context)` deferred ctor
`boolean` | `isBookmarkable()`
`boolean` | `isFinishButton()`
`void` | `pageAdded(WizardPage.WizardPagePosition pagePos)` shows/hides form buttons automatically depending on the position of this form in a wizard.
`void` | `pageSkipped()`
`void` | `removePageListener(PageListener l)`
`org.w3c.dom.Document` | `render(RequestContext context)` if there is no error, the form is filled with the current model values.
`void` | `revert(RequestContext context)` fills the form with values from the bean
`void` | `setBean(java.lang.Object bean)` Sets the beanModel.
`void` | `setBookmarkable(boolean b)`
`void` | `setBookmarkState(java.lang.Object state)` restores all editable properties from the bookmark state.
`void` | `setError(java.lang.String id, java.lang.String message)` sets an error message to a DOM element
`void` | `setFinishButton(boolean finishButton)`
`boolean` | `validate(RequestContext context)` fills bean and form from user input

Methods inherited from class com.tonbeller.wcf.form.XmlComponent
`destroy, getChildren, getDocument, getElement, getElement, getHandler, getHandler, getParent`

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

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

Methods inherited from interface com.tonbeller.wcf.component.Visible
`isVisible, setVisible`

Constructor Detail

### FormComponent

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

  creates a FormComponent with beanModel == this

Parameters:
  `id` -
  `document` -

### FormComponent

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

Method Detail

### revert

    public void revert(RequestContext context)

  fills the form with values from the bean

  Specified by:
    `revert` in interface `FormListener`
  Overrides:
    `revert` in class `ComponentSupport`
  Parameters:
    `context` -

### validate

    public boolean validate(RequestContext context)

  fills bean and form from user input

  Specified by:
    `validate` in interface `FormListener`
  Overrides:
    `validate` in class `ComponentSupport`
  Parameters:
    `context` -
  Returns:

### initialize

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

  deferred ctor

  Specified by:
    `initialize` in interface `LifeCycle`
  Overrides:
    `initialize` in class `XmlComponent`
  Throws:
    `java.lang.Exception`

### render

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

  if there is no error, the form is filled with the current model values. After that, the form is rendered.

  Specified by:
    `render` in interface `Renderable`
  Overrides:
    `render` in class `XmlComponent`
  Throws:
    `java.lang.Exception`
  See Also:
    `Renderable.render(RequestContext)`

### setBean

    public void setBean(java.lang.Object bean)

  Sets the beanModel.

### getBean

    public java.lang.Object getBean()

  Returns the beanModel.

  Returns:
    Object

### setError

    public void setError(java.lang.String id,
                         java.lang.String message)

  sets an error message to a DOM element

  Parameters:
    `id` - the value of the `id` attribute of the DOM Element that the error message will be attached to
    `message` - the error message or null to remove the error attribute

### clearErrors

    public void clearErrors()

  clears all error attributes in the DOM

### clearErrors

    protected void clearErrors(org.w3c.dom.NodeList list)

### getBookmarkState

    public java.lang.Object getBookmarkState(int levelOfDetail)

  adds all editable properties to the bookmark state. Editable properties are addressed via the `modelReference` attribute in the DOM.

  Specified by:
    `getBookmarkState` in interface `Bookmarkable`
  Overrides:
    `getBookmarkState` in class `ComponentSupport`
  Returns:
    a Map that contains the visible boolean

### setBookmarkState

    public void setBookmarkState(java.lang.Object state)

  restores all editable properties from the bookmark state. Editable properties are addressed via the `modelReference` attribute in the DOM.

  Specified by:
    `setBookmarkState` in interface `Bookmarkable`
  Overrides:
    `setBookmarkState` in class `ComponentSupport`
  Parameters:
    `state` - a map

### isBookmarkable

    public boolean isBookmarkable()

  Returns:

### setBookmarkable

    public void setBookmarkable(boolean b)

  Parameters:
    `b` -

### addPageListener

    public void addPageListener(PageListener l)

  Specified by:
    `addPageListener` in interface `WizardPage`

### removePageListener

    public void removePageListener(PageListener l)

  Specified by:
    `removePageListener` in interface `WizardPage`

### pageAdded

    public void pageAdded(WizardPage.WizardPagePosition pagePos)

  shows/hides form buttons automatically depending on the position of this form in a wizard. This method sets the buttons with the following ids: $id.back, $id.next, $id.cancel, $id.finish, $id.ok.
  - Only page: ok/cancel
  - First page: next/cancel/finish
  - Intermediate page: back/next/cancel/finish
  - Last page: back/cancel/finish
  Finish button is only displayed if the form component supports this: supportsPrematureFinishBtn()

  Specified by:
    `pageAdded` in interface `WizardPage`

### isFinishButton

    public boolean isFinishButton()

### setFinishButton

    public void setFinishButton(boolean finishButton)

### pageSkipped

    public void pageSkipped()

  Specified by:
    `pageSkipped` in interface `WizardPage`

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