org.apache.beehive.netui.pageflow
Class PageFlowStack

Object
  extended by PageFlowStack
All Implemented Interfaces:
Serializable, EventListener, HttpSessionBindingListener

public class PageFlowStack
extends Object
implements HttpSessionBindingListener, Serializable

Stack for keeping track of a series of nested page flows. When a nested page flow is entered, the previous page flow is pushed onto this stack, which is kept in the user session.

This Stack implements the HttpSessionBindingListener which will receive a callback when this is removed from the HttpSession. At this time, any PageFlowController instances stored on the stack will be destroyed using the PageFlowManagedObject.destroy(javax.servlet.http.HttpSession) lifecycle method.

See Also:
Serialized Form

Nested Class Summary
static class PageFlowStack.PushedPageFlow
          Wrapper that contains a pushed page flow and information related to it.
 
Method Summary
 void destroy(HttpServletRequest request)
          Destroy the stack of PageFlowControllers that have invoked nested page flows.
static PageFlowStack get(HttpServletRequest request)
          Deprecated. Use get(HttpServletRequest, ServletContext) instead.
static PageFlowStack get(HttpServletRequest request, boolean createIfNotExist)
          Deprecated. Use get(HttpServletRequest, ServletContext, boolean) instead.
static PageFlowStack get(HttpServletRequest request, ServletContext servletContext)
          Get the stack of nested page flows for the current user session.
static PageFlowStack get(HttpServletRequest request, ServletContext servletContext, boolean createIfNotExist)
          Get the stack of nested page flows for the current user session.
 boolean isEmpty()
          Tell whether the stack of nested page flows is empty.
 PageFlowStack.PushedPageFlow peek()
          Get the most recently-pushed page flow from the stack of nested page flows in the session.
 PageFlowStack.PushedPageFlow pop(HttpServletRequest request)
          Pop the most recently-pushed page flow from the stack of nested page flows in the session.
 void push(PageFlowController pageFlow, HttpServletRequest request)
          Push a page flow onto the stack of nested page flows in the session.
 int size()
          Get the size of the stack of nested page flows.
 String toString()
           
 void valueBound(HttpSessionBindingEvent event)
          Callback for HttpSessionBindingListener -- should not be invoked directly.
 void valueUnbound(HttpSessionBindingEvent event)
          Callback for HttpSessionBindingListener -- should not be invoked directly.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

get

public static PageFlowStack get(HttpServletRequest request,
                                ServletContext servletContext)
Get the stack of nested page flows for the current user session. Create and store an empty stack if none exists.

Parameters:
request - the current HttpServletRequest.
servletContext - the current ServletContext.
Returns:
the stack of nested page flows PageFlowStack.PushedPageFlows) for the current user session.

get

public static PageFlowStack get(HttpServletRequest request)
Deprecated. Use get(HttpServletRequest, ServletContext) instead.

Get the stack of nested page flows for the current user session. Create and store an empty stack if none exists.

Parameters:
request - the current HttpServletRequest.
Returns:
the stack of nested page flows PageFlowStack.PushedPageFlows) for the current user session.

get

public static PageFlowStack get(HttpServletRequest request,
                                ServletContext servletContext,
                                boolean createIfNotExist)
Get the stack of nested page flows for the current user session. Create and store an empty stack if none exists.

Parameters:
request - the current HttpServletRequest.
servletContext - the current ServletContext.
Returns:
a PageFlowStack of nested page flows (PageFlowControllers) for the current user session.

get

public static PageFlowStack get(HttpServletRequest request,
                                boolean createIfNotExist)
Deprecated. Use get(HttpServletRequest, ServletContext, boolean) instead.

Get the stack of nested page flows for the current user session. Create and store an empty stack if none exists.

Parameters:
request - the current HttpServletRequest
Returns:
a PageFlowStack of nested page flows (PageFlowControllers) for the current user session.

destroy

public void destroy(HttpServletRequest request)
Destroy the stack of PageFlowControllers that have invoked nested page flows.

Parameters:
request - the current HttpServletRequest.

push

public void push(PageFlowController pageFlow,
                 HttpServletRequest request)
Push a page flow onto the stack of nested page flows in the session.

Parameters:
pageFlow - the page flow to push.
request - the current HttpServletRequest.

pop

public PageFlowStack.PushedPageFlow pop(HttpServletRequest request)
Pop the most recently-pushed page flow from the stack of nested page flows in the session.

Parameters:
request - the current HttpServletRequest.
Returns:
a PageFlowStack.PushedPageFlow that represents the popped page flow.

peek

public PageFlowStack.PushedPageFlow peek()
Get the most recently-pushed page flow from the stack of nested page flows in the session.

Returns:
a PageFlowStack.PushedPageFlow that represents the page flow at the top of the stack.

isEmpty

public boolean isEmpty()
Tell whether the stack of nested page flows is empty.

Returns:
true if there are no nested page flows on the stack.

size

public int size()
Get the size of the stack of nested page flows.

Returns:
the number of page flows that are currently (hidden away) on the stack.

valueBound

public void valueBound(HttpSessionBindingEvent event)
Callback for HttpSessionBindingListener -- should not be invoked directly.

Specified by:
valueBound in interface HttpSessionBindingListener

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Callback for HttpSessionBindingListener -- should not be invoked directly.

Specified by:
valueUnbound in interface HttpSessionBindingListener

toString

public String toString()
Overrides:
toString in class Object