tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dso...@apache.org
Subject svn commit: r278801 - in /jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference: Option.xml Select.xml
Date Mon, 05 Sep 2005 17:17:27 GMT
Author: dsolis
Date: Mon Sep  5 10:17:19 2005
New Revision: 278801

URL: http://svn.apache.org/viewcvs?rev=278801&view=rev
Log:
Documentation for Select and Option components (thanks to Pierre-Yves Nicolas).

Modified:
    jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Option.xml
    jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Select.xml

Modified: jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Option.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Option.xml?rev=278801&r1=278800&r2=278801&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Option.xml
(original)
+++ jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Option.xml
Mon Sep  5 10:17:19 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- 
+<!--
    Copyright 2004, 2005 The Apache Software Foundation
 
    Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,47 +25,77 @@
   <header>
     <title>Option</title>
   </header>
-  
+
   <body>
 
-<p> <strong>THIS PAGE UNDER CONSTRUCTION</strong>
-</p>
+  <p>
+  A component that renders an HTML &lt;option&gt; form element. The
+  Option component must be wrapped by a &Select; component.
+  For a fully worked example showing the Option component, please refer to the &Select;
documentation.
+  </p>
 
 <p>
-  <strong>See also:</strong> 
+  <strong>See also: <link href="&apiroot;/form/Option.html">org.apache.tapestry.form.Option</link>,
&Form;, &PropertySelection;, &Select;</strong>
+
 </p>
 
 <section>
   <title>Parameters</title>
-  
+
 <table>
-  <tr> 
+  <tr>
     <th>Name</th>
     <th>Type</th>
 	  <th>Direction</th>
-    <th>Required</th> 
+
+    <th>Required</th>
     <th>Default</th>
     <th>Description</th>
   </tr>
+  <tr>
+    <td>selected</td>
+    <td>boolean</td>
+
+    <td>in-out</td>
+    <td>yes</td>
+    <td></td>
+    <td>
+       	Used to indicate whether the given option is selected.
+    </td>
+  </tr>
+  <tr>
+
+    <td>label</td>
+    <td>String</td>
+    <td>in</td>
+    <td>no</td>
+    <td></td>
+    <td>
+      A string which represents the option that may be selected. This is optional; any text
that follows the &lt;option&gt; tag is considered the label,
+      but this saves the designer from including one more &Insert; component.
+    </td>
+
+  </tr>
+</table>
 
-	</table>
-  
 <p>
-  Body: <strong>removed / allowed</strong>
-</p>  
+  Body: <strong>allowed</strong>
+</p>
 
 <p>
-  Informal parameters: <strong>allowed  / forbidden</strong>
+  Informal parameters: <strong>allowed</strong>
 </p>
 
 <p>
-  Reserved parameters: <em>none</em>
+  Reserved parameters: <em>value</em>
 </p>
 
 </section>
 
 <section>
   <title>Examples</title>
+
+  <p> Please see the documentation for the &Select; component.</p>
 
 </section>
 </body>

Modified: jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Select.xml
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Select.xml?rev=278801&r1=278800&r2=278801&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Select.xml
(original)
+++ jakarta/tapestry/trunk/framework/src/documentation/content/xdocs/tapestry/ComponentReference/Select.xml
Mon Sep  5 10:17:19 2005
@@ -1,5 +1,5 @@
 <?xml version="1.0"?>
-<!-- 
+<!--
    Copyright 2004, 2005 The Apache Software Foundation
 
    Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,47 +25,149 @@
   <header>
     <title>Select</title>
   </header>
-  
+
   <body>
 
-<p> <strong>THIS PAGE UNDER CONSTRUCTION</strong>
-</p>
+<p>Implements a component that manages an HTML &lt;select&gt; form element.
+The Select component can take the form of a drop down list (default) or a list selection
box if the "multiple" parameter is set to true.
+The Select component must wrap around &Option; components within a &Form;.</p>
+<p>Unless multiple selections are required, it is generally easier to use the &PropertySelection;
component.</p>
 
 <p>
