Author: dolander
Date: Tue Aug 30 12:31:17 2005
New Revision: 264835

URL: http://svn.apache.org/viewcvs?rev=264835&view=rev
Log:
Add an Form Controls example to the documentation


Added:
    
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
   (with props)
Modified:
    
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
    beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml

Modified: 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
URL: 
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml?rev=264835&r1=264834&r2=264835&view=diff
==============================================================================
--- 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
 (original)
+++ 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControls.xml
 Tue Aug 30 12:31:17 2005
@@ -8,7 +8,14 @@
     <body>
         <section id="Intro">
             <title>NetUI Form Control Tags</title>
-            <p></p>
+            <p> The following table summarizes the two basic NetUI tags which 
render as form controls.  There
+                are basic types, simple controls and group controls.  The 
simple controls map directly
+                to a single HTML element.  The group controls map to more than 
one HTML element, for example
+                an <code>&lt;select></code> and <code>&lt;option></code> 
elements represent a select box.
+                In addition, the table summarizes the natural data type the 
control is usually bound to.
+                Typicall, a form will post to an action that recieves a 
subclass of <code>FormData</code>
+                which is populated with the values from the form by the 
framework before the action is called.
+            </p>
             <table>
                 <tr><th>NetUI Form Control</th><th>Binding Data Type</th>
                 </tr>
@@ -29,7 +36,12 @@
                 
<tr><td>&lt;netui:textArea></td><td><code>java.lang.String[]</code></td></tr>
                 
<tr><td>&lt;netui:textBox></td><td><code>java.lang.String[]</code></td></tr>
             </table>
-            <p></p>
+            <section id="ExampleLink">
+                <title>NetUI Form Controls Example</title>
+                 <p>All of the code fragments in this topic come from a single 
example.  The example
+                    source can be found in the <a 
href="site:pageflow_tag_formControls_example">Form Controls Example</a>.
+                </p>
+            </section>
             <section id="Anchor">
                 <title>Anchor</title>
                 <p> Though not technically a form control, the 
<code>&lt;netui:anchor></code> can be used to
@@ -94,7 +106,7 @@
     <tr><th align="right">CheckBox [java.lang.String]</th><td><netui:checkBox 
dataSource="actionForm.checkBoxString"/></td></tr>
 </table>
 ]]></source>
-                <p> In the action form, the following three properties are 
being bound to by the above
+                <p> In the <code>FormData</code>, the following three 
properties are being bound to by the above
                     NetUI tags.
                 </p>
                 <source>
@@ -140,7 +152,7 @@
                 </p>
                 <p> In the following example, the a CheckBoxGroup contains 
four children defined
                     through options.  When the form is posted, all of the 
values that are selected
-                    (checked) will be posted back to an array in the action 
form.
+                    (checked) will be posted back to an array in the 
<code>FormData</code>.
                 </p>
                 <source><![CDATA[
 <netui:checkBoxGroup dataSource="actionForm.checkBoxGroup" 
orientation="vertical">
@@ -150,7 +162,7 @@
     <netui:checkBoxOption value="Check Four"/>
 </netui:checkBoxGroup>
 ]]></source>
-                <p> The following property in the action form will recieve the 
results of the
+                <p> The following property in the <code>FormData</code> will 
recieve the results of the
                     posted CheckBoxGroup.
                 </p>
                 <source>

Added: 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
URL: 
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml?rev=264835&view=auto
==============================================================================
--- 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
 (added)
+++ 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
 Tue Aug 30 12:31:17 2005
