com.filenet.wcm.toolkit.server.base
Class WcmUiModule

java.lang.Object
  extended bycom.filenet.wcm.toolkit.server.base.WcmDpContainer
      extended bycom.filenet.wcm.toolkit.server.base.WcmModule
          extended bycom.filenet.wcm.toolkit.server.base.GlobalEventModule
              extended bycom.filenet.wcm.toolkit.server.base.WcmUiModule
All Implemented Interfaces:
WcmModuleInterface, WcmUiModuleInterface
Direct Known Subclasses:
WcmAnchorList, WcmAnchorTree, WcmHeaderModule, WcmJSPModule, WcmMultiPanelModule, WcmSignInModule, WcmXSLModule

public class WcmUiModule
extends GlobalEventModule
implements WcmUiModuleInterface

This class defines base behavior for all UI modules.


Field Summary
 
Fields inherited from class com.filenet.wcm.toolkit.server.base.WcmModule
locale, NAME_DELIMITER
 
Constructor Summary
WcmUiModule()
           
 
Method Summary
 boolean getActive()
          Returns the active status of this UI module.
 java.lang.String getBasePath()
          Returns the URL for the application root, such as "http://host:port/approot".
 java.lang.String getBaseUrl()
          Return the URL for the current page (ex: http://host:port/approot/WcmPage.jsp).
 WcmURLBuilder getBaseURLBuilder()
          Return the URL builder for the current page (ex: http://host:port/approot/WcmPage.jsp).
 java.lang.String getControllerEventUrl(java.lang.String eventName)
          Generate an event URL targeted to the instance of WcmController on the current page.
 java.lang.String getControllerEventUrl(java.lang.String eventName, java.lang.String requestParameters)
          Generate an event URL targeted to the instance of WcmController on the current page.
 java.lang.String getEventFormFields()
          Returns a string of hidden form fields required on all forms in the format:

<input type='hidden' name='eventTarget' value='<<my name>>'> <input type='hidden' name='eventName' value='Submit'> <input type='hidden' name='eventParam1' value=''> <input type='hidden' name='eventParam2' value=''> <input type='hidden' name='eventParam3' value=''>
 java.lang.String getEventFormFields(java.lang.String eventName, java.lang.String eventParam1, java.lang.String eventParam2, java.lang.String eventParam3)
          Returns a string of hidden form fields required on all forms in the format:

<input type='hidden' name='eventTarget' value='<<my name>>'> <input type='hidden' name='eventName' value='Submit'> <input type='hidden' name='eventParam1' value=''> <input type='hidden' name='eventParam2' value=''> <input type='hidden' name='eventParam3' value=''>
 java.lang.String getEventFormTag(java.lang.String method)
          Get the open <form ...> tag using the value of getFormName() in the current module instance.
 java.lang.String getEventFormTag(java.lang.String method, java.lang.String actionURL)
          Get the open <form ...> tag using the value of getFormName() in the current module instance.
 java.lang.String getEventUrl()
          Generate a URL with eventTarget to this module instance on the current page.
 java.lang.String getEventUrl(java.lang.String eventName)
          Generate a URL with eventTarget to this module instance on the current page.
 java.lang.String getEventUrl(java.lang.String eventName, java.lang.String requestParameters)
          Generate a URL with eventTarget to this module instance on the current page.
 java.lang.String getEventUrl(java.lang.String eventTarget, java.lang.String eventName, java.lang.String requestParameters)
          Generate an event URL targeted to the specified module instance on the current page.
 java.lang.String getFormName()
          Returns form name.
 java.lang.String getFormSubmitUrl(java.lang.String formName, java.lang.String eventName, java.lang.String requestParameters)
          Generate an event URL that submits the named form targeted to this module instance on the current page.
 java.lang.String getFormSubmitUrl(java.lang.String formName, java.lang.String eventTarget, java.lang.String eventName, java.lang.String requestParameters)
          Generate an event URL that submits the named form targeted to the specified module instance on the current page.
 java.lang.String getGlobalEventUrl(java.lang.String eventName)
           
 java.lang.String getGlobalEventUrl(java.lang.String eventName, java.lang.String requestParameters)
           
 java.lang.String getPageUrl()
          Generate a URL to go to the specified page.
 java.lang.String getPageUrl(boolean addWindowId)
          Generate a URL to go to the specified page.
 java.lang.String getPageUrl(java.lang.String pageName)
          Generate a URL to go to the specified page.
 java.lang.String getPageUrl(java.lang.String pageName, java.lang.String requestParameters)
          Generate a URL to go to the specified page, with the specified request parameters.
 WcmUiModuleInterface getUiParent()
          Returns the parent UI module.
 boolean peekEvent(java.lang.String eventName)
          Returns true if the specified event is currently queued for this module instance.
 void render(java.io.Writer w)
          Default render method.
 void renderJSP(java.io.Writer w)
          The render method writes HTML to the web page using jsp path
 boolean routeEvent(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Route the event defined by WcmParameter.EVENT_NAME on the request.
 boolean routeEvent(java.lang.String eventName, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Route the specified event.
 void serverSideInclude(java.lang.String jspPath, java.io.Writer w)
          Do a server-side include from the specified path below "/" + WcmController.getUIRoot() + "/jsp/modules/".
 void serverSideInclude(java.io.Writer w)
          Do a server-side include from the specified path below "/" + WcmController.getUIRoot() + "/jsp/modules/".
 boolean setActive(boolean value)
          Sets the active value to true or false.
 void setJSP(java.lang.String path)
          Sets the JSP file that will be used included in render() method
 
Methods inherited from class com.filenet.wcm.toolkit.server.base.GlobalEventModule
onStartPage, subscribeGlobalEvent
 
Methods inherited from class com.filenet.wcm.toolkit.server.base.WcmModule
addChild, addChild, addChild, cleanup, debugTrace, getClassProperty, getClassProperty, getClassPropertyKeys, getConfiguration, getController, getDataStore, getModuleProperty, getModuleProperty, getModuleProperty, getModuleProperty, getModulePropertyKeys, getName, getParent, getWindowProperty, getWindowProperty, initialize, persist, queryDataProvider, setClassProperty, setClassProperty, setController, setModuleProperty, setModuleProperty, setName, setParent, setPortletParent, setWindowProperty
 
Methods inherited from class com.filenet.wcm.toolkit.server.base.WcmDpContainer
addDataProvider, addDataProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.filenet.wcm.toolkit.server.base.WcmUiModuleInterface
onStartPage
 
Methods inherited from interface com.filenet.wcm.toolkit.server.base.WcmModuleInterface
addDataProvider, cleanup, getDataStore, getModuleProperty, getName, getParent, initialize, persist, queryDataProvider, setController, setModuleProperty, setName, setParent
 

Constructor Detail

WcmUiModule

public WcmUiModule()
Method Detail

render

public void render(java.io.Writer w)
            throws java.lang.Exception
Default render method. Outputs the string "empty module".

Specified by:
render in interface WcmUiModuleInterface
Parameters:
w - Writer object
Throws:
java.lang.Exception

getBaseURLBuilder

public final WcmURLBuilder getBaseURLBuilder()
                                      throws java.lang.Exception
Return the URL builder for the current page (ex: http://host:port/approot/WcmPage.jsp).

Returns:
The WcmURLBuilder value.
Throws:
java.lang.Exception

getBaseUrl

public final java.lang.String getBaseUrl()
                                  throws java.lang.Exception
Return the URL for the current page (ex: http://host:port/approot/WcmPage.jsp).

Returns:
The String value.
Throws:
java.lang.Exception

getPageUrl

public final java.lang.String getPageUrl(boolean addWindowId)
                                  throws java.lang.Exception
Generate a URL to go to the specified page.

Parameters:
addWindowId - set to true if a window id is desired
Returns:
the url of the current page.
Throws:
java.lang.Exception

getPageUrl

public final java.lang.String getPageUrl()
                                  throws java.lang.Exception
Generate a URL to go to the specified page.

If a windowId is required, it is added to the URL automatically.

Returns:
the url of the current page.
Throws:
java.lang.Exception

getPageUrl

public final java.lang.String getPageUrl(java.lang.String pageName)
                                  throws java.lang.Exception
Generate a URL to go to the specified page.

If a windowId is required, it is added to the URL automatically.

Parameters:
pageName - The page name to go to. If null, an URL will be generated for the current page.
Returns:
The String value
Throws:
java.lang.Exception

getPageUrl

public final java.lang.String getPageUrl(java.lang.String pageName,
                                         java.lang.String requestParameters)
                                  throws java.lang.Exception
Generate a URL to go to the specified page, with the specified request parameters.

If a windowId is required, it is added to the URL automatically.

Parameters:
pageName - The page name to go to. If null, an URL will be generated for the current page.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getEventUrl

public final java.lang.String getEventUrl()
                                   throws java.lang.Exception
Generate a URL with eventTarget to this module instance on the current page. eventName is not specified.

The URL generated here is incomplete, because it does not include eventName. windowId is included automatically if required.

This method is useful if you want to create a "base" string from which to generate several event URL strings, by concatenating with eventName and whatever other parameters are needed.

Returns:
The String value
Throws:
java.lang.Exception

getGlobalEventUrl

public final java.lang.String getGlobalEventUrl(java.lang.String eventName)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getGlobalEventUrl

public final java.lang.String getGlobalEventUrl(java.lang.String eventName,
                                                java.lang.String requestParameters)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getEventUrl

public final java.lang.String getEventUrl(java.lang.String eventName)
                                   throws java.lang.Exception
Generate a URL with eventTarget to this module instance on the current page.

windowId is included automatically if it is required.

Parameters:
eventName - The event name that this URL is generated for.
Returns:
The String value
Throws:
java.lang.Exception

getEventUrl

public final java.lang.String getEventUrl(java.lang.String eventName,
                                          java.lang.String requestParameters)
                                   throws java.lang.Exception
Generate a URL with eventTarget to this module instance on the current page.

windowId is included automatically if it is required.

Parameters:
eventName - The event name that this URL is generated for.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getEventUrl

public final java.lang.String getEventUrl(java.lang.String eventTarget,
                                          java.lang.String eventName,
                                          java.lang.String requestParameters)
                                   throws java.lang.Exception
Generate an event URL targeted to the specified module instance on the current page.

windowId is included automatically if it is required.

Parameters:
eventTarget - The module name to target this event to (ex: the value of uiModule.getName()).
eventName - The event name that this URL is generated for.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getControllerEventUrl

public final java.lang.String getControllerEventUrl(java.lang.String eventName,
                                                    java.lang.String requestParameters)
                                             throws java.lang.Exception
Generate an event URL targeted to the instance of WcmController on the current page.

windowId is included automatically if it is required.

Parameters:
eventName - The event name that this URL is generated for.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getControllerEventUrl

public final java.lang.String getControllerEventUrl(java.lang.String eventName)
                                             throws java.lang.Exception
Generate an event URL targeted to the instance of WcmController on the current page.

windowId is included automatically if it is required.

Parameters:
eventName - The event name that this URL is generated for.
Returns:
The String value
Throws:
java.lang.Exception

getFormSubmitUrl

public final java.lang.String getFormSubmitUrl(java.lang.String formName,
                                               java.lang.String eventName,
                                               java.lang.String requestParameters)
                                        throws java.lang.Exception
Generate an event URL that submits the named form targeted to this module instance on the current page.

windowId is included automatically if it is required.

Parameters:
formName - The name of the form to submit. If null is specified, this method reverts to getEventUrl(eventName, requestParameters).
eventName - The event name that this URL is generated for.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getFormSubmitUrl

public final java.lang.String getFormSubmitUrl(java.lang.String formName,
                                               java.lang.String eventTarget,
                                               java.lang.String eventName,
                                               java.lang.String requestParameters)
                                        throws java.lang.Exception
Generate an event URL that submits the named form targeted to the specified module instance on the current page.

windowId is included automatically if it is required.

Parameters:
formName - The name of the form to submit. If null is specified, this method reverts to getEventUrl(eventTarget, eventName, requestParameters).
eventTarget - The module name to target this event to (ex: the value of uiModule.getName()).
eventName - The event name that this URL is generated for.
requestParameters - A request parameter string in the form "param=value&param=value&...". null is valid.
Returns:
The String value
Throws:
java.lang.Exception

getEventFormTag

public final java.lang.String getEventFormTag(java.lang.String method)
                                       throws java.lang.Exception
Get the open <form ...> tag using the value of getFormName() in the current module instance.

windowId is included automatically if it is required.

Parameters:
method - Should be GET or POST. If null, POST is used.
Returns:
The String value
Throws:
java.lang.Exception

getEventFormTag

public final java.lang.String getEventFormTag(java.lang.String method,
                                              java.lang.String actionURL)
                                       throws java.lang.Exception
Get the open <form ...> tag using the value of getFormName() in the current module instance.

windowId is included automatically if it is required.

Parameters:
method - Should be GET or POST. If null, POST is used.
actionURL - ActionURL. If null or not specified, basePageURL (with window id) will be used
Returns:
The String value
Throws:
java.lang.Exception

getEventFormFields

public final java.lang.String getEventFormFields()
Returns a string of hidden form fields required on all forms in the format:

<input type='hidden' name='eventTarget' value='<<my name>>'> <input type='hidden' name='eventName' value='Submit'> <input type='hidden' name='eventParam1' value=''> <input type='hidden' name='eventParam2' value=''> <input type='hidden' name='eventParam3' value=''>

Returns:
The String value

getEventFormFields

public final java.lang.String getEventFormFields(java.lang.String eventName,
                                                 java.lang.String eventParam1,
                                                 java.lang.String eventParam2,
                                                 java.lang.String eventParam3)
Returns a string of hidden form fields required on all forms in the format:

<input type='hidden' name='eventTarget' value='<<my name>>'> <input type='hidden' name='eventName' value='Submit'> <input type='hidden' name='eventParam1' value=''> <input type='hidden' name='eventParam2' value=''> <input type='hidden' name='eventParam3' value=''>

Parameters:
eventName - The event name that this URL is generated for.
eventParam1 - An optional event parameter.
eventParam2 - An optional event parameter.
eventParam3 - An optional event parameter.
Returns:
The String value

getBasePath

public final java.lang.String getBasePath()
                                   throws java.lang.Exception
Returns the URL for the application root, such as "http://host:port/approot".

Returns:
The String value.
Throws:
java.lang.Exception

getFormName

public java.lang.String getFormName()
Returns form name. Base behavior returns null.

Specified by:
getFormName in interface WcmUiModuleInterface
Returns:
The String value of the form name or null.

peekEvent

public boolean peekEvent(java.lang.String eventName)
Returns true if the specified event is currently queued for this module instance.

Parameters:
eventName - The name of the event to peek for.
Returns:
true or false

serverSideInclude

public void serverSideInclude(java.io.Writer w)
                       throws java.io.IOException,
                              javax.servlet.ServletException,
                              WcmException
Do a server-side include from the specified path below "/" + WcmController.getUIRoot() + "/jsp/modules/". For example, for "/WEB-INF/jsp/modules/apps.server.ui/WcmSignInModule.jsp", call serverSideInclude("apps.server.ui/WcmSignInModule.jsp", w). A reference to the UI module making this call is set so that the Java™Server Pages (JSP) page can call WcmController.getCurrentModule(request) to access it.

Parameters:
w - The Writer object that writes content back to the client/browser.
Throws:
java.io.IOException
javax.servlet.ServletException
WcmException

serverSideInclude

public void serverSideInclude(java.lang.String jspPath,
                              java.io.Writer w)
                       throws java.io.IOException,
                              javax.servlet.ServletException,
                              WcmException
Do a server-side include from the specified path below "/" + WcmController.getUIRoot() + "/jsp/modules/". For example, for "/WEB-INF/jsp/modules/apps.server.ui/WcmSignInModule.jsp", call serverSideInclude("apps.server.ui/WcmSignInModule.jsp", w). A reference to the UI module making this call is set so that the JSP can call WcmController.getCurrentModule(request) to access it.

Parameters:
jspPath - The relative path to the JSP to include.
w - The Writer object that writes content back to the client/browser.
Throws:
java.io.IOException
javax.servlet.ServletException
WcmException

setActive

public boolean setActive(boolean value)
Sets the active value to true or false.
When set to false, onStartPage will not be called on this module or its contained descendants. For use when you don't plan to be rendering this UI module onto the page.

Specified by:
setActive in interface WcmUiModuleInterface
Returns:
The previous set value.

getActive

public boolean getActive()
Returns the active status of this UI module. Controls whether or not onStartPage gets called by the controller on this module and all its children.

Specified by:
getActive in interface WcmUiModuleInterface
Returns:
boolean true or false

setJSP

public void setJSP(java.lang.String path)
Sets the JSP file that will be used included in render() method

Specified by:
setJSP in interface WcmUiModuleInterface
Parameters:
path - path to the jsp file.

renderJSP

public final void renderJSP(java.io.Writer w)
                     throws java.lang.Exception
Description copied from interface: WcmUiModuleInterface
The render method writes HTML to the web page using jsp path

Specified by:
renderJSP in interface WcmUiModuleInterface
Parameters:
w - The writer that the method should use to write out HTML to the page.
Throws:
java.lang.Exception

routeEvent

public boolean routeEvent(java.lang.String eventName,
                          javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws java.lang.Exception
Route the specified event. If a null or empty String event name is passed, or the named event handler is not found, then this call is a noop.

Parameters:
eventName -
request -
response -
Returns:
true if the event was successfully routed, false if not.
Throws:
java.lang.Exception

routeEvent

public boolean routeEvent(javax.servlet.http.HttpServletRequest request,
                          javax.servlet.http.HttpServletResponse response)
                   throws java.lang.Exception
Route the event defined by WcmParameter.EVENT_NAME on the request. If there is now event name parameter on the request, or the named event handler is not found, then this call is a noop.

Parameters:
request -
response -
Returns:
true if the event was successfully routed, false if not.
Throws:
java.lang.Exception

getUiParent

public WcmUiModuleInterface getUiParent()
Returns the parent UI module. If there is no parent UI module, returns null.

Returns:
The parent UI module.


© Copyright IBM Corp. 2002, 2007. All Rights Reserved.