You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/06/18 06:09:23 UTC

svn commit: r548201 - in /incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form: Check.java FormComponent.java ILabelProvider.java LabeledWebMarkupContainer.java Radio.java

Author: almaw
Date: Sun Jun 17 21:09:22 2007
New Revision: 548201

URL: http://svn.apache.org/viewvc?view=rev&rev=548201
Log:
Let us still chain together things.

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ILabelProvider.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/LabeledWebMarkupContainer.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java?view=diff&rev=548201&r1=548200&r2=548201
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Check.java Sun Jun 17 21:09:22 2007
@@ -169,4 +169,16 @@
 
 	}
 
+	/**
+	 * The value will be made available to the validator property by means of
+	 * ${label}. It does not have any specific meaning to Check itself.
+	 * 
+	 * @param labelModel
+	 * @return this for chaining
+	 */
+	public Check setLabel(IModel labelModel)
+	{
+		setLabelInternal(labelModel);
+		return this;
+	}
 }

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java?view=diff&rev=548201&r1=548200&r2=548201
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/FormComponent.java Sun Jun 17 21:09:22 2007
@@ -868,6 +868,19 @@
 			updateModel();
 		}
 	}
+	
+	/**
+	 * The value will be made available to the validator property by means of
+	 * ${label}. It does not have any specific meaning to FormComponent itself.
+	 * 
+	 * @param labelModel
+	 * @return this for chaining
+	 */
+	public FormComponent setLabel(IModel labelModel)
+	{
+		setLabelInternal(labelModel);
+		return this;
+	}
 
 	/**
 	 * Sets the value for a form component this value will be split the string

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ILabelProvider.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ILabelProvider.java?view=diff&rev=548201&r1=548200&r2=548201
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ILabelProvider.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/ILabelProvider.java Sun Jun 17 21:09:22 2007
@@ -32,13 +32,4 @@
 	 * @return labelModel
 	 */
 	public IModel getLabel();
-
-	/**
-	 * The value will be made available to the validator property by means of
-	 * ${label}. It does not have any specific meaning to FormComponent itself.
-	 * 
-	 * @param labelModel
-	 * @return this for chaining
-	 */
-	public ILabelProvider setLabel(IModel labelModel);
 }

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/LabeledWebMarkupContainer.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/LabeledWebMarkupContainer.java?view=diff&rev=548201&r1=548200&r2=548201
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/LabeledWebMarkupContainer.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/LabeledWebMarkupContainer.java Sun Jun 17 21:09:22 2007
@@ -30,9 +30,8 @@
 			ILabelProvider
 {
 	/**
-	 * The value will be made available to the validator property by means
-	 * of ${label}. It does not have any specific meaning to FormComponent
-	 * itself.
+	 * The value will be made available to the validator property by means of
+	 * ${label}. It does not have any specific meaning to FormComponent itself.
 	 */
 	private IModel labelModel = null;
 
@@ -61,15 +60,22 @@
 	}
 
 	/**
-	 * @see org.apache.wicket.markup.html.form.ILabelProvider#setLabel(org.apache.wicket.model.IModel)
+	 * Provide internal setter. We need this because people want to be able to
+	 * chain together our setters in FormComponent, etc. e.g. for
+	 * .setLabel(foo).setRequired()
+	 * 
+	 * TODO: When we move to JDK5 and covariant return types, we can push this
+	 * into ILabelProvider and still make chaining in FormComponent work
+	 * properly.
+	 * 
+	 * @param labelModel
 	 */
-	public ILabelProvider setLabel(IModel labelModel)
+	protected void setLabelInternal(IModel labelModel)
 	{
 		if (labelModel instanceof IComponentAssignedModel)
 		{
 			labelModel = ((IComponentAssignedModel)labelModel).wrapOnAssignment(this);
 		}
 		this.labelModel = labelModel;
-		return this;
 	}
 }

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java?view=diff&rev=548201&r1=548200&r2=548201
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Radio.java Sun Jun 17 21:09:22 2007
@@ -150,4 +150,17 @@
 			tag.put(ATTR_DISABLED, ATTR_DISABLED);
 		}
 	}
+	
+	/**
+	 * The value will be made available to the validator property by means of
+	 * ${label}. It does not have any specific meaning to Radio itself.
+	 * 
+	 * @param labelModel
+	 * @return this for chaining
+	 */
+	public Radio setLabel(IModel labelModel)
+	{
+		setLabelInternal(labelModel);
+		return this;
+	}
 }