/* * 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.widgets.Canvas; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.calendar.*; import com.smartgwt.client.types.TimeUnit; 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 TimelineGroupingSample implements EntryPoint { public void onModuleLoad() { HeaderLevel[] headerLevels = new HeaderLevel[]{ new HeaderLevel(TimeUnit.WEEK), new HeaderLevel(TimeUnit.DAY) }; // grouping fields must be specified as laneFields, but can be hidden as is done here ListGridField groupField = new ListGridField("devGroup"); groupField.setHidden(true); ListGridField[] laneFields = new ListGridField[]{ new ListGridField("title", "Developer", 120), groupField }; Timeline calendar = new Timeline(); calendar.setHeight(451); calendar.setStartDate(new Date(112, 5, 2)); calendar.setEndDate(new Date(112, 5, 22)); calendar.setCanEditLane(true); calendar.setShowEventDescriptions(false); // grouping settings calendar.setCanGroupLanes(true); calendar.setLaneGroupByField("devGroup"); calendar.setLaneFields(laneFields); calendar.setHeaderLevels(headerLevels); calendar.setLanes(TimelineLaneData.getRecords()); calendar.setData(TimelineData.getRecords()); calendar.draw(); } }