diff options
author | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2010-03-24 11:48:34 +0000 |
---|---|---|
committer | Jouni Koivuviita <jouni.koivuviita@itmill.com> | 2010-03-24 11:48:34 +0000 |
commit | b525addb90af3b239bce8c3e06d6581ea0034e39 (patch) | |
tree | 6cf481ee9205f505d6b239ddc34caa1a56121590 | |
parent | 34f8e119c17870845ef0155be747dd7865b35f9f (diff) | |
download | vaadin-framework-b525addb90af3b239bce8c3e06d6581ea0034e39.tar.gz vaadin-framework-b525addb90af3b239bce8c3e06d6581ea0034e39.zip |
Fixes #3492: DateField should have an option to show week numbers
svn changeset:12061/svn branch:6.3
-rw-r--r-- | WebContent/VAADIN/themes/reindeer/datefield/datefield.css | 17 | ||||
-rw-r--r-- | WebContent/VAADIN/themes/reindeer/styles.css | 17 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java | 21 |
3 files changed, 39 insertions, 16 deletions
diff --git a/WebContent/VAADIN/themes/reindeer/datefield/datefield.css b/WebContent/VAADIN/themes/reindeer/datefield/datefield.css index 6cf1880c07..c788481e3d 100644 --- a/WebContent/VAADIN/themes/reindeer/datefield/datefield.css +++ b/WebContent/VAADIN/themes/reindeer/datefield/datefield.css @@ -154,15 +154,15 @@ td.v-datefield-calendarpanel-nextyear { color: #eaeff1; text-shadow: #3b4651 0 -1px 0; vertical-align: top; -}/* -.v-datefield-calendarpanel-weeknumber td { +} +.v-datefield-calendarpanel-weeknumbers td { width: 12.4%; -}*/ +} .v-datefield-calendarpanel-weekdays strong { display: block; text-align: right; - padding-right: 5px; - height: 15px; + padding: 1px 5px 0 0; + height: 14px; border-top: 1px solid #596775; } .v-datefield-calendarpanel-weekdays .v-first { @@ -194,7 +194,12 @@ td.v-datefield-calendarpanel-nextyear { .v-datefield-calendarpanel-day-today { padding: 2px 5px 2px 0; display: block; - margin: 1px 0 0 6px; + margin: 1px 0 0 5px; +} +.v-datefield-calendarpanel-weeknumber { + margin: 0; + padding-top: 4px; + padding-bottom: 3px; } .v-datefield-calendarpanel-day-today { color: #4095d1; diff --git a/WebContent/VAADIN/themes/reindeer/styles.css b/WebContent/VAADIN/themes/reindeer/styles.css index cccb71c82c..020647e14b 100644 --- a/WebContent/VAADIN/themes/reindeer/styles.css +++ b/WebContent/VAADIN/themes/reindeer/styles.css @@ -2873,15 +2873,15 @@ td.v-datefield-calendarpanel-nextyear { color: #eaeff1; text-shadow: #3b4651 0 -1px 0; vertical-align: top; -}/* -.v-datefield-calendarpanel-weeknumber td { +} +.v-datefield-calendarpanel-weeknumbers td { width: 12.4%; -}*/ +} .v-datefield-calendarpanel-weekdays strong { display: block; text-align: right; - padding-right: 5px; - height: 15px; + padding: 1px 5px 0 0; + height: 14px; border-top: 1px solid #596775; } .v-datefield-calendarpanel-weekdays .v-first { @@ -2917,7 +2917,12 @@ td.v-datefield-calendarpanel-nextyear { .v-datefield-calendarpanel-day-today { padding: 2px 5px 2px 0; display: block; - margin: 1px 0 0 6px; + margin: 1px 0 0 5px; +} +.v-datefield-calendarpanel-weeknumber { + margin: 0; + padding-top: 4px; + padding-bottom: 3px; } .v-datefield-calendarpanel-day-today { color: #4095d1; diff --git a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java index 34c596ac20..7f0b3b6d84 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VCalendarPanel.java @@ -176,17 +176,30 @@ public class VCalendarPanel extends FlexTable implements MouseListener { days.getFlexCellFormatter().setStyleName(headerRow, weekColumn,
"v-week");
+ days.setHTML(headerRow, weekColumn, "<strong></strong>");
// Hide the week column if week numbers are not to be displayed.
days.getFlexCellFormatter().setVisible(headerRow, weekColumn,
showISOWeekNumbers);
- days.getFlexCellFormatter().setStyleName(headerRow, firstWeekdayColumn,
- "v-first");
- days.getFlexCellFormatter().setStyleName(headerRow,
- firstWeekdayColumn + 6, "v-last");
days.getRowFormatter().setStyleName(headerRow,
VDateField.CLASSNAME + "-calendarpanel-weekdays");
+ if (showISOWeekNumbers) {
+ days.getFlexCellFormatter().setStyleName(headerRow, weekColumn,
+ "v-first");
+ days.getFlexCellFormatter().setStyleName(headerRow,
+ firstWeekdayColumn, "");
+ days.getRowFormatter().addStyleName(headerRow,
+ VDateField.CLASSNAME + "-calendarpanel-weeknumbers");
+ } else {
+ days.getFlexCellFormatter().setStyleName(headerRow, weekColumn, "");
+ days.getFlexCellFormatter().setStyleName(headerRow,
+ firstWeekdayColumn, "v-first");
+ }
+
+ days.getFlexCellFormatter().setStyleName(headerRow,
+ firstWeekdayColumn + 6, "v-last");
+
// Print weekday names
final int firstDay = datefield.getDateTimeService().getFirstDayOfWeek();
for (int i = 0; i < 7; i++) {
|