ah, i figured it out just a moment ago.
we can just have is/setNullValid(boolean). this determines if a null value can be selected.
then:
if (isNullValid())
{
if (selected == null)
{
// render selected null value
}
else
{
// render unselected null value
}
}
else
{
if (selected == null)
{
// render choose-one option
}
}i think this covers all the bases and is much simpler. basically, the part where null is valid is the same.
but the part where null is not valid is simpler because we assume that the choose-one string is correct
to show for any choice where null is not allowed and yet is selected. make sense?
Johan Compagner wrote:
There is only one kind of empty. that can be selected (the "") not the "Choose One"
Because "Choose One" means in my point of view that the current value is a default null value but that value can't be null and it must be changed
After that you can never go back to null again (there is no such choice)
So choose one is not really a null value selection (because it users didn't change it a validator should see this...)
There is only one real NULL value and this is allowed or not for that field.
If the null value is allowd then "Choose One" should never happen/be rendered.
johan
Jonathan Locke wrote:
Martijn Dashorst wrote:
I agree with Johan. The AbstractChoice has quadruple semantics for emptyness, and two different string representations for emptyness: "choose one" and "" (which could be "<empty>", "<none>", "n/a", etc.
but if there are two different kinds of emptiness, there would have to be two different kinds of null, wouldn't there?
if it says "Choose One", it's because the value is null. if it says "", it's because the value is null. when would it have both? and how would it know which kind of empty is selected?
Both strings should configurable and isRequired and showNullOption are also necessary. Can't see it any other way. Perhaps the RequiredValidator could mean something here, but that is just as ugly as having the fields.
Martijn
Johan Compagner wrote:
i am currently thinking if this could handle every possible option..
for example you could have a value that is currently null but null can't be selected you have to Choose One..
and you can have a choice that the value is currenty null and null can be selected (then maybe choose one text doesn't have to be there, just "")
then you have that the value is not null and it can't be null then no null option (choose one or otherwise) must be generated
as last you have a value that is not null and it can be null so a null value must be generated but as a empty string..
I dont' believe in a combination of items like: "Choose One" , null, "entry1",...
But how do we say with one property (the string) that it must generate that one if the value is null but if the value is not null
don't generate a null selection (you can' select null)
johan
Jonathan Locke wrote:
in AbstractChoice, i see now that localization of the "Choose One" string isn't a bug exactly, but i'm pretty bothered by the renderNullOption and emptyAllowed properties. the only issue to solve is whether null is an option and what to display if it's selected. these can both be solved at the same time (in a /much/ more efficient and less magical way) by simply having one property called nullDisplayString. if the value is non-null, then that string would be used as a choice and to display any selected null value. am i missing a case? in any case, right now, there is a resource lookup going on everytime a choice is rendered.
btw, is there anywhere else in the toolkit do we do magic lookups like this?
jon
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Wicket-develop mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-develop
