org.barracudamvc.core.comp
Class DefaultViewContext

java.lang.Object
  extended by org.barracudamvc.core.comp.DefaultViewContext
All Implemented Interfaces:
ViewContext, StateMap

public class DefaultViewContext
extends Object
implements ViewContext

This class provides the default implementation of a ViewContext. A View Context basically exists to provide the component models with the information they need to actually pass back the proper data to the component.


Field Summary
 
Fields inherited from interface org.barracudamvc.core.comp.ViewContext
DOCUMENT, EVENT_CONTEXT, REQUEST, RESPONSE, TEMPLATE_NODE, VIEW_CAPABILITIES
 
Constructor Summary
DefaultViewContext()
          Create a DefaultViewContext
DefaultViewContext(javax.servlet.http.HttpServletRequest ireq, javax.servlet.http.HttpServletResponse iresp)
          Create a DefaultViewContext for req/response object
DefaultViewContext(ViewCapabilities ivc, javax.servlet.http.HttpServletRequest ireq, javax.servlet.http.HttpServletResponse iresp)
          Create a DefaultViewContext for a specific ViewCapabilities obj
DefaultViewContext(ViewEventContext ivec)
          Create a DefaultViewContext for a specific EventContext
 
Method Summary
 void clearState()
          clear all state information
 Document getDocument()
          Get the underlying template Document (if it exists - note that the ViewContext may be constructed BEFORE the Document has actually been loaded yet, so this property may not be available immediately after object creation.
 EventContext getEventContext()
          Get the underlying EventContext object
 javax.servlet.http.HttpServletRequest getRequest()
          Get the underlying HttpServletRequest
 javax.servlet.http.HttpServletResponse getResponse()
          Get the underlying HttpServletResponse
 Object getState(Object key)
          get a property in this StateMap
 Set getStateKeys()
          get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation)
 Map getStateStore()
          get a copy of the underlying Map
 Node getTemplateNode()
          Get the underlying template Node (if it exists)
 ViewCapabilities getViewCapabilities()
          Get the underlying ViewCapabilities object
 void putState(Object key, Object val)
          set a property in this StateMap
 Object removeState(Object key)
          remove a property in this StateMap
 void setDocument(Document document)
          Set the underlying template Document (note that this method is NOT part of the ViewContext interface)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultViewContext

public DefaultViewContext()
Create a DefaultViewContext


DefaultViewContext

public DefaultViewContext(javax.servlet.http.HttpServletRequest ireq,
                          javax.servlet.http.HttpServletResponse iresp)
Create a DefaultViewContext for req/response object


DefaultViewContext

public DefaultViewContext(ViewCapabilities ivc,
                          javax.servlet.http.HttpServletRequest ireq,
                          javax.servlet.http.HttpServletResponse iresp)
Create a DefaultViewContext for a specific ViewCapabilities obj


DefaultViewContext

public DefaultViewContext(ViewEventContext ivec)
Create a DefaultViewContext for a specific EventContext

Method Detail

getViewCapabilities

public ViewCapabilities getViewCapabilities()
Get the underlying ViewCapabilities object

Specified by:
getViewCapabilities in interface ViewContext
Returns:
the underlying ViewCapabilities object

getEventContext

public EventContext getEventContext()
Get the underlying EventContext object

Specified by:
getEventContext in interface ViewContext
Returns:
the underlying EventContext object

getTemplateNode

public Node getTemplateNode()
Get the underlying template Node (if it exists)

Specified by:
getTemplateNode in interface ViewContext
Returns:
the underlying template Node (if it exists)

setDocument

public void setDocument(Document document)
Set the underlying template Document (note that this method is NOT part of the ViewContext interface)


getDocument

public Document getDocument()
Get the underlying template Document (if it exists - note that the ViewContext may be constructed BEFORE the Document has actually been loaded yet, so this property may not be available immediately after object creation. It should always be set, however, by the time models are actually using the ViewContext).

Specified by:
getDocument in interface ViewContext
Returns:
the underlying template Document (if it exists)

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
Get the underlying HttpServletRequest

Specified by:
getRequest in interface ViewContext
Returns:
the underlying HttpServletRequest

getResponse

public javax.servlet.http.HttpServletResponse getResponse()
Get the underlying HttpServletResponse

Specified by:
getResponse in interface ViewContext
Returns:
the underlying HttpServletResponse

putState

public void putState(Object key,
                     Object val)
set a property in this StateMap

Specified by:
putState in interface StateMap
Parameters:
key - the state key object
val - the state value object

getState

public Object getState(Object key)
get a property in this StateMap

Specified by:
getState in interface StateMap
Parameters:
key - the state key object
Returns:
the value for the given key

removeState

public Object removeState(Object key)
remove a property in this StateMap

Specified by:
removeState in interface StateMap
Parameters:
key - the key object
Returns:
the object which was removed

getStateKeys

public Set getStateKeys()
get a keyset for this StateMap (whether or not the set is backed by the data store depends on the implementation)

Specified by:
getStateKeys in interface StateMap
Returns:
a Set of keys for this StateMap

getStateStore

public Map getStateStore()
get a copy of the underlying Map

Specified by:
getStateStore in interface StateMap
Returns:
a copy of the underlying state Map

clearState

public void clearState()
clear all state information

Specified by:
clearState in interface StateMap


Copyright © 2006 BarracudaMVC.org All Rights Reserved.