-  <strong>See also:</strong> 
+  <strong>See also: <link href="&apiroot;/form/Select.html">org.apache.tapestry.form.Select</link>,
&Form;, &Option;, &RadioGroup;, &Radio;, &PropertySelection;</strong>
+
 </p>
 
 <section>
   <title>Parameters</title>
-  
+
 <table>
-  <tr> 
+  <tr>
     <th>Name</th>
     <th>Type</th>
-	  <th>Direction</th>
-    <th>Required</th> 
+    <th>Direction</th>
+
+    <th>Required</th>
     <th>Default</th>
     <th>Description</th>
   </tr>
+  <tr>
+    <td>multiple</td>
+    <td>boolean</td>
+
+    <td>in</td>
+    <td>no</td>
+    <td>false</td>
+    <td>
+      If true, the component allows multiple selection.
+    </td>
+  </tr>
+  <tr>
+
+    <td>disabled</td>
+    <td>boolean</td>
+    <td>in</td>
+    <td>no</td>
+    <td>false</td>
+    <td>
+
+      Controls whether the select is active or not. Corresponds to the "disabled" HTML attribute.
+    </td>
+  </tr>
+  <tr>
+    <td>displayName</td>
+    <td>String</td>
+    <td>in</td>
+    <td>no</td>
+
+    <td></td>
+    <td>
+      The user-presentable name for the component, which will be used by a &FieldLabel;
connected to the component.
+    </td>
+  </tr>
+  <tr>
+    <td>validators</td>
+    <td>Array or collection of &Validator;, or &Validator;</td>
+
+    <td>in</td>
+    <td>no</td>
+    <td></td>
+    <td>
+      The validators to apply to the component. In many cases, a "validators" binding can
help.
+    </td>
+  </tr>
+  <tr>
+
+    <td>id</td>
+    <td>String</td>
+    <td>in</td>
+    <td>no</td>
+    <td></td>
+    <td>
+      Sets the id attribute for the rendered &lt;select&gt; element.
+    </td>
+
+  </tr>
+</table>
 
-	</table>
-  
 <p>
-  Body: <strong>removed / allowed</strong>
-</p>  
+  Body: <strong>allowed</strong>
+</p>
 
 <p>
-  Informal parameters: <strong>allowed  / forbidden</strong>
+  Informal parameters: <strong>allowed</strong>
 </p>
 
 <p>
-  Reserved parameters: <em>none</em>
+  Reserved parameters: <em>name</em>
 </p>
 
 </section>
 
 <section>
   <title>Examples</title>
+
+<p>In the following example, a user can select several colors (and, because of the
validator, he must select at least one).</p>
+
+<source><![CDATA[
+<form jwcid="@Form" listener="listener:formSubmit">
+ <span jwcid="@FieldLabel" field="component:colorChooser" displayName="Choose a color">Color</span>
+ <select jwcid="colorChooser@Select" multiple="ognl:true" validators="validators:required">
+  <span jwcid="@Foreach" source="ognl:colors" value="ognl:currentColor" index="ognl:currentColorIndex">
+   <option jwcid="@Option" selected="ognl:selection[currentColorIndex]" label="ognl:currentColor"/>
+  </span>
+ </select>
+ <input type="submit"/>
+</form>
+]]></source>
+
+<source><![CDATA[
+public abstract class ColorChooser extends BasePage implements PageBeginRenderListener{
+
+  private String[] colors = {"blue", "red", "green", "yellow"};
+
+  public abstract int getCurrentColorIndex();
+  public abstract String getCurrentColor();
+  public abstract boolean[] getSelection();
+  public abstract void setSelection(boolean[] selection);
+
+  public String[] getColors() {
+    return colors;
+  }
+
+  public void formSubmit() {
+    // process form
+
+  }
+
+  public void pageBeginRender(PageEvent event) {
+    if (getSelection() == null) {
+      setSelection(new boolean[colors.length]);
+    }
+  }
+
+}
+]]></source>
 
 </section>
 </body>



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


Mime
View raw message