org.enhydra.barracuda.core.event.helper
Class DefaultViewHandler

java.lang.Object
  |
  +--org.enhydra.barracuda.core.event.DefaultBaseEventListener
        |
        +--org.enhydra.barracuda.core.event.helper.DefaultViewHandler
All Implemented Interfaces:
BaseEventListener, java.util.EventListener
Direct Known Subclasses:
BTemplateViewHandler

public abstract class DefaultViewHandler
extends DefaultBaseEventListener

A very simple view handler that provides a default implementation tailored for the use of components. In many ways, this is analagous to the ComponentGateway class--a component hierarchy is created, initialized and rendered automatically for you. All the developer has to do is a) implement the handleViewEvent method to add any custom components to the root component (ie. for rendering) and b) return the master DOM page that needs to be rendered to generate the final view.


Field Summary
protected static org.apache.log4j.Logger localLogger
           
protected  int maxAge
           
protected  boolean preventCaching
           
protected  boolean printPretty
           
protected  boolean recycleChildren
           
 
Fields inherited from class org.enhydra.barracuda.core.event.DefaultBaseEventListener
idStr
 
Constructor Summary
DefaultViewHandler()
          Public noargs constructor
 
Method Summary
 DOMWriter getDOMWriter()
          Get a DOMWriter.
abstract  org.w3c.dom.Document handleViewEvent(BComponent root, ViewContext vc)
          Handle a view event.
 void handleViewEvent(ViewEventContext vec)
          Handle the ViewEvent
 void postCompRender(BComponent root, ViewContext vc)
          The purpose of this method is to allow for optional post-component-render cycle processing (ie. to remove a value from the user's session)
 void preCompRender(BComponent root, ViewContext vc)
          The purpose of this method is to allow for optional pre-component-render cycle processing (ie. to stick a value in the user's session)
 
Methods inherited from class org.enhydra.barracuda.core.event.DefaultBaseEventListener
getListenerID, handleControlEvent, handleEvent, handleOtherEvent, isHandled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

localLogger

protected static org.apache.log4j.Logger localLogger

printPretty

protected boolean printPretty

preventCaching

protected boolean preventCaching

maxAge

protected int maxAge

recycleChildren

protected boolean recycleChildren
Constructor Detail

DefaultViewHandler

public DefaultViewHandler()
Public noargs constructor

Method Detail

handleViewEvent

public abstract org.w3c.dom.Document handleViewEvent(BComponent root,
                                                     ViewContext vc)
                                              throws EventException,
                                                     javax.servlet.ServletException,
                                                     java.io.IOException

Handle a view event. This is the method developers will typically override. The developers shaould add any components to the root component and then return the underlying DOM Document (that backs their components) so it can be rendered

Parameters:
root - the root component which will get rendered as a result of this request
vc - the ViewContext object describes what features the client view is capable of supporting
Returns:
the Document to be rendered
Throws:
javax.servlet.ServletException
java.io.IOException
EventException

preCompRender

public void preCompRender(BComponent root,
                          ViewContext vc)
The purpose of this method is to allow for optional pre-component-render cycle processing (ie. to stick a value in the user's session)

Parameters:
root - the root component which will get rendered as a result of this request
vc - the ViewContext object describes what features the client view is capable of supporting

postCompRender

public void postCompRender(BComponent root,
                           ViewContext vc)
The purpose of this method is to allow for optional post-component-render cycle processing (ie. to remove a value from the user's session)

Parameters:
root - the root component which will get rendered as a result of this request
vc - the ViewContext object describes what features the client view is capable of supporting

getDOMWriter

public DOMWriter getDOMWriter()

Get a DOMWriter. By default, we use a DefaultDOMWriter. If you'd like to use something else, override this method.

Returns:
a DOMWriter to be used to render the DOM

handleViewEvent

public void handleViewEvent(ViewEventContext vec)
                     throws EventException,
                            javax.servlet.ServletException,
                            java.io.IOException
Handle the ViewEvent

Overrides:
handleViewEvent in class DefaultBaseEventListener
Parameters:
vec - the ViewEventContext
Throws:
java.io.IOException
javax.servlet.ServletException
EventException


Copyright © 2001 Enhydra.org