@Override
public String toScript(Locale locale, String format) {
StringBuffer script = new StringBuffer(super.toScript(locale,
format));
//init date picker with server time
int last = script.length() - 1;
if (',' != script.charAt(last)) {
script.append(",");
}
script.append("\n\tdate : \"" + dateFormat.format(new
Date()) + "\"");
return script.toString();
}
do we want that to be the default?
Overriding it that way is a bit ugly.
johan
On 8/28/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Applied. Cheers,
Eelco
On 8/28/06, Tomer Mevorach <[EMAIL PROTECTED]> wrote:
> in calendar-setup.js (wicket-extensions-1.2.2):
> replace line 158 ("if (dateEl)") with "if (dateEl && ( dateEl.value ||
> dateEl.innerHTML))".
>
> Regards,
> Tomer
>
>
> Johan Compagner wrote:
> > please make a patch then we will apply it.
> >
> > johan
> >
> >
> > On 8/28/06, *Tomer Mevorach* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > hi,
> > I have noticed that its impossible to initialize wickets date picker
> > with server time.
> > the reason for that lies in calendar-setup.js (line 159):
> > if (dateEl) params.date = Date.parseDate(dateEl.value ||
> > dateEl.innerHTML, dateFmt);
> >
> > I think that if Date.parseDate(dateEl.value || dateEl.innerHTML ,
> > dateFmt); is null then params.date should not be overridden.
> > that way it will be possible to initialize the date picker with the
> > value from the date parameter in case date pickers component does not
> > carry any value.
> >
> > Is there any alternative way to achieve server time initialization?
> >
> > Regards,
> > Tomer
> >
> >
> >
> > Johan Compagner wrote:
> > > why don't you give the model object that the datepicker
> > component has
> > > an inital value?
> > > (which is new Date())
> > >
> > > johan
> > >
> > >
> > > On 8/23/06, *Tomer Mevorach* <[EMAIL PROTECTED]
> > <mailto: [EMAIL PROTECTED]>
> > > <mailto: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
> > >
> > > hi,
> > >
> > > I have a DatePicker in my application and it works fine when its
> > > initialized with client machine time.
> > > I have problems initializing it with server time.
> > > in order to initialize it with server time i use the following
> > > DatePickerSettings and DateConverter:
> > >
> > >
> > > private static final DateFormat dateFormat = new
> > > SimpleDateFormat("MM/dd/yyyy HH:mm");
> > >
> > > private static final DatePickerSettings dateSettings = new
> > > DatePickerSettings() {
> > >
> > > public ResourceReference getLanguage(Locale
> > currentLocale) {
> > > return
> > > DatePickerComponentInitializer.getLanguage (Locale.US);
> > > }
> > >
> > > @Override
> > > public String toScript(Locale locale, String format) {
> > > StringBuffer script = new
> > > StringBuffer(super.toScript(locale,
> > > format));
> > > //init date picker with server time
> > > int last = script.length() - 1;
> > > if (',' != script.charAt(last)) {
> > > script.append(",");
> > > }
> > > script.append("\n\tdate : \"" +
> > dateFormat.format(new
> > > Date()) + "\"");
> > > return script.toString();
> > > }
> > > };
> > >
> > > private static final DateConverter dateConverter = new
> > > DateConverter() {
> > >
> > > public DateFormat getDateFormat(Locale locale) {
> > > return super.getDateFormat(Locale.US);
> > > }
> > > };
> > >
> > > static {
> > > dateSettings.setShowsTime(true);
> > > dateSettings.setTimeFormat ("24");
> > > dateSettings.setWeekNumbers (false);
> > > dateConverter.setDateFormat (Locale.US, dateFormat);
> > > }
> > >
> > > Here is the rendered JS:
> > >
> > > Calendar.setup(
> > > {
> > > inputField :
> > > "6:provisioningForm:startDateType:startDateTypes:1:startDate",
> > > button :
> > >
> > "6:provisioningForm:startDateType:startDateTypes:1:startDatePicker:trigger",
> >
> > > weekNumbers : false,
> > > showsTime : true,
> > > timeFormat : 24,
> > > ifFormat : "%m/%d/%Y %H:%M",
> > > date : "08/22/2006 19:06"
> > > });
> > >
> > >
> > > Can anyone please tell my what is it that I'm doing wrong
> > because the
> > > calendar keeps being initialized with client time.
> > >
> > > Regards,
> > > Tomer
> > >
> > >
> > >
> > >
> > >
> > -------------------------------------------------------------------------
> > > 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
> > < http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
> > >
> > < http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >>
> > > _______________________________________________
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > <mailto:Wicket-user@lists.sourceforge.net>
> > > <mailto: Wicket-user@lists.sourceforge.net
> > <mailto:Wicket-user@lists.sourceforge.net>>
> > > https://lists.sourceforge.net/lists/listinfo/wicket-user
> > <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
> > <http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642>
> > _______________________________________________
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > <mailto: 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
------------------------------------------------------------------------- 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