Author: ivaynberg
Date: Sun Feb  1 22:18:34 2009
New Revision: 739863

URL: http://svn.apache.org/viewvc?rev=739863&view=rev
Log:
WICKET-1545

Modified:
    
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
    
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java?rev=739863&r1=739862&r2=739863&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
 Sun Feb  1 22:18:34 2009
@@ -32,6 +32,17 @@
  * org.apache.wicket.markup.html.form.CheckGroup.
  * 
  * Must be attached to an <input type="checkbox" ... > markup.
+ * <p>
+ * STATELESS NOTES: By default this component cannot be used inside a 
stateless form. If it is
+ * desirable to use this inside a stateless form then
+ * <ul>
+ * <li>
+ * override #getValue() and return some stateless value to uniquely identify 
this radio (eg relative
+ * component path from group to this radio)</li>
+ * <li>
+ * override {...@link #getStatelessHint()} and return <code>true</code></li>
+ * </ul>
+ * </p>
  * 
  * @see org.apache.wicket.markup.html.form.CheckGroup
  * 
@@ -73,7 +84,7 @@
         * 
         * @return form submission value
         */
-       public final String getValue()
+       public String getValue()
        {
                if (uuid < 0)
                {
@@ -82,6 +93,12 @@
                return "check" + uuid;
        }
 
+       /** {...@inheritdoc} */
+       protected boolean getStatelessHint()
+       {
+               // because we use uuid field this cannot be stateless
+               return false;
+       }
 
        /**
         * @see Component#onComponentTag(ComponentTag)
@@ -101,7 +118,7 @@
                if (group == null)
                {
                        throw new WicketRuntimeException("Check component [" + 
getPath() +
-                                       "] cannot find its parent CheckGroup");
+                               "] cannot find its parent CheckGroup");
                }
 
                final String uuid = getValue();
@@ -118,7 +135,7 @@
                if (collection == null)
                {
                        throw new WicketRuntimeException("CheckGroup [" + 
group.getPath() +
-                                       "] contains a null model object, must 
be an object of type java.util.Collection");
+                               "] contains a null model object, must be an 
object of type java.util.Collection");
                }
 
                if (group.hasRawInput())
@@ -166,8 +183,8 @@
                                // NOTE: do not encode the url as that would 
give invalid
                                // JavaScript
                                tag.put("onclick", "window.location.href='" + 
url +
-                                               (url.toString().indexOf('?') > 
-1 ? "&amp;" : "?") + group.getInputName() +
-                                               "=' + this.value;");
+                                       (url.toString().indexOf('?') > -1 ? 
"&amp;" : "?") + group.getInputName() +
+                                       "=' + this.value;");
                        }
                }
 

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java?rev=739863&r1=739862&r2=739863&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
 Sun Feb  1 22:18:34 2009
@@ -29,6 +29,17 @@
  * Component representing a single radio choice in a 
org.apache.wicket.markup.html.form.RadioGroup.
  * 
  * Must be attached to an &lt;input type=&quot;radio&quot; ... &gt; markup.
+ * <p>
+ * STATELESS NOTES: By default this component cannot be used inside a 
stateless form. If it is
+ * desirable to use this inside a stateless form then
+ * <ul>
+ * <li>
+ * override #getValue() and return some stateless value to uniquely identify 
this radio (eg relative
+ * component path from group to this radio)</li>
+ * <li>
+ * override {...@link #getStatelessHint()} and return <code>true</code></li>
+ * </ul>
+ * </p>
  * 
  * @see org.apache.wicket.markup.html.form.RadioGroup
  * 
@@ -70,7 +81,7 @@
         * 
         * @return form submission value
         */
-       public final String getValue()
+       public String getValue()
        {
                if (uuid < 0)
                {
@@ -79,6 +90,11 @@
                return "radio" + uuid;
        }
 
+       protected boolean getStatelessHint()
+       {
+               // because we use uuid field this cannot be stateless
+               return false;
+       }
 
        /**
         * @see Component#onComponentTag(ComponentTag)


Reply via email to