pft, you guys!

i would go with the simplest!

class uppercasetextfield extends textfield<string> {
        public void updatemodel()
        {
              final String str=getconvertedinput();
              setdefaultmodelobject((str==null)?null:str.touppercase());
        }
}

done!

-igor

On Wed, Mar 4, 2009 at 3:07 PM, jWeekend <jweekend_for...@cabouge.com> wrote:
>
> Jeremy,
>
> I sensed you were uncomfortable with my "most Wicket-way" suggestion when I
> read  http://www.nabble.com/RE%3A-Uppercasing-inputs-p22338461.html your
> previous post on this thread  stating that the model doing the
> transformation work was on the "right track"; it is not unusual that more
> than one design can satisfy a given requirement.
>
> Do you like the idea of a model being responsible for conversion of users'
> textual input?
>
> Your article illustrates the use of nested models nicely but on this
> occasion I would probably go with
> http://www.nabble.com/Re%3A-Uppercasing-inputs-p22332471.html Adriano's idea
> for a client side, instant gratification, solution, and a custom text field
> with a converter if the conversion can happen later, on the server.
>
> Regards - Cemal
> http://jWeekend.com jWeekend
>
>
>
> Jeremy Thomerson-5 wrote:
>>
>> Cemal,
>>   I think I have to respectfully disagree with you here.  I describe what
>> I
>> feel is a better solution, and a little bit of why in this blog post from
>> a
>> few months ago:
>>
>> http://www.jeremythomerson.com/blog/2008/11/06/wicket-the-power-of-nested-models/
>>
>>   Basically, doing it the way you suggested isn't reusable across many
>> components - you have to create overridden variants of each type of input.
>> Also, a converter (or more specifically, an implementation of IConverter)
>> is
>> supposed to be for transforming a type of object to a string usable in the
>> browser / form post / etc, as it's javadoc mentions.
>>
>>   Anyway, as the saying goes "there are many ways to skin a cat" -
>> although
>> the saying isn't that great, I think it applies - there are multiple ways
>> of
>> accomplishing the same thing.
>>
>> --
>> Jeremy Thomerson
>> http://www.wickettraining.com
>>
>>
>> On Wed, Mar 4, 2009 at 12:04 PM, jWeekend
>> <jweekend_for...@cabouge.com>wrote:
>>
>>>
>>> Leszek,
>>>
>>> ... or, probably the most "Wicket-way" of doing this is to make a
>>> TextField
>>> subclass that overrides getConverter to return your special IConverter
>>> implementation which performs the capitalisation in its convertToObject.
>>>
>>> Regards - Cemal
>>> http://jWeekend.com jWeekend
>>>
>>>
>>> Leszek Gawron-2 wrote:
>>> >
>>> > Hello,
>>> >
>>> > one of my customers has this weird requirement that all data should be
>>> > input/shown uppercase. I can easily add
>>> >
>>> > input {
>>> >    text-transform: uppercase;
>>> > }
>>> >
>>> > to my css rules, but this does not change the fact that data written
>>> > into database will still be case sensitive.
>>> >
>>> > How can I create a behavior for TextField so that the dat is uppercased
>>> > before being written to the model?
>>> >
>>> > my regards
>>> >
>>> > --
>>> > Leszek Gawron
>>> >
>>> > ---------------------------------------------------------------------
>>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> > For additional commands, e-mail: users-h...@wicket.apache.org
>>> >
>>> >
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Uppercasing-inputs-tp22332360p22335650.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context: 
> http://www.nabble.com/Uppercasing-inputs-tp22332360p22341681.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to