org.apache.lenya.cms.usecase
Class UsecaseView

java.lang.Object
  extended by org.apache.lenya.cms.usecase.UsecaseView
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.service.Serviceable

public class UsecaseView
extends java.lang.Object
implements org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.service.Serviceable

Information about a usecase view.

Version:
$Id: UsecaseView.java 587463 2007-10-23 11:58:57Z nettings $

Example configuration:

<view uri="/modules/foo/usecases/foo-mogrify.jx"
     customFlow="/modules/foo/flow/myflow.js"
     menu="false|true"
     createContinuation="false|true"
 >
   <tab group="foo" name="bar"/>      // optional
   <parameter name="foo" value="bar/> // optional
 </view>

uri is the relative URL of the page to be sent back to the client. If the URI starts with a slash, it is resolved starting at the root sitemap, otherwise it is resolved relative to the current sitemap. The URI should not contain a scheme (such as cocoon:).

menu is a boolean that governs whether the Lenya GUI menu is displayed while the usecase is running. The displaying of the menu is handled by the usecase.xmap sitemap; hence this option is only functional if uri does not start with a slash (or if you implement it yourself based on the showMenu() method of this object).
Default is false.

customFlow is a javascript file where you can provide custom methods that will override those in the default usecase handler (modules-core/usecase/usecases.js). Currently, it provides support for "customLoopFlow" and "customSubmitFlow". Refer to the default handler for function prototypes and more information. NB: the "menu" and "createContinuation" attributes will have no effect when you use custom flow code, unless you check for them and implement the respective functions yourself.

createContinuation can be set to false, in which case the generic flowscript uses "sendPage" instead of "sendPageAndWait" and terminates after the view has been sent. When createContinuation is false, you must not specify submitFlow or loopFlow.
Default is true.

For tabbed usecases, you can optionally specify a tab group and name. Additional custom configuration can be passed via the generic "parameter" element.

For backwards compatibility with existing usecases, the constructor looks for a template attribute if no uri is present. It is mapped to the same field, viewUri, internally.


Field Summary
protected static java.lang.String ATTRIBUTE_CREATE_CONT
           
protected static java.lang.String ATTRIBUTE_CUSTOM_FLOW
           
protected static java.lang.String ATTRIBUTE_GROUP
           
protected static java.lang.String ATTRIBUTE_NAME
           
protected static java.lang.String ATTRIBUTE_SHOW_MENU
           
protected static java.lang.String ATTRIBUTE_TEMPLATE
           
protected static java.lang.String ATTRIBUTE_URI
           
protected static java.lang.String ATTRIBUTE_VALUE
           
protected static java.lang.String ELEMENT_PARAMETER
           
protected static java.lang.String ELEMENT_TAB
           
 
Constructor Summary
UsecaseView()
           
 
Method Summary
 void configure(org.apache.avalon.framework.configuration.Configuration config)
           
 boolean createContinuation()
           
 java.lang.String getCustomFlow()
           
 java.lang.String getParameter(java.lang.String name)
           
 Tab getTab()
           
 Tab[] getTabsInGroup()
           
 java.lang.String getViewURI()
           
 void service(org.apache.avalon.framework.service.ServiceManager manager)
           
 boolean showMenu()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIBUTE_URI

protected static final java.lang.String ATTRIBUTE_URI
See Also:
Constant Field Values

ATTRIBUTE_TEMPLATE

protected static final java.lang.String ATTRIBUTE_TEMPLATE
See Also:
Constant Field Values

ATTRIBUTE_CUSTOM_FLOW

protected static final java.lang.String ATTRIBUTE_CUSTOM_FLOW
See Also:
Constant Field Values

ATTRIBUTE_SHOW_MENU

protected static final java.lang.String ATTRIBUTE_SHOW_MENU
See Also:
Constant Field Values

ATTRIBUTE_CREATE_CONT

protected static final java.lang.String ATTRIBUTE_CREATE_CONT
See Also:
Constant Field Values

ELEMENT_PARAMETER

protected static final java.lang.String ELEMENT_PARAMETER
See Also:
Constant Field Values

ATTRIBUTE_NAME

protected static final java.lang.String ATTRIBUTE_NAME
See Also:
Constant Field Values

ATTRIBUTE_VALUE

protected static final java.lang.String ATTRIBUTE_VALUE
See Also:
Constant Field Values

ATTRIBUTE_GROUP

protected static final java.lang.String ATTRIBUTE_GROUP
See Also:
Constant Field Values

ELEMENT_TAB

protected static final java.lang.String ELEMENT_TAB
See Also:
Constant Field Values
Constructor Detail

UsecaseView

public UsecaseView()
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration config)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable
Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
Configurable.configure(org.apache.avalon.framework.configuration.Configuration)

getViewURI

public java.lang.String getViewURI()
Returns:
The URI of the JX template;

showMenu

public boolean showMenu()
Returns:
whether the menubar should be visible on usecase screens.

createContinuation

public boolean createContinuation()
Returns:
whether a continuation should be created.

getCustomFlow

public java.lang.String getCustomFlow()
Returns:
the Flowscript snippet to be executed during the usecase view loop.

getParameter

public java.lang.String getParameter(java.lang.String name)
Parameters:
name - The parameter name.
Returns:
The parameter value.

getTab

public Tab getTab()
Returns:
The tab the usecase belongs to or null.

getTabsInGroup

public Tab[] getTabsInGroup()
Returns:
All tabs in the same group.

service

public void service(org.apache.avalon.framework.service.ServiceManager manager)
             throws org.apache.avalon.framework.service.ServiceException
Specified by:
service in interface org.apache.avalon.framework.service.Serviceable
Throws:
org.apache.avalon.framework.service.ServiceException
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)


Copyright $ Apache Software Foundation. All Rights Reserved.