com.iplanet.jato.view
Class RequestHandlingTreeViewBase

java.lang.Object
  |
  +--com.iplanet.jato.view.ViewBase
        |
        +--com.iplanet.jato.view.ContainerViewBase
              |
              +--com.iplanet.jato.view.RequestHandlingViewBase
                    |
                    +--com.iplanet.jato.view.RequestHandlingTreeViewBase
All Implemented Interfaces:
ContainerView, RequestCompletionListener, RequestHandler, RequestParticipant, TreeView, View, WebActionHandler, WebActions

public abstract class RequestHandlingTreeViewBase
extends RequestHandlingViewBase
implements TreeView, RequestCompletionListener

Concrete TreeView implementation that supports request handling and handling of web actions. It is a separate class to support potentially several subclasses that wish to take advantage of this behavior but may differ in other significant ways.

Version:
JATO/1.2.2 $Id: RequestHandlingTreeViewBase.java,v 1.13 2002/03/27 02:58:10 todd Exp $

Field Summary
static java.lang.String DEFAULT_TREE_STATE_DATA_SESSION_ATTRIBUTE_NAME
           
static java.lang.String HANDLE_COMMAND_NVP_NAME
           
static java.lang.String HANDLE_STATE_NVP_NAME
           
 
Fields inherited from class com.iplanet.jato.view.RequestHandlingViewBase
HANDLE_REQUEST_METHOD_PREFIX, HANDLE_REQUEST_METHOD_SUFFIX
 
Fields inherited from class com.iplanet.jato.view.ContainerViewBase
BEGIN_DISPLAY_EVENT_METHOD_PREFIX, BEGIN_DISPLAY_EVENT_METHOD_SUFFIX, END_DISPLAY_EVENT_METHOD_PREFIX, END_DISPLAY_EVENT_METHOD_SUFFIX, eventMethodRegistry, OPTION_ENABLE_QUALIFIELD_CHILD_NAME_LOOKUPS, OPTION_USE_LEGACY_DISPLAY_EVENT_SIGNATURES
 
Fields inherited from interface com.iplanet.jato.view.View
QUALIFIED_VIEW_NAME_SEPARATOR
 
Fields inherited from interface com.iplanet.jato.view.WebActionHandler
DELETE_CONTEXT, EXECUTE_CONTEXT, INSERT_CONTEXT, MODEL_TYPE_DELETE, MODEL_TYPE_EXECUTE, MODEL_TYPE_INSERT, MODEL_TYPE_RETRIEVE, MODEL_TYPE_UPDATE, RETRIEVE_CONTEXT, UPDATE_CONTEXT
 
Fields inherited from interface com.iplanet.jato.view.WebActions
ACTION_CLEAR, ACTION_DELETE, ACTION_EXECUTE, ACTION_FIRST, ACTION_INSERT, ACTION_LAST, ACTION_NEXT, ACTION_PREV, ACTION_PREVIOUS, ACTION_REFRESH, ACTION_SELECT, ACTION_UPDATE
 
Constructor Summary
  RequestHandlingTreeViewBase(View parent, java.lang.String name)
          Creates an instance with a parent and name
protected RequestHandlingTreeViewBase(View parent, java.lang.String name, java.lang.String stateDataLookupName)
          Creates an instance with a parent, name, and state data lookup name.
 
Method Summary
 java.lang.Object acceptRequest(javax.servlet.http.HttpServletRequest request)
          This method is used by the application servlet to determine if this is the appropriate view to handle the servlet request.
