Set title on specific dates in DatePicker

334 views
Skip to first unread message

Alex opn

unread,
May 8, 2012, 8:45:09 AM5/8/12
to google-we...@googlegroups.com
Hello,

I'd like to be able to to set some text as title (which show up when a user hovers over a specific date) on some dates of a datepicker similar to the addStyleToDates-method:

http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/datepicker/client/DatePicker.html#addStyleToDates%28java.lang.String,%20java.util.Date%29

As I can't find a method for that I think it's not available out of the box, right?
Anyone ever implemented this functionality or something similar, are there problems extending DatePicker?

Regards
Alex

Brandon Donnelson

unread,
May 8, 2012, 5:20:01 PM5/8/12
to google-we...@googlegroups.com
Not sure this will help, but when I wanted some functions in DatePicker I extended it. I thought about copying all the datepickers source but there several classes that go along with it.


Brandon Donnelson

Patrick Tucker

unread,
May 8, 2012, 9:38:20 PM5/8/12
to google-we...@googlegroups.com

Alex opn

unread,
May 10, 2012, 9:12:26 AM5/10/12
to google-we...@googlegroups.com
Cool, exactly what I need : )

Starred!

Thanks a lot

Brandon Donnelson

unread,
May 10, 2012, 11:01:08 AM5/10/12
to google-we...@googlegroups.com
I like it. :)

While your in there could you add a method for getting the view? This way we could get access to disabling dates when the month is selected.
    public CalendarView getCalendarView() {
        return getView();
    }

Patrick Tucker

unread,
May 10, 2012, 11:09:02 AM5/10/12
to google-we...@googlegroups.com
DatePicker already has getView().
 
Do you mean in DateBox?  Currently from DateBox you have to access the CalendarView though getDatePicker().  I can add it, no guarantee it will get approved though.

Brandon Donnelson

unread,
May 10, 2012, 11:24:44 AM5/10/12
to google-we...@googlegroups.com
Yes, I know, but it's protected. I figured you'd see that :) 

I have to override datepicker to get at its view to disable dates I don't want selected in the calendar. Maybe ideally it would be better to open up extending the view and model to the datepicker which are both protected too. I'd love to extend either the DefaultView and add some logic to it for our app. I think the original intention for the view was for its extension from the comments I've read but it's been some time it would seem its more mature. 

CalendarView.class - comments at the top:
/**
 * Simple calendar view. Not extensible as we wish to evolve it freely over
 * time.
 */

Basically everything is protected for overriding functions. I can see why it's protected to improve the the methods before allowing for it to be extended and for use. 

Also do you see any harm in making the 'CalendarView getView()' a public method? because I don't :)

Thanks for taking a look at this Patrick.

Brandon

Patrick Tucker

unread,
May 10, 2012, 11:34:47 AM5/10/12
to google-we...@googlegroups.com
setTransientEnabledOnDates (boolean enabled, Date date) won't get you what you need or do the dates need to be disabled upon reload?
 
Just thinking a setEnabledOnDates (boolean enabled, Date date) should be added if a more permanent disable is what you are looking for.

Brandon Donnelson

unread,
May 10, 2012, 11:40:29 AM5/10/12
to google-we...@googlegroups.com
That method is protected inside the view, but thats the method I want access to. :)

Christian Goudreau

unread,
May 10, 2012, 11:40:52 AM5/10/12
to google-we...@googlegroups.com
I want this too!


On Tuesday, May 8, 2012 8:45:09 AM UTC-4, Alex opn wrote:

Brandon Donnelson

unread,
May 10, 2012, 11:45:46 AM5/10/12
to google-we...@googlegroups.com
The reason I want access to that method is for. 
1. I want a person to select only future dates
2. I want a person to select with in a date range
3. I want a person to select before a date
4. I want a person to select between a choice of dates.

Patrick Tucker

unread,
May 10, 2012, 10:57:59 PM5/10/12
to google-we...@googlegroups.com
Take a look at this patch.  I added setEnabledOnDate(boolean, Date) and getEnabledOnDate(boolean).  I wasn't sure if changing isDateEnabled(Date) was a good idea, so I left it alone.
 
Can you create an isse for the enabled capability so I can link to it when I submit the patch? 
Add_Title_and_Enabled_Support_To_DatePicker.txt
DatePicker_ScreenShot.png

Brandon Donnelson

unread,
May 10, 2012, 11:08:29 PM5/10/12
to google-we...@googlegroups.com
Your awesome Patrick!!!

Patrick Tucker

unread,
May 12, 2012, 11:11:23 AM5/12/12
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages