From 455da9d940c79d85e09fce48cf8f590328f4d677 Mon Sep 17 00:00:00 2001 From: Marc Englund Date: Fri, 17 Aug 2007 11:47:37 +0000 Subject: [PATCH] CalendarField ui changes svn changeset:2052/svn branch:trunk --- .../terminal/gwt/client/ui/ICalendar.java | 25 ++++++--- .../client/ui/datefield/ICalendarPanel.java | 2 +- .../datefield/css/datefield.css | 51 ++++++++++++++++++- 3 files changed, 67 insertions(+), 11 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java index 23a5e7c677..f6473430c0 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/ICalendar.java @@ -7,6 +7,8 @@ import java.util.Iterator; import java.util.List; import com.google.gwt.user.client.ui.FlexTable; +import com.google.gwt.user.client.ui.HTMLTable; +import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.SourcesTableEvents; import com.google.gwt.user.client.ui.TableListener; import com.itmill.toolkit.terminal.gwt.client.ApplicationConnection; @@ -19,7 +21,7 @@ public class ICalendar extends IDateField { private ICalendarPanel calPanel; - private FlexTable hourTable; + private HTMLTable hourTable; private EntrySource entrySource; @@ -76,6 +78,11 @@ public class ICalendar extends IDateField { hourTable = new FlexTable(); firstRender = true; hourTable.addTableListener(this.ftListener); + SimplePanel p = new SimplePanel(); + p.add(hourTable); + p.setStyleName(getStyleName() + "-hours"); + this.calPanel.getFlexCellFormatter().setColSpan(8, 0, 7); + this.calPanel.setWidget(8, 0, p); } Date curr = new Date(date.getTime()); for (int i = 0; i < 24; i++) { @@ -94,8 +101,9 @@ public class ICalendar extends IDateField { String ampm = (i < 12 ? "am" : "pm"); hstr = (i <= 12 ? i : i - 12) + ":00 " + ampm; } - hourTable.setHTML(i, 0, "" + hstr + ""); + hourTable.setHTML(i, 0, "" + hstr + ""); + hourTable.getCellFormatter().setStyleName(i, 0, + getStyleName() + "-time"); } List entries = this.entrySource.getEntries(curr, DateTimeService.RESOLUTION_HOUR); @@ -106,13 +114,12 @@ public class ICalendar extends IDateField { text += (text == "" ? "" : ", ") + (title != null ? title : "?"); } - hourTable.setHTML(i, 1, "" + text + ""); + hourTable.setHTML(i, 1, "" + text + ""); + hourTable.getCellFormatter().setStyleName(i, 1, + getStyleName() + "-title"); } } - this.calPanel.getFlexCellFormatter().setColSpan(8, 0, 7); - this.calPanel.setWidget(8, 0, hourTable); } private class HourTableListener implements TableListener { @@ -143,7 +150,9 @@ public class ICalendar extends IDateField { if (items.containsKey(id)) { items.remove(id); } - items.put(id, new ICalendarEntry(startDate, endDate, title, notime)); + items + .put(id, new ICalendarEntry(startDate, endDate, title, + notime)); } public List getEntries(Date date, int resolution) { diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/datefield/ICalendarPanel.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/datefield/ICalendarPanel.java index df4c32bcca..6633f3e18a 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/datefield/ICalendarPanel.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/datefield/ICalendarPanel.java @@ -179,7 +179,7 @@ public class ICalendarPanel extends FlexTable implements MouseListener, .hasNext();) { ICalendarEntry entry = (ICalendarEntry) it .next(); - title += (title.length() > 0 ? "\n" : "") + title += (title.length() > 0 ? ", " : "") + entry.getStringForDate(curr); } } diff --git a/src/com/itmill/toolkit/terminal/gwt/public/component-themes/datefield/css/datefield.css b/src/com/itmill/toolkit/terminal/gwt/public/component-themes/datefield/css/datefield.css index b990a94631..bbad2bacb9 100644 --- a/src/com/itmill/toolkit/terminal/gwt/public/component-themes/datefield/css/datefield.css +++ b/src/com/itmill/toolkit/terminal/gwt/public/component-themes/datefield/css/datefield.css @@ -40,6 +40,19 @@ background-color: #1C3E6E; cursor: default; } +.i-datefield-calendarpanel-day-entry { + color: #0074D9; +} +.i-datefield-calendarpanel-day-disabled { + font-weight: normal; + color: #dddddd; + cursor: default; + opacity: 0.5; +} +.i-datefield-calendarpanel-day-entry.i-datefield-calendarpanel-day-disabled { + color: #ABC8E2; +} + .i-datefield-time { white-space: nowrap; } @@ -47,7 +60,6 @@ display: inline; } - .i-datefield-calendar { border: 1px solid #29528a; padding: 5px; @@ -68,4 +80,39 @@ background: transparent url(../../panel/img/bottom-right.png) no-repeat right top; content: url(../../panel/img/bottom-left.png); margin: 5px -6px -6px -6px; -} \ No newline at end of file +} + +.i-datefield-entrycalendar-hours { + height: 150px; + overflow: auto; +} +.i-datefield-entrycalendar-hours table { + width: 92%; +} + +.i-datefield-entrycalendar-row-even { + cursor: pointer; + background-color: #fefefe; +} +.i-datefield-entrycalendar-row-odd { + cursor: pointer; + background-color: #eeeeee; +} +.i-datefield-entrycalendar-row-selected { + color: #fff; + background-color: #1C3E6E; +} +td.i-datefield-entrycalendar-time { + padding-right: 2px; + text-align: right; + white-space: nowrap; +} +td.i-datefield-entrycalendar-title { + padding-left: 2px; + text-align: left; + width: 80%; + color: #0074D9; +} +.i-datefield-entrycalendar-row-selected td span { + color: #fff; +} -- 2.39.5