You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2009/02/01 23:15:37 UTC

svn commit: r739862 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form: Check.java Radio.java

Author: ivaynberg
Date: Sun Feb  1 22:15:36 2009
New Revision: 739862

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

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
    wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java?rev=739862&r1=739861&r2=739862&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java Sun Feb  1 22:15:36 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
  * 
@@ -104,7 +115,7 @@
 	 * 
 	 * @return form submission value
 	 */
-	public final String getValue()
+	public String getValue()
 	{
 		if (uuid < 0)
 		{
@@ -114,7 +125,7 @@
 	}
 
 	@SuppressWarnings("unchecked")
-	private CheckGroup<T> getGroup()
+	protected CheckGroup<T> getGroup()
 	{
 		CheckGroup<T> group = this.group;
 		if (group == null)
@@ -288,5 +299,12 @@
 		setDefaultModelObject(object);
 	}
 
+	/** {@inheritDoc} */
+	@Override
+	protected boolean getStatelessHint()
+	{
+		// because this component uses uuid field it cannot be stateless
+		return false;
+	}
 
 }

Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java?rev=739862&r1=739861&r2=739862&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java (original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java Sun Feb  1 22:15:36 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
  * 
@@ -71,6 +82,7 @@
 	}
 
 	/**
+	 * @param id
 	 * @param group
 	 *            parent {@link RadioGroup}
 	 * @see WebMarkupContainer#WebMarkupContainer(String)
@@ -101,7 +113,7 @@
 	 * 
 	 * @return form submission value
 	 */
-	public final String getValue()
+	public String getValue()
 	{
 		if (uuid < 0)
 		{
@@ -122,7 +134,7 @@
 
 
 	@SuppressWarnings("unchecked")
-	private RadioGroup<T> getGroup()
+	protected RadioGroup<T> getGroup()
 	{
 		RadioGroup<T> group = this.group;
 		if (group == null)
@@ -270,5 +282,12 @@
 		setDefaultModelObject(object);
 	}
 
+	/** {@inheritDoc} */
+	@Override
+	protected boolean getStatelessHint()
+	{
+		// because we keep uuid this component cannot be stateless
+		return false;
+	}
 
 }