My favorites | Sign in
Project Logo
Project hosting will be READ-ONLY Wednesday at 8am PST due to brief network maintenance.
                
Search
for
Updated Jan 23, 2010 by Brad.Rydzewski
GettingStarted  
Getting started with the gwt-cal component library.

Setup

  1. Add the gwt-cal jar file to your project's build path. Right-click on the project node in the Package Explorer and select 'Build Path > Add External Archives...'. Specify the downloaded gwt-cal-<version>.jar
  2. Modify <Your Application>.gwt.xml to inherit the gwt-cal module and theme:
  <inherits name='com.bradrydzewski.gwt.calendar.Calendar' />
  <inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google' />

You will also need to download and add gwt-dnd (Drag Drop library). We used version 2.5, but it may also work with newer version.

  <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>

Creating a Calendar

Adding the calendar widget to a Panel just like any standard gwt widget.

Calendar calendar = new Calendar();
calendar.setDate(new Date()); //calendar date, not required
calendar.setDays(3); //number of days displayed at a time, not required
calendar.setWidth("500px");
calendar.setHeight("400px");
add(calendar);

Changing Views

gwt-cal version 0.9 now supports multiple view. You can switch

//Displays the Day View
calendar.setView(CalendarViews.DAY);
//Displays the Day View with 3 days
calendar.setView(CalendarViews.DAY, 3);

//Displays the month View
calendar.setView(CalendarViews.MONTH);

Adding Appointments

The following code snippet demonstrates how to create and add an appointment to the calendar widget. Every time an appointment is added to the calendar widget the layout is re-calculated and performed.

Appointment appt = new Appointment();
appt.setStart(...);
appt.setEnd(...);
appt.setTitle(...);
appt.addStyleName("gwt-appointment-blue");
calendar.addAppointment(appt);

For now, if an appointment is multi day, you need to manually set the following appointment attribute:

appt.setMultiDay(true);

We plan to auto-calculate isMultiDay() before the final 0.9 version is released.


Comment by aitor.carrera, Jul 08, 2009

Hi!

Great work, There is a way to control what timeblock user click vent the user dont click an appointment????

Regards

Comment by aitor.carrera, Jul 08, 2009

Looking in the code, I find that I need to manage simple panel click on DayViewGrid?.java, get the position on the grid and fire an action to create an Appoinmet. I will do it by this way, are you interested on this contribution?

Regards

Comment by Brad.Rydzewski, Jul 08, 2009

absolutely, any ideas to improve are welcome. Create a new Issue for this request and include some sample code and i'd be happy to add this functionality. I'm also interested in adding point/drag functionality to create an appointment that spans multiple time blocks.

Comment by biswas.supriyo, Aug 04, 2009

If I want to display data from database saved on different date basic then for each action like next, previous ... iness method call i snecessary?

Comment by biswas.supriyo, Aug 04, 2009

If I want to display data from database saved on different date basic then for each action like next, previous ... business method call is necessary? if yes then where to call ?

Hosted by Google Code