package de.smartgwttest.client;

import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceDateField;
import com.smartgwt.client.data.fields.DataSourceSequenceField;
import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.widgets.calendar.Calendar;

public class CalendarBug {

	public void onModuleLoad() {
        DataSource eventDS = new DataSource();  
        DataSourceSequenceField eventIdField = new DataSourceSequenceField("eventId");  
        eventIdField.setPrimaryKey(true);  
  
        DataSourceTextField nameField = new DataSourceTextField("name");  
        DataSourceTextField descField = new DataSourceTextField("description");  
        DataSourceDateField startDateField = new DataSourceDateField("startDate");  
        DataSourceDateField endDateField = new DataSourceDateField("endDate");  
  
        eventDS.setFields(eventIdField, nameField, descField, startDateField, endDateField);  
        eventDS.setClientOnly(true);  
        eventDS.setTestData(CalendarData.getRecords());  
  
        Calendar calendar = new Calendar();  
        calendar.setShowWeekends(false);  
        calendar.setShowWorkday(true);  
        calendar.setEventAutoArrange(true);
        calendar.setEventOverlap(false);
        calendar.setScrollToWorkday(true);  
        calendar.setDataSource(eventDS);  
        calendar.setAutoFetchData(true);  
        calendar.setEventSnapGap(10);
  
        calendar.draw();  
	}
}
