Smart GWT 4.0p (2013-08-19)
Ran into this problem yesterday. Please see attached screen shots (a second has been added to show how it appears in production environment). The overlapped events cause the event height to small, and the lane seems like a "waterfall model" instead optimized filled blocks on the grid.
Here is the code to repeat:
It seems the longer event (#58) causes the problem.
Please note OverlapSortSpecifiers are given.
/* the layout is even worst (one event on the top of the others) if there are no overlap sort specifiers, and you may want to fix that case as well */
It looks like a bug, please let me know. Thank you.
Ran into this problem yesterday. Please see attached screen shots (a second has been added to show how it appears in production environment). The overlapped events cause the event height to small, and the lane seems like a "waterfall model" instead optimized filled blocks on the grid.
Here is the code to repeat:
Code:
public class TestTimelineRenderingProblemWhenHasOverBookedEvents implements EntryPoint { private static Date today = new Date(); private static int year = today.getYear(); private static int month = today.getMonth(); private static int day = today.getDate() - today.getDay(); @Override public void onModuleLoad() { Timeline timeline = new Timeline(); timeline.setEventSnapGap(25); timeline.setCanResizeTimelineEvents(false); timeline.setCanEditLane(false); timeline.setShowEventDescriptions(false); timeline.setDefaultTimelineColumnSpan(1); timeline.setTimelineUnitsPerColumn(1); timeline.setColumnsPerPage(24); timeline.setTimeFormatter(TimeDisplayFormat.TOSHORTTIME); timeline.setShowWeekends(false); timeline.setWorkdays(new int[]{1,2,3,4,5,6}); timeline.setFirstDayOfWeek(1); // Monday timeline.setSaveButtonTitle("Start Request"); timeline.setEventNameFieldTitle("Request Comment"); timeline.setDateEditingStyle(DateEditingStyle.DATETIME); timeline.setEventLaneFieldTitle("Room"); String[] hours = new String[] { "6:00am", "7:00am", "8:00am", "9:00am", "10:00am", "11:00am", "12:00pm", "1:00pm", "2:00pm", "3:00pm", "4:00pm", "5:00pm", "6:00pm", "7:00pm", "8:00pm"}; HeaderLevel hlHour = new HeaderLevel(TimeUnit.HOUR, hours); hlHour.setHeaderWidth(100); HeaderLevel[] headerLevels = new HeaderLevel[]{ hlHour }; timeline.setHeaderLevels(headerLevels); ListGridField lgfLaneHeader = new ListGridField("title", "Room / Time"); timeline.setLaneFields(lgfLaneHeader); SortSpecifier[] overlapSortSpecifiers = { new SortSpecifier("order", SortDirection.DESCENDING), new SortSpecifier("startDate", SortDirection.ASCENDING)}; timeline.setOverlapSortSpecifiers(overlapSortSpecifiers); timeline.setLanes(getLanes()); long t = System.currentTimeMillis(); timeline.setData(getEvents()); System.out.println("set events: " + (System.currentTimeMillis() - t) + " ms"); Date startDate = new Date(year, month, day, 6, 0, 0); Date endDate = new Date(year, month, day, 16, 0, 0); timeline.setTimelineRange(startDate, endDate); timeline.draw(); } public static Lane[] getLanes() { Lane[] lanes = new Lane[]{ new Lane("ln 1", "ln 1"), }; for(Lane lane : lanes) { lane.setHeight(500); } return lanes; } public static CalendarEvent[] getEvents() { CalendarEvent[] events = new CalendarEvent[20]; events[0] = new CalendarEvent(35, "#35", "", new Date(year, month, day, 8, 0, 0), new Date(year, month, day, 8, 29, 59), "ln 1"); events[0].setAttribute("order", 2); events[1] = new CalendarEvent(36, "#36", "", new Date(year, month, day, 7, 30, 0), new Date(year, month, day, 7, 59, 59), "ln 1"); events[1].setAttribute("order", 2); events[2] = new CalendarEvent(37, "#37", "", new Date(year, month, day, 7, 0, 0), new Date(year, month, day, 7, 29, 59), "ln 1"); events[2].setAttribute("order", 2); events[3] = new CalendarEvent(38, "#38", "", new Date(year, month, day, 8, 0, 0), new Date(year, month, day, 8, 29, 59), "ln 1"); events[3].setAttribute("order", 2); events[4] = new CalendarEvent(39, "#39", "", new Date(year, month, day, 8, 0, 0), new Date(year, month, day, 8, 29, 59), "ln 1"); events[4].setAttribute("order", 2); events[5] = new CalendarEvent(40, "#40", "", new Date(year, month, day, 8, 30, 0), new Date(year, month, day, 8, 59, 59), "ln 1"); events[5].setAttribute("order", 2); events[6] = new CalendarEvent(41, "#41", "", new Date(year, month, day, 9, 0, 0), new Date(year, month, day, 9, 29, 59), "ln 1"); events[6].setAttribute("order", 2); events[7] = new CalendarEvent(42, "#42", "", new Date(year, month, day, 9, 0, 0), new Date(year, month, day, 9, 29, 59), "ln 1"); events[7].setAttribute("order", 2); events[8] = new CalendarEvent(43, "#43", "", new Date(year, month, day, 9, 30, 0), new Date(year, month, day, 9, 59, 59), "ln 1"); events[8].setAttribute("order", 2); events[9] = new CalendarEvent(44, "#44", "", new Date(year, month, day, 10, 0, 0), new Date(year, month, day, 10, 29, 59), "ln 1"); events[9].setAttribute("order", 2); events[10] = new CalendarEvent(45, "#45", "", new Date(year, month, day, 10, 30, 0), new Date(year, month, day, 10, 59, 59), "ln 1"); events[10].setAttribute("order", 2); events[11] = new CalendarEvent(46, "#46", "", new Date(year, month, day, 12, 0, 0), new Date(year, month, day, 12, 29, 59), "ln 1"); events[11].setAttribute("order", 2); events[12] = new CalendarEvent(47, "#47", "", new Date(year, month, day, 7, 30, 0), new Date(year, month, day, 7, 59, 59), "ln 1"); events[12].setAttribute("order", 2); events[13] = new CalendarEvent(48, "#48", "", new Date(year, month, day, 7, 0, 0), new Date(year, month, day, 7, 29, 59), "ln 1"); events[13].setAttribute("order", 2); events[14] = new CalendarEvent(49, "#49", "", new Date(year, month, day, 7, 30, 0), new Date(year, month, day, 7, 59, 59), "ln 1"); events[14].setAttribute("order", 2); events[15] = new CalendarEvent(51, "#51", "", new Date(year, month, day, 8, 30, 0), new Date(year, month, day, 8, 59, 59), "ln 1"); events[15].setAttribute("order", 2); events[16] = new CalendarEvent(52, "#52", "", new Date(year, month, day, 8, 30, 0), new Date(year, month, day, 8, 59, 59), "ln 1"); events[16].setAttribute("order", 2); events[17] = new CalendarEvent(53, "#53", "", new Date(year, month, day, 9, 0, 0), new Date(year, month, day, 9, 29, 59), "ln 1"); events[17].setAttribute("order", 2); events[18] = new CalendarEvent(54, "#54", "", new Date(year, month, day, 10, 0, 0), new Date(year, month, day, 10, 29, 59), "ln 1"); events[18].setAttribute("order", 2); events[19] = new CalendarEvent(58, "#58", "", new Date(year, month, day, 7, 0, 0), new Date(year, month, day, 15, 30, 0), "ln 1"); events[19].setAttribute("order", 6); return events; } }
Please note OverlapSortSpecifiers are given.
/* the layout is even worst (one event on the top of the others) if there are no overlap sort specifiers, and you may want to fix that case as well */
It looks like a bug, please let me know. Thank you.
Comment