i had that before but then we assume a lot of stuff (at least 2 instanceof checks)

but changed it back to this:

        if(dateConverter == null)
        {
            IConverter converter = target.getConverter ();
            if(converter instanceof Converter)
            {
                ITypeConverter typeConverter = ((Converter)converter).get(Date.class);
                if(typeConverter instanceof DateConverter)
                {
                    dateConverter = (DateConverter)typeConverter;
                }
            }
            if(dateConverter == null) dateConverter = new DateConverter();
        }

with a big TODO in it that this should be fixed/improved in 2.0

On 5/3/06, Ari Suutari <[EMAIL PROTECTED] > wrote:
Hi,

>see DatePicker.setDateConverter() method.

I noticed this.

>you can set the dateconverter method on the datepicker that you want to use
>So if you made youre own. Also set it on the DatePicker itself.

Yes, I know, but this is not consistent with the idea of converter factory.

>i can't use the target.getConverter() because that just returns a
>IConverter..

You can instead:

  IConverter ic = getConverter();
  Converter c;
  DateConverter dc;

  c = (Converter)ic;
  dc = (DateConverter)c.get(Date.class);

Not pretty, but I think it would work.

    Ari S.

On 5/3/06, Ari Suutari <[EMAIL PROTECTED]> wrote:
>
> I spotted this because we have a ConverterFactory which returns
> DateConverters which have format string different from default (think
> it as customer requirement). Now, when I create a TextField (.....,
> Date.class)
> it uses converter from ConverterFactory and my custom format string.
> However, when I create a date picker, it just says "new DateConverter"
> instead
> of getting it from field (would be best, since one can overried
> getConverter in
> component) or from ConverterFactory.  This results in DatePicker returning
> string that is unparseable by TextField.
>
> I think that the logic in DatePicker (ie. using java format string and
> DateConverter
> class) is move to right direction - however the current implementation is
> incomplete
> as I described above. This should be quite easy to fix, I think - maybe
> just
> replace "new DateConverter" by target.getConverter() in DatePicker ?
>
>     Ari S.
>
> ----- Original Message -----
> From: "Johan Compagner" <[EMAIL PROTECTED]>
> To: <wicket-user@lists.sourceforge.net>
> Sent: Wednesday, May 03, 2006 12:19 PM
> Subject: Re: [Wicket-user] DatePickerSettings.setIfFormat no longer works
>
>
> it is very dangerous to do that.
> The 2 formats MUST be in sync so you should just specify the java format
> stirng you want to have.
> You shouldn't set the _javascript_ format to something else (that is not the
> same as the java format string)
>
> or do you have a case where you have the datepicker but the value never
> get
> send back to the server?? (which seems odd)
>
> johan
>
>
> On 5/3/06, Ari Suutari <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > It looks like DatePickerSettings.setIfFormat no longer works. The value
> > set by it is always overwritten by DatePicker.getInitScript, which
> > calls settings.toScript with format taken from DateConverter.
> >
> > I would like two changes here:
> >
> > - adjust DatePickerSettings.toScript so that it calls setIfFormat only
> >    if ifFormat is null, ie. programmer hasn't provided any default.
> >
> > - adjust DatePicker so that it takes the DateConverter from
> > ConverterFactory.
> >   Now it just creates an instance of DateConverter, which might have
> > different
> >   format than the instance returned by ConverterFactory (which is used
> by
> > textfields).
> >   This can result in situations where date string returned by picker is
> > not parseable
> >   by text field.
> >
> >     Ari S.
> >
> >
> >
> > -------------------------------------------------------
> > Using Tomcat but need to do more? Need to support web services,
> security?
> > Get stuff done quickly with pre-integrated technology to make your job
> > easier
> > Download IBM WebSphere Application Server v.1.0.1 based on Apache
> Geronimo
> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to