package com.smartgwt.testcase;

import java.util.Date;

import com.google.gwt.core.client.EntryPoint;
import com.smartgwt.client.widgets.calendar.Calendar;
import com.smartgwt.client.widgets.calendar.CalendarEvent;

/**
 * Demonstrates issue: http://forums.smartclient.com/showthread.php?t=13750
 *
 */
public class TestGwt implements EntryPoint {

	public void onModuleLoad() {
		Date today = new Date();
		int year = today.getYear();
		int month = today.getMonth();
		int start = today.getDate() - today.getDay();

		Calendar calendar = new Calendar();
		calendar.setData(new CalendarEvent[] {
				new CalendarEvent(1,
						"Working scenario (later end date) - event 1", "x",
						new Date(year, month, start, 8, 15, 0), new Date(year,
								month, start, 8, 45, 0)),
				new CalendarEvent(2,
						"Working scenario (later end date) - event 2", "x",
						new Date(year, month, start, 8, 15, 0), new Date(year,
								month, start, 8, 45, 0)),
				new CalendarEvent(3,
						"Working scenario(earlier start date)  - event 1", "x",
						new Date(year, month, start, 9, 14, 0), new Date(year,
								month, start, 9, 44, 0)),
				new CalendarEvent(4,
						"Working scenario(earlier start date)  - event 2", "x",
						new Date(year, month, start, 9, 14, 0), new Date(year,
								month, start, 9, 44, 0)),
				new CalendarEvent(5, "Failing scenario - event 1", "x",
						new Date(year, month, start, 10, 15, 0), new Date(year,
								month, start, 10, 44, 0)),
				new CalendarEvent(6, "Failing scenario - event 2", "x",
						new Date(year, month, start, 10, 15, 0), new Date(year,
								month, start, 10, 44, 0)) });

		calendar.setAutoFetchData(true);
		calendar.draw();
	}

}
