You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by me...@apache.org on 2009/05/23 15:08:24 UTC

svn commit: r777907 - in /incubator/click/trunk/click: extras/src/org/apache/click/extras/control/FormTable.java framework/src/org/apache/click/control/Select.java

Author: medgar
Date: Sat May 23 13:08:24 2009
New Revision: 777907

URL: http://svn.apache.org/viewvc?rev=777907&view=rev
Log:
Javadoc updates

Modified:
    incubator/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
    incubator/click/trunk/click/framework/src/org/apache/click/control/Select.java

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java?rev=777907&r1=777906&r2=777907&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java Sat May 23 13:08:24 2009
@@ -65,7 +65,7 @@
  * in the table. Field error messages will be rendered as 'title' attribute
  * tooltip values.
  *
- * <h4>IMPORTANT NOTE</h4>
+ * <h3>IMPORTANT NOTE</h3>
  * Do not populate the FormTable rowList in the Page's <tt>onRender()</tt> method.
  * <p/>
  * When using the FormTable control its rowList property
@@ -411,6 +411,23 @@
     }
 
     /**
+     * Set the list of form table rows. Each row can either be a value object 
+     * (JavaBean) or an instance of a <tt>Map</tt>.
+     * <p/>
+     * <b>Important</b> ensure you set the rowList before control is processed 
+     * so posted object changes can be applied. Do not invoke this method via 
+     * the Page onRender() method, otherwise object updates will not be applied.
+     * <p/>
+     * Please note the rowList is cleared in table {@link #onDestroy()} method
+     * at the end of each request.
+     *
+     * @param rowList the list of table rows to set
+     */
+    public void setRowList(List rowList) {
+        super.setRowList(rowList);
+    }
+
+    /**
      * @see org.apache.click.control.Table#setSortedColumn(java.lang.String)
      *
      * @param columnName the name of the sorted column

Modified: incubator/click/trunk/click/framework/src/org/apache/click/control/Select.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/framework/src/org/apache/click/control/Select.java?rev=777907&r1=777906&r2=777907&view=diff
==============================================================================
--- incubator/click/trunk/click/framework/src/org/apache/click/control/Select.java (original)
+++ incubator/click/trunk/click/framework/src/org/apache/click/control/Select.java Sat May 23 13:08:24 2009
@@ -163,29 +163,39 @@
  * Note in this example the {@link #add(String)} method is used to add an Option
  * item to the Select.
  *
- * <h3>Specify a default value</h3>
+ * <h3>Required Behaviour</h3>
+ * 
+ * When a Select control's required property is set to true, then the user has
+ * to select a value other than the first value in the option list. The  first
+ * value represents a non-selection by the user. In the example below an
+ * Empty Option as set as the first value in the option list.
  *
- * It is often necessary to set a default selected value. This is best done in
- * the {@link org.apache.click.Page#onRender()} method:
  * <pre class="prettyprint">
  * public MyPage extends Page {
+ *     ..
+ *     
  *     private Select mySelect;
  *
  *     public MyPage() {
  *         mySelect = new Select("mySelect");
- *         mySelect.add("YES");
- *         mySelect.add("NO");
+ *         mySelect.setRequired(true);
+ *         
+ *         ..
  *     }
- *
- *     public void onRender() {
- *         // Only specify a default value if the current value is null
- *         if (mySelect.getValue() == null) {
- *             mySelect.setValue("YES");
- *         }
+ *     
+ *     public void onInit() {
+ *         mySelect.add(Option.EMPTY_OPTION);
+ *         List<Customer> customerList = customerDao.getCustomerList();
+ *         mySelect.addAll(customerList, "id", "name");
  *     }
+ *     
+ *     ..
  * }
  * </pre>
  *
+ * Remember always populate the Select option list before it is processed. Do
+ * not populate the option list in a Page's onRender() methods.
+ * 
  * <h3>Readonly Behaviour</h3>
  *
  * Note the &lt;select&gt; HTML element does not support the "readonly" attribute.
@@ -199,6 +209,29 @@
  * <a class="external" target="_blank" title="W3C HTML 4.01 Specification"
  *    href="http://www.w3.org/TR/html401/interact/forms.html#h-17.6">SELECT</a>
  *
+ * <h3>Specify a default value</h3>
+ *
+ * It is often necessary to set a default selected value. This is best done in
+ * the {@link org.apache.click.Page#onRender()} method:
+ * <pre class="prettyprint">
+ * public MyPage extends Page {
+ *     private Select mySelect;
+ *
+ *     public MyPage() {
+ *         mySelect = new Select("mySelect");
+ *         mySelect.add("YES");
+ *         mySelect.add("NO");
+ *     }
+ *
+ *     public void onRender() {
+ *         // Only specify a default value if the current value is null
+ *         if (mySelect.getValue() == null) {
+ *             mySelect.setValue("YES");
+ *         }
+ *     }
+ * }
+ * </pre>
+ *
  * @see Option
  * @see OptionGroup
  *