package com.vaadin.tests.components.uitest.components;

import com.vaadin.tests.components.uitest.TestSampler;
import com.vaadin.ui.Component;
import com.vaadin.ui.DateField;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.InlineDateField;
import com.vaadin.ui.PopupDateField;
import com.vaadin.ui.themes.ChameleonTheme;

public class DatesCssTest extends HorizontalLayout {

    private TestSampler parent;
    private int debugIdCounter = 0;

    public DatesCssTest(TestSampler parent) {
        this.parent = parent;
        setSpacing(true);
        setWidth("100%");

        createDateFieldWith(null, null);
        createDateFieldWith("Small", ChameleonTheme.DATEFIELD_SMALL);
        createDateFieldWith("Big", ChameleonTheme.DATEFIELD_BIG);

        DateField df = new PopupDateField("Popup date field");
        df.setId("datefield" + debugIdCounter++);
        addComponent(df);

        df = new InlineDateField("Inline date field");
        df.setId("datefield" + debugIdCounter++);
        addComponent(df);
    }

    private void createDateFieldWith(String caption, String primaryStyleName) {
        DateField df = new DateField("Date field");
        df.setId("datefield" + debugIdCounter++);

        if (caption != null) {
            df.setCaption(caption);
        }

        if (primaryStyleName != null) {
            df.addStyleName(primaryStyleName);
        }

        addComponent(df);

    }

    @Override
    public void addComponent(Component c) {
        parent.registerComponent(c);
        super.addComponent(c);
    }

}

@@ -49,16 +49,80 @@
 nents;%0A%0A
+import java.util.Calendar;%0Aimport java.util.GregorianCalendar;%0A%0A
 import c
@@ -168,16 +168,16 @@
 ampler;%0A
-
 import c
@@ -514,16 +514,92 @@
 r = 0;%0A%0A
+    private Calendar cal = new GregorianCalendar(2012, 8, 11, 18, 00, 00);%0A%0A
     publ
@@ -1002,32 +1002,68 @@
 ugIdCounter++);%0A
+        df.setValue(cal.getTime());%0A
         addCompo
@@ -1170,32 +1170,68 @@
 ugIdCounter++);%0A
+        df.setValue(cal.getTime());%0A
         addCompo
@@ -1371,32 +1371,32 @@
 (%22Date field%22);%0A
-
         df.setId
@@ -1428,16 +1428,52 @@
 nter++);
+%0A        df.setValue(cal.getTime());
 %0A%0A      

Set a specific date for the DateFields so test does not change daily.