protected  java.lang.Object acceptTreeHandleRequest(javax.servlet.http.HttpServletRequest request)
           
 int getNodeLevel()
           
 java.lang.String getNodeName()
           
 java.lang.String getNodeType()
           
 TreeModel getPrimaryModel()
          Returns the primary model used by this model's iteration and navigation logic.
 java.lang.Class getPrimaryModelClass()
          Returns the primary model class if one has been previously set, or if the primary model instance has been set.
 TreeViewStateData getStateData()
           
 java.lang.String getStateDataLookupName()
          Return the state value lookup name.
 java.lang.String getTreeHandleChildName()
           
 java.lang.Object getTreeHandleChildValue()
           
 CommandDescriptor getTreeHandleCommandDescriptor()
           
 java.lang.String getTreeHandleStateParameterName()
          NOTE: This method is provisional.
 void handleRequest(java.lang.Object anInvocation)
          Called by the application servlet to have the request handler process this request.
 boolean isChildNode()
           
 boolean isNodeExpanded()
           
 boolean isParentNode()
           
 boolean nextNode()
           
 void requestComplete()
          Called to notify the listener that the request is at an end
 void resetNodeLocation()
           
 void setPrimaryModel(TreeModel value)
          Sets the primary model used by this model's iteration and navigation logic.
 void setPrimaryModelClass(java.lang.Class value)
          Sets the class of the primary model, in order to allow later instantiation of the necessary primary model.
 void setPrimaryModelClass(java.lang.Class value, boolean lookInSession, boolean saveInSession)
          Sets the class of the primary model, in order to allow later instantiation of the necessary primary model.
 void setRequestContext(RequestContext requestContext)
          Sets the current request context.
protected  void setStateData(TreeViewStateData value)
           
 void setStateDataLookupName(java.lang.String value)
          Set the state value lookup name
 void setTreeHandleCommandDescriptor(CommandDescriptor value)
           
 
Methods inherited from class com.iplanet.jato.view.RequestHandlingViewBase
afterAllModelsExecute, afterModelExecutes, appMessage, beforeModelExecutes, beginDisplay, createDefaultExecutionContext, executeAutoDeletingModel, executeAutoDeletingModels, executeAutoExecutingModel, executeAutoExecutingModels, executeAutoInsertingModel, executeAutoInsertingModels, executeAutoRetrievingModel, executeAutoRetrievingModels, executeAutoRetrievingModels, executeAutoUpdatingModel, executeAutoUpdatingModels, getAutoRetrieveExecutionContext, getFirstActionExecutionContext, getLastActionExecutionContext, getModel, getNextActionExecutionContext, getPreviousActionExecutionContext, getRefreshActionExecutionContext, getRequestCompletionListenerChildNames, getRequestContext, getRequestParticipantChildNames, getSession, getViewBean, getWebActionModelOffset, getWebActionModels, getWebActionRowOffsetSessionKey, handleWebAction, isAutoRetrieveEnabled, onModelError, onNoModelDataAvailable, setAutoRetrieveEnabled, setAutoRetrieveExecutionContext, setWebActionModelOffset
 
Methods inherited from class com.iplanet.jato.view.ContainerViewBase
beginChildDisplay, beginChildDisplay, beginDisplay, childExists, createChild, createChildInternal, endChildDisplay, endChildDisplay, endDisplay, endDisplay, ensureChild, getChild, getChildNames, getChildNames, getChildType, getCommandChildNames, getDefaultModel, getDisplayField, getDisplayFieldBooleanValue, getDisplayFieldDoubleValue, getDisplayFieldIntValue, getDisplayFieldStringValue, getDisplayFieldValue, getNumChildren, getQualifiedCommandChildNames, mapRequestParameter, mapRequestParameters, onValidationException, registerChild, registerDisplayEventHandlers, removeAllChildren, removeChild, removeQualifiedNameIndices, resetChildren, setDefaultModel, setDisplayFieldValue, setDisplayFieldValue, setDisplayFieldValue, setDisplayFieldValue, unregisterChild
 
Methods inherited from class com.iplanet.jato.view.ViewBase
getName, getParent, getParentViewBean, getQualifiedName, getRootView, getRootView, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.iplanet.jato.view.ContainerView
beginChildDisplay, beginDisplay, endChildDisplay, endDisplay, getChild, getChildNames, getChildType, getDefaultModel, getDisplayField, getDisplayFieldValue, getNumChildren, mapRequestParameters, resetChildren, setDisplayFieldValue
 
Methods inherited from interface com.iplanet.jato.view.View
getName, getParent, getQualifiedName, setParent
 

Field Detail

HANDLE_COMMAND_NVP_NAME

public static final java.lang.String HANDLE_COMMAND_NVP_NAME

HANDLE_STATE_NVP_NAME

public static final java.lang.String HANDLE_STATE_NVP_NAME