@@ -0,0 +1,391 @@
+<?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>Form Controls Example</title>
+    </header>
+    <body>
+        <section id="Intro">
+            <title>Form Controls Example</title>
+            <p>This is a full example of all of the NetUI form control tags.  
In the exampe, the
+                <code>formTest.jsp</code> page defines a single form 
containing all of the
+                NetUI form controls.  When this form is posted, the 
<code>submit</code>
+                action is called.  This will simply pass the form as a page 
input to the <code>results.jsp</code>
+                where the full results are displayed.  The example contains 
table layout to make the
+                example a bit more readable.
+            </p>
+        </section>
+        <section id="Controller">
+            <title><code>Controller.jpf</code></title>
+            <p>
+            </p>
+            <source><![CDATA[
+package formControls;
+
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
+
+import org.apache.beehive.netui.pageflow.PageFlowController;
+import org.apache.beehive.netui.pageflow.Forward;
+import org.apache.beehive.netui.pageflow.FormData;
+import org.apache.struts.upload.FormFile;
+
[EMAIL PROTECTED](
+    simpleActions={
+        @Jpf.SimpleAction(name="begin", path="formTest.jsp")
+    }
+)
+public class Controller extends PageFlowController
+{
+    private String hidden = "Hidden Field";
+    private String[] hiddenArray = {"Hidden One", "Hidden Two"};
+    private boolean hiddenBoolean = true;
+
+
+    // Hidden dataInput properties
+    public String getHidden() {
+        return hidden;
+    }
+    public String[] getHiddenArray() {
+        return hiddenArray;
+    }
+    public boolean isHiddenBoolean() {
+        return hiddenBoolean;
+    }
+
+    @Jpf.Action(
+        [EMAIL PROTECTED](name="success",
+                               path="results.jsp",
+                               [EMAIL PROTECTED](name="bean", 
type=FormBean.class, required=true)}
+                              )
+        }
+    )
+    public Forward submit(FormBean formBean) {
+        Forward fwd = new Forward("success", "bean", formBean);
+        return fwd;
+    }
+
+    public static class FormBean extends FormData
+    {
+        // checkbox dataSources
+        private boolean checkBox;
+        private Boolean checkBoxBoolean;
+        private String  checkBoxString;
+
+        public boolean isCheckBox() {
+            return checkBox;
+        }
+        public void setCheckBox(boolean checkBox) {
+            this.checkBox = checkBox;
+        }
+
+        public Boolean getCheckBoxBoolean() {
+            return checkBoxBoolean;
+        }
+        public void setCheckBoxBoolean(Boolean checkBoxBoolean) {
+            this.checkBoxBoolean = checkBoxBoolean;
+        }
+
+        public String getCheckBoxString() {
+            return checkBoxString;
+        }
+        public void setCheckBoxString(String checkBoxString) {
+            this.checkBoxString = checkBoxString;
+        }
+
+        //checkBoxGroup
+        private String[] checkBoxGroup;
+
+        public String[] getCheckBoxGroup() {
+            return checkBoxGroup;
+        }
+        public void setCheckBoxGroup(String[] checkBoxGroup) {
+            this.checkBoxGroup = checkBoxGroup;
+        }
+
+        // fileUpdate
+        private FormFile fileUpload;
+
+        public FormFile getFileUpload() {
+            return fileUpload;
+        }
+        public void setFileUpload(FormFile fileUpload) {
+            this.fileUpload = fileUpload;
+        }
+
+        // hidden
+        private String hidden;
+        private String[] hiddenArray;
+        private boolean hiddenBoolean;
+
+        public String getHidden() {
+            return hidden;
+        }
+        public void setHidden(String hidden) {
+            this.hidden = hidden;
+        }
+
+        public String[] getHiddenArray() {
+            return hiddenArray;
+        }
+        public void setHiddenArray(String hiddenArray[]) {
+            this.hiddenArray = hiddenArray;
+        }
+
+        public boolean isHiddenBoolean() {
+            return hiddenBoolean;
+        }
+        public void setHiddenBoolean(boolean hiddenBoolean) {
+            this.hiddenBoolean = hiddenBoolean;
+        }
+
+        // radioButtonGroup
+        private String radioButtonGroup;
+
+        public String getRadioButtonGroup() {
+            return radioButtonGroup;
+        }
+        public void setRadioButtonGroup(String radioButtonGroup) {
+            this.radioButtonGroup = radioButtonGroup;
+        }
+
+        // select
+        private String singleSelect;
+        private String[] multiSelect;
+
+        public String getSingleSelect() {
+            return singleSelect;
+        }
+        public void setSingleSelect(String singleSelect) {
+            this.singleSelect = singleSelect;
+        }
+
+        public String[] getMultiSelect() {
+            return multiSelect;
+        }
+        public void setMultiSelect(String[] multiSelect) {
+            this.multiSelect = multiSelect;
+        }
+
+        // textArea
+        private String textArea;
+
+        public String getTextArea() {
+            return textArea;
+        }
+        public void setTextArea(String textArea) {
+            this.textArea = textArea;
+        }
+
+        // textBox
+        private String textBox;
+
+        public String getTextBox() {
+            return textBox;
+        }
+        public void setTextBox(String textBox) {
+            this.textBox = textBox;
+        }
+    }
+}
+
+]]></source>
+        </section>
+        <section id="FormTest">
+            <title>formText.jsp</title>
+            <p>
+            </p>
+            <source><![CDATA[
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"; prefix="netui" 
%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"; 
prefix="db"%>
+
+<netui:html>
+    <head>
+        <title>Form Test</title>
+        <netui:base />
+    </head>
+    <netui:body>
+        <h4>Form Test</h4>
+        <p style="color:green">This test maps all of the basic types of NetUI 
form controls to their
+            underlying data types.
+        </p>
+        <netui:form action="submit"  enctype="multipart/form-data">
+            <table border='1' cellspacing="0" cellpadding="0">
+                <tr><td valign="top">
+                    <h4 style="color:blue">CheckBox</h4>
+                    <table>
+                        <tr><th align="right">CheckBox 
[boolean]</th><td><netui:checkBox dataSource="actionForm.checkBox"/></td></tr>
+                        <tr><th align="right">CheckBox 
[java.lang.Boolean]</th><td><netui:checkBox 
dataSource="actionForm.checkBoxBoolean"/></td></tr>
+                        <tr><th align="right">CheckBox 
[java.lang.String]</th><td><netui:checkBox 
dataSource="actionForm.checkBoxString"/></td></tr>
+                    </table>
+                </td><td valign="top">
+                    <h4 style="color:blue">CheckBoxGroup</h4>
+                    <table>
+                        <tr><th align="right" 
valign="top">CheckBoxGroup</th><td>
+                        <netui:checkBoxGroup 
dataSource="actionForm.checkBoxGroup" orientation="vertical">
+                            <netui:checkBoxOption value="Check One"/>
+                            <netui:checkBoxOption value="Check Two"/>
+                            <netui:checkBoxOption value="Check Three"/>
+                            <netui:checkBoxOption value="Check Four"/>
+                        </netui:checkBoxGroup>
+                        </td></tr>
+                    </table>
+                </td></tr>
+                <tr><td valign="top">
+                    <h4 style="color:blue">FileUpload</h4>
+                    <table>
+                        <tr><th 
align="right">FileUpload</th><td><netui:fileUpload 
dataSource="actionForm.fileUpload"/></td></tr>
+                    </table>
+                </td><td valign="top">
+                    <h4 style="color:blue">Hidden</h4>
+                    <table>
+                        <tr><th align="right">Hidden</th><td><netui:hidden 
dataInput="${pageFlow.hidden}"  dataSource="actionForm.hidden"/></td></tr>
+                        <tr><th align="right">Hidden 
Array[0]</th><td><netui:hidden dataInput="${pageFlow.hiddenArray[0]}"  
dataSource="actionForm.hiddenArray"/></td></tr>
+                        <tr><th align="right">Hidden 
Array[1]</th><td><netui:hidden dataInput="${pageFlow.hiddenArray[1]}"  
dataSource="actionForm.hiddenArray"/></td></tr>
+                        <tr><th align="right">Hidden</th><td><netui:hidden 
dataInput="${pageFlow.hiddenBoolean}"  
dataSource="actionForm.hiddenBoolean"/></td></tr>
+                    </table>
+                </td></tr>
+                <tr><td valign="top">
+                    <h4 style="color:blue">RadioButtonGroup</h4>
+                    <table>
+                       <tr><th align="right" 
valign="top">RadioButtonGroup</th><td>
+                        <netui:radioButtonGroup 
dataSource="actionForm.radioButtonGroup" orientation="vertical">
+                            <netui:radioButtonOption value="Radio One"/>
+                            <netui:radioButtonOption value="Radio Two"/>
+                            <netui:radioButtonOption value="Radio Three"/>
+                            <netui:radioButtonOption value="Radio Four"/>
+                        </netui:radioButtonGroup>
+                        </td></tr>
+                     </table>
+                </td><td valign="top">
+                    <h4 style="color:blue">Select</h4>
+                    <table>
+                        <tr><th align="right">SingleSelect</th><td>
+                            <netui:select dataSource="actionForm.singleSelect">
+                                <netui:selectOption value="SelectOne">Select 
One</netui:selectOption>
+                                <netui:selectOption value="SelectTwo">Select 
Two</netui:selectOption>
+                                <netui:selectOption value="SelectThree">Select 
Three</netui:selectOption>
+                                <netui:selectOption value="SelectFour">Select 
Four</netui:selectOption>
+                            </netui:select>
+                        </td></tr>
+                        <tr><th align="right">MulitSelect</th><td>
+                            <netui:select multiple="true"  
dataSource="actionForm.multiSelect">
+                                <netui:selectOption value="SelectOne">Select 
One</netui:selectOption>
+                                <netui:selectOption value="SelectTwo">Select 
Two</netui:selectOption>
+                                <netui:selectOption value="SelectThree">Select 
Three</netui:selectOption>
+                                <netui:selectOption value="SelectFour">Select 
Four</netui:selectOption>
+                            </netui:select>
+                        </td></tr>
+                    </table>
+                </td></tr>
+                <tr><td valign="top">
+                    <h4 style="color:blue">TextArea</h4>
+                    <p><netui:textArea dataSource="actionForm.textArea" /></p>
+                </td><td valign="top">
+                     <h4 style="color:blue">TextBox</h4>
+                     <p><netui:textBox dataSource="actionForm.textBox" /></p>
+                </td></tr>
+                <tr><th align="right">Button</th><td><netui:button 
type="submit">Submit the Form</netui:button></td></tr>
+                <tr><th align="right">ImageButton</th><td><netui:imageButton  
src="insert.gif"/></td></tr>
+                <tr><th align="right">Anchor</th><td><netui:anchor  
formSubmit="true">Submit Form Through a Link</netui:anchor></td></tr>
+            </table>
+        </netui:form>
+        </netui:body>
+</netui:html>
+
+
+]]></source>
+        </section>
+        <section id="Results">
+            <title>results.jsp</title>
+            <p>
+            </p>
+            <source><![CDATA[
+<%@ page language="java" contentType="text/html;charset=UTF-8"%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0"; prefix="netui" 
%>
+<%@ taglib uri="http://beehive.apache.org/netui/tags-databinding-1.0"; 
prefix="netui-data"%>
+<netui-data:declarePageInput name="bean" type="FormBean" />
+<netui:html>
+    <head>
+        <title>Form Post Results</title>
+        <netui:base/>
+    </head>
+    <netui:body>
+        <h4>Form Post Requests</h4>
+        <p style="color:green">This page displays the results of the form 
post.  The posted form
+            is passed to the page as a PageInput.  We then bind to the 
pageInput and display all
+            of the resulting values.
+        </p>
+        <table border='1' cellspacing="0" cellpadding="0">
+            <tr><td valign="top">
+                <h4 style="color:blue">CheckBox</h4>
+                <table>
+                    <tr><th align="right">CheckBox 
[boolean]</th><td>${pageInput.bean.checkBox}</td></tr>
+                    <tr><th align="right">CheckBox 
[java.lang.Boolean]</th><td>${pageInput.bean.checkBoxBoolean}</td></tr>
+                    <tr><th align="right">CheckBox 
[java.lang.String]</th><td>${pageInput.bean.checkBoxString}</td></tr>
+                </table>
+            </td><td valign="top">
+                <h4 style="color:blue">CheckBoxGroup</h4>
+                <table>
+                    <netui-data:repeater 
dataSource="pageInput.bean.checkBoxGroup">
+                        <tr><td>${container.item}</td></tr>
+                    </netui-data:repeater>
+                </table>
+            </td></tr>
+            <tr><td valign="top">
+                <h4 style="color:blue">FileUpload</h4>
+                <p>
+                File Name: ${pageInput.bean.fileUpload.fileName}<br>
+                File Size: ${pageInput.bean.fileUpload.fileSize}<br>
+                </p>
+            </td><td valign="top">
+                <h4 style="color:blue">Hidden</h4>
+                <table>
+                    <tr><th 
align="right">Hidden</th><td>${pageInput.bean.hidden}</td></tr>
+                    <tr><th align="right">Hidden 
Array[0]</th><td>${pageInput.bean.hiddenArray[0]}</td></tr>
+                    <tr><th align="right">Hidden 
Array[1]</th><td>${pageInput.bean.hiddenArray[1]}</td></tr>
+                    <tr><th 
align="right">HiddenBoolean</th><td>${pageInput.bean.hiddenBoolean}</td></tr>
+                </table>
+            </td></tr>
+            <tr><td valign="top">
+                <h4 style="color:blue">RadioButtonGroup</h4>
+                <table>
+                    <netui-data:repeater 
dataSource="pageInput.bean.radioButtonGroup">
+                        <tr><td>${container.item}</td></tr>
+                    </netui-data:repeater>
+                </table>
+            </td><td valign="top">
+                <h4 style="color:blue">Select</h4>
+                <table>
+                    <tr><th 
align="right">SingleSelect</th><td>${pageInput.bean.singleSelect}</td></tr>
+                    <tr><th align="right">SingleSelect</th>
+                        <td>
+                            <table>
+                                <netui-data:repeater 
dataSource="pageInput.bean.multiSelect">
+                                    <tr><td>${container.item}</td></tr>
+                                </netui-data:repeater>
+                            </table>
+                        </td></tr>
+                </table>
+             </td></tr>
+            <tr><td valign="top">
+                <h4 style="color:blue">TextArea</h4>
+                <p>
+                ${pageInput.bean.textArea}<br>
+                </p>
+            </td><td valign="top">
+                <h4 style="color:blue">TextBox</h4>
+                <p>
+                ${pageInput.bean.textBox}<br>
+                </p>
+             </td></tr>
+        </table>
+        <netui:anchor action="begin">Return to Form</netui:anchor>
+    </netui:body>
+</netui:html>
+
+]]></source>
+        </section>
+    </body>
+</document>
\ No newline at end of file

Propchange: 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/tagsFormControlsExample.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
URL: 
http://svn.apache.org/viewcvs/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml?rev=264835&r1=264834&r2=264835&view=diff
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml 
(original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml 
Tue Aug 30 12:31:17 2005
@@ -38,6 +38,7 @@
                     <pageflow_tag_formControls_checkbox href="#CheckBox" />
                     <pageflow_tag_formControls_checkboxgroup 
href="#CheckBoxGroup" />
                 </pageflow_tag_formControls>
+                <pageflow_tag_formControls_example 
href="netui/tagsFormControlsExample.html"/>
                 <pageflow_tag_xhtml label="HTML/XHTML Support" 
href="netui/tagsXhtml.html">
                     <pageflow_tagsXhtml_HtmlTag href="#HtmlTag" />
                     <pageflow_tagsXhtml_BodyTag href="#BodyTag" />


Reply via email to