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:29:48 UTC
svn commit: r527016 -
/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:29:44 2007
New Revision: 527016
URL: http://svn.apache.org/viewvc?view=rev&rev=527016
Log:
rolled back deprecation of nullValid
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=527016&r1=527015&r2=527016
==============================================================================
--- 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:29:44 2007
@@ -37,13 +37,15 @@
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
}
/**
@@ -52,7 +54,6 @@
public AbstractSingleSelectChoice(final String id, final List choices)
{
super(id, choices);
- setRequired(true); // force choice by default
}
/**
@@ -65,7 +66,6 @@
final IChoiceRenderer renderer)
{
super(id, data, renderer);
- setRequired(true); // force choice by default
}
/**
@@ -74,7 +74,6 @@
public AbstractSingleSelectChoice(final String id, IModel model, final List data)
{
super(id, model, data);
- setRequired(true); // force choice by default
}
/**
@@ -88,7 +87,6 @@
final IChoiceRenderer renderer)
{
super(id, model, data, renderer);
- setRequired(true); // force choice by default
}
/**
@@ -98,7 +96,6 @@
public AbstractSingleSelectChoice(String id, IModel choices)
{
super(id, choices);
- setRequired(true); // force choice by default
}
/**
@@ -108,7 +105,6 @@
public AbstractSingleSelectChoice(String id, IModel model, IModel choices)
{
super(id, model, choices);
- setRequired(true); // force choice by default
}
/**
@@ -118,7 +114,6 @@
public AbstractSingleSelectChoice(String id, IModel choices, IChoiceRenderer renderer)
{
super(id, choices, renderer);
- setRequired(true); // force choice by default
}
@@ -130,7 +125,6 @@
IChoiceRenderer renderer)
{
super(id, model, choices, renderer);
- setRequired(true); // force choice by default
}
/**
@@ -148,28 +142,35 @@
}
/**
- * Is the <code>null</code> value a valid value?
+ * Is the <code>null</code> value a valid value? If it is, it means that
+ * the null value will be displayed, typically to the user as 'choose one'
+ * or something similar. Note that this doesn't say anything about whether a
+ * null value (not selecting a value) is permitted; use
+ * {@link #setRequired(boolean)} for that.
*
* @return <code>true</code> when the <code>null</code> value is
* allowed.
- * @deprecated use isRequired (note the inverse logic)
*/
- public final boolean isNullValid()
+ public boolean isNullValid()
{
- return !isRequired();
+ return nullValid;
}
/**
- * Is the <code>null</code> value a valid value?
+ * Is the <code>null</code> value a valid value? If it is, it means that
+ * the null value will be displayed, typically to the user as 'choose one'
+ * or something similar. Note that this doesn't say anything about whether a
+ * null value (not selecting a value) is permitted; use
+ * {@link #setRequired(boolean)} for that.
*
* @param nullValid
* whether null is a valid value
* @return this for chaining
- * @deprecated use setRequired (note the inverse logic)
*/
- public final AbstractSingleSelectChoice setNullValid(boolean nullValid)
+ public AbstractSingleSelectChoice setNullValid(boolean nullValid)
{
- return (AbstractSingleSelectChoice)setRequired(!nullValid);
+ this.nullValid = nullValid;
+ return this;
}
/**
@@ -210,7 +211,7 @@
protected CharSequence getDefaultChoice(final Object selected)
{
// Is null a valid selection value?
- if (!isRequired())
+ if (isNullValid())
{
// Null is valid, so look up the value for it
final String option = getLocalizer().getString("nullValid", this, "");
@@ -246,6 +247,7 @@
}
return "";
}
+
/**
* Gets whether the given value represents the current selection.