You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/04/10 06:17:14 UTC
svn commit: r527012 -
/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java
Author: ehillenius
Date: Mon Apr 9 21:17:13 2007
New Revision: 527012
URL: http://svn.apache.org/viewvc?view=rev&rev=527012
Log:
repaired default of not allowing (and displaying!) a null selection, and removed unused field.
Modified:
incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java
Modified: incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java?view=diff&rev=527012&r1=527011&r2=527012
==============================================================================
--- incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java (original)
+++ incubator/wicket/branches/wicket-1.x/jdk-1.4/wicket/src/main/java/wicket/markup/html/form/AbstractSingleSelectChoice.java Mon Apr 9 21:17:13 2007
@@ -37,15 +37,13 @@
private static final String EMPTY_STRING = "";
- /** Is the null value a valid value? */
- private boolean nullValid = false;
-
/**
* @see AbstractChoice#AbstractChoice(String)
*/
public AbstractSingleSelectChoice(final String id)
{
super(id);
+ setRequired(true); // force choice by default
}
/**
@@ -54,6 +52,7 @@
public AbstractSingleSelectChoice(final String id, final List choices)
{
super(id, choices);
+ setRequired(true); // force choice by default
}
/**
@@ -66,6 +65,7 @@
final IChoiceRenderer renderer)
{
super(id, data, renderer);
+ setRequired(true); // force choice by default
}
/**
@@ -74,6 +74,7 @@
public AbstractSingleSelectChoice(final String id, IModel model, final List data)
{
super(id, model, data);
+ setRequired(true); // force choice by default
}
/**
@@ -87,6 +88,7 @@
final IChoiceRenderer renderer)
{
super(id, model, data, renderer);
+ setRequired(true); // force choice by default
}
/**
@@ -96,6 +98,7 @@
public AbstractSingleSelectChoice(String id, IModel choices)
{
super(id, choices);
+ setRequired(true); // force choice by default
}
/**
@@ -105,6 +108,7 @@
public AbstractSingleSelectChoice(String id, IModel model, IModel choices)
{
super(id, model, choices);
+ setRequired(true); // force choice by default
}
/**
@@ -114,6 +118,7 @@
public AbstractSingleSelectChoice(String id, IModel choices, IChoiceRenderer renderer)
{
super(id, choices, renderer);
+ setRequired(true); // force choice by default
}
@@ -125,6 +130,7 @@
IChoiceRenderer renderer)
{
super(id, model, choices, renderer);
+ setRequired(true); // force choice by default
}
/**
@@ -171,7 +177,7 @@
*/
protected final Object convertValue(final String[] value)
{
- String tmp = value != null && value.length > 0?value[0]:null;
+ String tmp = value != null && value.length > 0 ? value[0] : null;
List choices = getChoices();
for (int index = 0; index < choices.size(); index++)
{
@@ -186,16 +192,18 @@
}
/**
- * The localizer will be ask for the property to display
- * Depending on if null is allowed or not it will ask for:
+ * The localizer will be ask for the property to display Depending on if
+ * null is allowed or not it will ask for:
*
* <ul>
- * <li>nullValid: when null is valid and by default it will show an empty string as a choice.</li>
- * <li>null: when null is not a valid choice and it will make a choice with "Choose One"</li>
+ * <li>nullValid: when null is valid and by default it will show an empty
+ * string as a choice.</li>
+ * <li>null: when null is not a valid choice and it will make a choice with
+ * "Choose One"</li>
* </ul>
*
- * The choice for null is valid will always be returned. The choice when null is not valid
- * will only be returned if the selected object is null.
+ * The choice for null is valid will always be returned. The choice when
+ * null is not valid will only be returned if the selected object is null.
*
* @see wicket.markup.html.form.AbstractChoice#getDefaultChoice(Object)
*/
@@ -232,8 +240,8 @@
{
// Force the user to pick a non-null value
final String option = getLocalizer().getString("null", this, CHOOSE_ONE);
- return new AppendingStringBuffer("\n<option selected=\"selected\" value=\"\">").append(option).append(
- "</option>");
+ return new AppendingStringBuffer("\n<option selected=\"selected\" value=\"\">")
+ .append(option).append("</option>");
}
}
return "";