Calendar Add-on customizing

Hello,
I use the Calendar add-on and I would like to know if there is a simple and easy way to customize the Calendar view to display a
year Calendar
?

So far, I worked on the monthly view to test the add-on, in defining one a startDate and endDate > 7 days.

I saw that the
Calendar
class (server side) uses the class
VCalendar
(client side) through an annotation @ClientWidget (VCalendar. class) .

This
VCalendar
class has a method
updateFromUIDL()
which calls
updateMonthView ()
which calls
updateMonthGrid ()
which instantiates an object
MonthGrid
that I should replace with a new object
YearGrid
.

I thought of the
Design Pattern “Adapter”
but as the Calendar class (server side) uses the class VCalendar through the annotation @ ClientWidget (VCalendar. class), I do not know if that’s possible?

Someone would have any idea ?

Thank you

:blink:

Inside your widgetset, you could subclass the server-side Calendar with only constructors and a new @ClientWidget annotation, and subclass VCalendar. Note that as always, client side code needs to be in a “client” package under the package with your widgetset .gwt.xml file. However, the necessary methods seem to be private (as well as many fields used by them), so it looks like you would effectively need to copy the contents of the VCalendar class.

In this case, it is not possible to replace only the class MonthView with an alternate implementation using GWT deferred bindings because MonthView is created with an explicit constructor call, not GWT.create(). Otherwise, you could inherit it and then replace it at widgetset compilation time with deferred bindings.

You could
create an enhancement request
for making the calendar more extensible - the minimal change that would probably help you would be the use of GWT.create() when creating MonthGrid or WeekGrid instances. I do not know if that would be sufficient in your case. Other forms of extensibility would require spending much more time on API design.

Thank you for your answer.
That’s what I thought, it will not be simple.
Yes, I noticed while browsing the code a lot of properties and methods I’ll need was declared “private”.

Could you explain or give me a url that I can understand why I will need GWT.create () ?

Thank you

:slight_smile:

GWT
deferred bindings
can replace a class with an alternative implementation at widgetset compilation time based on a few lines of XML in your widgetset. However, this can only be done if the class to be replaced is constructed with GWT.create(), which uses the default (parameterless) constructor of the class.