summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebContent/VAADIN/themes/base/base.scss2
-rw-r--r--WebContent/VAADIN/themes/base/inlinedatefield/inlinedatefield.scss5
-rw-r--r--WebContent/VAADIN/themes/liferay/datefield/datefield.scss76
-rw-r--r--WebContent/VAADIN/themes/liferay/inlinedatefield/inlinedatefield.scss8
-rw-r--r--WebContent/VAADIN/themes/liferay/liferay.scss2
-rw-r--r--WebContent/VAADIN/themes/reindeer/inlinedatefield/inlinedatefield.scss8
-rw-r--r--WebContent/VAADIN/themes/reindeer/reindeer.scss2
-rw-r--r--WebContent/VAADIN/themes/runo/datefield/datefield.scss78
-rw-r--r--WebContent/VAADIN/themes/runo/inlinedatefield/inlinedatefield.scss8
-rw-r--r--WebContent/VAADIN/themes/runo/runo.scss2
-rw-r--r--client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java4
-rw-r--r--client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java8
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java71
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VDateField.java2
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java5
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java32
-rw-r--r--client/src/com/vaadin/client/ui/datefield/VTextualDate.java25
-rw-r--r--shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java2
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html247
-rw-r--r--uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java42
20 files changed, 500 insertions, 129 deletions
diff --git a/WebContent/VAADIN/themes/base/base.scss b/WebContent/VAADIN/themes/base/base.scss
index 8a126476bc..7e2e20a969 100644
--- a/WebContent/VAADIN/themes/base/base.scss
+++ b/WebContent/VAADIN/themes/base/base.scss
@@ -10,6 +10,7 @@
@import "customcomponent/customcomponent.scss";
@import "customlayout/customlayout.scss";
@import "datefield/datefield.scss";
+@import "inlinedatefield/inlinedatefield.scss";
@import "dragwrapper/dragwrapper.scss";
@import "embedded/embedded.scss";
@import "formlayout/formlayout.scss";
@@ -60,6 +61,7 @@
@include base-customcomponent;
@include base-customlayout;
@include base-datefield;
+ @include base-inline-datefield;
@include base-dragwrapper;
@include base-embedded;
@include base-formlayout;
diff --git a/WebContent/VAADIN/themes/base/inlinedatefield/inlinedatefield.scss b/WebContent/VAADIN/themes/base/inlinedatefield/inlinedatefield.scss
new file mode 100644
index 0000000000..0c42979b6b
--- /dev/null
+++ b/WebContent/VAADIN/themes/base/inlinedatefield/inlinedatefield.scss
@@ -0,0 +1,5 @@
+@mixin base-inline-datefield($name : v-inline-datefield){
+
+ /* FIXME $name should be passed to the the mixing instead of the default. Fix when SASS compiler works. #9821 */
+ @include base-datefield(v-inline-datefield);
+} \ No newline at end of file
diff --git a/WebContent/VAADIN/themes/liferay/datefield/datefield.scss b/WebContent/VAADIN/themes/liferay/datefield/datefield.scss
index 4bfc810b52..ad26907a18 100644
--- a/WebContent/VAADIN/themes/liferay/datefield/datefield.scss
+++ b/WebContent/VAADIN/themes/liferay/datefield/datefield.scss
@@ -1,56 +1,56 @@
-@mixin liferay-datefield {
+@mixin liferay-datefield($name : v-datefield) {
-.v-datefield-popup {
+.#{$name}-popup {
padding: 3px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
-.v-datefield-calendarpanel-header {
+.#{$name}-calendarpanel-header {
height: 28px;
}
-.v-datefield-calendarpanel:focus {
+.#{$name}-calendarpanel:focus {
outline: none;
}
-.v-datefield-calendarpanel-body {
+.#{$name}-calendarpanel-body {
text-align: right;
vertical-align: top;
}
-.v-datefield-popupcalendar .v-datefield-button {
+.#{$name}-popupcalendar .#{$name}-button {
background: transparent url(../common/buttons_sprites.png) no-repeat 0 -48px;
width: 24px;
height: 24px;
border: none;
}
-.v-datefield-popupcalendar .v-datefield-button:hover {
+.#{$name}-popupcalendar .#{$name}-button:hover {
background-position: 0px -72px;
}
-.v-datefield-popupcalendar .v-datefield-button:focus {
+.#{$name}-popupcalendar .#{$name}-button:focus {
background-position: 0px -96px;
}
-.v-datefield-month .v-datefield-calendarpanel-month,
-.v-datefield-day .v-datefield-calendarpanel-month,
-.v-datefield-full .v-datefield-calendarpanel-month {
+.#{$name}-month .#{$name}-calendarpanel-month,
+.#{$name}-day .#{$name}-calendarpanel-month,
+.#{$name}-full .#{$name}-calendarpanel-month {
width: 124px;
}
-.v-datefield-year .v-datefield-calendarpanel-month {
+.#{$name}-year .#{$name}-calendarpanel-month {
width: 35px;
}
-.v-datefield-calendarpanel-month {
+.#{$name}-calendarpanel-month {
background: transparent url(datefield_sprites.png) repeat-x 0 -112px;
font-weight: bold;
}
-span.v-datefield-calendarpanel-month {
+span.#{$name}-calendarpanel-month {
display: block;
text-align: center;
background: transparent;
@@ -58,15 +58,15 @@ span.v-datefield-calendarpanel-month {
padding: 1px 3px 0;
}
-.v-datefield-calendarpanel-prevyear,
-.v-datefield-calendarpanel-nextyear {
+.#{$name}-calendarpanel-prevyear,
+.#{$name}-calendarpanel-nextyear {
width: 22px;
}
-.v-datefield-calendarpanel-prevyear button,
-.v-datefield-calendarpanel-prevmonth button,
-.v-datefield-calendarpanel-nextmonth button,
-.v-datefield-calendarpanel-nextyear button {
+.#{$name}-calendarpanel-prevyear button,
+.#{$name}-calendarpanel-prevmonth button,
+.#{$name}-calendarpanel-nextmonth button,
+.#{$name}-calendarpanel-nextyear button {
width: 22px;
height: 28px;
border: none;
@@ -83,42 +83,42 @@ span.v-datefield-calendarpanel-month {
border-radius: 0;
}
-.v-ie .v-datefield-calendarpanel-prevyear button,
-.v-ie .v-datefield-calendarpanel-nextyear button,
-.v-ie .v-datefield-calendarpanel-prevmonth button,
-.v-ie .v-datefield-calendarpanel-nextmonth button {
+.v-ie .#{$name}-calendarpanel-prevyear button,
+.v-ie .#{$name}-calendarpanel-nextyear button,
+.v-ie .#{$name}-calendarpanel-prevmonth button,
+.v-ie .#{$name}-calendarpanel-nextmonth button {
text-indent: 0;
font-size: 1px;
}
-.v-datefield-calendarpanel-prevmonth button {
+.#{$name}-calendarpanel-prevmonth button {
background-position: 0 -56px;
}
-.v-datefield-calendarpanel-prevmonth {
+.#{$name}-calendarpanel-prevmonth {
background: transparent url(datefield_sprites.png) repeat-x 0 -112px;
}
-.v-datefield-calendarpanel-nextyear button {
+.#{$name}-calendarpanel-nextyear button {
background-position: 0 -28px;
width: 100%;
min-width: 22px;
}
-.v-datefield-calendarpanel-nextmonth button {
+.#{$name}-calendarpanel-nextmonth button {
background-position: 0 -84px;
}
-.v-datefield-calendarpanel-nextmonth {
+.#{$name}-calendarpanel-nextmonth {
background: transparent url(datefield_sprites.png) repeat-x 0 -112px;
}
-.v-datefield-calendarpanel-prevyear button {
+.#{$name}-calendarpanel-prevyear button {
width: 100%;
min-width: 22px;
}
-.v-datefield-calendarpanel-day {
+.#{$name}-calendarpanel-day {
display: block;
width: 22px;
margin: 0 0 3px 3px;
@@ -132,37 +132,37 @@ span.v-datefield-calendarpanel-month {
border-radius: 4px;
}
-.v-datefield-calendarpanel-day-today {
+.#{$name}-calendarpanel-day-today {
font-weight: bold;
}
-.v-datefield-calendarpanel-day-selected {
+.#{$name}-calendarpanel-day-selected {
background: #b5b5b5 url(/html/themes/classic/images/application/state_active_bg.png) repeat-x 0 0;
color: #000;
border-color: #555;
}
-.v-datefield-calendarpanel-day-focused {
+.#{$name}-calendarpanel-day-focused {
outline: 1px dotted #555;
}
-.v-datefield-calendarpanel-weekdays {
+.#{$name}-calendarpanel-weekdays {
text-align: center;
}
-.v-datefield-calendarpanel-weekdays strong {
+.#{$name}-calendarpanel-weekdays strong {
font-weight: normal;
}
-.v-datefield-calendarpanel-weeknumber {
+.#{$name}-calendarpanel-weeknumber {
display: block;
border: none;
padding: 2px 0 2px 0;
margin: 0;
}
-.v-datefield-calendarpanel-body table {
+.#{$name}-calendarpanel-body table {
margin: 0 auto;
width: 200px;
}
diff --git a/WebContent/VAADIN/themes/liferay/inlinedatefield/inlinedatefield.scss b/WebContent/VAADIN/themes/liferay/inlinedatefield/inlinedatefield.scss
new file mode 100644
index 0000000000..58aa928ee8
--- /dev/null
+++ b/WebContent/VAADIN/themes/liferay/inlinedatefield/inlinedatefield.scss
@@ -0,0 +1,8 @@
+@mixin liferay-inlinedatefield ($name : v-inline-datefield) {
+
+ @include liferay-datefield(v-inline-datefield);
+
+ .#{$name} {
+ line-height:19px; /* Override popup datefields line-height:0 to get correct line heights */
+ }
+} \ No newline at end of file
diff --git a/WebContent/VAADIN/themes/liferay/liferay.scss b/WebContent/VAADIN/themes/liferay/liferay.scss
index 7ec561ffc9..3128e48c76 100644
--- a/WebContent/VAADIN/themes/liferay/liferay.scss
+++ b/WebContent/VAADIN/themes/liferay/liferay.scss
@@ -7,6 +7,7 @@
@import "contextmenu/contextmenu.scss";
@import "datefield/datefield.scss";
+@import "inlinedatefield/inlinedatefield.scss";
@import "formlayout/formlayout.scss";
@import "menubar/menubar.scss";
@import "notification/notification.scss";
@@ -32,6 +33,7 @@
@include liferay-common;
@include liferay-contextmenu;
@include liferay-datefield;
+ @include liferay-inlinedatefield;
@include liferay-formlayout;
@include liferay-menubar;
@include liferay-notification;
diff --git a/WebContent/VAADIN/themes/reindeer/inlinedatefield/inlinedatefield.scss b/WebContent/VAADIN/themes/reindeer/inlinedatefield/inlinedatefield.scss
new file mode 100644
index 0000000000..19402f8208
--- /dev/null
+++ b/WebContent/VAADIN/themes/reindeer/inlinedatefield/inlinedatefield.scss
@@ -0,0 +1,8 @@
+@mixin reindeer-inlinedatefield ($name : v-inline-datefield) {
+
+ @include reindeer-datefield(v-inline-datefield);
+
+ .#{$name} {
+ line-height:14px; /* Override popup datefields line-height:0 to get correct line heights */
+ }
+} \ No newline at end of file
diff --git a/WebContent/VAADIN/themes/reindeer/reindeer.scss b/WebContent/VAADIN/themes/reindeer/reindeer.scss
index e102e99bc5..ef827190b5 100644
--- a/WebContent/VAADIN/themes/reindeer/reindeer.scss
+++ b/WebContent/VAADIN/themes/reindeer/reindeer.scss
@@ -9,6 +9,7 @@
@import "common/common.scss";
@import "datefield/datefield.scss";
+@import "inlinedatefield/inlinedatefield.scss";
@import "formlayout/formlayout.scss";
@import "label/label.scss";
@import "layouts/layouts.scss";
@@ -39,6 +40,7 @@
@include reindeer-nativebutton;
@include reindeer-common;
@include reindeer-datefield;
+ @include reindeer-inlinedatefield;
@include reindeer-formlayout;
@include reindeer-label;
@include reindeer-layouts;
diff --git a/WebContent/VAADIN/themes/runo/datefield/datefield.scss b/WebContent/VAADIN/themes/runo/datefield/datefield.scss
index 57ad061b65..82dad4a0ac 100644
--- a/WebContent/VAADIN/themes/runo/datefield/datefield.scss
+++ b/WebContent/VAADIN/themes/runo/datefield/datefield.scss
@@ -1,10 +1,10 @@
-@mixin runo-datefield {
+@mixin runo-datefield($name : v-datefield) {
-.v-datefield input.v-textfield,
-.v-datefield input.v-textfield[type=text] {
+.#{$name} input.v-textfield,
+.#{$name} input.v-textfield[type=text] {
height: 18px;
}
-.v-datefield-button {
+.#{$name}-button {
font-size:13px;
width: 22px;
height: 24px;
@@ -14,7 +14,7 @@
background: transparent url(img/open-button.png) no-repeat right 0;
vertical-align: top;
}
-.v-datefield-popup {
+.#{$name}-popup {
font-family: "Trebuchet MS", geneva, helvetica, arial, tahoma, verdana, sans-serif;
color: #464f52;
font-size: 12px;
@@ -25,39 +25,39 @@
-moz-border-radius: 4px;
border-radius: 4px;
}
-.v-datefield-calendarpanel {
+.#{$name}-calendarpanel {
width: 230px;
}
-.v-datefield-popup .v-datefield-calendarpanel {
+.#{$name}-popup .#{$name}-calendarpanel {
width: 200px;
}
-.v-datefield-year .v-datefield-calendarpanel {
+.#{$name}-year .#{$name}-calendarpanel {
width: 100px;
}
-.v-datefield-calendarpanel td {
+.#{$name}-calendarpanel td {
text-align: right;
}
-.v-datefield-calendarpanel td span {
+.#{$name}-calendarpanel td span {
display: block;
}
-.v-datefield-calendarpanel-header {
+.#{$name}-calendarpanel-header {
height: 30px;
font-size: 13px;
}
-td.v-datefield-calendarpanel-month {
+td.#{$name}-calendarpanel-month {
font-weight: bold;
text-shadow: 0 1px 0 #fff;
width: 150px;
}
-.v-datefield-calendarpanel-prevyear,
-.v-datefield-calendarpanel-nextyear,
-.v-datefield-calendarpanel-prevmonth,
-.v-datefield-calendarpanel-nextmonth {
+.#{$name}-calendarpanel-prevyear,
+.#{$name}-calendarpanel-nextyear,
+.#{$name}-calendarpanel-prevmonth,
+.#{$name}-calendarpanel-nextmonth {
width: 16px;
}
/* Year buttons */
-.v-datefield-calendarpanel .v-button-prevyear,
-.v-datefield-calendarpanel .v-button-nextyear {
+.#{$name}-calendarpanel .v-button-prevyear,
+.#{$name}-calendarpanel .v-button-nextyear {
display: block;
width: 16px;
height: 16px;
@@ -67,16 +67,16 @@ td.v-datefield-calendarpanel-month {
text-indent: -90000px;
margin: 0 auto;
}
-.v-datefield-calendarpanel .v-button-nextyear {
+.#{$name}-calendarpanel .v-button-nextyear {
background: transparent url(img/nextyear.png) no-repeat;
}
-.v-datefield-calendarpanel .v-button-prevyear:hover,
-.v-datefield-calendarpanel .v-button-nextyear:hover {
+.#{$name}-calendarpanel .v-button-prevyear:hover,
+.#{$name}-calendarpanel .v-button-nextyear:hover {
background-position: left bottom;
}
/* Month buttons */
-.v-datefield-calendarpanel .v-button-prevmonth,
-.v-datefield-calendarpanel .v-button-nextmonth {
+.#{$name}-calendarpanel .v-button-prevmonth,
+.#{$name}-calendarpanel .v-button-nextmonth {
display: block;
width: 11px;
height: 16px;
@@ -86,42 +86,42 @@ td.v-datefield-calendarpanel-month {
text-indent: -90000px;
margin: 0 auto;
}
-.v-datefield-calendarpanel .v-button-nextmonth {
+.#{$name}-calendarpanel .v-button-nextmonth {
background: transparent url(img/nextmonth.png) no-repeat;
}
-.v-datefield-calendarpanel .v-button-prevmonth:hover,
-.v-datefield-calendarpanel .v-button-nextmonth:hover {
+.#{$name}-calendarpanel .v-button-prevmonth:hover,
+.#{$name}-calendarpanel .v-button-nextmonth:hover {
background-position: left bottom;
}
-.v-datefield-calendarpanel strong {
+.#{$name}-calendarpanel strong {
color: #ee5311;
display: block;
width: 20px;
font-size: 12px;
}
-.v-datefield-calendarpanel-day,
-.v-datefield-calendarpanel-weeknumber,
-.v-datefield-calendarpanel-day-today {
+.#{$name}-calendarpanel-day,
+.#{$name}-calendarpanel-weeknumber,
+.#{$name}-calendarpanel-day-today {
padding: 1px 3px;
width: 14px;
height: 16px;
}
-.v-datefield-calendarpanel-day-today {
+.#{$name}-calendarpanel-day-today {
border: 1px solid #429ce9;
width: 12px;
height: 14px;
}
-.v-datefield-calendarpanel-day-entry {
+.#{$name}-calendarpanel-day-entry {
color: #6a98b5;
}
-.v-datefield-calendarpanel-day-disabled {
+.#{$name}-calendarpanel-day-disabled {
font-weight: normal;
color: #dddddd;
}
-.v-datefield-calendarpanel-day-entry.v-datefield-calendarpanel-day-disabled {
+.#{$name}-calendarpanel-day-entry.#{$name}-calendarpanel-day-disabled {
color: #afd6f8;
}
-.v-datefield-calendarpanel-day-selected {
+.#{$name}-calendarpanel-day-selected {
font-weight: bold;
width: 14px;
height: 16px;
@@ -130,18 +130,18 @@ td.v-datefield-calendarpanel-month {
background: transparent url(img/selected-bg.png) no-repeat 50% 50%;
border: none;
}
-.v-datefield-time {
+.#{$name}-time {
font-size: 11px;
}
-.v-datefield-time .v-select {
+.#{$name}-time .v-select {
font-size: 10px;
padding: 0;
margin: 0;
}
-.v-datefield-rendererror .v-textfield {
+.#{$name}-rendererror .v-textfield {
background: #ff9999;
}
-.v-datefield-prompt .v-datefield-textfield {
+.#{$name}-prompt .#{$name}-textfield {
color: #999;
font-style: normal;
}
diff --git a/WebContent/VAADIN/themes/runo/inlinedatefield/inlinedatefield.scss b/WebContent/VAADIN/themes/runo/inlinedatefield/inlinedatefield.scss
new file mode 100644
index 0000000000..ada30fa40e
--- /dev/null
+++ b/WebContent/VAADIN/themes/runo/inlinedatefield/inlinedatefield.scss
@@ -0,0 +1,8 @@
+@mixin runo-inline-datefield($name : v-inline-datefield){
+
+ @include runo-datefield(v-inline-datefield);
+
+ .#{$name} {
+ line-height: 18px; /* Override inherited line-height: 0 needed for popup datefield */
+ }
+} \ No newline at end of file
diff --git a/WebContent/VAADIN/themes/runo/runo.scss b/WebContent/VAADIN/themes/runo/runo.scss
index 6db7c335cb..04f1ec5f13 100644
--- a/WebContent/VAADIN/themes/runo/runo.scss
+++ b/WebContent/VAADIN/themes/runo/runo.scss
@@ -6,6 +6,7 @@
@import "caption/caption.scss";
@import "common/common.scss";
@import "datefield/datefield.scss";
+@import "inlinedatefield/inlinedatefield.scss";
@import "formlayout/formlayout.scss";
@import "gridlayout/gridlayout.scss";
@import "label/label.scss";
@@ -38,6 +39,7 @@
@include runo-common;
@include runo-datefield;
+ @include runo-inline-datefield;
@include runo-formlayout;
@include runo-gridlayout;
@include runo-label;
diff --git a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
index 994a9e1d66..2f48d7411c 100644
--- a/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/AbstractDateFieldConnector.java
@@ -80,7 +80,7 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
// Remove old stylename that indicates current resolution
setWidgetStyleName(
- VDateField.CLASSNAME
+ getWidget().getStylePrimaryName()
+ "-"
+ VDateField
.resolutionToString(getWidget().currentResolution),
@@ -90,7 +90,7 @@ public class AbstractDateFieldConnector extends AbstractFieldConnector
// Add stylename that indicates current resolution
setWidgetStyleName(
- VDateField.CLASSNAME
+ getWidget().getStylePrimaryName()
+ "-"
+ VDateField
.resolutionToString(getWidget().currentResolution),
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index fbc7bcc88c..b2a5b49212 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -144,12 +144,12 @@ public class PopupDateFieldConnector extends TextualDateConnector {
// update the style change to popup calendar widget with the correct
// prefix
if (!styleName.startsWith("-")) {
- getWidget().popup.setStyleName(
- VPopupCalendar.POPUP_PRIMARY_STYLE_NAME + "-" + styleName,
+ getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
+ + "-popup-" + styleName,
add);
} else {
- getWidget().popup.setStyleName(
- VPopupCalendar.POPUP_PRIMARY_STYLE_NAME + styleName, add);
+ getWidget().popup.setStyleName(getWidget().getStylePrimaryName()
+ + "-popup" + styleName, add);
}
}
diff --git a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
index 0d21638417..2323035e58 100644
--- a/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/datefield/VCalendarPanel.java
@@ -197,9 +197,11 @@ public class VCalendarPanel extends FocusableFlexTable implements
private boolean hasFocus = false;
- public VCalendarPanel() {
+ private VDateField parent;
+
+ private boolean initialRenderDone = false;
- setStyleName(VDateField.CLASSNAME + "-calendarpanel");
+ public VCalendarPanel() {
/*
* Firefox auto-repeat works correctly only if we use a key press
@@ -213,7 +215,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
}
addFocusHandler(this);
addBlurHandler(this);
+ }
+ public void setParentField(VDateField parent) {
+ this.parent = parent;
}
/**
@@ -342,6 +347,26 @@ public class VCalendarPanel extends FocusableFlexTable implements
return enabled;
}
+ @Override
+ public void setStyleName(String style) {
+ super.setStyleName(style);
+ if (initialRenderDone) {
+ // Dynamic updates to the stylename needs to render the calendar to
+ // update the inner element stylenames
+ renderCalendar();
+ }
+ }
+
+ @Override
+ public void setStylePrimaryName(String style) {
+ super.setStylePrimaryName(style);
+ if (initialRenderDone) {
+ // Dynamic updates to the stylename needs to render the calendar to
+ // update the inner element stylenames
+ renderCalendar();
+ }
+ }
+
private void clearCalendarBody(boolean remove) {
if (!remove) {
// Leave the cells in place but clear their contents
@@ -368,7 +393,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
private void buildCalendarHeader(boolean needsMonth) {
getRowFormatter().addStyleName(0,
- VDateField.CLASSNAME + "-calendarpanel-header");
+ parent.getStylePrimaryName() + "-calendarpanel-header");
if (prevMonth == null && needsMonth) {
prevMonth = new VEventButton();
@@ -379,10 +404,6 @@ public class VCalendarPanel extends FocusableFlexTable implements
nextMonth.setHTML("›");
nextMonth.setStyleName("v-button-nextmonth");
nextMonth.setTabIndex(-1);
- getFlexCellFormatter().setStyleName(0, 3,
- VDateField.CLASSNAME + "-calendarpanel-nextmonth");
- getFlexCellFormatter().setStyleName(0, 1,
- VDateField.CLASSNAME + "-calendarpanel-prevmonth");
setWidget(0, 3, nextMonth);
setWidget(0, 1, prevMonth);
@@ -405,18 +426,24 @@ public class VCalendarPanel extends FocusableFlexTable implements
nextYear.setTabIndex(-1);
setWidget(0, 0, prevYear);
setWidget(0, 4, nextYear);
- getFlexCellFormatter().setStyleName(0, 0,
- VDateField.CLASSNAME + "-calendarpanel-prevyear");
- getFlexCellFormatter().setStyleName(0, 4,
- VDateField.CLASSNAME + "-calendarpanel-nextyear");
}
final String monthName = needsMonth ? getDateTimeService().getMonth(
displayedMonth.getMonth()) : "";
final int year = displayedMonth.getYear() + 1900;
+
getFlexCellFormatter().setStyleName(0, 2,
- VDateField.CLASSNAME + "-calendarpanel-month");
- setHTML(0, 2, "<span class=\"" + VDateField.CLASSNAME
+ parent.getStylePrimaryName() + "-calendarpanel-month");
+ getFlexCellFormatter().setStyleName(0, 0,
+ parent.getStylePrimaryName() + "-calendarpanel-prevyear");
+ getFlexCellFormatter().setStyleName(0, 4,
+ parent.getStylePrimaryName() + "-calendarpanel-nextyear");
+ getFlexCellFormatter().setStyleName(0, 3,
+ parent.getStylePrimaryName() + "-calendarpanel-nextmonth");
+ getFlexCellFormatter().setStyleName(0, 1,
+ parent.getStylePrimaryName() + "-calendarpanel-prevmonth");
+
+ setHTML(0, 2, "<span class=\"" + parent.getStylePrimaryName()
+ "-calendarpanel-month\">" + monthName + " " + year
+ "</span>");
}
@@ -458,7 +485,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
setCellSpacing(0);
getFlexCellFormatter().setColSpan(1, 0, 5);
getFlexCellFormatter().setStyleName(1, 0,
- VDateField.CLASSNAME + "-calendarpanel-body");
+ parent.getStylePrimaryName() + "-calendarpanel-body");
days.getFlexCellFormatter().setStyleName(headerRow, weekColumn,
"v-week");
@@ -468,7 +495,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
isShowISOWeekNumbers());
days.getRowFormatter().setStyleName(headerRow,
- VDateField.CLASSNAME + "-calendarpanel-weekdays");
+ parent.getStylePrimaryName() + "-calendarpanel-weekdays");
if (isShowISOWeekNumbers()) {
days.getFlexCellFormatter().setStyleName(headerRow, weekColumn,
@@ -476,7 +503,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
days.getFlexCellFormatter().setStyleName(headerRow,
firstWeekdayColumn, "");
days.getRowFormatter().addStyleName(headerRow,
- VDateField.CLASSNAME + "-calendarpanel-weeknumbers");
+ parent.getStylePrimaryName()
+ + "-calendarpanel-weeknumbers");
} else {
days.getFlexCellFormatter().setStyleName(headerRow, weekColumn, "");
days.getFlexCellFormatter().setStyleName(headerRow,
@@ -524,6 +552,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
// Actually write the day of month
Day day = new Day((Date) curr.clone());
+ day.setStyleName(parent.getStylePrimaryName()
+ + "-calendarpanel-day");
if (curr.equals(selectedDate)) {
day.addStyleDependentName(CN_SELECTED);
@@ -549,7 +579,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
days.getCellFormatter().setVisible(weekOfMonth, weekColumn,
isShowISOWeekNumbers());
if (isShowISOWeekNumbers()) {
- final String baseCssClass = VDateField.CLASSNAME
+ final String baseCssClass = parent.getStylePrimaryName()
+ "-calendarpanel-weeknumber";
String weekCssClass = baseCssClass;
@@ -605,12 +635,14 @@ public class VCalendarPanel extends FocusableFlexTable implements
setWidget(2, 0, time);
getFlexCellFormatter().setColSpan(2, 0, 5);
getFlexCellFormatter().setStyleName(2, 0,
- VDateField.CLASSNAME + "-calendarpanel-time");
+ parent.getStylePrimaryName() + "-calendarpanel-time");
} else if (isTimeSelectorNeeded()) {
time.updateTimes();
} else if (time != null) {
remove(time);
}
+
+ initialRenderDone = true;
}
/**
@@ -1539,13 +1571,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
* A widget representing a single day in the calendar panel.
*/
private class Day extends InlineHTML {
- private static final String BASECLASS = VDateField.CLASSNAME
- + "-calendarpanel-day";
private final Date date;
Day(Date date) {
super("" + date.getDate());
- setStyleName(BASECLASS);
this.date = date;
addClickHandler(dayClickHandler);
}
diff --git a/client/src/com/vaadin/client/ui/datefield/VDateField.java b/client/src/com/vaadin/client/ui/datefield/VDateField.java
index 915ac4c54d..84fe061347 100644
--- a/client/src/com/vaadin/client/ui/datefield/VDateField.java
+++ b/client/src/com/vaadin/client/ui/datefield/VDateField.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2011 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
diff --git a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
index 41b7aedae6..2f2c3b3290 100644
--- a/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
+++ b/client/src/com/vaadin/client/ui/datefield/VDateFieldCalendar.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2011 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -34,6 +34,7 @@ public class VDateFieldCalendar extends VDateField {
public VDateFieldCalendar() {
super();
calendarPanel = new VCalendarPanel();
+ calendarPanel.setParentField(this);
add(calendarPanel);
calendarPanel.setSubmitListener(new SubmitListener() {
@Override
@@ -55,7 +56,7 @@ public class VDateFieldCalendar extends VDateField {
}
});
}
-
+
/**
* TODO refactor: almost same method as in VPopupCalendar.updateValue
*/
diff --git a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
index 79ede5b013..0762b965e1 100644
--- a/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/datefield/VPopupCalendar.java
@@ -55,10 +55,7 @@ import com.vaadin.shared.ui.datefield.Resolution;
public class VPopupCalendar extends VTextualDate implements Field,
ClickHandler, CloseHandler<PopupPanel>, SubPartAware {
- protected static final String POPUP_PRIMARY_STYLE_NAME = VDateField.CLASSNAME
- + "-popup";
-
- protected final Button calendarToggle;
+ protected final Button calendarToggle = new Button();
protected VCalendarPanel calendar;
@@ -69,8 +66,6 @@ public class VPopupCalendar extends VTextualDate implements Field,
public VPopupCalendar() {
super();
- calendarToggle = new Button();
- calendarToggle.setStyleName(CLASSNAME + "-button");
calendarToggle.setText("");
calendarToggle.addClickHandler(this);
// -2 instead of -1 to avoid FocusWidget.onAttach to reset it
@@ -78,6 +73,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
add(calendarToggle);
calendar = GWT.create(VCalendarPanel.class);
+ calendar.setParentField(this);
calendar.setFocusOutListener(new FocusOutListener() {
@Override
public boolean onFocusOut(DomEvent<?> event) {
@@ -106,7 +102,6 @@ public class VPopupCalendar extends VTextualDate implements Field,
});
popup = new VOverlay(true, true, true);
- popup.setStyleName(POPUP_PRIMARY_STYLE_NAME);
popup.setWidget(calendar);
popup.addCloseHandler(this);
@@ -115,6 +110,7 @@ public class VPopupCalendar extends VTextualDate implements Field,
sinkEvents(Event.ONKEYDOWN);
+ updateStyleNames();
}
@SuppressWarnings("deprecation")
@@ -163,8 +159,26 @@ public class VPopupCalendar extends VTextualDate implements Field,
*/
@Override
public void setStyleName(String style) {
- // make sure the style is there before size calculation
- super.setStyleName(style + " " + CLASSNAME + "-popupcalendar");
+ super.setStyleName(style);
+ updateStyleNames();
+ }
+
+ @Override
+ public void setStylePrimaryName(String style) {
+ removeStyleName(getStylePrimaryName() + "-popupcalendar");
+ super.setStylePrimaryName(style);
+ updateStyleNames();
+ }
+
+ @Override
+ protected void updateStyleNames() {
+ super.updateStyleNames();
+ if (getStylePrimaryName() != null && calendarToggle != null) {
+ addStyleName(getStylePrimaryName() + "-popupcalendar");
+ calendarToggle.setStyleName(getStylePrimaryName() + "-button");
+ popup.setStyleName(getStylePrimaryName() + "-popup");
+ calendar.setStyleName(getStylePrimaryName() + "-calendarpanel");
+ }
}
/**
diff --git a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
index e2d9962979..9bacfded13 100644
--- a/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
+++ b/client/src/com/vaadin/client/ui/datefield/VTextualDate.java
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright 2011 Vaadin Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
@@ -39,8 +39,7 @@ import com.vaadin.shared.ui.datefield.Resolution;
public class VTextualDate extends VDateField implements Field, ChangeHandler,
Focusable, SubPartAware {
- private static final String PARSE_ERROR_CLASSNAME = CLASSNAME
- + "-parseerror";
+ private static final String PARSE_ERROR_CLASSNAME = "-parseerror";
protected final TextBox text;
@@ -54,13 +53,8 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
private boolean prompting = false;
public VTextualDate() {
-
super();
text = new TextBox();
- // use normal textfield styles as a basis
- text.setStyleName(VTextField.CLASSNAME);
- // add datefield spesific style name also
- text.addStyleName(CLASSNAME + "-textfield");
text.addChangeHandler(this);
text.addFocusHandler(new FocusHandler() {
@Override
@@ -100,6 +94,13 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
add(text);
}
+ protected void updateStyleNames() {
+ if (text != null) {
+ text.setStyleName(VTextField.CLASSNAME);
+ text.addStyleName(getStylePrimaryName() + "-textfield");
+ }
+ }
+
protected String getFormatString() {
if (formatStr == null) {
if (currentResolution == Resolution.YEAR) {
@@ -153,7 +154,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
* is what usually is needed except for updateFromUIDL.
*/
protected void buildDate() {
- removeStyleName(PARSE_ERROR_CLASSNAME);
+ removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
// Create the initial text for the textfield
String dateText;
Date currentDate = getDate();
@@ -206,11 +207,11 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
}
// remove possibly added invalid value indication
- removeStyleName(PARSE_ERROR_CLASSNAME);
+ removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
} catch (final Exception e) {
VConsole.log(e);
- addStyleName(PARSE_ERROR_CLASSNAME);
+ addStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
// this is a hack that may eventually be removed
getClient().updateVariable(getId(), "lastInvalidDateString",
text.getText(), false);
@@ -219,7 +220,7 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
} else {
setDate(null);
// remove possibly added invalid value indication
- removeStyleName(PARSE_ERROR_CLASSNAME);
+ removeStyleName(getStylePrimaryName() + PARSE_ERROR_CLASSNAME);
}
// always send the date string
getClient()
diff --git a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
index 879670effa..7a36c3c8e7 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
@@ -4,6 +4,6 @@ import com.vaadin.shared.AbstractFieldState;
public class InlineDateFieldState extends AbstractFieldState {
{
- primaryStyleName = "v-datefield";
+ primaryStyleName = "v-inline-datefield";
}
}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html
new file mode 100644
index 0000000000..1b3cb8dcab
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="http://localhost:8888/" />
+<title>New Test</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">New Test</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.datefield.DateFieldPrimaryStyleNames?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]</td>
+ <td>my-inline-datefield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]</td>
+ <td>my-inline-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]/VCalendarPanel[0]/domChild[1]/domChild[0]</td>
+ <td>my-inline-datefield-calendarpanel-header</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]/VCalendarPanel[0]/domChild[1]/domChild[1]/domChild[0]</td>
+ <td>my-inline-datefield-calendarpanel-body</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-datefield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-datefield-popupcalendar</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]/domChild[0]</td>
+ <td>my-datefield-textfield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]/domChild[1]</td>
+ <td>my-datefield-button</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]#popupButton</td>
+ <td>13,0</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//body/div[last()]</td>
+ <td>my-datefield-popup</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//body/div[last()]</td>
+ <td>my-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']</td>
+ <td>my-datefield-calendarpanel</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]</td>
+ <td>my-datefield-calendarpanel-header</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[1]</td>
+ <td>my-datefield-calendarpanel-prevyear</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[2]</td>
+ <td>my-datefield-calendarpanel-prevmonth</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[3]</td>
+ <td>my-datefield-calendarpanel-month</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[4]</td>
+ <td>my-datefield-calendarpanel-nextmonth</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[5]</td>
+ <td>my-datefield-calendarpanel-nextyear</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td[1]</td>
+ <td>my-datefield-calendarpanel-body</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td[1]/table/tbody/tr[1]</td>
+ <td>my-datefield-calendarpanel-weekdays</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]#popupButton</td>
+ <td>13,0</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]</td>
+ <td>my-second-inline-datefield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]</td>
+ <td>my-second-inline-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]/VCalendarPanel[0]/domChild[1]/domChild[0]</td>
+ <td>my-second-inline-datefield-calendarpanel-header</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VDateFieldCalendar[0]/VCalendarPanel[0]/domChild[1]/domChild[1]/domChild[0]</td>
+ <td>my-second-inline-datefield-calendarpanel-body</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-second-datefield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-second-datefield-popupcalendar</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]</td>
+ <td>my-second-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]/domChild[0]</td>
+ <td>my-second-datefield-textfield</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]/domChild[1]</td>
+ <td>my-second-datefield-button</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]#popupButton</td>
+ <td>13,0</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//body/div[last()]</td>
+ <td>my-second-datefield-popup</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//body/div[last()]</td>
+ <td>my-second-datefield-day</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']</td>
+ <td>my-second-datefield-calendarpanel</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]</td>
+ <td>my-second-datefield-calendarpanel-header</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[1]</td>
+ <td>my-second-datefield-calendarpanel-prevyear</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[2]</td>
+ <td>my-second-datefield-calendarpanel-prevmonth</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[3]</td>
+ <td>my-second-datefield-calendarpanel-month</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[4]</td>
+ <td>my-second-datefield-calendarpanel-nextmonth</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[1]/td[5]</td>
+ <td>my-second-datefield-calendarpanel-nextyear</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td[1]</td>
+ <td>my-second-datefield-calendarpanel-body</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>//*[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td[1]/table/tbody/tr[1]</td>
+ <td>my-second-datefield-calendarpanel-weekdays</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldPrimaryStyleNames::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VPopupCalendar[0]#popupButton</td>
+ <td>13,0</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java
new file mode 100644
index 0000000000..ca9492b111
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.components.datefield;
+
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.InlineDateField;
+
+public class DateFieldPrimaryStyleNames extends TestBase {
+
+ @Override
+ protected void setup() {
+ final DateField df = new DateField();
+ df.setPrimaryStyleName("my-datefield");
+ addComponent(df);
+
+ final InlineDateField idf = new InlineDateField();
+ idf.setPrimaryStyleName("my-inline-datefield");
+ addComponent(idf);
+
+ addComponent(new Button("Set primary stylename",
+ new Button.ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ df.setPrimaryStyleName("my-second-datefield");
+ idf.setPrimaryStyleName("my-second-inline-datefield");
+ }
+ }));
+
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Datefield should work with primary stylenames both initially and dynamically";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 9903;
+ }
+
+}