after re-reading that message I find it a little to ... mixed up.
one idea was that you could use a ShowRangeHandlers<Date> that you'll
add it to your DatePicker object,
on the onShowRange() method you'll need to take the date list between
the start and the end of the range, and for the dates that are <= your
lastDisabledDate do a call of
datepicker.setTransientEnabledOnDates(false,date);
or you could add the disabled dates to a list and call
datepicker.setTransientEnabledOnDates(false,disabledDateList); //
this will call the first method so will be no gain
this approach is time consuming it's a heavy load when there are many
days to disable
a second idea:
the default constructor DatePicker() calls the following constructor
DatePicker(MonthSelector monthSelector, CalendarView view,
CalendarModel model)
with the following arguments
new DefaultMonthSelector(), new DefaultCalendarView(), new
CalendarModel()
the CalendarView (DefaultCalendarView) is the class that takes care of
the dates isEnable()
because you don't have access to that second constructor you'll have
to make your own DatePicker that extends DatePicker so that you could
access it, and instead of using the DefaultCalendarView use your own
class made from the code of this one and change in the inner class
CellGrid the method isEnabled() so that it'll make the check if the
date is < lastDisabledDate
lastDisabledDate would be set by a method of your custom DatePicker to
your custom CalendarView.
this is a more elegant approach (I think) and also could be used to
disable specific dates (a list of dates), or a specific dayOfWeek
good luck
On Feb 26, 9:25 am, Ashar Lohmar <[email protected]> wrote:
> someone asked the same question and i gave him a few hints
> herehttp://groups.google.com/group/google-web-toolkit/browse_thread/threa...
> hope you'll get something out of it
>
> good luck
>
> On Feb 25, 1:19 pm, Ice13ill <[email protected]> wrote:
>
> > At least tell me if i'm posting the wrong questions :P
>
> > On Feb 24, 4:47 pm, Ice13ill <[email protected]> wrote:
>
> > > I tried using formatting but i can't disable the cells of theDatePicker
>
> > > I just want to disable all dates before a given date. how do i do
> > > that ?
>
> > > On Jan 20, 6:54 pm, Jim Douglas <[email protected]> wrote:
>
> > > > If you're using a DateBox, you can define a custom Format with your
> > > > own parsing rules with:
>
> > > > setFormat(new CustomDateFormat(DateTimeFormat.getFormat
> > > > (pattern)));
>
> > > >http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/g...)
>
> > > > private static final String DATE_BOX_FORMAT_ERROR =
> > > > "dateBoxFormatError";
>
> > > > private class CustomDateFormat extends DateBox.DefaultFormat
> > > > {
> > > > public CustomDateFormat(DateTimeFormat dateTimeFormat)
> > > > {
> > > > super(dateTimeFormat);
> > > > }
>
> > > > @Override
> > > > public Date parse(DateBox dateBox, String dateText, boolean
> > > > reportError)
> > > > {
> > > > Date date = null;
> > > > try
> > > > {
> > > > if (dateText.length() > 0)
> > > > {
> > > > date = getDateTimeFormat().parseStrict(dateText);
> > > > }
> > > > }
> > > > catch (Exception exception)
> > > > {
> > > > // According to the documentation, this should be an
> > > > // IllegalArgumentException, but bugs in
> > > > DateTimeFormat
> > > > // can cause other exceptions to be thrown, for
> > > > example:
> > > > // java.lang.StringIndexOutOfBoundsException: String
> > > > index out of range: 0
> > > > // at java.lang.String.charAt(String.java:558)
> > > > // at
> > > > com.google.gwt.i18n.client.DateTimeFormat.parseInt(DateTimeFormat.java:
> > > > 1415)
> > > > }
> > > > if (date == null)
> > > > {
> > > > // If there are other formats you want to support, do
> > > > the parsing here
> > > > }
> > > > if (date != null)
> > > > {
> > > > // If there aredatesthat you want to disallow, set
> > > > date to null here
> > > > }
> > > > if (date == null && reportError)
> > > > {
> > > > dateBox.addStyleName(DATE_BOX_FORMAT_ERROR);
> > > > }
> > > > return date;
> > > > }
> > > > }
>
> > > > On Jan 19, 8:02 am, Mark Davis <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > I need todisablespecifieddatesinDatePicker.
>
> > > > > What is the best way to do it?
>
> > > > > thanks in advance,
> > > > > Mark
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.