Nino,
if you assign the DateTextField a model (with a valid date), the datepicker
picks the date up
and marks the given date as selected.

@ CalendarGroup
the most unobtrusive way i could come up with is the following:
let the user override DatePicker#configure and do this:

widgetProperties.put("pages", 2);

problems arise when the user wants to use month/year selection too,
as these two options don't work together (which option is more important?)
we could do a check for that in DatePicker#renderHead right before the
widgetProperties are
transformed into a javascript array (line 190 or so) and throw an exception
if (enableMonthYearSelection && widgetProperties.contains("pages") &&
Objects.longValue(widgetProperties.get("pages")) > 1)

on the client side, the function Wicket.DateTime.init checks whether the
configuration
property "pages" is available and greater 1 and instantiates a CalendarGroup
instead of a Calendar.

another (more dummy save) approach is to provide a class DatePickerGroup
which final overrides enableMonthYearSelection with return false
and introduces an overridable method getPages which sets the property.

i would rather take the first route, as it doesn't expand the api.
i also think that's what Eelco would prefer, right? ;)

gerolf

On 10/1/07, Gerolf Seitz <[EMAIL PROTECTED]> wrote:
>
> if you set a model for the textfield, the datepicker should actually pick
> it up.
> but i'm not sure whether this "picking up" is done in the
> Wicket.DateTime.showCalendar method,
> which is not called for the renderOnLoad-DatePicker, iirc...
>
> i will take a look at this later today...
>
> gerolf
>
> On 10/1/07, Nino Saturnino Martinez Vazquez Wael < [EMAIL PROTECTED]>
> wrote:
> >
> > Sure there are always more questions:)
> >
> > I know that the problem with YUI calender, it has no model? what I mean
> > are of course the calendar are attached to a tf field, and we use that
> > for interaction on the calendar, but it seems that it are one way
> > calendar --> textfield. Always being calendar thats pushing the value to
> >
> > the text field, and not noticing the differences if any the other way.
> > And yes we are talking about the standalone version(good memory,
> > Gerolf).
> >
> > It could be very nice if the calendar had some way of opening up for
> > special statements I wanted to input.. For example to make the special
> > rendering work I could just do this:
> >
> > YAHOO.example.calendar.cal1.addRenderer("2/29",
> > YAHOO.example.calendar.cal1.*renderCellStyleHighlight1 );
> > *This adds the css class identifier highlight1 to the date 29/2. Then it
> > would be up to the user or we could provide a default style which were
> > bold. User can always override these styles.
> >
> >
> > I mean the current implementation already knows a lot of this, it knows
> > the namespace and the instance so I think if I somehow could be allowed
> > doing something like below and there where such a method.
> >
> > // pseudo alike code
> > Protected void additionalInitParametersAndCalls(List calls)
> > {
> > }
> >
> > List param=...
> >
> > param.add("addRenderer("2/29",
> > YAHOO.example.calendar.cal1.*renderCellStyleHighlight1)*");
> >
> > This approach however requires that the user of the component are aware
> > that its a YUI calender, we could also just encapsulate the things and
> > make java methods for it. But theres just so many use cases thats
> > possible.
> >
> > WDYT?
> >
> > -Nino
> >
> >
> >
> > Gerolf Seitz wrote:
> > > hi nino,
> > >
> > > @ your problem:
> > > if there is no model which can be updated (ie with an
> > > AjaxFormComponentUpdatingBehavior), so wicket doesn't know what
> > happened on
> > > the client side. as a consequence the calendar is initialized with the
> >
> > > default dates.
> > > are we talking about a standalone calendar with an invisible
> > textfield?
> > >
> > > @ multipage calendar:
> > > i already have something in my mind for supporting multipage
> > calendars. i
> > > will try to add it this evening.
> > >
> > > @custom renderer:
> > > it would be nice if you could come up with something ;)
> > >
> > > anymore questions?
> > >
> > > regards,
> > >   gerolf
> > >
> > > On 10/1/07, Nino Saturnino Martinez Vazquez Wael <
> > [EMAIL PROTECTED]>
> > > wrote:
> > >
> > >> What's planed for the calendar?
> > >>
> > >> I have an issue(I'll file a bug if asked to):
> > >>
> > >> Selecting a date on calendar
> > >> goto another (wicket)page
> > >> return to the page with calendar and now default date a selected
> > again.
> > >> I do not do anything special  to  preserve the  date for the
> > calendar,
> > >> it  does not have a model..
> > >>
> > >>
> > >> Im starting to need these things:
> > >>
> > >> Multipage calendar
> > >> http://developer.yahoo.com/yui/examples/calendar/calgrp.html
> > >> Calendar dates marked with bold
> > >> http://developer.yahoo.com/yui/examples/calendar/render.html
> > >>
> > >> I could try to implement these thinges myself an supply a patch
> > later.
> > >>
> > >> regards Nino
> > >>
> > >> ---------------------------------------------------------------------
> >
> > >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> > >> For additional commands, e-mail: [EMAIL PROTECTED]
> > >>
> > >>
> > >>
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>

Reply via email to