Hi,
getInput would be fine if we were just starting development. But we have a big
application going to production soon and I'm seeking some kind of another
alternative
than telling all developers to change their TextFields to MyTrimmerTextFields.
Converter interface has been very handy for me before, but it just failed on
this one.
Why should you think Converter only as datatype converter ? I'm sure that
there are plenty of use cases where manipulating also the value would be handy.
Also, I don't think that removing the short-circuit done by isAssignableFrom
woundn't be a performace problem ?
What I have liked about wicket a lot is that there are a lot of different
interfaces
that one can use to get between things and alter the behaviour for local needs
without creating a derived component of each standard component. This is also
the reason I'm insisting about similar solution here.
Ari S.
----- Original Message -----
From: "Igor Vaynberg" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, March 08, 2006 9:23 AM
Subject: Re: [Wicket-user] TextField and trimming blanks at end (and maybe at
beginning)
but is it really then a conversion? why run a Integer->Integer conversion or
a String->String conversion? then you are really warping the converter into
an input postprocessor. why not create a simple subclass of textfield and
override getInput() ?
-Igor
On 3/7/06, Ari Suutari <[EMAIL PROTECTED]> wrote:
Could someone also take a look at Converter so it could be used ?
I mean this line in Converter.java:
// Catch all cases where value is already the right type
if (c.isAssignableFrom(value.getClass()))
{
return value;
}
This is some kind of a optimization, right ? But as a side effect
it makes it impossible to do any conversion on textfield input
if it is stored to String field in model (quite usual case, I think).
Maybe just drop those lines ?
Ari S.
----- Original Message -----
From: "Eelco Hillenius" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 07, 2006 7:22 PM
Subject: Re: [Wicket-user] TextField and trimming blanks at end (and maybe
at beginning)
>I don't think we need it in core. Maybe as an example somewhere. We
> have to get our users get used to working with custom components more,
> as that's one of the key points of Wicket imo :)
>
> Eelco
>
>
> On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>> but do we need this in core? its a trivial subclass, why not create it
in
>> your own codebase?
>>
>> if you guys want it in core you can have it, just asking.
>>
>> -Igor
>>
>>
>>
>> On 3/7/06, Ryan Sonnek <[EMAIL PROTECTED]> wrote:
>> > +1 for this solution. this seems to be the cleanest implementation
to
>> > me and puts the responsibility on the developer to *use* the correct
>> > component.
>> >
>> > On 3/7/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
>> > > i guess thats true. you can create a subclass TrimmingTextField
that
>> > > overrides getInput() and trims it.
>> > >
>> > >
>> > > -Igor
>> > >
>> > >
>> > > On 3/7/06, Johan Compagner < [EMAIL PROTECTED]> wrote:
>> > > >
>> > > > So before the input goes into the required/type conversion and
>> validators
>> > > we first trim it
>> > > > when that flag is set?.
>> > > >
>> > > > he also could just overwrite getInput() and trim the text when
called.
>> > > >
>> > > >
>> > > > johan
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED] > wrote:
>> > > > >
>> > > > > i was also thinking a trim flag on the textfield and textarea
only.
>> are
>> > > you opposed to that also Johan?
>> > > > >
>> > > > >
>> > > > > -Igor
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > On 3/7/06, Johan Compagner < [EMAIL PROTECTED]> wrote:
>> > > > > >
>> > > > > > You also could use a Converter for this i guess.
>> > > > > >
>> > > > > >
>> > > > > > johan
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > On 3/7/06, Ari Suutari <[EMAIL PROTECTED] > wrote:
>> > > > > > > Hi,
>> > > > > > >
>> > > > > > > But simple validation is already on wicket level. Of course
we
>> could
>> > > > > > > argue on this, but I really think that right place for
simple
>> > > > > > > input "cleanup" is the user interface layer:
>> > > > > > >
>> > > > > > > - Let's say I have a model, which has field called "code".
>> > > > > > > - If user types new value for this in a field, I (and even
user,
>> I
>> > > think)
>> > > > > > > excepts that invisible blanks at end of "code" are
removed. It
>> is
>> > > > > > > very easy to accidentally put them there with copy &
paste,
>> for
>> > > example.
>> > > > > > > - However, if I code something like this: m.setCode("ZAP
"); I
>> > > sure
>> > > > > > > except that it is stored excactly as I wrote.
>> > > > > > >
>> > > > > > > Besides, who it would harm if TextField & TextArea had a
flag
>> > > > > > > like this ? Nobody forces one to use it.
>> > > > > > >
>> > > > > > > Ari S.
>> > > > > > >
>> > > > > > > ----- Original Message -----
>> > > > > > > From: "Johan Compagner" <[EMAIL PROTECTED]>
>> > > > > > > To: < [email protected]>
>> > > > > > > Sent: Tuesday, March 07, 2006 11:35 AM
>> > > > > > > Subject: Re: [Wicket-user] TextField and trimming blanks at
end
>> (and
>> > > maybe at beginning)
>> > > > > > >
>> > > > > > >
>> > > > > > > a trim flag on what?
>> > > > > > > Form component?
>> > > > > > > I don't like that what does it do for non text fields?
>> > > > > > >
>> > > > > > > trimming should belong in a model. For example a
ModelWrapper
>> where
>> > > you put
>> > > > > > > youre real models in.
>> > > > > > >
>> > > > > > > johan
>> > > > > > >
>> > > > > > >
>> > > > > > > On 3/7/06, Ari Suutari <[EMAIL PROTECTED] >
wrote:
>> > > > > > > >
>> > > > > > > > Hi,
>> > > > > > > >
>> > > > > > > > setTrimValue flag would be great (maybe there should be
>> settings
>> > > > > > > > for left/right trim ?).
>> > > > > > > >
>> > > > > > > > Model might be also a working solution, but somehow I
feel
>> that
>> > > > > > > > this kind of task belongs to upper layer.
>> > > > > > > >
>> > > > > > > > Ari S.
>> > > > > > > >
>> > > > > > > > ----- Original Message -----
>> > > > > > > > From: "Igor Vaynberg" < [EMAIL PROTECTED]>
>> > > > > > > > To: < [email protected] >
>> > > > > > > > Sent: Monday, March 06, 2006 7:11 PM
>> > > > > > > > Subject: Re: [Wicket-user] TextField and trimming blanks
at
>> end
>> > > (and maybe
>> > > > > > > > at beginning)
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > this should be a flag on the textfield so you can call
>> > > > > > > > setTrimValue(boolean)
>> > > > > > > > what do others think?
>> > > > > > > >
>> > > > > > > > if not you can write a model that trims for you on
setObject()
>> > > > > > > >
>> > > > > > > > -Igor
>> > > > > > > >
>> > > > > > > >
>> > > > > > > > On 3/6/06, Ari Suutari < [EMAIL PROTECTED]>
wrote:
>> > > > > > > > >
>> > > > > > > > > Hi,
>> > > > > > > > >
>> > > > > > > > > What might be the simplest way to change behaviour of
whole
>> > > wicket
>> > > > > > > > > application
>> > > > > > > > > so that TextField have their input trimmed of blanks at
end
>> ?
>> > > > > > > > >
>> > > > > > > > > I tried to do this via converters (I have my own
converter
>> > > factory),
>> > > > > > > > > but it didn't work because Converter.convert doesn't do
>> anything
>> > > > > > > > > if String is being assigned to String field in model
(it
>> uses
>> > > > > > > > > isAssignableFrom
>> > > > > > > > > for this check).
>> > > > > > > > >
>> > > > > > > > > Ari S.
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > > > > > > >
>> > > -------------------------------------------------------
>> > > > > > > > > This SF.Net email is sponsored by xPML, a
groundbreaking
>> > > scripting
>> > > > > > > > > language
>> > > > > > > > > that extends applications into web and mobile media.
Attend
>> the
>> > > live
>> > > > > > > > > webcast
>> > > > > > > > > and join the prime developer group breaking into this
new
>> coding
>> > > > > > > > > territory!
>> > > > > > > > >
>> > >
>>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> > > > > > > > >
>> _______________________________________________
>> > > > > > > > > Wicket-user mailing list
>> > > > > > > > > [email protected]
>> > > > > > > > >
>> > >
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > > > > > >
>> > > -------------------------------------------------------
>> > > > > > > > This SF.Net email is sponsored by xPML, a groundbreaking
>> scripting
>> > > > > > > > language
>> > > > > > > > that extends applications into web and mobile media.
Attend
>> the
>> > > live
>> > > > > > > > webcast
>> > > > > > > > and join the prime developer group breaking into this new
>> coding
>> > > > > > > > territory!
>> > > > > > > >
>> > >
>>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> > > > > > > >
>> _______________________________________________
>> > > > > > > > Wicket-user mailing list
>> > > > > > > > [email protected]
>> > > > > > > >
>> > >
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > > > > >
>> > > -------------------------------------------------------
>> > > > > > > This SF.Net email is sponsored by xPML, a groundbreaking
>> scripting
>> > > language
>> > > > > > > that extends applications into web and mobile media. Attend
the
>> live
>> > > webcast
>> > > > > > > and join the prime developer group breaking into this new
coding
>> > > territory!
>> > > > > > >
>> > >
>>
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> > > > > > > _______________________________________________
>> > > > > > > Wicket-user mailing list
>> > > > > > > [email protected]
>> > > > > > >
>> > >
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>> > > > > > >
>> > > > > >
>> > > > > >
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>> > -------------------------------------------------------
>> > This SF.Net email is sponsored by xPML, a groundbreaking scripting
>> language
>> > that extends applications into web and mobile media. Attend the live
>> webcast
>> > and join the prime developer group breaking into this new coding
>> territory!
>> >
>> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642
>> > _______________________________________________
>> > Wicket-user mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/wicket-user
>> >
>>
>>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
> that extends applications into web and mobile media. Attend the live
webcast
> and join the prime developer group breaking into this new coding
territory!
>
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user