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.component
Class ComponentSupport

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

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

Direct Known Subclasses:
  ConfirmComponent, EditableTableComponent, NestableComponentSupport, WizardComponent, XmlComponent

public abstract class ComponentSupport
extends java.lang.Object
implements Component, Form, javax.servlet.http.HttpSessionBindingListener, Visible, RoleExprHolder, Bookmarkable

default implementation of a component

Author:
  av

Field Summary

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

Constructor Summary
`ComponentSupport(java.lang.String id, Component parent)` creates a component

Method Summary
`void` | `addFormListener(FormListener listener)`
`void` | `destroy(javax.servlet.http.HttpSession session)` called on session timeout or when the component is not used any more
`java.lang.Object` | `getBookmarkState(int levelOfDetail)` returns a Map.
`Dispatcher` | `getDispatcher()` returns a `Dispatcher` for this component.
`Form` | `getForm()` Deprecated. Component implements Form directly
`java.lang.String` | `getId()`
`java.util.Locale` | `getLocale()`
`protected java.lang.String` | `getNextView()`
`Component` | `getParent()` returns the parent component as specified by initialize() or null, if this is the root component
`java.lang.String` | `getRoleExpr()` name of a role, optionally prefixed by "!".
`void` | `initialize(RequestContext context)` called once when the component is created.
`boolean` | `isAutoValidate()`
`boolean` | `isListeningTo(java.util.Map httpParams)`
`boolean` | `isVisible()` true, if this component should be rendered
`void` | `removeFormListener(FormListener listener)`
`void` | `request(RequestContext context)` notified by a Dispatcher for specific HTTP Requests
`void` | `revert(RequestContext context)` reverts this component to model values
`void` | `setAutoValidate(boolean autoValidate)`
`void` | `setBookmarkState(java.lang.Object state)` restores the visible attribute from the map
`void` | `setId(java.lang.String string)`
`void` | `setNextView(java.lang.String uri)` forwards to another page
`void` | `setParent(Component parent)` sets the parent.
`void` | `setRoleExpr(java.lang.String roleExpr)`
`void` | `setVisible(boolean b)` true, if this component should be rendered
`boolean` | `validate(RequestContext context)` validates user input and updates the model
`void` | `valueBound(javax.servlet.http.HttpSessionBindingEvent e)` empty
`void` | `valueUnbound(javax.servlet.http.HttpSessionBindingEvent ev)` calls destroy on the component

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.Renderable
`render`

Constructor Detail

### ComponentSupport

    public ComponentSupport(java.lang.String id,
                            Component parent)

  creates a component

Parameters:
  `id` - the id for the session attribute of this component

Method Detail

### getDispatcher

    public Dispatcher getDispatcher()

  returns a `Dispatcher` for this component. The dispatcher is local to this component (i.e. the component may `clear()` it). The dispatcher is registered with the Controller and functional.

### initialize

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

  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`
  Throws:
    `java.lang.Exception`
  See Also:
    `destroy(javax.servlet.http.HttpSession)`, `valueBound(javax.servlet.http.HttpSessionBindingEvent)`, `ComponentTag.doEndTag()`

### destroy

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

  called on session timeout or when the component is not used any more

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

### request

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

  Description copied from interface: `RequestListener`
  notified by a Dispatcher for specific HTTP Requests

  Specified by:
    `request` in interface `RequestListener`
  Parameters:
    `context` - the current request
  Throws:
    `java.lang.Exception`

### valueBound

    public void valueBound(javax.servlet.http.HttpSessionBindingEvent e)

  empty

  Specified by:
    `valueBound` in interface `javax.servlet.http.HttpSessionBindingListener`

### valueUnbound

    public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent ev)

  calls destroy on the component

  Specified by:
    `valueUnbound` in interface `javax.servlet.http.HttpSessionBindingListener`

### getId

    public java.lang.String getId()

  Returns:
    the id of this component (name of the session attribute).

### isVisible

    public boolean isVisible()

  true, if this component should be rendered

  Specified by:
    `isVisible` in interface `Visible`
  Returns:
    boolean

### setVisible

    public void setVisible(boolean b)

  true, if this component should be rendered

  Specified by:
    `setVisible` in interface `Visible`
  Parameters:
    `b` -

### getForm

    public Form getForm()

  Deprecated. Component implements Form directly

  returns the `Form` for this component. The `Form` is local to this component.

  Returns:
    Form

### setId

    public void setId(java.lang.String string)

  Parameters:
    `string` -

### getLocale

    public java.util.Locale getLocale()

  Returns:

### getRoleExpr

    public java.lang.String getRoleExpr()

  Description copied from interface: `RoleExprHolder`
  name of a role, optionally prefixed by "!". If the name of a role is returned, then members of that role may access this component. If the role name is prefixed with "!", then everybody except members of that role may access this component.

  Specified by:
    `getRoleExpr` in interface `RoleExprHolder`
  Returns:

### setRoleExpr

    public void setRoleExpr(java.lang.String roleExpr)

  Specified by:
    `setRoleExpr` in interface `RoleExprHolder`
  Parameters:
    `roleExpr` -

### getBookmarkState

    public java.lang.Object getBookmarkState(int levelOfDetail)

  returns a Map. Derived classe may use this map to store their properties. To avoid conflicts the name of an entry (key) should equal the property name (getter/setter).

  Specified by:
    `getBookmarkState` in interface `Bookmarkable`
  Parameters:
    `levelOfDetail` - INTENSIONAL or EXTENSIONAL
  Returns:
    a Map that contains the visible boolean

### setBookmarkState

    public void setBookmarkState(java.lang.Object state)

  restores the visible attribute from the map

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

### addFormListener

    public void addFormListener(FormListener listener)

  Specified by:
    `addFormListener` in interface `Form`
  Parameters:
    `listener` -

### removeFormListener

    public void removeFormListener(FormListener listener)

  Specified by:
    `removeFormListener` in interface `Form`
  Parameters:
    `listener` -

### revert

    public void revert(RequestContext context)

  Description copied from interface: `FormListener`
  reverts this component to model values

  Specified by:
    `revert` in interface `FormListener`
  Parameters:
    `context` -

### validate

    public boolean validate(RequestContext context)

  Description copied from interface: `FormListener`
  validates user input and updates the model

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

### getParent

    public Component getParent()

  Description copied from interface: `Component`
  returns the parent component as specified by initialize() or null, if this is the root component

  Specified by:
    `getParent` in interface `Component`
  Returns:
    Returns the parent.

### setParent

    public void setParent(Component parent)

  sets the parent. Must be called before initialize()!!

  Parameters:
    `parent` - The parent to set.

### setNextView

    public void setNextView(java.lang.String uri)

  forwards to another page

  Specified by:
    `setNextView` in interface `Component`
  Parameters:
    `uri` - if uri starts with "/" it will be interpreted as context relative path (i.e. the context will be prepended), otherwise it will be interpreted as relative to the current page.

### getNextView

    protected java.lang.String getNextView()

### isAutoValidate

    public boolean isAutoValidate()

  Returns:
    Returns the autoValidate.

### setAutoValidate

    public void setAutoValidate(boolean autoValidate)

  Parameters:
    `autoValidate` - The autoValidate to set.

### isListeningTo

    public boolean isListeningTo(java.util.Map httpParams)

  Specified by:
    `isListeningTo` in interface `Component`
  Parameters:
    `httpParams` - map of http parameters that may identify a RequestListener of this component
  Returns:
    true if this component is listening to a http request with `httpParams`

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