/* * Smart GWT (GWT for SmartClient) * Copyright 2008 and beyond, Isomorphic Software, Inc. * * Smart GWT is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License version 3 * as published by the Free Software Foundation. Smart GWT is also * available under typical commercial license terms - see * http://smartclient.com/license * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ import java.util.Date; import com.smartgwt.client.types.TimeUnit; import com.smartgwt.client.widgets.calendar.*; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.sample.showcase.client.data.TimelineData; import com.smartgwt.sample.showcase.client.data.TimelineLaneData; import com.google.gwt.core.client.EntryPoint; public class TimelineZonesAndIndicatorsSample implements EntryPoint { public void onModuleLoad() { HeaderLevel[] headerLevels = new HeaderLevel[]{ new HeaderLevel(TimeUnit.WEEK), new HeaderLevel(TimeUnit.DAY) }; Timeline calendar = new Timeline(); calendar.setHeight(451); calendar.setStartDate(new Date(116, 5, 2)); calendar.setEndDate(new Date(116, 5, 22)); calendar.setCanEditLane(true); calendar.setShowEventDescriptions(false); calendar.setEventSnapGap(8 * 60); // snap to 8 hour intervals calendar.setLaneEventPadding(2); // add a little space around events // zone settings calendar.setShowZones(true); calendar.setZones( new CalendarEvent(-1, "June 3-6", "", new Date(116, 5, 3), new Date(116, 5, 6)), new CalendarEvent(-2, "June 10-14", "", new Date(116, 5, 10), new Date(116, 5, 14)) ); // indicator settings calendar.setShowIndicators(true); calendar.setIndicators( new CalendarEvent(-3, "June 15 - noon", "Team Lunch", new Date(116, 5, 15, 12, 0), null) ); // set up the grid calendar.setHeaderLevels(headerLevels); calendar.setLanes(TimelineLaneData.getRecords()); calendar.setLaneFields(new ListGridField[]{ new ListGridField("title", "Developer", 120)}); calendar.setData(TimelineData.getRecords()); calendar.draw(); } }