Customization
A calendar page extends com.manydesigns.portofino.pageactions.calendar.CalendarAction, you can override any method of it.
SUMMARY
Hooks
CalendarAction defines several hooks, predefined methods in Portofino, to extend its behavior.
void loadObjects(Interval interval)
This method loads the object for the calendar view. In the predefined example it calls loadCalendars and loadEvents.
Parameter start,
loadObjects(DateTime instant, int maxEvents)
This method loads the object for the agenda view. In the predefined example it calls loadCalendars and loadEvents. It limits the events to the maxEvents number
Parameter start, maxEvents
loadCalendars()
This is an example method that defines new "Calendar" objects and add them in "calendars" list.
Calendar testCal1 = new Calendar("alice", "Alice", new Color(0xe0, 0x40, 0x30)); calendars.add(testCal1);
loadEvents(DateTime start)
This is an example method that creates "Event" objects and adds them to a calendar. Events are defined by a calendar, an id, a description, an interval, a readUrl and a String editUrl.
e.g.
eventInterval = new Interval(time.plusHours(14).plusMinutes(30), time.plusHours(16).plusMinutes(30)); event = new Event( testCal1, "e3", "Meeting", eventInterval, null, null);
Parameter DateTime start
Useful objects
The action give to you the following objects that you can use in your methods:
context
The Stripes context, e.g. you can obtain the request from it.
originalPath
A string with the current path.
model
A com.manydesigns.portofino.model.Model, which stores all the information about the databases (e.g. tables, columns, ...).
portofinoConfiguration
This object stores all the configuration properties.
application
The Application object which store all common data of your application(e.g. all Hibernate sessions).
logger
The org.slf4j.Logger that you can use to log your activities.