You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by Apache Wiki <wi...@apache.org> on 2005/06/05 00:14:43 UTC

[Jakarta-taglibs Wiki] Update of "ReusableDialogComponents/Tutorials/Aggregation" by RahulAkolkar

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Jakarta-taglibs Wiki" for change notification.

The following page has been changed by RahulAkolkar:
http://wiki.apache.org/jakarta-taglibs/ReusableDialogComponents/Tutorials/Aggregation

New page:
''When Harry Met Sally''

----

In a GUI, it is common to present multiple widgets to the user in a single content pane, and have the user interact with them. In a VUI, it is expected that the author have control over which speech widget(s) from a given set - there may be more than one - are active at any given time, and hence taking part in the dialog with the user. Within the RDC framework, this level of control over multiple components is obtained by the use of containers. The group container is commonly used to ''hold'' more than one components, and manage the dialog via their execution.

 * '''Example 1:'''
{{{
<rdc:group id="myGroup" strategy="org.apache.taglibs.rdc.dm.SimpleDirectedDialog">
  <rdc:date id="myDate" minDate="01012005" maxDate="12312005" />
  <rdc:time id="myTime" minTime="0800a" maxTime="0500p" />
</rdc:group>
}}}

Interpretation:
{{{
Prompt the user for a date in the year 2005, and then a time between 8 AM and 5 PM. Since the SimpleDirectedDialog strategy is used, the children execute in document order.
}}}


 * '''Example 2:'''
{{{
    <%-- 
    Following bean created to illustrate the use of EL expressions in
    group navigation rules
    --%>
    <jsp:useBean id="myBean" class="java.util.HashMap" scope="request" >
      <c:set target="${myBean}" property="myProperty" value="time"/>
    </jsp:useBean>

    <rdc:group id="myGroup" strategy="org.apache.taglibs.rdc.dm.RuleBasedDirectedDialog"
     config="rules.xml" >

      <rdc:time id="time" confirm="true" echo="true"/>

      <rdc:duration id="duration" confirm="true" echo="true"/>

      <rdc:date id="date" minDate="01012005" maxDate="01012008" />

      <rdc:select1 id="select" optionList="options.xml" />

    </rdc:group>
}}}

where options.xml is:
{{{
<?xml version="1.0" encoding="ISO-8859-1" ?>
<list>
    <option>date</option>
    <option>time</option>
</list>
}}}

and, where rules.xml is:
{{{
<?xml version='1.0' encoding=="ISO-8859-1" ?>
<!DOCTYPE dm-config SYSTEM "rulebased.dtd">
<dm-config>
  <navigation>
    <initial target="select" />
    <rule from="select" defaultTarget="duration" >
      <!-- 
           In the lvalue attribute of the following condition
           we obtain the value of the RDC that just finished
           execution by evaluating its ID as an EL expression
           in the host JSP's page context.
           REMEMBER: Any RDC returns its value as a page context
           variable taking the same name as its ID.
      -->
      <condition lvalue="#{select}" operation="equal-to" rvalue="date"
       target="date" />
      <!-- 
           The rvalue attribute of the following condition
           illustrates how to use EL expressions in the ruleset.
           myBean is defined in JSP hosting the group which is executing
           based on these rules
      -->
      <condition lvalue="#{select}" operation="equal-to"
       rvalue="#{myBean.myProperty}" target="time" />
    </rule>
  </navigation>
</dm-config>
}}}

Interpretation:
{{{
Using the RuleBasedDirectedDialog strategy, where the configuration file rules.xml serves as the controller. Start off with the RDC whose ID is select. Once it finishes execution (which may require multiple round trips), if its value equals date, execute RDC with ID date, else if its value equals myBean.myProperty, execute RDC with ID time, else, by default, execute RDC with ID duration.
}}}


=== Pluggable Dialog Management Strategies For Group ===
The group container supports pluggable dialog management strategies. A strategy for group can be defined by implementing the {{{org.apache.taglibs.rdc.core.DialogManager}}} interface. This is usually done by extending {{{org.apache.taglibs.rdc.dm.DialogManagerImpl}}}, which does much of the brunt work needed at the framework level, leaving the strategy author to define just the ''controller'' bit for collecting input using the component children. The distribution currently provides a couple of generic strategies. A one-off strategy can also be authored for a particular flow within a particular application, if appropriate.

There can be multiple levels of arbitrary nesting in groups, as long as the dialog management strategies of participating groups are compatible.

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-dev-help@jakarta.apache.org