You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jc...@apache.org on 2007/11/01 15:28:38 UTC
svn commit: r591022 -
/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java
Author: jcompagner
Date: Thu Nov 1 07:28:37 2007
New Revision: 591022
URL: http://svn.apache.org/viewvc?rev=591022&view=rev
Log:
escape option value in own method
Modified:
wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java
Modified: wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java?rev=591022&r1=591021&r2=591022&view=diff
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java (original)
+++ wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/form/AbstractChoice.java Thu Nov 1 07:28:37 2007
@@ -121,7 +121,7 @@
* @see org.apache.wicket.Component#Component(String, IModel)
*/
public AbstractChoice(final String id, IModel model, final List choices,
- final IChoiceRenderer renderer)
+ final IChoiceRenderer renderer)
{
this(id, model, new Model((Serializable)choices), renderer);
}
@@ -188,7 +188,7 @@
* @see org.apache.wicket.Component#Component(String, IModel)
*/
public AbstractChoice(final String id, IModel model, final IModel choices,
- final IChoiceRenderer renderer)
+ final IChoiceRenderer renderer)
{
super(id, model);
this.choices = wrap(choices);
@@ -205,7 +205,7 @@
if (choices == null)
{
throw new NullPointerException(
- "List of choices is null - Was the supplied 'Choices' model empty?");
+ "List of choices is null - Was the supplied 'Choices' model empty?");
}
return choices;
}
@@ -369,7 +369,7 @@
* The currently selected string value
*/
protected void appendOptionHtml(AppendingStringBuffer buffer, Object choice, int index,
- String selected)
+ String selected)
{
Object objectValue = renderer.getDisplayValue(choice);
Class objectClass = objectValue == null ? null : objectValue.getClass();
@@ -403,13 +403,24 @@
CharSequence escaped = display;
if (getEscapeModelStrings())
{
- escaped = Strings.escapeMarkup(display, false, true);
+ escaped = escapeOptionHtml(display);
}
buffer.append(escaped);
buffer.append("</option>");
}
/**
+ * Method to override if you want special escaping of the options html.
+ *
+ * @param displayValue
+ * @return The escaped display value
+ */
+ protected CharSequence escapeOptionHtml(String displayValue)
+ {
+ return Strings.escapeMarkup(displayValue, false, true);
+ }
+
+ /**
* @see org.apache.wicket.markup.html.form.FormComponent#supportsPersistence()
*/
protected boolean supportsPersistence()
@@ -464,7 +475,7 @@
public String toString()
{
return "ChoiceListChange[component: " + getPath() + ", old choices: " + oldChoices +
- "]";
+ "]";
}