Author: steveh
Date: Tue Mar 15 13:57:16 2005
New Revision: 157593

URL: http://svn.apache.org/viewcvs?view=rev&rev=157593
Log:
Adding topic on nested page flows and popup windows.

Added:
    
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml
   (with props)
    
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.dia
   (with props)
    
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.png
   (with props)
    
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.dia
   (with props)
    
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.png
   (with props)
Modified:
    
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/site.xml

Added: 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml?view=auto&rev=157593
==============================================================================
--- 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml
 (added)
+++ 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml
 Tue Mar 15 13:57:16 2005
@@ -0,0 +1,285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" 
+       "http://forrest.apache.org/dtd/document-v20.dtd";>
+<document>
+       <header>
+               <title>Popup Windows</title>
+       </header>
+       <body>
+               <section id="intro">
+                       <title>Introduction</title>
+                   <p>The following topic explains how to collect data from a 
nested page flow and 'return'
+                               the data to the nesting/main page flow.  The 
nested page flow 
+                               can appear as a popup window if so desired.</p>
+                       
+               </section>
+               <section id="single_pageflow">
+                       <title>Submit/Display Cycle in a Single Page 
Flow</title>
+                       <p>Before we get to nested page flows and popup 
windows, lets first take a look at the 
+                               basic page flow submission cycle.  Below is a 
diagram of the basic cycle.</p>
+                       <p><img src="images/nested_1.png" 
alt="singlepageflow"/></p>
+<p>Below is the code for the basic cycle: (1) <code>index.jsp</code> contains 
the form for 
+       collecting data, (2) the submission is handled by the method 
<code>submit()</code>,
+       and (3) the submitted data is displayed by <code>results.jsp</code>.</p>
+<p><strong>index.jsp</strong></p>
+       <source>    &lt;netui:form action="submit">
+      Name:            &lt;netui:textBox dataSource="actionForm.name"/>
+      Favorite Color:  &lt;netui:textBox dataSource="actionForm.color"/>
+      &lt;br/>
+      &lt;netui:button type="submit" value="submit"/>
+    &lt;/netui:form></source>
+                               <p><strong>Controller.jpf</strong></p>
+                       <source>...
+                               
[EMAIL PROTECTED](
+    simpleActions={
+        @Jpf.SimpleAction(name="begin", path="index.jsp")
+    }
+)
+public class Controller 
+    extends PageFlowController
+{
+
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(
+                name = "success",
+                path = "results.jsp"
+            )
+        }
+    )
+    protected Forward submit(SubmitForm form)
+    {
+        return new Forward("success", "form", form );
+    }
+
+    public static class SubmitForm extends FormData
+    {
+        private String _name;
+        private String _color;
+
+        public String getName()
+        {
+            return _name;
+        }
+
+        public void setName(String value)
+        {
+            _name = value;
+        }
+
+        public String getColor()
+        {
+            return _color;
+        }
+
+        public void setColor(String value)
+        {
+            _color = value;
+        }
+    }
+}</source>
+<p><strong>results.jsp</strong></p>
+<source>    Submitted Name: ${pageInput.form.name}
+    &lt;br/>
+    Submitted Color: ${pageInput.form.color}
+    &lt;br/>
+    &lt;br/>
+    &lt;netui:anchor action="begin">[start over]&lt;/netui:anchor></source>
+               </section>
+               <section id="nesting_nested_pageflows">
+                       <title>Submit/Display Cycle with Nested Page 
Flow</title>
+                       <p>In this section we introduce a nested page flow to 
help collect data from the user.</p>
+                       <p>When the user clicks the "get color" button (see the 
<code>index.jsp</code>
+                               page below), an instance of a nested page flow 
is created (GetColor.jpf).
+                               When the user submits the form within the 
nested page flow, the data is 'returned'
+                               to populate the form within the main/nesting 
page flow.</p>
+                               <p>The diagram below shows how the user moves 
into the nested page flow, and 
+                                       then back into the main/nesting page 
flow.</p>
+                       <p><img alt="nested_2" src="images/nested_2.png"/></p>
+                       <p>The code for the main and nested page flow follows. 
<!--[todo: more description of 
+                               this code]--></p>
+                       <p><strong>index.jsp</strong></p>
+                       <source>    &lt;netui:form action="submit">
+      Name:            &lt;netui:textBox dataSource="actionForm.name"/>
+      Favorite Color:  &lt;netui:textBox dataSource="actionForm.color"/>
+      &lt;br/>
+      <strong>&lt;netui:button type="submit" value="get color" 
action="getColor"/></strong>
+      &lt;netui:button type="submit" value="submit"/>
+    &lt;/netui:form></source>
+<p><strong>Controller.jpf</strong></p>
+<source>...
+
+public class Controller 
+    extends PageFlowController
+{
+
+    ...
+
+    <strong>/**
+     * This action forwards to the nested page flow to gather the favorite 
color.
+     */
+    protected Forward getColor(SubmitForm form)
+    {
+        return new Forward("getColorFlow");
+    }
+
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(
+                name="success",
+                navigateTo=Jpf.NavigateTo.currentPage
+            )
+        }
+    )
+    protected Forward colorSuccess( String color )
+    {
+        SubmitForm previousForm = ( SubmitForm ) getPreviousFormBean();
+        previousForm.setColor( color );
+        return new Forward( "success", previousForm );
+    }</strong>
+
+    ...
+
+}</source>
+<p><strong>results.jsp</strong></p>
+<source>[unchanged from above]</source>
+<p><strong>getColor/index.jsp</strong></p>
+<source>      &lt;netui:form action="submitColor">
+        Color:&lt;br/>
+          &lt;netui:select dataSource="actionForm.color" size="5">
+            &lt;netui:selectOption value="red" />
+            &lt;netui:selectOption value="blue" />
+            &lt;netui:selectOption value="green" />
+            &lt;netui:selectOption value="yellow" />
+            &lt;netui:selectOption value="orange" />
+          &lt;/netui:select>
+        &lt;br/>&nbsp;
+        &lt;netui:button type="submit" value="submit"/>
+      &lt;/netui:form></source>
+<p><strong>getColor/GetColor.jpf</strong></p>
+<source>package getColor;
+
+import javax.servlet.http.HttpSession;
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+import javax.servlet.http.HttpServletRequest;
+import org.apache.struts.action.ActionMapping;
+import org.apache.beehive.netui.pageflow.FormData;
+
+
[EMAIL PROTECTED](
+    nested=true,
+    simpleActions={
+        @Jpf.SimpleAction(name="begin", path="index.jsp")
+    }
+)
+public class GetColor extends PageFlowController
+{
+    @Jpf.Action(
+        forwards={
+            @Jpf.Forward(
+                name="done", 
+                returnAction="colorSuccess",
+                outputFormBeanType=String.class)
+        }
+    )
+    protected Forward submitColor( ColorForm form )
+    {
+        return new Forward( "done", form.getColor() );
+    }
+
+    public static class ColorForm extends FormData
+    {
+        private String _color;
+
+        public String getColor()
+        {
+            return _color;
+        }
+
+        public void setColor(String value)
+        {
+            _color = value;
+        }
+    }
+}</source>
+               </section>
+               <section id="popups">
+                       <title>Submit/Display Cycle with Nested Page Flow 
(Popup Window Enabled)</title>
+            <p>This section explains how to make the nested page flow appear 
as a popup window.</p> 
+<section id="popup_attribute"><title>The Popup Attribute</title>
+       <p>If you want your nested page flow to run inside a popup window set 
the popup attribute to "true"
+</p>
+<source>      &lt;netui:button type="submit" value="Pick Color" 
action="getColor" <strong>popup="true"</strong>>
+          &lt;netui:configurePopup location="false" width="550" height="150">
+          &lt;/netui:configurePopup>
+      &lt;/netui:button></source>
+
+<p>This attribute is legal on all tags that can raise an action, except for <a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/imageButton.html">&lt;netui:imageButton></a>.
+</p>
+<ol>
+       <li><a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/anchor.html">&lt;netui:anchor></a></li>
+       <li><a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/imageAnchor.html">&lt;netui:imageAnchor></a></li>
+       <li><a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/button.html">&lt;netui:button></a></li>
+       <li><a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/area.html">&lt;netui:area></a></li>
+       </ol>
+<p>Note - <a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/imageButton.html">&lt;netui:imageButton></a>
 should be used for submitting a form *without* javascript.</p>
