Author: ivaynberg
Date: Sat May 24 23:43:12 2008
New Revision: 659928
URL: http://svn.apache.org/viewvc?rev=659928&view=rev
Log:
WICKET-1592
Modified:
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
Modified:
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.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/Form.java?rev=659928&r1=659927&r2=659928&view=diff
==============================================================================
---
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
(original)
+++
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/Form.java
Sat May 24 23:43:12 2008
@@ -16,8 +16,12 @@
*/
package org.apache.wicket.markup.html.form;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -574,6 +578,35 @@
}
/**
+ * Gets all [EMAIL PROTECTED] IFormValidator}s added to this form
+ *
+ * @return unmodifiable collection of [EMAIL PROTECTED] IFormValidator}s
+ */
+ public final Collection getFormValidators()
+ {
+ final int size = formValidators_size();
+
+ List validators = null;
+
+ if (size == 0)
+ {
+ // form has no validators, use empty collection
+ validators = Collections.EMPTY_LIST;
+ }
+ else
+ {
+ // form has validators, copy all into collection
+ validators = new ArrayList(size);
+ for (int i = 0; i < size; i++)
+ {
+ validators.add(formValidators_get(i));
+ }
+ }
+ return Collections.unmodifiableCollection(validators);
+ }
+
+
+ /**
* This generates a piece of javascript code that sets the url in the
special hidden field and
* submits the form.
*
@@ -1564,7 +1597,7 @@
}
else
{
- tag.put("action", Strings.escapeMarkup(url));
+ tag.put("action", Strings.escapeMarkup(url));
}
if (multiPart)
@@ -1657,24 +1690,21 @@
{
String[] pair = params[j].split("=");
- buffer.append("<input type=\"hidden\" name=\"")
- .append(recode(pair[0]))
- .append("\" value=\"")
- .append(pair.length > 1 ? recode(pair[1]) : "")
- .append("\" />");
+ buffer.append("<input type=\"hidden\"
name=\"").append(recode(pair[0])).append(
+ "\" value=\"").append(pair.length > 1 ?
recode(pair[1]) : "").append("\" />");
}
}
- /**
- * Take URL-encoded query string value, unencode it and return
HTML-escaped version
- */
- private String recode(String s)
- {
- String un = WicketURLDecoder.QUERY_INSTANCE.decode(s);
- return Strings.escapeMarkup(un).toString();
- }
+ /**
+ * Take URL-encoded query string value, unencode it and return
HTML-escaped version
+ */
+ private String recode(String s)
+ {
+ String un = WicketURLDecoder.QUERY_INSTANCE.decode(s);
+ return Strings.escapeMarkup(un).toString();
+ }
- /**
+ /**
* @see org.apache.wicket.Component#onDetach()
*/
protected void onDetach()
@@ -1957,7 +1987,8 @@
*
* @return String that well be used as prefix to form component input
names
*/
- protected String getInputNamePrefix() {
+ protected String getInputNamePrefix()
+ {
return "";
}
}