DEFAULT_TREE_STATE_DATA_SESSION_ATTRIBUTE_NAME

public static final java.lang.String DEFAULT_TREE_STATE_DATA_SESSION_ATTRIBUTE_NAME
Constructor Detail

RequestHandlingTreeViewBase

public RequestHandlingTreeViewBase(View parent,
                                   java.lang.String name)
Creates an instance with a parent and name
Parameters:
parent - The parent view or null if this view has no parent
name - The logical name of this view

RequestHandlingTreeViewBase

protected RequestHandlingTreeViewBase(View parent,
                                      java.lang.String name,
                                      java.lang.String stateDataLookupName)
Creates an instance with a parent, name, and state data lookup name. This consructor may change in the future; therefore, it is currently marked protected. If developers wish to make this constructor publicly accessible, they must override this constructor in a subclass.
Parameters:
parent - The parent view or null if this view has no parent
name - The logical name of this view
stateDataLookupName - The session attribute name that will be used to lookup this instance's TreeViewStateData object
Method Detail

setRequestContext

public void setRequestContext(RequestContext requestContext)
Description copied from class: RequestHandlingViewBase
Sets the current request context. We've augmented this method to push the request context to any child views that are of type RequestParticipant.
Overrides:
setRequestContext in class RequestHandlingViewBase
Following copied from class: com.iplanet.jato.view.RequestHandlingViewBase
Parameters:
value - The request context

requestComplete

public void requestComplete()
Description copied from interface: RequestCompletionListener
Called to notify the listener that the request is at an end
Specified by:
requestComplete in interface RequestCompletionListener
Overrides:
requestComplete in class RequestHandlingViewBase

getPrimaryModel

public TreeModel getPrimaryModel()
Returns the primary model used by this model's iteration and navigation logic. The primary model is the only model used by this logic, regardless of the models bound to child views. Child views must be bound to the primary model to experience the effect of node iteration. The primary model must be specified before iteration through this view's nodes can occur.

Additionally, if a primary model has not already been set on this view, this method will attempt to create a primary model if the primary model class has been provided.

Returns:
This view's primary model, used for iteration through nodes

setPrimaryModel

public void setPrimaryModel(TreeModel value)
Sets the primary model used by this model's iteration and navigation logic. The primary model is the only model used by this logic, regardless of the models bound to child views. Child views must be bound to the primary model to experience the effect of tile iteration. The primary model must be specified before iteration through this view's tiles can occur. This method will also set the value of the primary model class property.
Parameters:
value - This view's primary model, used for iteration through tiles
See Also:
TreeModel

getPrimaryModelClass

public java.lang.Class getPrimaryModelClass()
Returns the primary model class if one has been previously set, or if the primary model instance has been set. Because of certain constraints in obtaining a model instance at view construction time (such as the request context not yet being present), a developer can optionally set the primary model class instead of the primary model instance. This allows the view to later instantiate the primary model object using the request context's model manager. In general, we recommend that developers set the primary model class rather than a primary model instance during initialization.
Returns:
The primary model class, or null if a primary model class has not been set

setPrimaryModelClass

public void setPrimaryModelClass(java.lang.Class value)
Sets the class of the primary model, in order to allow later instantiation of the necessary primary model. Because of certain constraints in obtaining a model instance at view construction time (such as the request context not yet being present), a developer can optionally set the primary model class instead of the primary model instance. This allows the view to later instantiate the primary model object using the request context's ModelManager. In general, we recommend that developers set the primary model class rather than a primary model instance during initialization. The primary model class must implement the com.iplanet.jato.model.TreeModel interface.
Parameters:
The - primary model class

setPrimaryModelClass

public void setPrimaryModelClass(java.lang.Class value,
                                 boolean lookInSession,
                                 boolean saveInSession)
Sets the class of the primary model, in order to allow later instantiation of the necessary primary model. Because of certain constraints in obtaining a model instance at view construction time (such as the request context not yet being present), a developer can optionally set the primary model class instead of the primary model instance. This allows the view to later instantiate the primary model object using the request context's model manager. In general, we recommend that developers set the primary model class rather than a primary model instance during initialization. The primary model class must implement the com.iplanet.jato.model.TreeModel interface.
Parameters:
The - primary model class