+</section>
+       <section id="configurePopupTag"><title>The 
&lt;netui:configurePopupTag></title>
+       <p>Use the <a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/configurePopup.html">&lt;netui:configurePopup></a>
+       tag to determine the shape of the popup window.</p>
+       <source>      &lt;netui:button type="submit" value="Pick Color" 
action="getColor" popup="true">
+          <strong>&lt;netui:configurePopup location="false" width="550" 
height="150">
+          &lt;/netui:configurePopup></strong>
+      &lt;/netui:button></source>
+               </section>
+               <section id="retrievePopupOutputTag"><title>The 
&lt;netui:retrievePopupOutput</title>
+                       <p>To access values returned by the nested page flow 
use the <a 
href="../apidocs/taglib/beehive.apache.org/netui/tags-html-1.0/retrievePopupOutput.html">&lt;netui:retrievePopupOutput></a>
 tag,
+for example,</p>
+                       <source>&lt;netui:retrievePopupOutput 
dataSource="outputFormBean.zipCode" tagIdRef="zipCodeField"/></source>
+                       <p>Include multiple instances of the tag to set 
multiple fields.</p>
+                       <p><strong>Note</strong> - the 
&lt;netui:retrievePopupOutput> tag must be nested inside 
+                               the &lt;netui:configurePopup> tag even if the 
&lt;netui:configurePopup> tag has no attributes</p>
+                       <p>The &lt;netui:configurePopup> tag has two 
attributes, <code>dataSource</code>
+                               and <code>tagIdRef</code>, both of which are 
required.  Both accept expressions that
+                               can be evaluated at runtime.</p>
+                       <p><strong>Note</strong> - 
'<code>outputFormBean</code>' is a special binding context 
+                               that applies in this situation.  It is the 
"return value" of the nested page 
+                               flow: It receives the value generated by the 
'outputFormBean' 
+                               (or 'outputFormBeanType') in the returnAction 
forward from the nested page flow. 
+                               This binding context is only legal when used in 
the &lt;netui:retrievePopupOutput> tag.</p>
+                       </section>
+                       <section id="_auto"><title>The <code>_auto</code> 
Global Forward</title>
+                               <p>If you are returning data from the nested 
flow it is passed as a bean to 
+                                       the action in the nesting page flow, 
for example</p>
+                               <source>        @Jpf.Action()
+        public Forward nestedPageFlowGotZip(ZipForm zipForm)
+        {
+            return new Forward("_auto");
+        }</source>
+               <p>Here is what the code looks like in the nested page flow</p> 
+<source>        @Jpf.Action(
+            forwards={
+                @Jpf.Forward(name="success",
+                             returnAction="nestedPageFlowGotZip", 
+                             outputFormBeanType=ZipForm.class
+                )
+            }
+        )
+        public Forward done()
+        {
+            ZipForm returnForm = new ZipCodeForm();
+            returnForm.setZipCode("12345");     // pretend we got this through 
user input
+            return new Forward("success", new ZipForm( "12345" ));
+        }</source>
+               <p>
+The bean returned to the nesting flow is accessed in the page using the 
special data binding 
+context, <code>outputFormBean</code></p>
+               
+                               
+                                       </section>
+       </section>
+       </body>
+</document>
\ No newline at end of file

Propchange: 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/pageflow/popupWindows.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/site.xml
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/site.xml?view=diff&r1=157592&r2=157593
==============================================================================
--- 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/site.xml 
(original)
+++ 
incubator/beehive/trunk/docs/forrest/src/documentation/content/xdocs/site.xml 
Tue Mar 15 13:57:16 2005
@@ -20,6 +20,7 @@
             <pageflow_building label="Building a Web-App" 
href="pageflow/pageflow_building.html"/>
             <pageflow_altering label="Altering a Page Flow" 
href="pageflow/pageflow_altering.html"/>
             <pageflow_sharedFlow label="Shared Flow" 
href="pageflow/sharedFlow.html"/>
+            <pageflow_popups label="Popup Windows" 
href="pageflow/popupWindows.html"/>
             <pageflow_programming label="Page Flow Programming" 
href="pageflow/guide.html"/>
         </pageflow>
         <controls label="Controls">

Added: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.dia
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.dia?view=auto&rev=157593
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.dia
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.png
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.png?view=auto&rev=157593
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_1.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.dia
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.dia?view=auto&rev=157593
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.dia
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.png
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.png?view=auto&rev=157593
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/beehive/trunk/docs/forrest/src/documentation/resources/images/nested_2.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to