WUI : API


org.westofj.wui
Class WRunner

java.lang.Object
  extended byorg.westofj.wui.WRunner

public class WRunner
extends Object

A WRunner manages the application for a single client. An instance of a runner is created the first time the user visits the application and stored in the users session.

Version:
$Revision: 1.9 $, $Date: 2004/03/08 01:57:36 $
Author:
bill

Constructor Summary
WRunner()
          Constructs a runner.
 
Method Summary
 void addStyleSheet(String styleSheet)
          Adds a style sheet to the runners collection of style sheets.
 void clear()
          Empties the page stack of the runner.
protected  void destroy()
          Called when the runner is destroyed.
 void enqueue(WEvent event)
           
 void enqueue2(WEvent event)
           
 void exit()
          Instructs the controller to destroy the runner when the runner finishes its current event processing and render cycle.
 String findId(Widget widget)
          Returns the registered identifier for the specified widget.
 WApplication getApplication()
          Returns the WApplication instance associated with the runner.
 String getContextPath()
          Returns the context path of the runner.
 WPage getCurrentPage()
          Returns the page at the top of the page stack.
 String getDefaultStyleSheet()
          Returns the default style sheet of the runner.
 Locale getLocale()
          Returns the locale associated with the runner.
 HttpServletRequest getRequest()
          Returns the active request instance.
 String getResourcePath(String path)
          Returns a normalized URL for the specified path .
 HttpServletResponse getResponse()
          Returns the active response instance.
static WRunner getRunner()
          Returns the current runner context.
 String getServletPath()
          Returns the servlet path of the runner.
 Collection getStyleSheets()
          Returns an unmodifiable collection of style sheets associated with the runner.
 String getTransactionId()
          Returns the transaction identifier.
protected  void init()
          Called when the runner is created.
 WPage popPage()
          Removes a page from the top of the page stack.
 void pushPage(WPage page)
          Pushes a WPage instance onto the top of the runners page stack.
 String registerWidget(Widget widget)
           
 void removeStyleSheet(String styleSheet)
          Removes a style sheet from the runners collection of style sheets.
 void renderResourcePath(PrintWriter out, String path)
          Renders a normalized URL for the specified path .
 void setCurrentPage(WPage page)
          Replaces the page at the top of the page stack with the specified page.
 void setDefaultStyleSheet(String defaultStyleSheet)
          Sets the default style sheet of the runner.
 void setLocale(Locale locale)
          Sets the locale associated with the runner.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WRunner

public WRunner()
Constructs a runner.

Method Detail

init

protected void init()
Called when the runner is created.


destroy

protected void destroy()
Called when the runner is destroyed.


getApplication

public final WApplication getApplication()
Returns the WApplication instance associated with the runner. Each runner is associated with one application instance.

Returns:
WApplication

pushPage

public final void pushPage(WPage page)
Pushes a WPage instance onto the top of the runners page stack. The runner will render the page on the top of the stack to the client.

Parameters:
page -

popPage

public final WPage popPage()
Removes a page from the top of the page stack.

Returns:
WPage the page removed from the page stack.

getCurrentPage

public final WPage getCurrentPage()
Returns the page at the top of the page stack. The page at the top of the page stack will be rendered to the user.

Returns:
WPage

setCurrentPage

public final void setCurrentPage(WPage page)
Replaces the page at the top of the page stack with the specified page.

Parameters:
page - the page to be placed at the top of the page stack.

getLocale

public final Locale getLocale()
Returns the locale associated with the runner.

Returns:
Locale the locale associated with the runner.

setLocale

public final void setLocale(Locale locale)
Sets the locale associated with the runner.

Parameters:
locale - the locale associated with the runner.

getDefaultStyleSheet

public final String getDefaultStyleSheet()
Returns the default style sheet of the runner.

Returns:
String the default style sheet of the runner.

setDefaultStyleSheet

public final void setDefaultStyleSheet(String defaultStyleSheet)
Sets the default style sheet of the runner.

Parameters:
defaultStyleSheet - the default style sheet of the runner.

addStyleSheet

public final void addStyleSheet(String styleSheet)
Adds a style sheet to the runners collection of style sheets.

Parameters:
styleSheet - the style sheet to add to the runner.

removeStyleSheet

public final void removeStyleSheet(String styleSheet)
Removes a style sheet from the runners collection of style sheets.

Parameters:
styleSheet - the style sheet to remove.

getStyleSheets

public final Collection getStyleSheets()
Returns an unmodifiable collection of style sheets associated with the runner.

Returns:
Collection an unmodifiable collection of style sheets associated with the runner.

renderResourcePath

public final void renderResourcePath(PrintWriter out,
                                     String path)
Renders a normalized URL for the specified path . This method transforms the resource: specification into a valid URL to instruct the controller to return the resource from the classpath.

Parameters:
out -
path -

getResourcePath

public final String getResourcePath(String path)
Returns a normalized URL for the specified path . This method transforms the resource: specification into a valid URL to instruct the controller to return the resource from the classpath.

Parameters:
path - the URL to normalize.
Returns:
String a normalized URL.

exit

public void exit()
Instructs the controller to destroy the runner when the runner finishes its current event processing and render cycle.


clear

public final void clear()
Empties the page stack of the runner.


getServletPath

public final String getServletPath()
Returns the servlet path of the runner.

Returns:
String the servlet path of the runner.

getContextPath

public final String getContextPath()
Returns the context path of the runner.

Returns:
String the context path of the runner.

registerWidget

public final String registerWidget(Widget widget)

findId

public final String findId(Widget widget)
Returns the registered identifier for the specified widget.

Parameters:
widget - the widget for which to return the identifier.
Returns:
String the registered identifier of the specified widget.

getTransactionId

public final String getTransactionId()
Returns the transaction identifier.

Returns:
String the transaction identifier.

getRequest

public final HttpServletRequest getRequest()
Returns the active request instance.

Returns:
HttpServletRequest the active request instance.

getResponse

public final HttpServletResponse getResponse()
Returns the active response instance.

Returns:
HttpServletResponse the active response instance.

enqueue

public void enqueue(WEvent event)

enqueue2

public void enqueue2(WEvent event)

getRunner

public static WRunner getRunner()
Returns the current runner context.

Returns:
WRunner the current runner context.

Copyright (c) 2003 West of J - All rights reserved.