getStateDataLookupName

public java.lang.String getStateDataLookupName()
Return the state value lookup name. This lookup name is the session attribute name that will be used to lookup this instance's TreeViewStateData object.

setStateDataLookupName

public void setStateDataLookupName(java.lang.String value)
Set the state value lookup name
Parameters:
stateDataLookupName - The session attribute name that will be used to lookup this instance's TreeViewStateData object

resetNodeLocation

public void resetNodeLocation()
                       throws ModelControlException
Specified by:
resetNodeLocation in interface TreeView

nextNode

public boolean nextNode()
                 throws ModelControlException
Specified by:
nextNode in interface TreeView

getNodeLevel

public int getNodeLevel()
                 throws ModelControlException
Specified by:
getNodeLevel in interface TreeView

getNodeName

public java.lang.String getNodeName()
                             throws ModelControlException
Specified by:
getNodeName in interface TreeView

getNodeType

public java.lang.String getNodeType()
                             throws ModelControlException
Specified by:
getNodeType in interface TreeView

isNodeExpanded

public boolean isNodeExpanded()
Specified by:
isNodeExpanded in interface TreeView

isParentNode

public boolean isParentNode()
Specified by:
isParentNode in interface TreeView

isChildNode

public boolean isChildNode()
Specified by:
isChildNode in interface TreeView

getTreeHandleChildName

public java.lang.String getTreeHandleChildName()
Specified by:
getTreeHandleChildName in interface TreeView

getTreeHandleChildValue

public java.lang.Object getTreeHandleChildValue()
Specified by:
getTreeHandleChildValue in interface TreeView

getTreeHandleStateParameterName

public java.lang.String getTreeHandleStateParameterName()
NOTE: This method is provisional. For internal use only.
Specified by:
getTreeHandleStateParameterName in interface TreeView

acceptRequest

public java.lang.Object acceptRequest(javax.servlet.http.HttpServletRequest request)
Description copied from interface: RequestHandler
This method is used by the application servlet to determine if this is the appropriate view to handle the servlet request. The view should determine if one of its CommandField display fields generated this request, and return an invocation object describing the invocation.
Overrides:
acceptRequest in class RequestHandlingViewBase
Following copied from class: com.iplanet.jato.view.RequestHandlingViewBase
Returns:
An opaque invocation object storing information necessary to the handleRequest() method of this implementation. This implementation currently returns an instance of ViewInvocation.

acceptTreeHandleRequest

protected java.lang.Object acceptTreeHandleRequest(javax.servlet.http.HttpServletRequest request)

handleRequest

public void handleRequest(java.lang.Object anInvocation)
                   throws java.lang.Exception
Description copied from class: RequestHandlingViewBase
Called by the application servlet to have the request handler process this request. This implementation will further dispatch the request to the Command specified in the invocation. If a command is not available from the invocation, a default command will be used to handle the request (an instance of DefaultRequestHandlingCommand ).

There is no need to override this method in implementing classes, though of course, there is no reason one could not. Such a technique may be well suited to single-location security handling, logging, or other tasks.

The expected behavior of the handling method (or this method, if totally overridden) is to forward the request to another JSP/view bean/resource, preparing the target in any way necessary to support the request. Note that the current request context has already been set when this method is called by virtue of the RequestParticipant interface, which this class implements.

Overrides:
handleRequest in class RequestHandlingViewBase
Following copied from class: com.iplanet.jato.view.RequestHandlingViewBase
Parameters:
invocation - The opaque invocation object previously returned by the acceptRequest(...) method. The implementation can store any information useful to it in this object. This implementation currently expects this object to be an instance of ViewInvocation.
See Also:
Command, DefaultRequestHandlingCommand, DefaultTiledRequestHandlingCommand

getTreeHandleCommandDescriptor

public CommandDescriptor getTreeHandleCommandDescriptor()

setTreeHandleCommandDescriptor

public void setTreeHandleCommandDescriptor(CommandDescriptor value)

getStateData

public TreeViewStateData getStateData()
Specified by:
getStateData in interface TreeView

setStateData

protected void setStateData(TreeViewStateData value)