wicket-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ivaynb...@apache.org
Subject svn commit: r906807 - in /wicket/trunk/wicket/src/main/java/org/apache/wicket: ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java markup/html/form/Check.java markup/html/form/Radio.java
Date Fri, 05 Feb 2010 04:13:38 GMT
Author: ivaynberg
Date: Fri Feb  5 04:13:37 2010
New Revision: 906807

URL: http://svn.apache.org/viewvc?rev=906807&view=rev
Log:
WICKET-2510
Issue: WICKET-2510

Modified:
    wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
    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/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java?rev=906807&r1=906806&r2=906807&view=diff
==============================================================================
--- wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
(original)
+++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ajax/form/AjaxFormChoiceComponentUpdatingBehavior.java
Fri Feb  5 04:13:37 2010
@@ -70,7 +70,7 @@
 		asb.append(" for (var i = 0 ; i < inputNodes.length ; i ++) {\n");
 		asb.append(" var inputNode = inputNodes[i];\n");
 		asb.append(" if (!inputNode.type) continue;\n");
-		asb.append(" if (!(inputNode.id.indexOf(markupId+'-')===0)) continue;\n");
+		asb.append(" if (!(inputNode.className.indexOf('wicket-'+markupId)===0)) continue;\n");
 		asb.append(" var inputType = inputNode.type.toLowerCase();\n");
 		asb.append(" if (inputType == 'checkbox' || inputType == 'radio') {\n");
 		asb.append(" Wicket.Event.add(inputNode, 'click', callbackScript);\n");

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=906807&r1=906806&r2=906807&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 Fri Feb
 5 04:13:37 2010
@@ -25,6 +25,7 @@
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.protocol.http.portlet.PortletRequestContext;
+import org.apache.wicket.util.string.Strings;
 
 
 /**
@@ -140,21 +141,6 @@
 		return group;
 	}
 
-	/** {@inheritDoc} */
-	@Override
-	protected void onBeforeRender()
-	{
-		// prefix markup id of this radio with its group's id
-		// this will make it easier to identify all radios that belong to a specific group
-		final String prefix = getGroup().getMarkupId() + "-";
-		if (!getMarkupId().startsWith(prefix))
-		{
-			setMarkupId(prefix + getMarkupId());
-		}
-		super.onBeforeRender();
-	}
-
-
 	/**
 	 * @see Component#onComponentTag(ComponentTag)
 	 * @param tag
@@ -241,6 +227,20 @@
 		{
 			tag.put(ATTR_DISABLED, ATTR_DISABLED);
 		}
+
+		// put group id into the class so we can easily identify all radios belonging to the group
+		final String marker = "wicket-" + getGroup().getMarkupId();
+		String clazz = tag.getAttribute("class");
+		if (Strings.isEmpty(clazz))
+		{
+			clazz = marker;
+		}
+		else
+		{
+			clazz = clazz + " " + marker;
+		}
+		tag.put("class", clazz);
+
 	}
 
 	/**

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=906807&r1=906806&r2=906807&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 Fri Feb
 5 04:13:37 2010
@@ -23,6 +23,7 @@
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.protocol.http.portlet.PortletRequestContext;
+import org.apache.wicket.util.string.Strings;
 
 /**
  * Component representing a single radio choice in a org.apache.wicket.markup.html.form.RadioGroup.
@@ -121,22 +122,6 @@
 	}
 
 	/**
-	 * @see org.apache.wicket.Component#onBeforeRender()
-	 */
-	@Override
-	protected void onBeforeRender()
-	{
-		// prefix markup id of this radio with its group's id
-		// this will make it easier to identify all radios that belong to a specific group
-		final String prefix = getGroup().getMarkupId() + "-";
-		if (!getMarkupId().startsWith(prefix))
-		{
-			setMarkupId(prefix + getMarkupId());
-		}
-		super.onBeforeRender();
-	}
-
-	/**
 	 * 
 	 * @return The associated radio group Component
 	 */
@@ -228,6 +213,20 @@
 		{
 			tag.put(ATTR_DISABLED, ATTR_DISABLED);
 		}
+
+		// put group id into the class so we can easily identify all radios belonging to the group
+		final String marker = "wicket-" + getGroup().getMarkupId();
+		String clazz = tag.getAttribute("class");
+		if (Strings.isEmpty(clazz))
+		{
+			clazz = marker;
+		}
+		else
+		{
+			clazz = clazz + " " + marker;
+		}
+		tag.put("class", clazz);
+
 	}
 
 	/**



Mime
View raw message