From 6624c7fedf44b1097eb09f78d016ba471aa3dc12 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 12 Feb 2013 09:15:21 +0200
Subject: Added support for Dates to DefaultFieldGroupFieldFactory (#8539)

Change-Id: I61b45b4bb988878d86a913d383764ce7c17c3bf9
---
 .../src/com/vaadin/tests/fieldgroup/DateForm.html  |  42 ++++++
 .../src/com/vaadin/tests/fieldgroup/DateForm.java  | 150 +++++++++++++++++++++
 2 files changed, 192 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/DateForm.html
 create mode 100644 uitest/src/com/vaadin/tests/fieldgroup/DateForm.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html
new file mode 100644
index 0000000000..f141091805
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.html
@@ -0,0 +1,42 @@
+<?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.fieldgroup.DateForm?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1/20/84</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1/20/84</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VDateFieldCalendar[0]/VCalendarPanel[0]#day20</td>
+	<td>v-inline-datefield-calendarpanel-day-selected</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestsfieldgroupDateForm::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VTextField[0]</td>
+	<td>Jan 20, 1984 4:34:49 PM</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java
new file mode 100644
index 0000000000..0d906a086b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java
@@ -0,0 +1,150 @@
+package com.vaadin.tests.fieldgroup;
+
+import java.util.Date;
+
+import com.vaadin.data.fieldgroup.BeanFieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
+import com.vaadin.data.fieldgroup.PropertyId;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.data.bean.Person;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.PopupDateField;
+import com.vaadin.ui.TextField;
+
+public class DateForm extends TestBase {
+
+    private Log log = new Log(5);
+    @PropertyId("date1")
+    private DateField dateField;
+    @PropertyId("date2")
+    private PopupDateField popupDateField;
+    @PropertyId("date3")
+    private InlineDateField inlineDateField;
+    @PropertyId("date4")
+    private TextField textField;
+
+    public static class DateObject {
+        private Date date1, date2, date3, date4;
+
+        public DateObject(Date date1, Date date2, Date date3, Date date4) {
+            super();
+            this.date1 = date1;
+            this.date2 = date2;
+            this.date3 = date3;
+            this.date4 = date4;
+        }
+
+        public Date getDate1() {
+            return date1;
+        }
+
+        public void setDate1(Date date1) {
+            this.date1 = date1;
+        }
+
+        public Date getDate2() {
+            return date2;
+        }
+
+        public void setDate2(Date date2) {
+            this.date2 = date2;
+        }
+
+        public Date getDate3() {
+            return date3;
+        }
+
+        public void setDate3(Date date3) {
+            this.date3 = date3;
+        }
+
+        public Date getDate4() {
+            return date4;
+        }
+
+        public void setDate4(Date date4) {
+            this.date4 = date4;
+        }
+
+    }
+
+    @Override
+    protected void setup() {
+        addComponent(log);
+        final FieldGroup fieldGroup = new BeanFieldGroup<DateObject>(
+                DateObject.class);
+        fieldGroup.setBuffered(true);
+
+        fieldGroup.buildAndBindMemberFields(this);
+        textField.setWidth("20em");
+        addComponent(dateField);
+        addComponent(popupDateField);
+        addComponent(inlineDateField);
+        addComponent(textField);
+
+        Button commitButton = new Button("Commit", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                String msg = "Commit succesful";
+                try {
+                    fieldGroup.commit();
+                } catch (CommitException e) {
+                    msg = "Commit failed: " + e.getMessage();
+                }
+                Notification.show(msg);
+                log.log(msg);
+
+            }
+        });
+        Button discardButton = new Button("Discard",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        fieldGroup.discard();
+                        log.log("Discarded changes");
+
+                    }
+                });
+        Button showBean = new Button("Show bean values",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.log(getPerson(fieldGroup).toString());
+
+                    }
+                });
+        addComponent(commitButton);
+        addComponent(discardButton);
+        addComponent(showBean);
+
+        DateObject d = new DateObject(new Date(443457289789L), new Date(
+                443457289789L), new Date(443457289789L),
+                new Date(443457289789L));
+        fieldGroup.setItemDataSource(new BeanItem<DateObject>(d));
+    }
+
+    public static Person getPerson(FieldGroup binder) {
+        return ((BeanItem<Person>) binder.getItemDataSource()).getBean();
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Ensure FieldGroupFieldFactory supports Dates";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8539;
+    }
+
+}
-- 
cgit v1.2.3


From 7df9f960992cc9acfd4bbb1aa9a84af1205cd6ec Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Fri, 18 Jan 2013 10:45:01 +0200
Subject: Added tutorial examples for creating a simple login view #10076

Change-Id: I4cce618a6937cd1c0f3fc57e742666fb4749fa5a
---
 .../minitutorials/v70/SimpleLoginMainView.java     |  42 +++++++
 .../tests/minitutorials/v70/SimpleLoginUI.java     |  64 ++++++++++
 .../tests/minitutorials/v70/SimpleLoginView.java   | 137 +++++++++++++++++++++
 3 files changed, 243 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java
new file mode 100644
index 0000000000..cb59aa1608
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginMainView.java
@@ -0,0 +1,42 @@
+package com.vaadin.tests.minitutorials.v70;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.Label;
+
+public class SimpleLoginMainView extends CustomComponent implements View {
+
+    public static final String NAME = "";
+
+    Label text = new Label();
+
+    Button logout = new Button("Logout", new Button.ClickListener() {
+
+        @Override
+        public void buttonClick(ClickEvent event) {
+
+            // "Logout" the user
+            getSession().setAttribute("user", null);
+
+            // Refresh this view, should redirect to login view
+            getUI().getNavigator().navigateTo(NAME);
+        }
+    });
+
+    public SimpleLoginMainView() {
+        setCompositionRoot(new CssLayout(text, logout));
+    }
+
+    @Override
+    public void enter(ViewChangeEvent event) {
+        // Get the user name from the session
+        String username = String.valueOf(getSession().getAttribute("user"));
+
+        // And show the username
+        text.setValue("Hello " + username);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
new file mode 100644
index 0000000000..2fbbff10a8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
@@ -0,0 +1,64 @@
+package com.vaadin.tests.minitutorials.v70;
+
+import com.vaadin.navigator.Navigator;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.UI;
+
+public class SimpleLoginUI extends UI {
+
+    @Override
+    protected void init(VaadinRequest request) {
+
+        /*
+         * Create a new instance of the navigator. The navigator will attach
+         * itself automatically to this view.
+         */
+        new Navigator(this, this);
+
+        /*
+         * The initial log view where the user can login to the application
+         */
+        getNavigator().addView(SimpleLoginView.NAME, SimpleLoginView.class);
+
+        /*
+         * Add the main view of the application
+         */
+        getNavigator().addView(SimpleLoginMainView.NAME,
+                SimpleLoginMainView.class);
+                       
+        /*
+         * We use a view change handler to ensure the user is always redirected
+         * to the login view if the user is not logged in.
+         */
+        getNavigator().addViewChangeListener(new ViewChangeListener() {
+            
+            @Override
+            public boolean beforeViewChange(ViewChangeEvent event) {
+                
+                // Check if a user has logged in
+                boolean isLoggedIn = getSession().getAttribute("user") != null;
+                boolean isLoginView = event.getNewView() instanceof SimpleLoginView;
+
+                if (!isLoggedIn && !isLoginView) {
+                    // Redirect to login view always if a user has not yet
+                    // logged in
+                    getNavigator().navigateTo(SimpleLoginView.NAME);
+                    return false;
+
+                } else if (isLoggedIn && isLoginView) {
+                    // If someone tries to access to login view while logged in,
+                    // then cancel
+                    return false;
+                }
+
+                return true;
+            }
+            
+            @Override
+            public void afterViewChange(ViewChangeEvent event) {
+                
+            }
+        });
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java
new file mode 100644
index 0000000000..88a2a8f678
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java
@@ -0,0 +1,137 @@
+package com.vaadin.tests.minitutorials.v70;
+
+import com.vaadin.data.validator.AbstractValidator;
+import com.vaadin.data.validator.EmailValidator;
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent;
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CustomComponent;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.themes.Reindeer;
+
+public class SimpleLoginView extends CustomComponent implements View,
+        Button.ClickListener {
+
+    public static final String NAME = "login";
+
+    private final TextField user;
+
+    private final PasswordField password;
+
+    private final Button loginButton;
+
+    public SimpleLoginView() {
+        setSizeFull();
+
+        // Create the user input field
+        user = new TextField("User:");
+        user.setWidth("300px");
+        user.setRequired(true);
+        user.setInputPrompt("Your username (eg. joe@email.com)");
+        user.addValidator(new EmailValidator("Username must be an email address"));
+        user.setInvalidAllowed(false);
+
+        // Create the password input field
+        password = new PasswordField("Password:");
+        password.setWidth("300px");
+        password.addValidator(new PasswordValidator());
+        password.setRequired(true);
+        password.setValue("");
+        password.setNullRepresentation("");
+
+        // Create login button
+        loginButton = new Button("Login", this);
+
+        // Add both to a panel
+        VerticalLayout fields = new VerticalLayout(user, password, loginButton);
+        fields.setCaption("Please login to access the application. (test@test.com/passw0rd)");
+        fields.setSpacing(true);
+        fields.setMargin(new MarginInfo(true, true, true, false));
+        fields.setSizeUndefined();
+
+        // The view root layout
+        VerticalLayout viewLayout = new VerticalLayout(fields);
+        viewLayout.setSizeFull();
+        viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
+        viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
+        setCompositionRoot(viewLayout);
+    }
+    
+    @Override
+    public void enter(ViewChangeEvent event) {
+        // focus the username field when user arrives to the login view
+        user.focus();
+    }
+
+    /*
+     * Validator for validating the passwords
+     */
+    private static final class PasswordValidator extends
+            AbstractValidator<String> {
+
+        public PasswordValidator() {
+            super("The password provided is not valid");
+        }
+
+        @Override
+        protected boolean isValidValue(String value) {
+            /*
+             * Password must be at least 8 characters long and contain at least
+             * one number
+             */
+            if (value != null
+                    && (value.length() < 8 || !value.matches(".*\\d.*"))) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public Class<String> getType() {
+            return String.class;
+        }
+    }
+
+    @Override
+    public void buttonClick(ClickEvent event) {
+
+        /*
+         * Validate the fields using the navigator. By using validors for the
+         * fields we reduce the amount of queries we have to use to the database
+         * for wrongly entered passwords
+         */
+        if (!user.isValid() || !password.isValid()) {
+            return;
+        }
+
+        String username = user.getValue();
+        String password = this.password.getValue();
+
+        /*
+         * Validate username and password with database here. For examples sake
+         * I use a dummy username and password.
+         */
+        boolean isValid = username.equals("test@test.com")
+                && password.equals("passw0rd");
+
+        if(isValid){
+            // Store the current user in the service session
+            getSession().setAttribute("user", username);
+
+            // Navigate to main view
+            getUI().getNavigator().navigateTo(SimpleLoginMainView.NAME);
+
+        } else {
+
+            // Wrong password clear the password field and refocuses it
+            this.password.setValue(null);
+            this.password.focus();
+        }
+    }
+}
+
-- 
cgit v1.2.3


From c5af559686ab3984d43c59a8d6289b99229961e1 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Sun, 24 Feb 2013 18:20:37 +0200
Subject: Automatically listen to shutdown port and not not enforce -ea (#9998)

Relaxed requirement to enable assertions with DevelopmentServerLauncher to make it easier to get started.
Changed default to automatically listen to shutdown port 8889. Can be turned of by specifying port -1.

Change-Id: Id088b97fb9e8b5e7d9aa3cef874a8d2c02a6ca58
---
 uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
index 381091206a..444a70348c 100644
--- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
+++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
@@ -58,9 +58,11 @@ public class DevelopmentServerLauncher {
 
         // Pass-through of arguments for Jetty
         final Map<String, String> serverArgs = parseArguments(args);
+        if (!serverArgs.containsKey("shutdownPort"))
+            serverArgs.put("shutdownPort", "8889");
 
-        if (serverArgs.containsKey("shutdownPort")) {
-            int port = Integer.parseInt(serverArgs.get("shutdownPort"));
+        int port = Integer.parseInt(serverArgs.get("shutdownPort"));
+        if (port > 0) {
             try {
                 // Try to notify another instance that it's time to close
                 Socket socket = new Socket((String) null, port);
@@ -94,7 +96,7 @@ public class DevelopmentServerLauncher {
         try {
             assert false;
 
-            throw new RuntimeException("You should run "
+            System.err.println("You should run "
                     + DevelopmentServerLauncher.class.getSimpleName()
                     + " with assertions enabled. Add -ea as a VM argument.");
         } catch (AssertionError e) {
-- 
cgit v1.2.3


From b5c6f6cc0c75fa2849ad14dd395af69698440257 Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Tue, 5 Mar 2013 10:48:11 +0200
Subject: WAI-ARIA for form fields (#11180)

Changes in the base classes of the form fields for WAI-ARIA integration

Change-Id: I770082c353b1b0004875675e28f03d6a3e69f03f
---
 client/src/com/vaadin/client/ui/AriaHelper.java    |  95 ++++++
 .../com/vaadin/client/ui/HandlesAriaCaption.java   |  20 ++
 .../AbstractOrderedLayoutConnector.java            |   7 +
 .../com/vaadin/client/ui/orderedlayout/Slot.java   |   7 +-
 .../tests/layouts/CaptionsInLayoutsWaiAria.java    | 354 +++++++++++++++++++++
 5 files changed, 482 insertions(+), 1 deletion(-)
 create mode 100644 client/src/com/vaadin/client/ui/AriaHelper.java
 create mode 100644 client/src/com/vaadin/client/ui/HandlesAriaCaption.java
 create mode 100644 uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/AriaHelper.java b/client/src/com/vaadin/client/ui/AriaHelper.java
new file mode 100644
index 0000000000..e762ba57ce
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/AriaHelper.java
@@ -0,0 +1,95 @@
+package com.vaadin.client.ui;
+
+import com.google.gwt.aria.client.Id;
+import com.google.gwt.aria.client.InvalidValue;
+import com.google.gwt.aria.client.Roles;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Helper class that helps to implement the WAI-ARIA functionality.
+ */
+public class AriaHelper {
+
+    /**
+     * Binds a caption (label in HTML speak) to the form element as required by
+     * WAI-ARIA specification.
+     * 
+     * @param widget
+     *            Element, that should be bound to the caption
+     * @param captionElement
+     *            Element of the caption
+     */
+    public static void bindCaption(Widget widget, Element captionElement) {
+        assert widget != null : "Valid Widget required";
+
+        ensureUniqueId(captionElement);
+
+        if (widget instanceof HandlesAriaCaption) {
+            ((HandlesAriaCaption) widget).handleAriaCaption(captionElement);
+        } else if (captionElement != null) {
+            String ownerId = ensureUniqueId(widget.getElement());
+            captionElement.setAttribute("for", ownerId);
+
+            Roles.getTextboxRole().setAriaLabelledbyProperty(
+                    widget.getElement(), Id.of(captionElement));
+        } else {
+            Roles.getTextboxRole().removeAriaLabelledbyProperty(
+                    widget.getElement());
+        }
+    }
+
+    /**
+     * Handles the required actions depending of the input element being
+     * required or not.
+     * 
+     * @param inputElement
+     *            Element, typically an input element
+     * @param required
+     *            boolean, true when the element is required
+     */
+    public static void handleInputRequired(Element inputElement,
+            boolean required) {
+        if (required) {
+            Roles.getTextboxRole().setAriaRequiredProperty(inputElement, true);
+        } else {
+            Roles.getTextboxRole().removeAriaRequiredProperty(inputElement);
+        }
+    }
+
+    /**
+     * Handles the required actions depending of the input element contains
+     * unaccepted input
+     * 
+     * @param inputElement
+     *            Element, typically an input element
+     * @param showError
+     *            boolean, true when the element input has an error
+     */
+    public static void handleInputError(Element inputElement, boolean showError) {
+        if (showError) {
+            Roles.getTextboxRole().setAriaInvalidState(inputElement,
+                    InvalidValue.TRUE);
+        } else {
+            Roles.getTextboxRole().removeAriaInvalidState(inputElement);
+        }
+    }
+
+    /**
+     * Makes sure that the provided element has an id attribute. Adds a new
+     * unique id if not.
+     * 
+     * @param element
+     *            Element to check
+     * @return String with the id of the element
+     */
+    private static String ensureUniqueId(Element element) {
+        String id = element.getId();
+        if (null == id || id.isEmpty()) {
+            id = DOM.createUniqueId();
+            element.setId(id);
+        }
+        return id;
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/HandlesAriaCaption.java b/client/src/com/vaadin/client/ui/HandlesAriaCaption.java
new file mode 100644
index 0000000000..4eef0c5c25
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/HandlesAriaCaption.java
@@ -0,0 +1,20 @@
+package com.vaadin.client.ui;
+
+import com.google.gwt.user.client.Element;
+
+/**
+ * Some Widgets need to handle the caption handling for WAI-ARIA themselfs, as
+ * for example the required ids need to be set in a specific way. In such a
+ * case, the Widget needs to implement this interface.
+ */
+public interface HandlesAriaCaption {
+
+    /**
+     * Called to bind the provided caption (label in HTML speak) element to the
+     * main input element of the Widget.
+     * 
+     * @param captionElement
+     *            Element of the caption
+     */
+    void handleAriaCaption(Element captionElement);
+}
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
index 50de8e0936..ac5a08475e 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/AbstractOrderedLayoutConnector.java
@@ -31,6 +31,7 @@ import com.vaadin.client.communication.StateChangeEvent.StateChangeHandler;
 import com.vaadin.client.ui.AbstractFieldConnector;
 import com.vaadin.client.ui.AbstractLayoutConnector;
 import com.vaadin.client.ui.LayoutClickEventHandler;
+import com.vaadin.client.ui.AriaHelper;
 import com.vaadin.client.ui.layout.ElementResizeEvent;
 import com.vaadin.client.ui.layout.ElementResizeListener;
 import com.vaadin.shared.AbstractFieldState;
@@ -258,6 +259,12 @@ public abstract class AbstractOrderedLayoutConnector extends
         slot.setCaption(caption, iconUrlString, styles, error, showError,
                 required, enabled);
 
+        AriaHelper.handleInputRequired(child.getWidget().getElement(),
+                required);
+        AriaHelper.handleInputError(child.getWidget().getElement(),
+                showError);
+        AriaHelper.bindCaption(child.getWidget(), slot.getCaptionElement());
+
         if (slot.hasCaption()) {
             CaptionPosition pos = slot.getCaptionPosition();
             getLayoutManager().addElementResizeListener(
diff --git a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
index 795b724292..cf19da3496 100644
--- a/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
+++ b/client/src/com/vaadin/client/ui/orderedlayout/Slot.java
@@ -18,6 +18,7 @@ package com.vaadin.client.ui.orderedlayout;
 
 import java.util.List;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
@@ -92,7 +93,6 @@ public final class Slot extends SimplePanel {
 
     private ElementResizeListener spacingResizeListener;
 
-
     // Caption is placed after component unless there is some part which
     // moves it above.
     private CaptionPosition captionPosition = CaptionPosition.RIGHT;
@@ -479,6 +479,11 @@ public final class Slot extends SimplePanel {
                 // character)
                 requiredIcon.setInnerHTML("*");
                 requiredIcon.setClassName("v-required-field-indicator");
+
+                // The star should not be read by the screen reader, as it is
+                // purely visual. Required state is set at the element level for
+                // the screen reader.
+                Roles.getTextboxRole().setAriaHiddenState(requiredIcon, true);
             }
             caption.appendChild(requiredIcon);
         } else if (requiredIcon != null) {
diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
new file mode 100644
index 0000000000..126caa5985
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
@@ -0,0 +1,354 @@
+package com.vaadin.tests.layouts;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.server.UserError;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractField;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.CssLayout;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.OptionGroup;
+import com.vaadin.ui.PasswordField;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.VerticalLayout;
+
+public class CaptionsInLayoutsWaiAria extends TestBase {
+
+    private static final Object CAPTION = "CAPTION";
+    private static final Object CLASS = "C";
+    private static final Object WIDTH = "W";
+
+    private NativeSelect layoutSelect;
+    private Layout layout;
+    private VerticalLayout verticalLayout;
+    private HorizontalLayout horizontalLayout;
+    private GridLayout gridLayout;
+    private FormLayout formLayout;
+    private List<AbstractField<?>> components = new ArrayList<AbstractField<?>>();
+    private CssLayout cssLayout;
+    private HorizontalLayout layoutParent = new HorizontalLayout();
+
+    @Override
+    protected void setup() {
+        // setTheme("tests-tickets");
+        addComponent(createLayoutSelect());
+        addComponent(toggleRequired());
+        // addComponent(toggleCaptions());
+        // addComponent(toggleError());
+        addComponent(toggleIcon());
+        addComponent(toggleReadOnly());
+        addComponent(toggleInvalid());
+        addComponent(addCaptionText());
+        // layoutParent.addComponent(new
+        // NativeButton("Button right of layout"));
+        addComponent(layoutParent);
+        // addComponent(new NativeButton("Button below layout"));
+        createComponents();
+        layoutSelect.setValue(layoutSelect.getItemIds().iterator().next());
+    }
+
+    private Component addCaptionText() {
+        Button b = new Button("Add caption text");
+        b.addListener(new ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                prependCaptions("a");
+            }
+        });
+        return b;
+    }
+
+    protected void prependCaptions(String prepend) {
+        for (AbstractField<?> c : components) {
+            c.setCaption(prepend + c.getCaption());
+        }
+
+    }
+
+    private Component toggleRequired() {
+        CheckBox requiredToggle = new CheckBox();
+        requiredToggle.setImmediate(true);
+        requiredToggle.setCaption("Required");
+        requiredToggle.addListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setRequired((Boolean) event.getProperty().getValue());
+            }
+        });
+        return requiredToggle;
+    }
+
+    private Component toggleIcon() {
+        CheckBox iconToggle = new CheckBox();
+        iconToggle.setImmediate(true);
+        iconToggle.setCaption("Icons");
+        iconToggle.addListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setIcon((Boolean) event.getProperty().getValue());
+            }
+        });
+        return iconToggle;
+    }
+
+    private Component toggleReadOnly() {
+        CheckBox readOnlyToggle = new CheckBox();
+        readOnlyToggle.setImmediate(true);
+        readOnlyToggle.setCaption("Read only");
+        readOnlyToggle.addValueChangeListener(new ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setReadOnly((Boolean) event.getProperty().getValue());
+            }
+        });
+
+        return readOnlyToggle;
+    }
+
+    private Component toggleInvalid() {
+        CheckBox invalid = new CheckBox("Invalid");
+        invalid.setImmediate(true);
+        invalid.addValueChangeListener(new ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setInvalid((Boolean) event.getProperty().getValue());
+            }
+        });
+
+        return invalid;
+    }
+
+    protected void setInvalid(boolean value) {
+        UserError userError = null;
+        if (value) {
+            userError = new UserError(
+                    "Der eingegebene Wert ist nicht zulässig!");
+        }
+
+        for (AbstractField<?> c : components) {
+            c.setComponentError(userError);
+        }
+    }
+
+    protected void setRequired(boolean value) {
+        for (AbstractField<?> c : components) {
+            c.setRequired(value);
+        }
+
+    }
+
+    protected void setIcon(boolean value) {
+        for (AbstractField<?> c : components) {
+            if (!value) {
+                c.setIcon(null);
+            } else {
+                c.setIcon(new ThemeResource("../runo/icons/16/ok.png"));
+            }
+        }
+
+    }
+
+    protected void setReadOnly(boolean value) {
+        for (AbstractField<?> c : components) {
+            c.setReadOnly(value);
+        }
+    }
+
+    private Component toggleError() {
+        CheckBox errorToggle = new CheckBox();
+        errorToggle.setImmediate(true);
+        errorToggle.setCaption("Error");
+        errorToggle.addListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setError((Boolean) event.getProperty().getValue());
+            }
+        });
+        return errorToggle;
+    }
+
+    protected void setError(boolean value) {
+        for (AbstractField<?> c : components) {
+            if (value) {
+                c.setComponentError(new UserError("error"));
+            } else {
+                c.setComponentError(null);
+
+            }
+        }
+
+    }
+
+    private void createComponents() {
+        components.add(new TextField("Default TextBox"));
+        components.add(new TextArea("Default TextArea."));
+        // components.add(new RichTextArea("Default RichtTextArea"));
+        components.add(new PasswordField("Default Password"));
+        components.add(new DateField("Default DateField"));
+
+        // PopupDateField popupDateField = new
+        // PopupDateField("Default DateField");
+        // popupDateField.setTextFieldEnabled(false);
+        // components.add(popupDateField);
+
+        components.add(new CheckBox("Default CheckBox"));
+
+        ComboBox comboBox = new ComboBox("Default ComboBox");
+        comboBox.addItem("Item1");
+        components.add(comboBox);
+
+        OptionGroup radioGroup = new OptionGroup("Single Items");
+        radioGroup.addItem("Single Item 1");
+        radioGroup.addItem("Single Item 2");
+        radioGroup.setMultiSelect(false);
+        components.add(radioGroup);
+
+        OptionGroup checkGroup = new OptionGroup("Multi Items");
+        checkGroup.addItem("Multi Item 1");
+        checkGroup.addItem("Multi Item 2");
+        checkGroup.setMultiSelect(true);
+        components.add(checkGroup);
+
+        // Tree tree = new Tree();
+        // tree.setCaption("tree");
+        // tree.addItem("single item");
+        // components.add(tree);
+    }
+
+    private void setLayout(Layout newLayout) {
+        if (layout == null) {
+            layoutParent.addComponent(newLayout, 0);
+        } else {
+            layoutParent.replaceComponent(layout, newLayout);
+        }
+        layout = newLayout;
+
+        for (Component c : components) {
+            if (c.getParent() != layout) {
+                layout.addComponent(c);
+            }
+        }
+
+    }
+
+    private Layout getLayout(String caption,
+            Class<? extends Layout> layoutClass, String width) {
+        Layout l;
+        if (layoutClass == VerticalLayout.class) {
+            if (verticalLayout == null) {
+                verticalLayout = new VerticalLayout();
+                verticalLayout.setStyleName("borders");
+            }
+            l = verticalLayout;
+        } else if (layoutClass == HorizontalLayout.class) {
+            if (horizontalLayout == null) {
+                horizontalLayout = new HorizontalLayout();
+                horizontalLayout.setStyleName("borders");
+            }
+            l = horizontalLayout;
+        } else if (layoutClass == GridLayout.class) {
+            if (gridLayout == null) {
+                gridLayout = new GridLayout();
+                gridLayout.setStyleName("borders");
+            }
+            l = gridLayout;
+        } else if (layoutClass == CssLayout.class) {
+            if (cssLayout == null) {
+                cssLayout = new CssLayout();
+                cssLayout.setStyleName("borders");
+            }
+            l = cssLayout;
+        } else if (layoutClass == FormLayout.class) {
+            if (formLayout == null) {
+                formLayout = new FormLayout();
+                formLayout.setStyleName("borders");
+            }
+            l = formLayout;
+        } else {
+            return null;
+        }
+
+        l.setCaption(caption);
+        if (width.equals("auto")) {
+            width = null;
+        }
+
+        l.setWidth(width);
+
+        // addComponent(l);
+
+        return l;
+    }
+
+    private Component createLayoutSelect() {
+        layoutSelect = new NativeSelect("Layout");
+        layoutSelect.addContainerProperty(CAPTION, String.class, "");
+        layoutSelect.addContainerProperty(CLASS, Class.class, "");
+        layoutSelect.addContainerProperty(WIDTH, String.class, "");
+        layoutSelect.setItemCaptionPropertyId(CAPTION);
+        layoutSelect.setNullSelectionAllowed(false);
+
+        for (Class<?> cls : new Class[] { HorizontalLayout.class,
+                VerticalLayout.class, GridLayout.class, CssLayout.class,
+                FormLayout.class }) {
+            for (String width : new String[] { "auto" }) {
+                Object id = layoutSelect.addItem();
+                Item i = layoutSelect.getItem(id);
+                i.getItemProperty(CAPTION).setValue(
+                        cls.getSimpleName() + ", " + width);
+                i.getItemProperty(CLASS).setValue(cls);
+                i.getItemProperty(WIDTH).setValue(width);
+            }
+
+        }
+        layoutSelect.setImmediate(true);
+        layoutSelect.addListener(new ValueChangeListener() {
+
+            @Override
+            @SuppressWarnings("unchecked")
+            public void valueChange(ValueChangeEvent event) {
+                Item i = layoutSelect.getItem(event.getProperty().getValue());
+
+                setLayout(getLayout((String) i.getItemProperty(CAPTION)
+                        .getValue(), (Class<? extends Layout>) i
+                        .getItemProperty(CLASS).getValue(), (String) i
+                        .getItemProperty(WIDTH).getValue()));
+            }
+        });
+
+        return layoutSelect;
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Tests what happens when the caption changes in various layouts. Behavior should be consistent.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 5424;
+    }
+
+}
-- 
cgit v1.2.3


From 67d05facb86aa01578906a9a34a67f0ca833bb85 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 11 Mar 2013 23:29:37 +0200
Subject: Updated test as Property.toString no longer returns the property
 value

Change-Id: Ic5da1d536ab633b60bc61e1b525fe8f2a8470a73
---
 .../vaadin/tests/components/tree/TreeItemClickAndValueChange.html    | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html
index bf83a1acdb..83508c9478 100644
--- a/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html
+++ b/uitest/src/com/vaadin/tests/components/tree/TreeItemClickAndValueChange.html
@@ -64,7 +64,7 @@
 <tr>
 	<td>assertText</td>
 	<td>vaadin=runTrees::PID_SLog_row_1</td>
-	<td>4. left click on source: [Item 1], client: [*];, relative: [-1,-1], itemId: Item 2, propertyId: null</td>
+	<td>4. left click on source: com.vaadin.ui.Tree@*, client: [*];, relative: [-1,-1], itemId: Item 2, propertyId: null</td>
 </tr>
 <tr>
 	<td>assertText</td>
@@ -74,9 +74,8 @@
 <tr>
 	<td>assertText</td>
 	<td>vaadin=runTrees::PID_SLog_row_3</td>
-	<td>2. left click on source: [], client: [*];, relative: [-1,-1], itemId: Item 1, propertyId: null</td>
+	<td>2. left click on source: com.vaadin.ui.Tree@*, client: [*];, relative: [-1,-1], itemId: Item 1, propertyId: null</td>
 </tr>
-
 </tbody></table>
 </body>
 </html>
-- 
cgit v1.2.3


From 45f97119c7a99a31c1223a814c23ea2c3a08459b Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 11 Mar 2013 23:36:42 +0200
Subject: Fixed locator string

Change-Id: Iaa5bda79704153e5a10fc6aa3b2244a06a89cf0a
---
 .../table/ColumnCollapsingAndColumnExpansion.html  | 65 +---------------------
 1 file changed, 2 insertions(+), 63 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
index 9e529836b6..69b436a41b 100644
--- a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
+++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
@@ -13,12 +13,7 @@
 </thead><tbody>
 <tr>
 	<td>open</td>
-	<td>/run/com.vaadin.tests.components.table.ColumnCollapsingAndColumnExpansion</td>
-	<td></td>
-</tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
+	<td>/run/com.vaadin.tests.components.table.ColumnCollapsingAndColumnExpansion?restartApplication</td>
 	<td></td>
 </tr>
 <!--Initial state, all 3 columns visible-->
@@ -32,20 +27,10 @@
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[0]/domChild[1]</td>
 	<td></td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <!--Hide 'col2' through table interface-->
 <tr>
 	<td>click</td>
-	<td>//td[@id='gwt-uid-2']/span/div</td>
-	<td></td>
-</tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
+	<td>//td[@id='gwt-uid-4']/span/div</td>
 	<td></td>
 </tr>
 <tr>
@@ -53,73 +38,38 @@
 	<td></td>
 	<td>col2-hidden</td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <!--Hide 'Col1' using button-->
 <tr>
 	<td>enterCharacter</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
 	<td>Col1</td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>click</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
 	<td></td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>screenCapture</td>
 	<td></td>
 	<td>col1-col2-hidden</td>
 </tr>
 <!--Show 'col2' using action handler-->
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>contextmenu</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
 	<td></td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>mouseClick</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VContextMenu[0]#option0</td>
 	<td>11,6</td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>enterCharacter</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
 	<td>Col2</td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>screenCapture</td>
 	<td></td>
@@ -131,28 +81,17 @@
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VTextField[0]</td>
 	<td>Col1</td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>click</td>
 	<td>vaadin=runcomvaadintestscomponentstableColumnCollapsingAndColumnExpansion::/VVerticalLayout[0]/ChildComponentContainer[1]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
 	<td></td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <!--We should now be back at the initial state, all 3 columns visible-->
 <tr>
 	<td>screenCapture</td>
 	<td></td>
 	<td>col1-col2-col3-visible-again</td>
 </tr>
-
 </tbody></table>
 </body>
 </html>
-- 
cgit v1.2.3


From d0b5b614e9e4dfb53dfcdcc53096b2f26ed12327 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 12 Mar 2013 00:52:23 +0200
Subject: Fixed locale to ensure the same results in all browsers

Change-Id: I0a4f9f69f5b5339def23e940ef9cb42163c42638
---
 uitest/src/com/vaadin/tests/fieldgroup/DateForm.java | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java
index 0d906a086b..3064856db9 100644
--- a/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java
+++ b/uitest/src/com/vaadin/tests/fieldgroup/DateForm.java
@@ -1,6 +1,7 @@
 package com.vaadin.tests.fieldgroup;
 
 import java.util.Date;
+import java.util.Locale;
 
 import com.vaadin.data.fieldgroup.BeanFieldGroup;
 import com.vaadin.data.fieldgroup.FieldGroup;
@@ -77,6 +78,7 @@ public class DateForm extends TestBase {
 
     @Override
     protected void setup() {
+        getMainWindow().setLocale(Locale.US);
         addComponent(log);
         final FieldGroup fieldGroup = new BeanFieldGroup<DateObject>(
                 DateObject.class);
-- 
cgit v1.2.3


From 41798f820c60c43c89d8fb480821d8bda4c42bfb Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Wed, 6 Mar 2013 11:23:48 +0200
Subject: Implemented injection of css styles #5500

Change-Id: Iaccffb4a3e137968d5f51672cdd56f803a9e9d2e
---
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  92 +++++++++++++++
 server/src/com/vaadin/server/Page.java             | 128 ++++++++++++++++++++-
 .../src/com/vaadin/tests/themes/CSSInjectTest.html |  57 +++++++++
 .../src/com/vaadin/tests/themes/CSSInjectTest.java |  87 ++++++++++++++
 4 files changed, 363 insertions(+), 1 deletion(-)
 create mode 100644 uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
 create mode 100644 uitest/src/com/vaadin/tests/themes/CSSInjectTest.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 0fb7439587..7f3c7010dd 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -17,13 +17,19 @@ package com.vaadin.client.ui.ui;
 
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.dom.client.HeadElement;
+import com.google.gwt.dom.client.LinkElement;
 import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.NodeList;
 import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.StyleInjector;
 import com.google.gwt.event.dom.client.ScrollEvent;
 import com.google.gwt.event.dom.client.ScrollHandler;
 import com.google.gwt.event.logical.shared.ResizeEvent;
@@ -56,6 +62,7 @@ import com.vaadin.client.ui.VNotification;
 import com.vaadin.client.ui.VUI;
 import com.vaadin.client.ui.layout.MayScrollChildren;
 import com.vaadin.client.ui.window.WindowConnector;
+import com.vaadin.server.Page.StyleSheet;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.ComponentStateUtil;
 import com.vaadin.shared.ui.Connect;
@@ -256,6 +263,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
                     final UIDL notification = (UIDL) it.next();
                     VNotification.showNotification(client, notification);
                 }
+            } else if (tag == "css-injections") {
+                injectCSS(childUidl);
             }
         }
 
@@ -324,6 +333,89 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
         getWidget().rendering = false;
     }
 
+    /**
+     * Reads CSS strings and resources injected by {@link StyleSheet#inject}
+     * from the UIDL stream.
+     * 
+     * @param uidl
+     *            The uidl which contains "css-resource" and "css-string" tags
+     */
+    private void injectCSS(UIDL uidl) {
+
+        final HeadElement head = HeadElement.as(Document.get()
+                .getElementsByTagName(HeadElement.TAG).getItem(0));
+
+        /*
+         * Search the UIDL stream for CSS resources and strings to be injected.
+         */
+        final List<String> resourcesToInject = new LinkedList<String>();
+        final StringBuilder cssToInject = new StringBuilder();
+        for (Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
+            UIDL cssInjectionsUidl = (UIDL) it.next();
+
+            // Check if we have resources to inject
+            if (cssInjectionsUidl.getTag().equals("css-resource")) {
+                String url = getWidget().connection
+                        .translateVaadinUri(cssInjectionsUidl
+                                .getStringAttribute("url"));
+
+                // Check if url already has been injected
+                boolean injected = false;
+                NodeList<com.google.gwt.dom.client.Element> links = head
+                        .getElementsByTagName(LinkElement.TAG);
+                for (int i = 0; i < links.getLength(); i++) {
+                    LinkElement link = LinkElement.as(links.getItem(i));
+                    if (link.getHref().equals(url)) {
+                        injected = true;
+                        break;
+                    }
+                }
+
+                if (!injected) {
+                    // Ensure duplicates do not get injected
+                    resourcesToInject.add(url);
+                }
+
+                // Check if we have CSS string to inject
+            } else if (cssInjectionsUidl.getTag().equals("css-string")) {
+                for (Iterator<?> it2 = cssInjectionsUidl.getChildIterator(); it2
+                        .hasNext();) {
+                    cssToInject.append((String) it2.next());
+                }
+            }
+        }
+
+        /*
+         * Inject resources as deferred to ensure other Vaadin resources that
+         * are located before in the DOM get applied first so the injected ones
+         * can override them.
+         */
+        if (!resourcesToInject.isEmpty()) {
+            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+
+                @Override
+                public void execute() {
+                    for (String url : resourcesToInject) {
+                        LinkElement link = LinkElement.as(DOM
+                                .createElement(LinkElement.TAG));
+                        link.setRel("stylesheet");
+                        link.setHref(url);
+                        link.setType("text/css");
+                        head.appendChild(link);
+                    }
+                }
+            });
+        }
+
+        /*
+         * Inject the string CSS injections as a combined style tag. Not
+         * injected as deferred since StyleInjector will do it for us.
+         */
+        if (cssToInject.length() > 0) {
+            StyleInjector.injectAtEnd(cssToInject.toString());
+        }
+    }
+
     public void init(String rootPanelId,
             ApplicationConnection applicationConnection) {
         DOM.sinkEvents(getWidget().getElement(), Event.ONKEYDOWN
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index 8737b478c3..f7b65a8e9b 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -303,6 +303,115 @@ public class Page implements Serializable {
         }
     }
 
+    /**
+     * Contains dynamically injected styles injected in the HTML document at
+     * runtime.
+     * 
+     * @since 7.1
+     */
+    public static class StyleSheet implements Serializable {
+
+        /*
+         * Points to last injected string injection
+         */
+        private int injectedStringPointer;
+
+        private final List<String> stringInjections = new LinkedList<String>();
+
+        /*
+         * Points to last injected resource injection
+         */
+        private int injectedResourcesPointer;
+
+        private final List<Resource> resourceInjections = new LinkedList<Resource>();
+
+        private final UI ui;
+
+        private StyleSheet(UI ui) {
+            this.ui = ui;
+        }
+
+        /**
+         * Injects a raw CSS string into the page.
+         * 
+         * @param css
+         *            The CSS to inject
+         */
+        public void inject(String css) {
+            if (css == null) {
+                throw new IllegalArgumentException(
+                        "Cannot inject null CSS string");
+            }
+
+            /*
+             * Check if last injection was the same, in that case ignore it.
+             */
+            if (!stringInjections.isEmpty() && injectedStringPointer > 0) {
+                String lastInjection = stringInjections
+                        .get(injectedStringPointer - 1);
+                if (lastInjection.equals(css.trim())) {
+                    return;
+                }
+            }
+
+            stringInjections.add(css.trim());
+            ui.markAsDirty();
+        }
+
+        /**
+         * Injects a CSS resource into the page
+         * 
+         * @param resource
+         *            The resource to inject.
+         */
+        public void inject(Resource resource) {
+            if (resource == null) {
+                throw new IllegalArgumentException(
+                        "Cannot inject null resource");
+            }
+
+            resourceInjections.add(resource);
+            ui.markAsDirty();
+        }
+
+        private void paint(PaintTarget target) throws PaintException {
+
+            // If full repaint repaint all injections
+            if (target.isFullRepaint()) {
+                injectedStringPointer = 0;
+                injectedResourcesPointer = 0;
+            }
+
+            target.startTag("css-injections");
+
+            // Paint pending string injections
+            List<String> injections = stringInjections.subList(
+                    injectedStringPointer, stringInjections.size());
+
+            for (String css : injections) {
+                target.startTag("css-string");
+                target.addText(css);
+                target.endTag("css-string");
+            }
+
+            injectedStringPointer = stringInjections.size();
+
+            // Paint pending resource injections
+            List<Resource> resInjections = resourceInjections.subList(
+                    injectedResourcesPointer, resourceInjections.size());
+
+            for (Resource res : resInjections) {
+                target.startTag("css-resource");
+                target.addAttribute("url", res);
+                target.endTag("css-resource");
+            }
+
+            target.endTag("css-injections");
+
+            injectedResourcesPointer = resourceInjections.size();
+        }
+    }
+
     private EventRouter eventRouter;
 
     private final UI uI;
@@ -312,6 +421,8 @@ public class Page implements Serializable {
 
     private JavaScript javaScript;
 
+    private StyleSheet styleSheet;
+
     /**
      * The current browser location.
      */
@@ -576,10 +687,22 @@ public class Page implements Serializable {
             javaScript = new JavaScript();
             javaScript.extend(uI);
         }
-
         return javaScript;
     }
 
+    /**
+     * Returns that stylesheet associated with this Page. The stylesheet
+     * contains additional styles injected at runtime into the HTML document.
+     * 
+     * @since 7.1
+     */
+    public StyleSheet getStyleSheet() {
+        if (styleSheet == null) {
+            styleSheet = new StyleSheet(uI);
+        }
+        return styleSheet;
+    }
+
     public void paintContent(PaintTarget target) throws PaintException {
         if (!openList.isEmpty()) {
             for (final Iterator<OpenResource> i = openList.iterator(); i
@@ -637,6 +760,9 @@ public class Page implements Serializable {
                     location.toString());
         }
 
+        if (styleSheet != null) {
+            styleSheet.paint(target);
+        }
     }
 
     /**
diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
new file mode 100644
index 0000000000..05a0f256c2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
@@ -0,0 +1,57 @@
+<?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.themes.CSSInjectTest?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>hello-world-gray</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextArea[0]</td>
+	<td>.hello{color:blue;}</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>hello-blue</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VTextArea[0]</td>
+	<td>.world{color:red;}</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>world-red</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
new file mode 100644
index 0000000000..bedbf47fe2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
@@ -0,0 +1,87 @@
+package com.vaadin.tests.themes;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.UUID;
+
+import com.vaadin.server.Page;
+import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.StreamResource;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.TextArea;
+
+public class CSSInjectTest extends TestBase {
+
+    @Override
+    protected void setup() {
+
+        final StyleSheet stylesheet = Page.getCurrent().getStyleSheet();
+
+        // Inject some resources initially
+        stylesheet.inject(new StreamResource(new StreamResource.StreamSource() {
+
+            @Override
+            public InputStream getStream() {
+                return new ByteArrayInputStream(
+                        ".hello, .world { color:silver; }".getBytes());
+            }
+        }, "mystyles-" + System.currentTimeMillis() + ".css"));
+
+        Label hello = new Label(
+                "<span class='hello'>Hello</span> <span class='world'>world</span>",
+                ContentMode.HTML);
+        addComponent(hello);
+
+        final TextArea cssToInject = new TextArea();
+        cssToInject.setImmediate(true);
+        addComponent(cssToInject);
+
+        Button inject = new Button("Inject!", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                stylesheet.inject(cssToInject.getValue());
+                cssToInject.setValue("");
+            }
+        });
+        addComponent(inject);
+
+        Button injectRandom = new Button("Inject as resource!",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+
+                        final String css = cssToInject.getValue();
+
+                        stylesheet.inject(new StreamResource(
+                                new StreamResource.StreamSource() {
+
+                                    @Override
+                                    public InputStream getStream() {
+                                        return new ByteArrayInputStream(css
+                                                .getBytes());
+                                    }
+                                }, UUID.randomUUID().toString() + ".css"));
+
+                        cssToInject.setValue("");
+                    }
+                });
+        addComponent(injectRandom);
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Demonstrates how CSS injections can be used to theme the \"Hello world\" label below";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 5500;
+    }
+
+}
-- 
cgit v1.2.3


From 9764317f6be8091cfda37faac9294f5e58ecfeef Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Mon, 18 Mar 2013 15:41:46 +0200
Subject: Added CSS Inject / ColorPicker tutorial #11360

Change-Id: Iacafb3c4e26c4ff1a258eff466cfd18508d8ff0c
---
 .../v71beta/CSSInjectWithColorpicker.java          | 234 +++++++++++++++++++++
 1 file changed, 234 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java
new file mode 100644
index 0000000000..4ac85ab231
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java
@@ -0,0 +1,234 @@
+package com.vaadin.tests.widgetset.client.minitutorials.v71beta;
+
+import java.util.Arrays;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.Page;
+import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.ColorPicker;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorChangeListener;
+
+public class CSSInjectWithColorpicker extends UI {
+
+    @Override
+    protected void init(VaadinRequest request) {
+
+        // Create a text editor
+        Component editor = createEditor("Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        +"Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec.");
+
+        
+        VerticalLayout content = new VerticalLayout(editor);
+        content.setMargin(true);
+        setContent(content);
+    }
+
+    /**
+     * Creates a text editor for visually editing text
+     * 
+     * @param text
+     *            The text editor
+     * @return
+     */
+    private Component createEditor(String text) {
+
+        Panel editor = new Panel("Text Editor");
+        editor.setWidth("580px");
+
+        VerticalLayout panelContent = new VerticalLayout();
+        panelContent.setSpacing(true);
+        panelContent.setMargin(new MarginInfo(true, false, false, false));
+        editor.setContent(panelContent);
+
+        // Create the toolbar
+        HorizontalLayout toolbar = new HorizontalLayout();
+        toolbar.setSpacing(true);
+        toolbar.setMargin(new MarginInfo(false, false, false, true));
+
+        // Create the font family selector
+        toolbar.addComponent(createFontSelect());
+
+        // Create the font size selector
+        toolbar.addComponent(createFontSizeSelect());
+
+        // Create the text color selector
+        toolbar.addComponent(createTextColorSelect());
+
+        // Create the background color selector
+        toolbar.addComponent(createBackgroundColorSelect());
+
+        panelContent.addComponent(toolbar);
+        panelContent.setComponentAlignment(toolbar, Alignment.MIDDLE_LEFT);
+
+        // Spacer between toolbar and text
+        panelContent.addComponent(new Label("<hr/>", ContentMode.HTML));
+
+        // The text to edit
+        TextArea textLabel = new TextArea(null, text);
+        textLabel.setWidth("100%");
+        textLabel.setHeight("200px");
+        
+        // IMPORTANT: We are here setting the style name of the label, we are going to use this in our injected styles to target the label
+        textLabel.setStyleName("text-label");
+        
+        panelContent.addComponent(textLabel);
+
+        return editor;
+    }
+
+    /**
+     * Creates a background color select dialog
+     */
+    private Component createBackgroundColorSelect() {
+        ColorPicker bgColor = new ColorPicker("Background", Color.WHITE);
+        bgColor.setWidth("110px");
+        bgColor.setCaption("Background");
+        bgColor.addColorChangeListener(new ColorChangeListener() {
+
+            @Override
+            public void colorChanged(ColorChangeEvent event) {
+
+                // Get the new background color
+                Color color = event.getColor();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new background color
+                styles.inject(".v-app .v-textarea.text-label { background-color:"
+                        + color.getCSS() + "; }");
+            }
+        });
+        return bgColor;
+    }
+
+    /**
+     * Create a text color selction dialog
+     */
+    private Component createTextColorSelect() {
+
+        // Colorpicker for changing text color
+        ColorPicker textColor = new ColorPicker("Color", Color.BLACK);
+        textColor.setWidth("110px");
+        textColor.setCaption("Color");
+        textColor.addColorChangeListener(new ColorChangeListener() {
+
+            @Override
+            public void colorChanged(ColorChangeEvent event) {
+
+                // Get the new text color
+                Color color = event.getColor();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new color as a style
+                styles.inject(".v-app .v-textarea.text-label { color:"
+                        + color.getCSS() + "; }");
+            }
+        });
+
+        return textColor;
+    }
+
+    /**
+     * Creates a font family selection dialog
+     */
+    private Component createFontSelect() {
+        final ComboBox select = new ComboBox(null, Arrays.asList("Arial",
+                "Helvetica", "Verdana", "Courier", "Times", "sans-serif"));
+        select.setValue("Arial");
+        select.setWidth("200px");
+        select.setInputPrompt("Font");
+        select.setDescription("Font");
+        select.setImmediate(true);
+        select.setNullSelectionAllowed(false);
+        select.setNewItemsAllowed(false);
+
+        select.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                // Get the new font family
+                String fontFamily = select.getValue().toString();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new font size as a style. We need .v-app to
+                // override Vaadin's default styles here
+                styles.inject(".v-app .v-textarea.text-label { font-family:"
+                        + fontFamily + "; }");
+            }
+        });
+
+        return select;
+    }
+
+    /**
+     * Creates a font size selection control
+     */
+    private Component createFontSizeSelect() {
+
+        final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10,
+                12, 14, 16, 20, 25, 30, 40, 50));
+        select.setWidth("100px");
+        select.setValue(12);
+        select.setInputPrompt("Font size");
+        select.setDescription("Font size");
+        select.setImmediate(true);
+        select.setNullSelectionAllowed(false);
+        select.setNewItemsAllowed(false);
+        select.addValueChangeListener(new ValueChangeListener() {
+            
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                // Get the new font size
+                Integer fontSize = (Integer) select.getValue();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new font size as a style. We need .v-app to
+                // override Vaadin's default styles here
+                styles.inject(".v-app .v-textarea.text-label { font-size:"
+                        + String.valueOf(fontSize) + "px; }");
+            }
+        });
+
+        return select;
+    }
+}
-- 
cgit v1.2.3


From 320b4e3776976e5dad822f01542f338cf76140bb Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Wed, 20 Mar 2013 10:37:11 +0200
Subject: WAI-ARIA fields (#11180)

Field implementations of the WAI-ARIA changes in the base classes

Change-Id: Ie51e76130f3f9976a32c373334b709f0f5b68f1a
---
 WebContent/VAADIN/themes/base/common/common.scss   |   6 +
 client/src/com/vaadin/client/VCaption.java         |  15 +++
 client/src/com/vaadin/client/VErrorMessage.java    |   3 +
 client/src/com/vaadin/client/VTooltip.java         | 130 ++++++++++++++++++---
 client/src/com/vaadin/client/ui/AriaHelper.java    |  58 ++++++---
 .../com/vaadin/client/ui/HandlesAriaCaption.java   |   8 +-
 .../src/com/vaadin/client/ui/VCalendarPanel.java   |  85 ++++++++++++--
 client/src/com/vaadin/client/ui/VCheckBox.java     |  25 ++++
 client/src/com/vaadin/client/ui/VFilterSelect.java |  13 +++
 client/src/com/vaadin/client/ui/VFormLayout.java   |  15 +++
 client/src/com/vaadin/client/ui/VOptionGroup.java  |  61 +++++++++-
 .../src/com/vaadin/client/ui/VPopupCalendar.java   | 113 +++++++++++++++++-
 client/src/com/vaadin/client/ui/VTextField.java    |   4 +
 client/src/com/vaadin/client/ui/VTextualDate.java  |  21 +++-
 .../com/vaadin/client/ui/tree/TreeConnector.java   |  35 +++++-
 .../tests/layouts/CaptionsInLayoutsWaiAria.java    |   1 -
 16 files changed, 541 insertions(+), 52 deletions(-)

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/common/common.scss b/WebContent/VAADIN/themes/base/common/common.scss
index e801ec2821..27c6dc949c 100644
--- a/WebContent/VAADIN/themes/base/common/common.scss
+++ b/WebContent/VAADIN/themes/base/common/common.scss
@@ -238,4 +238,10 @@ input::-ms-clear {
 	height: 0;
 }
 
+.v-assistive-device-only {
+	position: absolute;
+	left: -2000px;
+	width: 10px;
+	overflow: hidden;
+}
 }
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/VCaption.java b/client/src/com/vaadin/client/VCaption.java
index 47287636c4..607a0f0b0a 100644
--- a/client/src/com/vaadin/client/VCaption.java
+++ b/client/src/com/vaadin/client/VCaption.java
@@ -16,12 +16,15 @@
 
 package com.vaadin.client;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.AriaHelper;
 import com.vaadin.client.ui.Icon;
 import com.vaadin.shared.AbstractComponentState;
 import com.vaadin.shared.AbstractFieldState;
@@ -88,6 +91,8 @@ public class VCaption extends HTML {
         this.client = client;
         owner = component;
 
+        AriaHelper.bindCaption(component.getWidget(), getElement());
+
         if (client != null && owner != null) {
             setOwnerPid(getElement(), owner.getConnectorId());
         }
@@ -209,11 +214,21 @@ public class VCaption extends HTML {
 
                 DOM.insertChild(getElement(), requiredFieldIndicator,
                         getInsertPosition(InsertPosition.REQUIRED));
+
+                Roles.getTextboxRole().setAriaRequiredProperty(
+                        owner.getWidget().getElement(), true);
+
+                // Hide the required indicator from assistive device
+                Roles.getTextboxRole().setAriaHiddenState(
+                        requiredFieldIndicator, true);
             }
         } else if (requiredFieldIndicator != null) {
             // Remove existing
             DOM.removeChild(getElement(), requiredFieldIndicator);
             requiredFieldIndicator = null;
+
+            Roles.getTextboxRole().removeAriaRequiredProperty(
+                    owner.getWidget().getElement());
         }
 
         if (showError) {
diff --git a/client/src/com/vaadin/client/VErrorMessage.java b/client/src/com/vaadin/client/VErrorMessage.java
index a384b451dd..2e42b98a05 100644
--- a/client/src/com/vaadin/client/VErrorMessage.java
+++ b/client/src/com/vaadin/client/VErrorMessage.java
@@ -31,6 +31,9 @@ public class VErrorMessage extends FlowPanel {
     public VErrorMessage() {
         super();
         setStyleName(CLASSNAME);
+
+        // Needed for binding with WAI-ARIA attributes
+        getElement().setId(DOM.createUniqueId());
     }
 
     /**
diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index 759b90a8cd..e6d9a79a5b 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -15,8 +15,16 @@
  */
 package com.vaadin.client;
 
+import com.google.gwt.aria.client.Id;
+import com.google.gwt.aria.client.LiveValue;
+import com.google.gwt.aria.client.Roles;
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DomEvent;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
 import com.google.gwt.event.dom.client.KeyDownEvent;
 import com.google.gwt.event.dom.client.KeyDownHandler;
 import com.google.gwt.event.dom.client.MouseMoveEvent;
@@ -54,6 +62,9 @@ public class VTooltip extends VOverlay {
     // Open next tooltip faster. Disabled after 2 sec of showTooltip-silence.
     private boolean justClosed = false;
 
+    private String uniqueId = DOM.createUniqueId();
+    private Element layoutElement;
+
     /**
      * Used to show tooltips; usually used via the singleton in
      * {@link ApplicationConnection}. NOTE that #setOwner(Widget)} should be
@@ -68,8 +79,19 @@ public class VTooltip extends VOverlay {
         setWidget(layout);
         layout.add(em);
         DOM.setElementProperty(description, "className", CLASSNAME + "-text");
-        DOM.appendChild(layout.getElement(), description);
+
+        layoutElement = layout.getElement();
+        DOM.appendChild(layoutElement, description);
         setSinkShadowEvents(true);
+
+        // WAI-ARIA additions
+        layoutElement.setId(uniqueId);
+        Roles.getTooltipRole().setAriaLiveProperty(getElement(),
+                LiveValue.POLITE);
+
+        description.setId(DOM.createUniqueId());
+        Roles.getTooltipRole().set(layoutElement);
+        Roles.getTooltipRole().setAriaHiddenState(layoutElement, true);
     }
 
     /**
@@ -204,15 +226,27 @@ public class VTooltip extends VOverlay {
         closing = true;
         justClosed = true;
         justClosedTimer.schedule(QUICK_OPEN_TIMEOUT);
+    }
 
+    @Override
+    public void hide() {
+        super.hide();
+        Roles.getTooltipRole().setAriaHiddenState(layoutElement, true);
+        Roles.getTooltipRole().removeAriaDescribedbyProperty(
+                tooltipEventHandler.currentElement);
     }
 
     private int tooltipEventMouseX;
     private int tooltipEventMouseY;
 
-    public void updatePosition(Event event) {
-        tooltipEventMouseX = DOM.eventGetClientX(event);
-        tooltipEventMouseY = DOM.eventGetClientY(event);
+    public void updatePosition(Event event, boolean isFocused) {
+        if (isFocused) {
+            tooltipEventMouseX = -1000;
+            tooltipEventMouseY = -1000;
+        } else {
+            tooltipEventMouseX = DOM.eventGetClientX(event);
+            tooltipEventMouseY = DOM.eventGetClientY(event);
+        }
     }
 
     @Override
@@ -246,13 +280,18 @@ public class VTooltip extends VOverlay {
     }
 
     private class TooltipEventHandler implements MouseMoveHandler,
-            ClickHandler, KeyDownHandler {
+            ClickHandler, KeyDownHandler, FocusHandler, BlurHandler {
 
         /**
          * Current element hovered
          */
         private com.google.gwt.dom.client.Element currentElement = null;
 
+        /**
+         * Current element focused
+         */
+        private boolean currentIsFocused;
+
         /**
          * Current tooltip active
          */
@@ -319,41 +358,77 @@ public class VTooltip extends VOverlay {
 
         @Override
         public void onMouseMove(MouseMoveEvent mme) {
-            Event event = Event.as(mme.getNativeEvent());
+            handleShowHide(mme, false);
+        }
+
+        @Override
+        public void onClick(ClickEvent event) {
+            handleHideEvent();
+        }
+
+        @Override
+        public void onKeyDown(KeyDownEvent event) {
+            handleHideEvent();
+        }
+
+        /**
+         * Displays Tooltip when page is navigated with the keyboard.
+         * 
+         * Tooltip is not visible. This makes it possible for assistive devices
+         * to recognize the tooltip.
+         */
+        @Override
+        public void onFocus(FocusEvent fe) {
+            handleShowHide(fe, true);
+        }
+
+        /**
+         * Hides Tooltip when the page is navigated with the keyboard.
+         * 
+         * Removes the Tooltip from page to make sure assistive devices don't
+         * recognize it by accident.
+         */
+        @Override
+        public void onBlur(BlurEvent be) {
+            handleHideEvent();
+        }
+
+        private void handleShowHide(DomEvent domEvent, boolean isFocused) {
+            Event event = Event.as(domEvent.getNativeEvent());
             com.google.gwt.dom.client.Element element = Element.as(event
                     .getEventTarget());
 
             // We can ignore move event if it's handled by move or over already
-            if (currentElement == element) {
+            if (currentElement == element && currentIsFocused == isFocused) {
                 return;
             }
-            currentElement = element;
 
             boolean connectorAndTooltipFound = resolveConnector((com.google.gwt.user.client.Element) element);
             if (!connectorAndTooltipFound) {
                 if (isShowing()) {
                     handleHideEvent();
+                    Roles.getButtonRole()
+                            .removeAriaDescribedbyProperty(element);
                 } else {
                     currentTooltipInfo = null;
                 }
             } else {
-                updatePosition(event);
+                updatePosition(event, isFocused);
+
                 if (isShowing()) {
                     replaceCurrentTooltip();
+                    Roles.getTooltipRole().removeAriaDescribedbyProperty(
+                            currentElement);
                 } else {
                     showTooltip();
                 }
-            }
-        }
 
-        @Override
-        public void onClick(ClickEvent event) {
-            handleHideEvent();
-        }
+                Roles.getTooltipRole().setAriaDescribedbyProperty(element,
+                        Id.of(uniqueId));
+            }
 
-        @Override
-        public void onKeyDown(KeyDownEvent event) {
-            handleHideEvent();
+            currentIsFocused = isFocused;
+            currentElement = element;
         }
     }
 
@@ -370,6 +445,25 @@ public class VTooltip extends VOverlay {
         widget.addDomHandler(tooltipEventHandler, MouseMoveEvent.getType());
         widget.addDomHandler(tooltipEventHandler, ClickEvent.getType());
         widget.addDomHandler(tooltipEventHandler, KeyDownEvent.getType());
+        widget.addDomHandler(tooltipEventHandler, FocusEvent.getType());
+        widget.addDomHandler(tooltipEventHandler, BlurEvent.getType());
         Profiler.leave("VTooltip.connectHandlersToWidget");
     }
+
+    /**
+     * Returns the unique id of the tooltip element.
+     * 
+     * @return String containing the unique id of the tooltip, which always has
+     *         a value
+     */
+    public String getUniqueId() {
+        return uniqueId;
+    }
+
+    @Override
+    public void setPopupPositionAndShow(PositionCallback callback) {
+        super.setPopupPositionAndShow(callback);
+
+        Roles.getTooltipRole().setAriaHiddenState(layoutElement, false);
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/AriaHelper.java b/client/src/com/vaadin/client/ui/AriaHelper.java
index 189149f8b5..56f358f294 100644
--- a/client/src/com/vaadin/client/ui/AriaHelper.java
+++ b/client/src/com/vaadin/client/ui/AriaHelper.java
@@ -27,6 +27,7 @@ import com.google.gwt.user.client.ui.Widget;
  * Helper class that helps to implement the WAI-ARIA functionality.
  */
 public class AriaHelper {
+    public static final String ASSISTIVE_DEVICE_ONLY_STYLE = "v-assistive-device-only";
 
     /**
      * Binds a caption (label in HTML speak) to the form element as required by
@@ -40,24 +41,32 @@ public class AriaHelper {
     public static void bindCaption(Widget widget, Element captionElement) {
         assert widget != null : "Valid Widget required";
 
-        if (null != captionElement) {
-            ensureUniqueId(captionElement);
-
-            if (widget instanceof HandlesAriaCaption) {
-                ((HandlesAriaCaption) widget).handleAriaCaption(captionElement);
+        if (widget instanceof HandlesAriaCaption) {
+            // Let the widget handle special cases itself
+            if (captionElement == null) {
+                ((HandlesAriaCaption) widget).clearAriaCaption();
             } else {
-                String ownerId = ensureUniqueId(widget.getElement());
-                captionElement.setAttribute("for", ownerId);
-
-                Roles.getTextboxRole().setAriaLabelledbyProperty(
-                        widget.getElement(), Id.of(captionElement));
+                ensureUniqueId(captionElement);
+                ((HandlesAriaCaption) widget).bindAriaCaption(captionElement);
             }
+        } else if (captionElement != null) {
+            // Handle the default case
+            ensureUniqueId(captionElement);
+            String ownerId = ensureUniqueId(widget.getElement());
+            captionElement.setAttribute("for", ownerId);
+
+            Roles.getTextboxRole().setAriaLabelledbyProperty(
+                    widget.getElement(), Id.of(captionElement));
         } else {
-            Roles.getTextboxRole().removeAriaLabelledbyProperty(
-                    widget.getElement());
+            clearCaption(widget);
         }
     }
 
+    public static void clearCaption(Widget widget) {
+        Roles.getTextboxRole()
+                .removeAriaLabelledbyProperty(widget.getElement());
+    }
+
     /**
      * Handles the required actions depending of the input element being
      * required or not.
@@ -102,7 +111,7 @@ public class AriaHelper {
      *            Element to check
      * @return String with the id of the element
      */
-    private static String ensureUniqueId(Element element) {
+    public static String ensureUniqueId(Element element) {
         String id = element.getId();
         if (null == id || id.isEmpty()) {
             id = DOM.createUniqueId();
@@ -110,4 +119,27 @@ public class AriaHelper {
         }
         return id;
     }
+
+    /**
+     * Moves an element out of sight. That way it is possible to have additional
+     * information for an assistive device, that is not in the way for visual
+     * users.
+     * 
+     * @param element
+     *            Element to move out of sight
+     */
+    public static void visibleForAssistiveDevicesOnly(Element element) {
+        element.addClassName(ASSISTIVE_DEVICE_ONLY_STYLE);
+    }
+
+    /**
+     * Clears the settings that moved the element out of sight, so it is visible
+     * on the page again.
+     * 
+     * @param element
+     *            Element to clear the specific styles from
+     */
+    public static void visibleForAll(Element element) {
+        element.removeClassName(ASSISTIVE_DEVICE_ONLY_STYLE);
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/HandlesAriaCaption.java b/client/src/com/vaadin/client/ui/HandlesAriaCaption.java
index 045bec1d4b..fbbbbff462 100644
--- a/client/src/com/vaadin/client/ui/HandlesAriaCaption.java
+++ b/client/src/com/vaadin/client/ui/HandlesAriaCaption.java
@@ -32,5 +32,11 @@ public interface HandlesAriaCaption {
      * @param captionElement
      *            Element of the caption
      */
-    void handleAriaCaption(Element captionElement);
+    void bindAriaCaption(Element captionElement);
+
+    /**
+     * Called to clear the binding to a caption from the main input element of
+     * the widget.
+     */
+    void clearAriaCaption();
 }
diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java
index e234cc911c..3e81ec734b 100644
--- a/client/src/com/vaadin/client/ui/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java
@@ -19,6 +19,8 @@ package com.vaadin.client.ui;
 import java.util.Date;
 import java.util.Iterator;
 
+import com.google.gwt.aria.client.Roles;
+import com.google.gwt.aria.client.SelectedValue;
 import com.google.gwt.dom.client.Node;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
@@ -40,6 +42,7 @@ import com.google.gwt.event.dom.client.MouseOutEvent;
 import com.google.gwt.event.dom.client.MouseOutHandler;
 import com.google.gwt.event.dom.client.MouseUpEvent;
 import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.ui.Button;
@@ -175,9 +178,9 @@ public class VCalendarPanel extends FocusableFlexTable implements
 
     private boolean showISOWeekNumbers;
 
-    private Date displayedMonth;
+    private FocusedDate displayedMonth;
 
-    private Date focusedDate;
+    private FocusedDate focusedDate;
 
     private Day selectedDay;
 
@@ -198,8 +201,9 @@ public class VCalendarPanel extends FocusableFlexTable implements
     private boolean initialRenderDone = false;
 
     public VCalendarPanel() {
-
+        getElement().setId(DOM.createUniqueId());
         setStyleName(VDateField.CLASSNAME + "-calendarpanel");
+        Roles.getGridRole().set(getElement());
 
         /*
          * Firefox auto-repeat works correctly only if we use a key press
@@ -267,6 +271,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
     private void selectDate(Date date) {
         if (selectedDay != null) {
             selectedDay.removeStyleDependentName(CN_SELECTED);
+            Roles.getGridcellRole().removeAriaSelectedState(
+                    selectedDay.getElement());
         }
 
         int rowCount = days.getRowCount();
@@ -279,6 +285,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
                     if (curday.getDate().equals(date)) {
                         curday.addStyleDependentName(CN_SELECTED);
                         selectedDay = curday;
+                        Roles.getGridcellRole().setAriaSelectedState(
+                                selectedDay.getElement(), SelectedValue.TRUE);
                         return;
                     }
                 }
@@ -528,6 +536,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
             } else {
                 days.setHTML(headerRow, firstWeekdayColumn + i, "");
             }
+
+            Roles.getColumnheaderRole().set(
+                    days.getCellFormatter().getElement(headerRow,
+                            firstWeekdayColumn + i));
         }
 
         // Zero out hours, minutes, seconds, and milliseconds to compare dates
@@ -557,6 +569,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
 
                 if (curr.equals(selectedDate)) {
                     day.addStyleDependentName(CN_SELECTED);
+                    Roles.getGridcellRole().setAriaSelectedState(
+                            day.getElement(), SelectedValue.TRUE);
                     selectedDay = day;
                 }
                 if (curr.equals(today)) {
@@ -574,10 +588,14 @@ public class VCalendarPanel extends FocusableFlexTable implements
                 }
 
                 days.setWidget(weekOfMonth, firstWeekdayColumn + dayOfWeek, day);
+                Roles.getGridcellRole().set(
+                        days.getCellFormatter().getElement(weekOfMonth,
+                                firstWeekdayColumn + dayOfWeek));
 
                 // ISO week numbers if requested
                 days.getCellFormatter().setVisible(weekOfMonth, weekColumn,
                         isShowISOWeekNumbers());
+
                 if (isShowISOWeekNumbers()) {
                     final String baseCssClass = parent.getStylePrimaryName()
                             + "-calendarpanel-weeknumber";
@@ -615,8 +633,9 @@ public class VCalendarPanel extends FocusableFlexTable implements
         if (focusedDate == null) {
             Date now = new Date();
             // focusedDate must have zero hours, mins, secs, millisecs
-            focusedDate = new Date(now.getYear(), now.getMonth(), now.getDate());
-            displayedMonth = new Date(now.getYear(), now.getMonth(), 1);
+            focusedDate = new FocusedDate(now.getYear(), now.getMonth(),
+                    now.getDate());
+            displayedMonth = new FocusedDate(now.getYear(), now.getMonth(), 1);
         }
 
         if (getResolution().getCalendarField() <= Resolution.MONTH
@@ -1062,9 +1081,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
              */
         } else if (keycode == getResetKey() && !shift) {
             // Restore showing value the selected value
-            focusedDate = new Date(value.getYear(), value.getMonth(),
+            focusedDate = new FocusedDate(value.getYear(), value.getMonth(),
                     value.getDate());
-            displayedMonth = new Date(value.getYear(), value.getMonth(), 1);
+            displayedMonth = new FocusedDate(value.getYear(), value.getMonth(),
+                    1);
             renderCalendar();
             return true;
         }
@@ -1264,9 +1284,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
         if (value == null) {
             focusedDate = displayedMonth = null;
         } else {
-            focusedDate = new Date(value.getYear(), value.getMonth(),
+            focusedDate = new FocusedDate(value.getYear(), value.getMonth(),
                     value.getDate());
-            displayedMonth = new Date(value.getYear(), value.getMonth(), 1);
+            displayedMonth = new FocusedDate(value.getYear(), value.getMonth(),
+                    1);
         }
 
         // Re-render calendar if the displayed month is changed,
@@ -1821,4 +1842,50 @@ public class VCalendarPanel extends FocusableFlexTable implements
             mouseTimer.cancel();
         }
     }
+
+    /**
+     * Helper class to inform the screen reader that the user changed the
+     * selected date. It sets the value of a field that is outside the view, and
+     * is defined as a live area. That way the screen reader recognizes the
+     * change and reads it to the user.
+     */
+    public class FocusedDate extends Date {
+
+        public FocusedDate(int year, int month, int date) {
+            super(year, month, date);
+        }
+
+        @Override
+        public void setTime(long time) {
+            super.setTime(time);
+            setLabel();
+        }
+
+        @Override
+        @Deprecated
+        public void setDate(int date) {
+            super.setDate(date);
+            setLabel();
+        }
+
+        @Override
+        @Deprecated
+        public void setMonth(int month) {
+            super.setMonth(month);
+            setLabel();
+        }
+
+        @Override
+        @Deprecated
+        public void setYear(int year) {
+            super.setYear(year);
+            setLabel();
+        }
+
+        private void setLabel() {
+            if (parent instanceof VPopupCalendar) {
+                ((VPopupCalendar) parent).setFocusedDate(this);
+            }
+        }
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/VCheckBox.java b/client/src/com/vaadin/client/ui/VCheckBox.java
index ca1e3ebcdb..a94c2fcfee 100644
--- a/client/src/com/vaadin/client/ui/VCheckBox.java
+++ b/client/src/com/vaadin/client/ui/VCheckBox.java
@@ -16,6 +16,8 @@
 
 package com.vaadin.client.ui;
 
+import com.google.gwt.aria.client.CheckedValue;
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
@@ -46,6 +48,11 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
     public VCheckBox() {
         setStyleName(CLASSNAME);
 
+        // Add a11y role "checkbox"
+        Roles.getCheckboxRole().set(getElement());
+        Roles.getCheckboxRole().setAriaCheckedState(getElement(),
+                CheckedValue.FALSE);
+
         Element el = DOM.getFirstChild(getElement());
         while (el != null) {
             DOM.sinkEvents(el,
@@ -69,4 +76,22 @@ public class VCheckBox extends com.google.gwt.user.client.ui.CheckBox implements
         }
     }
 
+    @Override
+    public void setValue(Boolean value, boolean fireEvents) {
+        setCheckedValue(value);
+        super.setValue(value, fireEvents);
+    }
+
+    private void setCheckedValue(Boolean value) {
+        CheckedValue checkedValue = value ? CheckedValue.TRUE
+                : CheckedValue.FALSE;
+        Roles.getCheckboxRole().setAriaCheckedState(getElement(), checkedValue);
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+
+        Roles.getCheckboxRole().setAriaDisabledState(getElement(), true);
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/VFilterSelect.java b/client/src/com/vaadin/client/ui/VFilterSelect.java
index cea3489b42..5025f27248 100644
--- a/client/src/com/vaadin/client/ui/VFilterSelect.java
+++ b/client/src/com/vaadin/client/ui/VFilterSelect.java
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.dom.client.Style;
@@ -219,6 +220,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
 
             DOM.sinkEvents(root, Event.ONMOUSEDOWN | Event.ONMOUSEWHEEL);
             addCloseHandler(this);
+
+            Roles.getListRole().set(getElement());
         }
 
         /**
@@ -684,6 +687,7 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
             while (it.hasNext()) {
                 final FilterSelectSuggestion s = it.next();
                 final MenuItem mi = new MenuItem(s.getDisplayString(), true, s);
+                Roles.getListitemRole().set(mi.getElement());
 
                 Util.sinkOnloadForImages(mi.getElement());
 
@@ -1049,9 +1053,13 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
         });
 
         popupOpener.sinkEvents(Event.ONMOUSEDOWN);
+        Roles.getButtonRole().set(popupOpener.getElement());
+
         panel.add(tb);
         panel.add(popupOpener);
         initWidget(panel);
+        Roles.getComboboxRole().set(panel.getElement());
+
         tb.addKeyDownHandler(this);
         tb.addKeyUpHandler(this);
 
@@ -1059,6 +1067,8 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
         tb.addBlurHandler(this);
         tb.addClickHandler(this);
 
+        Roles.getTextboxRole().set(tb.getElement());
+
         popupOpener.addClickHandler(this);
 
         setStyleName(CLASSNAME);
@@ -1163,8 +1173,11 @@ public class VFilterSelect extends Composite implements Field, KeyDownHandler,
         // Always update styles as they might have been overwritten
         if (textInputEnabled) {
             removeStyleDependentName(STYLE_NO_INPUT);
+            Roles.getTextboxRole().removeAriaReadonlyProperty(tb.getElement());
         } else {
             addStyleDependentName(STYLE_NO_INPUT);
+            Roles.getTextboxRole().setAriaReadonlyProperty(tb.getElement(),
+                    true);
         }
 
         if (this.textInputEnabled == textInputEnabled) {
diff --git a/client/src/com/vaadin/client/ui/VFormLayout.java b/client/src/com/vaadin/client/ui/VFormLayout.java
index 495e842bfd..4c7190340f 100644
--- a/client/src/com/vaadin/client/ui/VFormLayout.java
+++ b/client/src/com/vaadin/client/ui/VFormLayout.java
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.DOM;
@@ -276,6 +277,9 @@ public class VFormLayout extends SimplePanel {
             if (state.caption != null) {
                 if (captionText == null) {
                     captionText = DOM.createSpan();
+
+                    AriaHelper.bindCaption(owner.getWidget(), captionText);
+
                     DOM.insertChild(getElement(), captionText, icon == null ? 0
                             : 1);
                 }
@@ -305,11 +309,22 @@ public class VFormLayout extends SimplePanel {
                     DOM.setElementProperty(requiredFieldIndicator, "className",
                             "v-required-field-indicator");
                     DOM.appendChild(getElement(), requiredFieldIndicator);
+
+                    Roles.getTextboxRole().setAriaRequiredProperty(
+                            owner.getWidget().getElement(), true);
+
+                    // Hide the required indicator from screen reader, as this
+                    // information is set directly at the input field
+                    Roles.getTextboxRole().setAriaHiddenState(
+                            requiredFieldIndicator, true);
                 }
             } else {
                 if (requiredFieldIndicator != null) {
                     DOM.removeChild(getElement(), requiredFieldIndicator);
                     requiredFieldIndicator = null;
+
+                    Roles.getTextboxRole().removeAriaRequiredProperty(
+                            owner.getWidget().getElement());
                 }
             }
 
diff --git a/client/src/com/vaadin/client/ui/VOptionGroup.java b/client/src/com/vaadin/client/ui/VOptionGroup.java
index 2ba8a9e729..f0c7b7f83d 100644
--- a/client/src/com/vaadin/client/ui/VOptionGroup.java
+++ b/client/src/com/vaadin/client/ui/VOptionGroup.java
@@ -22,6 +22,9 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import com.google.gwt.aria.client.CheckedValue;
+import com.google.gwt.aria.client.Id;
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
@@ -32,6 +35,7 @@ import com.google.gwt.event.dom.client.LoadEvent;
 import com.google.gwt.event.dom.client.LoadHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.ui.CheckBox;
 import com.google.gwt.user.client.ui.FocusWidget;
 import com.google.gwt.user.client.ui.Focusable;
@@ -46,7 +50,7 @@ import com.vaadin.shared.EventId;
 import com.vaadin.shared.ui.optiongroup.OptionGroupConstants;
 
 public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
-        BlurHandler {
+        BlurHandler, HandlesAriaCaption {
 
     public static final String CLASSNAME = "v-select-optiongroup";
 
@@ -85,6 +89,8 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
     /** For internal use only. May be removed or replaced in the future. */
     public boolean htmlContentAllowed = false;
 
+    private String labelId;
+
     public VOptionGroup() {
         super(CLASSNAME);
         panel = (Panel) optionsContainer;
@@ -99,6 +105,13 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
     public void buildOptions(UIDL uidl) {
         panel.clear();
         optionsEnabled.clear();
+
+        if (isMultiselect()) {
+            Roles.getGroupRole().set(getElement());
+        } else {
+            Roles.getRadiogroupRole().set(getElement());
+        }
+
         for (final Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
             final UIDL opUidl = (UIDL) it.next();
             CheckBox op;
@@ -118,9 +131,30 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
             if (isMultiselect()) {
                 op = new VCheckBox();
                 op.setHTML(itemHtml);
+
+                // Add a11y role "checkbox" - FIXME - did not find a good
+                // solution to prevent getFirstChild()
+                com.google.gwt.dom.client.Element checkBoxElement = op
+                        .getElement().getFirstChildElement();
+                Roles.getCheckboxRole().set(checkBoxElement);
+                Roles.getCheckboxRole().setAriaCheckedState(checkBoxElement,
+                        CheckedValue.FALSE);
             } else {
                 op = new RadioButton(paintableId, itemHtml, true);
                 op.setStyleName("v-radiobutton");
+
+                // Add a11y role "radio" - FIXME - did not find a good solution
+                // to prevent getFirstChild()
+                com.google.gwt.dom.client.Element radioElement = op
+                        .getElement().getFirstChildElement();
+                Roles.getRadioRole().set(radioElement);
+                Roles.getRadioRole().setAriaCheckedState(radioElement,
+                        CheckedValue.FALSE);
+            }
+
+            if (labelId != null && !labelId.isEmpty()) {
+                Roles.getFormRole().setAriaDescribedbyProperty(
+                        op.getElement().getFirstChildElement(), Id.of(labelId));
             }
 
             if (icon != null && icon.length() != 0) {
@@ -165,6 +199,13 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
             }
             client.updateVariable(paintableId, "selected", getSelectedItems(),
                     isImmediate());
+
+            for (CheckBox item : optionsToKeys.keySet()) {
+                CheckedValue value = item.getValue() ? CheckedValue.TRUE
+                        : CheckedValue.FALSE;
+                Roles.getCheckboxRole().setAriaCheckedState(item.getElement(),
+                        value);
+            }
         }
     }
 
@@ -238,4 +279,22 @@ public class VOptionGroup extends VOptionGroupBase implements FocusHandler,
             });
         }
     }
+
+    @Override
+    public void bindAriaCaption(Element captionElement) {
+        labelId = captionElement.getId();
+        for (CheckBox item : optionsToKeys.keySet()) {
+            Roles.getCheckboxRole().setAriaLabelledbyProperty(
+                    item.getElement(), Id.of(labelId));
+        }
+    }
+
+    @Override
+    public void clearAriaCaption() {
+        labelId = null;
+        for (CheckBox item : optionsToKeys.keySet()) {
+            Roles.getCheckboxRole().removeAriaLabelledbyProperty(
+                    item.getElement());
+        }
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index 2a2578aa16..dfa5625341 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -18,6 +18,9 @@ package com.vaadin.client.ui;
 
 import java.util.Date;
 
+import com.google.gwt.aria.client.Id;
+import com.google.gwt.aria.client.LiveValue;
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.core.client.GWT;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
@@ -25,14 +28,18 @@ import com.google.gwt.event.dom.client.DomEvent;
 import com.google.gwt.event.dom.client.KeyCodes;
 import com.google.gwt.event.logical.shared.CloseEvent;
 import com.google.gwt.event.logical.shared.CloseHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.PopupPanel;
 import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
+import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.BrowserInfo;
 import com.vaadin.client.VConsole;
 import com.vaadin.client.ui.VCalendarPanel.FocusOutListener;
@@ -68,6 +75,10 @@ public class VPopupCalendar extends VTextualDate implements Field,
 
     private boolean textFieldEnabled = true;
 
+    private String captionId;
+
+    private Label selectedDate;
+
     public VPopupCalendar() {
         super();
 
@@ -75,6 +86,11 @@ public class VPopupCalendar extends VTextualDate implements Field,
         calendarToggle.addClickHandler(this);
         // -2 instead of -1 to avoid FocusWidget.onAttach to reset it
         calendarToggle.getElement().setTabIndex(-2);
+
+        Roles.getButtonRole().set(calendarToggle.getElement());
+        Roles.getButtonRole().setAriaHiddenState(calendarToggle.getElement(),
+                true);
+
         add(calendarToggle);
 
         calendar = GWT.create(VCalendarPanel.class);
@@ -88,6 +104,9 @@ public class VPopupCalendar extends VTextualDate implements Field,
             }
         });
 
+        Roles.getButtonRole().setAriaControlsProperty(
+                calendarToggle.getElement(), Id.of(calendar.getElement()));
+
         calendar.setSubmitListener(new SubmitListener() {
             @Override
             public void onSubmit() {
@@ -109,7 +128,19 @@ public class VPopupCalendar extends VTextualDate implements Field,
         popup = new VOverlay(true, true, true);
         popup.setOwner(this);
 
-        popup.setWidget(calendar);
+        FlowPanel wrapper = new FlowPanel();
+        selectedDate = new Label();
+        selectedDate.setStyleName(getStylePrimaryName() + "-selecteddate");
+        AriaHelper.visibleForAssistiveDevicesOnly(selectedDate.getElement());
+
+        Roles.getTextboxRole().setAriaLiveProperty(selectedDate.getElement(),
+                LiveValue.ASSERTIVE);
+        Roles.getTextboxRole().setAriaAtomicProperty(selectedDate.getElement(),
+                true);
+        wrapper.add(selectedDate);
+        wrapper.add(calendar);
+
+        popup.setWidget(wrapper);
         popup.addCloseHandler(this);
 
         DOM.setElementProperty(calendar.getElement(), "id",
@@ -181,9 +212,63 @@ public class VPopupCalendar extends VTextualDate implements Field,
         text.setEnabled(textFieldEnabled);
         if (textFieldEnabled) {
             calendarToggle.setTabIndex(-1);
+            Roles.getButtonRole().setAriaHiddenState(
+                    calendarToggle.getElement(), true);
         } else {
             calendarToggle.setTabIndex(0);
+            Roles.getButtonRole().setAriaHiddenState(
+                    calendarToggle.getElement(), false);
+        }
+
+        handleAriaAttributes();
+    }
+
+    @Override
+    public void bindAriaCaption(Element captionElement) {
+        captionId = captionElement.getId();
+
+        if (isTextFieldEnabled()) {
+            super.bindAriaCaption(captionElement);
+        } else {
+            AriaHelper.bindCaption(calendarToggle, captionElement);
+        }
+
+        handleAriaAttributes();
+    }
+
+    private void handleAriaAttributes() {
+        Widget removeFromWidget;
+        Widget setForWidget;
+
+        if (isTextFieldEnabled()) {
+            setForWidget = text;
+            removeFromWidget = calendarToggle;
+        } else {
+            setForWidget = calendarToggle;
+            removeFromWidget = text;
         }
+
+        Roles.getFormRole().removeAriaLabelledbyProperty(
+                removeFromWidget.getElement());
+        if (captionId == null) {
+            Roles.getFormRole().removeAriaLabelledbyProperty(
+                    setForWidget.getElement());
+        } else {
+            Roles.getFormRole().setAriaLabelledbyProperty(
+                    setForWidget.getElement(), Id.of(captionId));
+        }
+    }
+
+    @Override
+    public void clearAriaCaption() {
+        captionId = null;
+        if (isTextFieldEnabled()) {
+            super.clearAriaCaption();
+        } else {
+            AriaHelper.clearCaption(calendarToggle);
+        }
+
+        handleAriaAttributes();
     }
 
     /*
@@ -350,6 +435,32 @@ public class VPopupCalendar extends VTextualDate implements Field,
         calendar.setFocus(focus);
     }
 
+    @Override
+    public void setEnabled(boolean enabled) {
+        super.setEnabled(enabled);
+
+        if (enabled) {
+            Roles.getButtonRole().setAriaDisabledState(
+                    calendarToggle.getElement(), true);
+        } else {
+            Roles.getButtonRole().setAriaDisabledState(
+                    calendarToggle.getElement(), false);
+        }
+    }
+
+    /**
+     * Sets the content of a special field for assistive devices, so that they
+     * can recognize the change and inform the user (reading out in case of
+     * screen reader)
+     * 
+     * @param selectedDate
+     *            Date that is currently selected
+     */
+    public void setFocusedDate(Date selectedDate) {
+        this.selectedDate.setText(DateTimeFormat.getFormat("dd, MMMM, yyyy")
+                .format(selectedDate));
+    }
+
     /**
      * For internal use only. May be removed or replaced in the future.
      * 
diff --git a/client/src/com/vaadin/client/ui/VTextField.java b/client/src/com/vaadin/client/ui/VTextField.java
index 0fbed0dd90..9b85dd22da 100644
--- a/client/src/com/vaadin/client/ui/VTextField.java
+++ b/client/src/com/vaadin/client/ui/VTextField.java
@@ -16,6 +16,7 @@
 
 package com.vaadin.client.ui;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.event.dom.client.ChangeEvent;
@@ -95,6 +96,9 @@ public class VTextField extends TextBoxBase implements Field, ChangeHandler,
         }
         addFocusHandler(this);
         addBlurHandler(this);
+
+        // Add a11y role "textbox"
+        Roles.getTextboxRole().set(node);
     }
 
     /**
diff --git a/client/src/com/vaadin/client/ui/VTextualDate.java b/client/src/com/vaadin/client/ui/VTextualDate.java
index 2f444a8587..97a868b69d 100644
--- a/client/src/com/vaadin/client/ui/VTextualDate.java
+++ b/client/src/com/vaadin/client/ui/VTextualDate.java
@@ -18,6 +18,7 @@ package com.vaadin.client.ui;
 
 import java.util.Date;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.event.dom.client.ChangeEvent;
@@ -34,7 +35,7 @@ import com.vaadin.shared.EventId;
 import com.vaadin.shared.ui.datefield.Resolution;
 
 public class VTextualDate extends VDateField implements Field, ChangeHandler,
-        Focusable, SubPartAware {
+        Focusable, SubPartAware, HandlesAriaCaption {
 
     private static final String PARSE_ERROR_CLASSNAME = "-parseerror";
 
@@ -96,6 +97,9 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
                 }
             }
         });
+
+        Roles.getTextboxRole().set(text.getElement());
+
         add(text);
     }
 
@@ -150,6 +154,16 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
         return formatStr;
     }
 
+    @Override
+    public void bindAriaCaption(Element captionElement) {
+        AriaHelper.bindCaption(text, captionElement);
+    }
+
+    @Override
+    public void clearAriaCaption() {
+        AriaHelper.clearCaption(text);
+    }
+
     /**
      * Updates the text field according to the current date (provided by
      * {@link #getDate()}). Takes care of updating text, enabling and disabling
@@ -178,8 +192,12 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
 
         if (readonly) {
             text.addStyleName("v-readonly");
+            Roles.getTextboxRole().setAriaReadonlyProperty(text.getElement(),
+                    true);
         } else {
             text.removeStyleName("v-readonly");
+            Roles.getTextboxRole()
+                    .removeAriaReadonlyProperty(text.getElement());
         }
 
     }
@@ -348,5 +366,4 @@ public class VTextualDate extends VDateField implements Field, ChangeHandler,
 
         return null;
     }
-
 }
diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
index d6d1cef8cc..6e3fffb47c 100644
--- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java
+++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
@@ -19,6 +19,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 
+import com.google.gwt.aria.client.Roles;
 import com.google.gwt.dom.client.Element;
 import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.BrowserInfo;
@@ -26,6 +27,7 @@ import com.vaadin.client.Paintable;
 import com.vaadin.client.TooltipInfo;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.Util;
+import com.vaadin.client.VConsole;
 import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractComponentConnector;
 import com.vaadin.client.ui.VTree;
@@ -93,7 +95,7 @@ public class TreeConnector extends AbstractComponentConnector implements
             }
             childTree = getWidget().new TreeNode();
             getConnection().getVTooltip().connectHandlersToWidget(childTree);
-            updateNodeFromUIDL(childTree, childUidl);
+            updateNodeFromUIDL(childTree, childUidl, 1);
             getWidget().body.add(childTree);
             childTree.addStyleDependentName("root");
             childTree.childNodeContainer.addStyleDependentName("root");
@@ -108,6 +110,9 @@ public class TreeConnector extends AbstractComponentConnector implements
         getWidget().isMultiselect = "multi".equals(selectMode);
 
         if (getWidget().isMultiselect) {
+            Roles.getTreeRole().setAriaMultiselectableProperty(
+                    getWidget().getElement(), true);
+
             if (BrowserInfo.get().isTouchDevice()) {
                 // Always use the simple mode for touch devices that do not have
                 // shift/ctrl keys (#8595)
@@ -116,6 +121,9 @@ public class TreeConnector extends AbstractComponentConnector implements
                 getWidget().multiSelectMode = MultiSelectMode.valueOf(uidl
                         .getStringAttribute("multiselectmode"));
             }
+        } else {
+            Roles.getTreeRole().setAriaMultiselectableProperty(
+                    getWidget().getElement(), false);
         }
 
         getWidget().selectedIds = uidl.getStringArrayVariableAsSet("selected");
@@ -169,7 +177,18 @@ public class TreeConnector extends AbstractComponentConnector implements
                 // expanding node happened server side
                 rootNode.setState(true, false);
             }
-            renderChildNodes(rootNode, (Iterator) uidl.getChildIterator());
+            String levelPropertyString = Roles.getTreeitemRole()
+                    .getAriaLevelProperty(rootNode.getElement());
+            int levelProperty;
+            try {
+                levelProperty = Integer.valueOf(levelPropertyString);
+            } catch (NumberFormatException e) {
+                levelProperty = 1;
+                VConsole.error(e);
+            }
+
+            renderChildNodes(rootNode, (Iterator) uidl.getChildIterator(),
+                    levelProperty + 1);
         }
     }
 
@@ -196,7 +215,10 @@ public class TreeConnector extends AbstractComponentConnector implements
 
     }
 
-    public void updateNodeFromUIDL(TreeNode treeNode, UIDL uidl) {
+    public void updateNodeFromUIDL(TreeNode treeNode, UIDL uidl, int level) {
+        Roles.getTreeitemRole().setAriaLevelProperty(treeNode.getElement(),
+                level);
+
         String nodeKey = uidl.getStringAttribute("key");
         treeNode.setText(uidl
                 .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_CAPTION));
@@ -212,7 +234,8 @@ public class TreeConnector extends AbstractComponentConnector implements
             if (uidl.getChildCount() == 0) {
                 treeNode.childNodeContainer.setVisible(false);
             } else {
-                renderChildNodes(treeNode, (Iterator) uidl.getChildIterator());
+                renderChildNodes(treeNode, (Iterator) uidl.getChildIterator(),
+                        level + 1);
                 treeNode.childrenLoaded = true;
             }
         } else {
@@ -243,7 +266,7 @@ public class TreeConnector extends AbstractComponentConnector implements
                 .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_ICON));
     }
 
-    void renderChildNodes(TreeNode containerNode, Iterator<UIDL> i) {
+    void renderChildNodes(TreeNode containerNode, Iterator<UIDL> i, int level) {
         containerNode.childNodeContainer.clear();
         containerNode.childNodeContainer.setVisible(true);
         while (i.hasNext()) {
@@ -256,7 +279,7 @@ public class TreeConnector extends AbstractComponentConnector implements
             }
             final TreeNode childTree = getWidget().new TreeNode();
             getConnection().getVTooltip().connectHandlersToWidget(childTree);
-            updateNodeFromUIDL(childTree, childUidl);
+            updateNodeFromUIDL(childTree, childUidl, level);
             containerNode.childNodeContainer.add(childTree);
             if (!i.hasNext()) {
                 childTree
diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
index 126caa5985..4ffe7f806e 100644
--- a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
+++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
@@ -1,6 +1,5 @@
 package com.vaadin.tests.layouts;
 
-
 import java.util.ArrayList;
 import java.util.List;
 
-- 
cgit v1.2.3


From de0761b03d7f1acf2aad8ac824d5cb49b75f9391 Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Thu, 21 Mar 2013 10:52:41 +0200
Subject: Moved CSSInjectWithColorpicker to correct package

Change-Id: I8b7d283b68da60d236748364cac4c5ac3310f836
---
 .../v71beta/CSSInjectWithColorpicker.java          | 234 +++++++++++++++++++++
 .../v71beta/CSSInjectWithColorpicker.java          | 234 ---------------------
 2 files changed, 234 insertions(+), 234 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
 delete mode 100644 uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
new file mode 100644
index 0000000000..09c5f91293
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
@@ -0,0 +1,234 @@
+package com.vaadin.tests.minitutorials.v71beta;
+
+import java.util.Arrays;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.Page;
+import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.shared.ui.colorpicker.Color;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.ColorPicker;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.Component;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
+import com.vaadin.ui.components.colorpicker.ColorChangeListener;
+
+public class CSSInjectWithColorpicker extends UI {
+
+    @Override
+    protected void init(VaadinRequest request) {
+
+        // Create a text editor
+        Component editor = createEditor("Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        +"Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec.");
+
+        
+        VerticalLayout content = new VerticalLayout(editor);
+        content.setMargin(true);
+        setContent(content);
+    }
+
+    /**
+     * Creates a text editor for visually editing text
+     * 
+     * @param text
+     *            The text editor
+     * @return
+     */
+    private Component createEditor(String text) {
+
+        Panel editor = new Panel("Text Editor");
+        editor.setWidth("580px");
+
+        VerticalLayout panelContent = new VerticalLayout();
+        panelContent.setSpacing(true);
+        panelContent.setMargin(new MarginInfo(true, false, false, false));
+        editor.setContent(panelContent);
+
+        // Create the toolbar
+        HorizontalLayout toolbar = new HorizontalLayout();
+        toolbar.setSpacing(true);
+        toolbar.setMargin(new MarginInfo(false, false, false, true));
+
+        // Create the font family selector
+        toolbar.addComponent(createFontSelect());
+
+        // Create the font size selector
+        toolbar.addComponent(createFontSizeSelect());
+
+        // Create the text color selector
+        toolbar.addComponent(createTextColorSelect());
+
+        // Create the background color selector
+        toolbar.addComponent(createBackgroundColorSelect());
+
+        panelContent.addComponent(toolbar);
+        panelContent.setComponentAlignment(toolbar, Alignment.MIDDLE_LEFT);
+
+        // Spacer between toolbar and text
+        panelContent.addComponent(new Label("<hr/>", ContentMode.HTML));
+
+        // The text to edit
+        TextArea textLabel = new TextArea(null, text);
+        textLabel.setWidth("100%");
+        textLabel.setHeight("200px");
+        
+        // IMPORTANT: We are here setting the style name of the label, we are going to use this in our injected styles to target the label
+        textLabel.setStyleName("text-label");
+        
+        panelContent.addComponent(textLabel);
+
+        return editor;
+    }
+
+    /**
+     * Creates a background color select dialog
+     */
+    private Component createBackgroundColorSelect() {
+        ColorPicker bgColor = new ColorPicker("Background", Color.WHITE);
+        bgColor.setWidth("110px");
+        bgColor.setCaption("Background");
+        bgColor.addColorChangeListener(new ColorChangeListener() {
+
+            @Override
+            public void colorChanged(ColorChangeEvent event) {
+
+                // Get the new background color
+                Color color = event.getColor();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new background color
+                styles.inject(".v-app .v-textarea.text-label { background-color:"
+                        + color.getCSS() + "; }");
+            }
+        });
+        return bgColor;
+    }
+
+    /**
+     * Create a text color selction dialog
+     */
+    private Component createTextColorSelect() {
+
+        // Colorpicker for changing text color
+        ColorPicker textColor = new ColorPicker("Color", Color.BLACK);
+        textColor.setWidth("110px");
+        textColor.setCaption("Color");
+        textColor.addColorChangeListener(new ColorChangeListener() {
+
+            @Override
+            public void colorChanged(ColorChangeEvent event) {
+
+                // Get the new text color
+                Color color = event.getColor();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new color as a style
+                styles.inject(".v-app .v-textarea.text-label { color:"
+                        + color.getCSS() + "; }");
+            }
+        });
+
+        return textColor;
+    }
+
+    /**
+     * Creates a font family selection dialog
+     */
+    private Component createFontSelect() {
+        final ComboBox select = new ComboBox(null, Arrays.asList("Arial",
+                "Helvetica", "Verdana", "Courier", "Times", "sans-serif"));
+        select.setValue("Arial");
+        select.setWidth("200px");
+        select.setInputPrompt("Font");
+        select.setDescription("Font");
+        select.setImmediate(true);
+        select.setNullSelectionAllowed(false);
+        select.setNewItemsAllowed(false);
+
+        select.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                // Get the new font family
+                String fontFamily = select.getValue().toString();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new font size as a style. We need .v-app to
+                // override Vaadin's default styles here
+                styles.inject(".v-app .v-textarea.text-label { font-family:"
+                        + fontFamily + "; }");
+            }
+        });
+
+        return select;
+    }
+
+    /**
+     * Creates a font size selection control
+     */
+    private Component createFontSizeSelect() {
+
+        final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10,
+                12, 14, 16, 20, 25, 30, 40, 50));
+        select.setWidth("100px");
+        select.setValue(12);
+        select.setInputPrompt("Font size");
+        select.setDescription("Font size");
+        select.setImmediate(true);
+        select.setNullSelectionAllowed(false);
+        select.setNewItemsAllowed(false);
+        select.addValueChangeListener(new ValueChangeListener() {
+            
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                // Get the new font size
+                Integer fontSize = (Integer) select.getValue();
+
+                // Get the stylesheet of the page
+                StyleSheet styles = Page.getCurrent().getStyleSheet();
+
+                // inject the new font size as a style. We need .v-app to
+                // override Vaadin's default styles here
+                styles.inject(".v-app .v-textarea.text-label { font-size:"
+                        + String.valueOf(fontSize) + "px; }");
+            }
+        });
+
+        return select;
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java
deleted file mode 100644
index 4ac85ab231..0000000000
--- a/uitest/src/com/vaadin/tests/widgetset/client/minitutorials/v71beta/CSSInjectWithColorpicker.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package com.vaadin.tests.widgetset.client.minitutorials.v71beta;
-
-import java.util.Arrays;
-
-import com.vaadin.data.Property.ValueChangeEvent;
-import com.vaadin.data.Property.ValueChangeListener;
-import com.vaadin.server.Page;
-import com.vaadin.server.Page.StyleSheet;
-import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.MarginInfo;
-import com.vaadin.shared.ui.colorpicker.Color;
-import com.vaadin.shared.ui.label.ContentMode;
-import com.vaadin.ui.Alignment;
-import com.vaadin.ui.ColorPicker;
-import com.vaadin.ui.ComboBox;
-import com.vaadin.ui.Component;
-import com.vaadin.ui.HorizontalLayout;
-import com.vaadin.ui.Label;
-import com.vaadin.ui.Panel;
-import com.vaadin.ui.TextArea;
-import com.vaadin.ui.UI;
-import com.vaadin.ui.VerticalLayout;
-import com.vaadin.ui.components.colorpicker.ColorChangeEvent;
-import com.vaadin.ui.components.colorpicker.ColorChangeListener;
-
-public class CSSInjectWithColorpicker extends UI {
-
-    @Override
-    protected void init(VaadinRequest request) {
-
-        // Create a text editor
-        Component editor = createEditor("Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        +"Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec.");
-
-        
-        VerticalLayout content = new VerticalLayout(editor);
-        content.setMargin(true);
-        setContent(content);
-    }
-
-    /**
-     * Creates a text editor for visually editing text
-     * 
-     * @param text
-     *            The text editor
-     * @return
-     */
-    private Component createEditor(String text) {
-
-        Panel editor = new Panel("Text Editor");
-        editor.setWidth("580px");
-
-        VerticalLayout panelContent = new VerticalLayout();
-        panelContent.setSpacing(true);
-        panelContent.setMargin(new MarginInfo(true, false, false, false));
-        editor.setContent(panelContent);
-
-        // Create the toolbar
-        HorizontalLayout toolbar = new HorizontalLayout();
-        toolbar.setSpacing(true);
-        toolbar.setMargin(new MarginInfo(false, false, false, true));
-
-        // Create the font family selector
-        toolbar.addComponent(createFontSelect());
-
-        // Create the font size selector
-        toolbar.addComponent(createFontSizeSelect());
-
-        // Create the text color selector
-        toolbar.addComponent(createTextColorSelect());
-
-        // Create the background color selector
-        toolbar.addComponent(createBackgroundColorSelect());
-
-        panelContent.addComponent(toolbar);
-        panelContent.setComponentAlignment(toolbar, Alignment.MIDDLE_LEFT);
-
-        // Spacer between toolbar and text
-        panelContent.addComponent(new Label("<hr/>", ContentMode.HTML));
-
-        // The text to edit
-        TextArea textLabel = new TextArea(null, text);
-        textLabel.setWidth("100%");
-        textLabel.setHeight("200px");
-        
-        // IMPORTANT: We are here setting the style name of the label, we are going to use this in our injected styles to target the label
-        textLabel.setStyleName("text-label");
-        
-        panelContent.addComponent(textLabel);
-
-        return editor;
-    }
-
-    /**
-     * Creates a background color select dialog
-     */
-    private Component createBackgroundColorSelect() {
-        ColorPicker bgColor = new ColorPicker("Background", Color.WHITE);
-        bgColor.setWidth("110px");
-        bgColor.setCaption("Background");
-        bgColor.addColorChangeListener(new ColorChangeListener() {
-
-            @Override
-            public void colorChanged(ColorChangeEvent event) {
-
-                // Get the new background color
-                Color color = event.getColor();
-
-                // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
-
-                // inject the new background color
-                styles.inject(".v-app .v-textarea.text-label { background-color:"
-                        + color.getCSS() + "; }");
-            }
-        });
-        return bgColor;
-    }
-
-    /**
-     * Create a text color selction dialog
-     */
-    private Component createTextColorSelect() {
-
-        // Colorpicker for changing text color
-        ColorPicker textColor = new ColorPicker("Color", Color.BLACK);
-        textColor.setWidth("110px");
-        textColor.setCaption("Color");
-        textColor.addColorChangeListener(new ColorChangeListener() {
-
-            @Override
-            public void colorChanged(ColorChangeEvent event) {
-
-                // Get the new text color
-                Color color = event.getColor();
-
-                // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
-
-                // inject the new color as a style
-                styles.inject(".v-app .v-textarea.text-label { color:"
-                        + color.getCSS() + "; }");
-            }
-        });
-
-        return textColor;
-    }
-
-    /**
-     * Creates a font family selection dialog
-     */
-    private Component createFontSelect() {
-        final ComboBox select = new ComboBox(null, Arrays.asList("Arial",
-                "Helvetica", "Verdana", "Courier", "Times", "sans-serif"));
-        select.setValue("Arial");
-        select.setWidth("200px");
-        select.setInputPrompt("Font");
-        select.setDescription("Font");
-        select.setImmediate(true);
-        select.setNullSelectionAllowed(false);
-        select.setNewItemsAllowed(false);
-
-        select.addValueChangeListener(new ValueChangeListener() {
-
-            @Override
-            public void valueChange(ValueChangeEvent event) {
-                // Get the new font family
-                String fontFamily = select.getValue().toString();
-
-                // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
-
-                // inject the new font size as a style. We need .v-app to
-                // override Vaadin's default styles here
-                styles.inject(".v-app .v-textarea.text-label { font-family:"
-                        + fontFamily + "; }");
-            }
-        });
-
-        return select;
-    }
-
-    /**
-     * Creates a font size selection control
-     */
-    private Component createFontSizeSelect() {
-
-        final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10,
-                12, 14, 16, 20, 25, 30, 40, 50));
-        select.setWidth("100px");
-        select.setValue(12);
-        select.setInputPrompt("Font size");
-        select.setDescription("Font size");
-        select.setImmediate(true);
-        select.setNullSelectionAllowed(false);
-        select.setNewItemsAllowed(false);
-        select.addValueChangeListener(new ValueChangeListener() {
-            
-            @Override
-            public void valueChange(ValueChangeEvent event) {
-                // Get the new font size
-                Integer fontSize = (Integer) select.getValue();
-
-                // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
-
-                // inject the new font size as a style. We need .v-app to
-                // override Vaadin's default styles here
-                styles.inject(".v-app .v-textarea.text-label { font-size:"
-                        + String.valueOf(fontSize) + "px; }");
-            }
-        });
-
-        return select;
-    }
-}
-- 
cgit v1.2.3


From 4570ac9d812bfe80cf6c44c6f9b2a0eeb5101d4f Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 26 Mar 2013 00:44:59 +0200
Subject: Id changed because of id generation for wai-aria

Change-Id: Ib216994e540d34179fc0e5498e0461bdf82f8794
---
 .../tests/components/table/ColumnCollapsingAndColumnExpansion.html      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
index 69b436a41b..261d1939cd 100644
--- a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
+++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
@@ -30,7 +30,7 @@
 <!--Hide 'col2' through table interface-->
 <tr>
 	<td>click</td>
-	<td>//td[@id='gwt-uid-4']/span/div</td>
+	<td>//td[@id='gwt-uid-7']/span/div</td>
 	<td></td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From a2a8666118de8b8f746e631a3aab4c58d2d4a6af Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Sun, 24 Mar 2013 16:38:45 +0200
Subject: Added Page.reload (#10250)

Change-Id: I8ec7edbc370388d8b36a474a8845e846395f26ed
---
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  6 +++
 server/src/com/vaadin/server/Page.java             |  7 ++++
 .../src/com/vaadin/shared/ui/ui/PageClientRpc.java |  2 +
 .../vaadin/tests/components/page/PageReload.html   | 46 ++++++++++++++++++++++
 .../vaadin/tests/components/page/PageReload.java   | 34 ++++++++++++++++
 5 files changed, 95 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/components/page/PageReload.html
 create mode 100644 uitest/src/com/vaadin/tests/components/page/PageReload.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 4f0ea2de37..1df74afd2e 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -97,6 +97,12 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
             public void setTitle(String title) {
                 com.google.gwt.user.client.Window.setTitle(title);
             }
+
+            @Override
+            public void reload() {
+                Window.Location.reload();
+
+            }
         });
         registerRpc(ScrollClientRpc.class, new ScrollClientRpc() {
             @Override
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index f7b65a8e9b..e84271e883 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -1041,4 +1041,11 @@ public class Page implements Serializable {
         uI.getRpcProxy(PageClientRpc.class).setTitle(title);
     }
 
+    /**
+     * Reloads the page in the browser.
+     */
+    public void reload() {
+        uI.getRpcProxy(PageClientRpc.class).reload();
+    }
+
 }
diff --git a/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java b/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
index 3d8f607cb8..eb847bacd0 100644
--- a/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
+++ b/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
@@ -22,4 +22,6 @@ public interface PageClientRpc extends ClientRpc {
 
     public void setTitle(String title);
 
+    public void reload();
+
 }
diff --git a/uitest/src/com/vaadin/tests/components/page/PageReload.html b/uitest/src/com/vaadin/tests/components/page/PageReload.html
new file mode 100644
index 0000000000..20d61a48f1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/page/PageReload.html
@@ -0,0 +1,46 @@
+<?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="" />
+<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.page.PageReload?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td>
+	<td>1. UI id: 0</td>
+</tr>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.page.PageReload</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td>
+	<td>1. UI id: 1</td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>vaadin=runcomvaadintestscomponentspagePageReload::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentspagePageReload::PID_SLog_row_0</td>
+	<td>1. UI id: 2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/page/PageReload.java b/uitest/src/com/vaadin/tests/components/page/PageReload.java
new file mode 100644
index 0000000000..c1799b29e3
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/page/PageReload.java
@@ -0,0 +1,34 @@
+package com.vaadin.tests.components.page;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+
+public class PageReload extends AbstractTestUIWithLog {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        Button b = new Button("Press to reload");
+        b.addClickListener(new ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                getPage().reload();
+            }
+        });
+        addComponent(b);
+        log("UI id: " + getUIId());
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests Page.reload(). Click button to refresh the page.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 10250;
+    }
+
+}
-- 
cgit v1.2.3


From d4fcfdf7aa21899e8a621d48b8c1bb75fbd46c62 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 22 Mar 2013 17:45:26 +0200
Subject: Ensure session is locked during cleanup (#10569)

* At the same time ensures request timer handling is done while session is locked (#10108)

Change-Id: Ifc36e1ac66d02e25fe98616319c014137bd94c10
---
 server/src/com/vaadin/server/VaadinService.java    | 39 +++++++++++----
 .../src/com/vaadin/server/VaadinSessionTest.java   | 57 +++++++++++++++++-----
 .../tests/applicationcontext/CloseSession.java     | 16 +++++-
 3 files changed, 89 insertions(+), 23 deletions(-)

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index 20d87d6554..e4970d4104 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -1024,13 +1024,19 @@ public abstract class VaadinService implements Serializable {
      * 
      * @param session
      */
-    private void removeClosedUIs(VaadinSession session) {
-        for (UI ui : new ArrayList<UI>(session.getUIs())) {
-            if (ui.isClosing()) {
-                getLogger().log(Level.FINER, "Removing closed UI {0}",
-                        ui.getUIId());
-                session.removeUI(ui);
-            }
+    private void removeClosedUIs(final VaadinSession session) {
+        ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
+        for (final UI ui : uis) {
+            ui.runSafely(new Runnable() {
+                @Override
+                public void run() {
+                    if (ui.isClosing()) {
+                        getLogger().log(Level.FINER, "Removing closed UI {0}",
+                                ui.getUIId());
+                        session.removeUI(ui);
+                    }
+                }
+            });
         }
     }
 
@@ -1177,10 +1183,23 @@ public abstract class VaadinService implements Serializable {
     public void requestEnd(VaadinRequest request, VaadinResponse response,
             VaadinSession session) {
         if (session != null) {
-            cleanupSession(session);
-            long duration = (System.nanoTime() - (Long) request
+            final VaadinSession finalSession = session;
+
+            session.runSafely(new Runnable() {
+                @Override
+                public void run() {
+                    cleanupSession(finalSession);
+                }
+            });
+
+            final long duration = (System.nanoTime() - (Long) request
                     .getAttribute(REQUEST_START_TIME_ATTRIBUTE)) / 1000000;
-            session.setLastRequestDuration(duration);
+            session.runSafely(new Runnable() {
+                @Override
+                public void run() {
+                    finalSession.setLastRequestDuration(duration);
+                }
+            });
         }
         CurrentInstance.clearAll();
     }
diff --git a/server/tests/src/com/vaadin/server/VaadinSessionTest.java b/server/tests/src/com/vaadin/server/VaadinSessionTest.java
index 6cad3307bf..e433e6fd05 100644
--- a/server/tests/src/com/vaadin/server/VaadinSessionTest.java
+++ b/server/tests/src/com/vaadin/server/VaadinSessionTest.java
@@ -25,30 +25,38 @@ import javax.servlet.http.HttpSessionBindingEvent;
 import junit.framework.Assert;
 
 import org.easymock.EasyMock;
+import org.junit.Before;
 import org.junit.Test;
 
 import com.vaadin.server.ClientConnector.DetachEvent;
 import com.vaadin.server.ClientConnector.DetachListener;
 import com.vaadin.ui.UI;
+import com.vaadin.util.CurrentInstance;
 
 public class VaadinSessionTest {
 
-    @Test
-    public void threadLocalsAfterUnderlyingSessionTimeout() {
-
-        final VaadinServlet mockServlet = new VaadinServlet() {
+    private VaadinSession session;
+    private VaadinServlet mockServlet;
+    private VaadinServletService mockService;
+    private HttpSession mockHttpSession;
+    private WrappedSession mockWrappedSession;
+    private VaadinServletRequest vaadinRequest;
+    private UI ui;
+
+    @Before
+    public void setup() {
+        mockServlet = new VaadinServlet() {
             @Override
             public String getServletName() {
                 return "mockServlet";
             };
         };
 
-        final VaadinServletService mockService = new VaadinServletService(
-                mockServlet, EasyMock.createMock(DeploymentConfiguration.class));
+        mockService = new VaadinServletService(mockServlet,
+                EasyMock.createMock(DeploymentConfiguration.class));
 
-        HttpSession mockHttpSession = EasyMock.createMock(HttpSession.class);
-        WrappedSession mockWrappedSession = new WrappedHttpSession(
-                mockHttpSession) {
+        mockHttpSession = EasyMock.createMock(HttpSession.class);
+        mockWrappedSession = new WrappedHttpSession(mockHttpSession) {
             final ReentrantLock lock = new ReentrantLock();
 
             @Override
@@ -60,10 +68,10 @@ public class VaadinSessionTest {
             }
         };
 
-        final VaadinSession session = new VaadinSession(mockService);
+        session = new VaadinSession(mockService);
         session.storeInSession(mockService, mockWrappedSession);
 
-        final UI ui = new UI() {
+        ui = new UI() {
             Page page = new Page(this) {
                 @Override
                 public void init(VaadinRequest request) {
@@ -79,7 +87,7 @@ public class VaadinSessionTest {
                 return page;
             }
         };
-        VaadinServletRequest vaadinRequest = new VaadinServletRequest(
+        vaadinRequest = new VaadinServletRequest(
                 EasyMock.createMock(HttpServletRequest.class), mockService) {
             @Override
             public String getParameter(String name) {
@@ -96,6 +104,11 @@ public class VaadinSessionTest {
         ui.setSession(session);
         session.addUI(ui);
 
+    }
+
+    @Test
+    public void threadLocalsAfterUnderlyingSessionTimeout() {
+
         final AtomicBoolean detachCalled = new AtomicBoolean(false);
         ui.addDetachListener(new DetachListener() {
             @Override
@@ -112,4 +125,24 @@ public class VaadinSessionTest {
         session.valueUnbound(EasyMock.createMock(HttpSessionBindingEvent.class));
         Assert.assertTrue(detachCalled.get());
     }
+
+    @Test
+    public void threadLocalsAfterSessionDestroy() {
+        final AtomicBoolean detachCalled = new AtomicBoolean(false);
+        ui.addDetachListener(new DetachListener() {
+            @Override
+            public void detach(DetachEvent event) {
+                detachCalled.set(true);
+                Assert.assertEquals(ui, UI.getCurrent());
+                Assert.assertEquals(ui.getPage(), Page.getCurrent());
+                Assert.assertEquals(session, VaadinSession.getCurrent());
+                Assert.assertEquals(mockService, VaadinService.getCurrent());
+                Assert.assertEquals(mockServlet, VaadinServlet.getCurrent());
+            }
+        });
+        CurrentInstance.clearAll();
+        session.close();
+        mockService.cleanupSession(session);
+        Assert.assertTrue(detachCalled.get());
+    }
 }
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java
index 446638f8a2..cca76cc9e3 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseSession.java
@@ -18,13 +18,16 @@ package com.vaadin.tests.applicationcontext;
 
 import javax.servlet.http.HttpSession;
 
+import com.vaadin.server.Page;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinService;
+import com.vaadin.server.VaadinSession;
 import com.vaadin.server.WrappedHttpSession;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.UI;
 
 public class CloseSession extends AbstractTestUI {
     private static final String OLD_HASH_PARAM = "oldHash";
@@ -158,6 +161,17 @@ public class CloseSession extends AbstractTestUI {
     @Override
     public void detach() {
         super.detach();
-        System.out.println("UI " + getUIId() + " detached");
+        log.log("Detach of " + this + " (" + getUIId() + ")");
+        boolean correctUI = (UI.getCurrent() == this);
+        boolean correctPage = (Page.getCurrent() == getPage());
+        boolean correctVaadinSession = (VaadinSession.getCurrent() == getSession());
+        boolean correctVaadinService = (VaadinService.getCurrent() == getSession()
+                .getService());
+        log.log("UI.current correct in detach: " + correctUI);
+        log.log("Page.current correct in detach: " + correctPage);
+        log.log("VaadinSession.current correct in detach: "
+                + correctVaadinSession);
+        log.log("VaadinService.current correct in detach: "
+                + correctVaadinService);
     }
 }
-- 
cgit v1.2.3


From cbd3badb929e0253a44ae19464b6dd0caebca968 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 26 Mar 2013 10:51:50 +0200
Subject: Fixed locking issue in tests

Change-Id: I3706cfa46f82615b8cc677bcaaa207d5ab05bf40
---
 .../tests/data/converter/ConverterFactory.java     |  9 +++++----
 .../tests/server/AlwaysLockedVaadinSession.java    | 23 ++++++++++++++++++++++
 .../tests/server/TestStreamVariableMapping.java    | 11 +++++++++--
 .../clientconnector/AttachDetachListeners.java     |  4 +++-
 .../AbstractFieldValueConversions.java             |  9 +++++----
 .../abstractfield/DefaultConverterFactory.java     |  5 +++--
 .../abstractfield/RemoveListenersOnDetach.java     |  3 ++-
 .../component/fieldgroup/BeanFieldGroupTest.java   |  1 +
 .../server/component/label/LabelConverters.java    |  3 ++-
 .../server/component/ui/CustomUIClassLoader.java   |  3 ++-
 .../component/window/AddRemoveSubWindow.java       |  3 ++-
 .../component/window/AttachDetachWindow.java       |  3 ++-
 .../tests/src/com/vaadin/ui/LabelDataSource.java   |  3 ++-
 .../util/ReflectToolsGetFieldValueByType.java      |  2 --
 .../tests/application/ThreadLocalInstances.java    |  7 ++++++-
 15 files changed, 67 insertions(+), 22 deletions(-)
 create mode 100644 server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java

(limited to 'uitest/src')

diff --git a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
index 5067da8861..bf4412fbce 100644
--- a/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/data/converter/ConverterFactory.java
@@ -22,6 +22,7 @@ import junit.framework.TestCase;
 import com.vaadin.data.util.converter.Converter;
 import com.vaadin.data.util.converter.DefaultConverterFactory;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.TextField;
 
 public class ConverterFactory extends TestCase {
@@ -66,7 +67,7 @@ public class ConverterFactory extends TestCase {
 
     public void testApplicationConverterFactoryInBackgroundThread() {
         VaadinSession.setCurrent(null);
-        final VaadinSession appWithCustomIntegerConverter = new VaadinSession(
+        final VaadinSession appWithCustomIntegerConverter = new AlwaysLockedVaadinSession(
                 null);
         appWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
@@ -84,7 +85,7 @@ public class ConverterFactory extends TestCase {
     }
 
     public void testApplicationConverterFactoryForDetachedComponent() {
-        final VaadinSession appWithCustomIntegerConverter = new VaadinSession(
+        final VaadinSession appWithCustomIntegerConverter = new AlwaysLockedVaadinSession(
                 null);
         appWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
@@ -98,11 +99,11 @@ public class ConverterFactory extends TestCase {
     }
 
     public void testApplicationConverterFactoryForDifferentThanCurrentApplication() {
-        final VaadinSession fieldAppWithCustomIntegerConverter = new VaadinSession(
+        final VaadinSession fieldAppWithCustomIntegerConverter = new AlwaysLockedVaadinSession(
                 null);
         fieldAppWithCustomIntegerConverter
                 .setConverterFactory(new ConverterFactory42());
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
 
         TextField tf = new TextField("", "123") {
             @Override
diff --git a/server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java b/server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java
new file mode 100644
index 0000000000..49e761f8b1
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/AlwaysLockedVaadinSession.java
@@ -0,0 +1,23 @@
+package com.vaadin.tests.server;
+
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import com.vaadin.server.VaadinService;
+import com.vaadin.server.VaadinSession;
+
+public class AlwaysLockedVaadinSession extends VaadinSession {
+
+    private ReentrantLock lock;
+
+    public AlwaysLockedVaadinSession(VaadinService service) {
+        super(service);
+        lock = new ReentrantLock();
+        lock.lock();
+    }
+
+    @Override
+    public Lock getLockInstance() {
+        return lock;
+    }
+}
diff --git a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
index 68fbdb8d0d..da0bf9ebc8 100644
--- a/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
+++ b/server/tests/src/com/vaadin/tests/server/TestStreamVariableMapping.java
@@ -4,9 +4,12 @@ import junit.framework.TestCase;
 
 import org.easymock.EasyMock;
 
+import com.vaadin.server.DeploymentConfiguration;
 import com.vaadin.server.LegacyCommunicationManager;
 import com.vaadin.server.StreamVariable;
 import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinServlet;
+import com.vaadin.server.VaadinServletService;
 import com.vaadin.server.VaadinSession;
 import com.vaadin.ui.ConnectorTracker;
 import com.vaadin.ui.UI;
@@ -22,7 +25,7 @@ public class TestStreamVariableMapping extends TestCase {
 
     @Override
     protected void setUp() throws Exception {
-        final VaadinSession application = new VaadinSession(null);
+        final VaadinSession application = new AlwaysLockedVaadinSession(null);
         final UI uI = new UI() {
             @Override
             protected void init(VaadinRequest request) {
@@ -73,7 +76,11 @@ public class TestStreamVariableMapping extends TestCase {
     }
 
     private LegacyCommunicationManager createCommunicationManager() {
-        return new LegacyCommunicationManager(new VaadinSession(null));
+        VaadinServletService vss = new VaadinServletService(
+                EasyMock.createMock(VaadinServlet.class),
+                EasyMock.createMock(DeploymentConfiguration.class));
+        return new LegacyCommunicationManager(
+                new AlwaysLockedVaadinSession(vss));
     }
 
 }
diff --git a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
index 8a61ec6352..f8dbaccdad 100644
--- a/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
+++ b/server/tests/src/com/vaadin/tests/server/clientconnector/AttachDetachListeners.java
@@ -18,6 +18,7 @@ import com.vaadin.server.ClientConnector.DetachListener;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinService;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.Component;
 import com.vaadin.ui.CssLayout;
 import com.vaadin.ui.Label;
@@ -40,7 +41,8 @@ public class AttachDetachListeners {
     public void setUp() {
         control = EasyMock.createStrictControl();
 
-        session = new VaadinSession(control.createMock(VaadinService.class));
+        session = new AlwaysLockedVaadinSession(
+                control.createMock(VaadinService.class));
 
         ui = new UI() {
             @Override
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
index cd77101ac3..144ca0fe24 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/AbstractFieldValueConversions.java
@@ -17,6 +17,7 @@ import com.vaadin.tests.data.bean.Address;
 import com.vaadin.tests.data.bean.Country;
 import com.vaadin.tests.data.bean.Person;
 import com.vaadin.tests.data.bean.Sex;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.CheckBox;
 import com.vaadin.ui.TextField;
 
@@ -45,7 +46,7 @@ public class AbstractFieldValueConversions extends TestCase {
     }
 
     public void testNonmodifiedBufferedFieldConversion() {
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
         TextField tf = new TextField("salary");
         tf.setBuffered(true);
         tf.setLocale(new Locale("en", "US"));
@@ -61,7 +62,7 @@ public class AbstractFieldValueConversions extends TestCase {
     }
 
     public void testModifiedBufferedFieldConversion() {
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
         TextField tf = new TextField("salary");
         tf.setBuffered(true);
         tf.setLocale(new Locale("en", "US"));
@@ -129,7 +130,7 @@ public class AbstractFieldValueConversions extends TestCase {
     }
 
     public void testChangeReadOnlyFieldLocale() {
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
 
         TextField tf = new TextField("salary");
         tf.setLocale(new Locale("en", "US"));
@@ -214,7 +215,7 @@ public class AbstractFieldValueConversions extends TestCase {
     }
 
     public void testNumberDoubleConverterChange() {
-        final VaadinSession a = new VaadinSession(null);
+        final VaadinSession a = new AlwaysLockedVaadinSession(null);
         VaadinSession.setCurrent(a);
         TextField tf = new TextField() {
             @Override
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
index 698e9bcee4..5455da18f8 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/DefaultConverterFactory.java
@@ -11,6 +11,7 @@ import com.vaadin.tests.data.bean.Address;
 import com.vaadin.tests.data.bean.Country;
 import com.vaadin.tests.data.bean.Person;
 import com.vaadin.tests.data.bean.Sex;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.TextField;
 
 public class DefaultConverterFactory extends TestCase {
@@ -53,7 +54,7 @@ public class DefaultConverterFactory extends TestCase {
     }
 
     public void testFloatConversion() {
-        VaadinSession sess = new VaadinSession(null);
+        VaadinSession sess = new AlwaysLockedVaadinSession(null);
         VaadinSession.setCurrent(sess);
 
         TextField tf = new TextField();
@@ -68,7 +69,7 @@ public class DefaultConverterFactory extends TestCase {
     }
 
     public void testDefaultNumberConversion() {
-        VaadinSession app = new VaadinSession(null);
+        VaadinSession app = new AlwaysLockedVaadinSession(null);
         VaadinSession.setCurrent(app);
         TextField tf = new TextField();
         tf.setLocale(new Locale("en", "US"));
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index cd9b6c6631..6dfd50c44c 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -9,6 +9,7 @@ import com.vaadin.data.util.AbstractProperty;
 import com.vaadin.data.util.converter.Converter.ConversionException;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.AbstractField;
 import com.vaadin.ui.UI;
 
@@ -18,7 +19,7 @@ public class RemoveListenersOnDetach {
     int numReadOnlyChanges = 0;
 
     AbstractField field = new AbstractField() {
-        final private VaadinSession application = new VaadinSession(null);
+        final private VaadinSession application = new AlwaysLockedVaadinSession(null);
         private UI uI = new UI() {
 
             @Override
diff --git a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
index 68c1133dc0..44b77e88e2 100644
--- a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/BeanFieldGroupTest.java
@@ -3,6 +3,7 @@ package com.vaadin.tests.server.component.fieldgroup;
 import static org.junit.Assert.assertEquals;
 
 import org.junit.Test;
+
 import com.vaadin.data.fieldgroup.BeanFieldGroup;
 
 public class BeanFieldGroupTest {
diff --git a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
index 7fd2930865..13da46cd60 100644
--- a/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
+++ b/server/tests/src/com/vaadin/tests/server/component/label/LabelConverters.java
@@ -21,6 +21,7 @@ import com.vaadin.data.Property;
 import com.vaadin.data.util.MethodProperty;
 import com.vaadin.server.VaadinSession;
 import com.vaadin.tests.data.bean.Person;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.Label;
 
 public class LabelConverters extends TestCase {
@@ -37,7 +38,7 @@ public class LabelConverters extends TestCase {
     }
 
     public void testIntegerDataSource() {
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
         Label l = new Label("Foo");
         Property ds = new MethodProperty<Integer>(Person.createTestPerson1(),
                 "age");
diff --git a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
index 8884c0c27c..186f563569 100644
--- a/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
+++ b/server/tests/src/com/vaadin/tests/server/component/ui/CustomUIClassLoader.java
@@ -15,6 +15,7 @@ import com.vaadin.server.UIClassSelectionEvent;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinService;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.UI;
 
 public class CustomUIClassLoader extends TestCase {
@@ -113,7 +114,7 @@ public class CustomUIClassLoader extends TestCase {
     }
 
     private VaadinSession createStubApplication() {
-        return new VaadinSession(null) {
+        return new AlwaysLockedVaadinSession(null) {
             @Override
             public DeploymentConfiguration getConfiguration() {
                 return createConfigurationMock();
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
index bf6d127a83..15d3707f28 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AddRemoveSubWindow.java
@@ -8,6 +8,7 @@ import org.junit.Test;
 
 import com.vaadin.server.LegacyApplication;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.LegacyWindow;
 import com.vaadin.ui.UI;
 import com.vaadin.ui.Window;
@@ -25,7 +26,7 @@ public class AddRemoveSubWindow {
 
     @Test
     public void addSubWindow() {
-        VaadinSession.setCurrent(new VaadinSession(null));
+        VaadinSession.setCurrent(new AlwaysLockedVaadinSession(null));
         TestApp app = new TestApp();
         app.init();
         Window subWindow = new Window("Sub window");
diff --git a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
index 63a58bcab3..4dfadc23a1 100644
--- a/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
+++ b/server/tests/src/com/vaadin/tests/server/component/window/AttachDetachWindow.java
@@ -8,6 +8,7 @@ import org.junit.Test;
 import com.vaadin.server.ClientConnector;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.UI;
 import com.vaadin.ui.VerticalLayout;
@@ -15,7 +16,7 @@ import com.vaadin.ui.Window;
 
 public class AttachDetachWindow {
 
-    private VaadinSession testApp = new VaadinSession(null);
+    private VaadinSession testApp = new AlwaysLockedVaadinSession(null);
 
     private interface TestContainer {
         public boolean attachCalled();
diff --git a/server/tests/src/com/vaadin/ui/LabelDataSource.java b/server/tests/src/com/vaadin/ui/LabelDataSource.java
index 7dcb382124..87ca4e372c 100644
--- a/server/tests/src/com/vaadin/ui/LabelDataSource.java
+++ b/server/tests/src/com/vaadin/ui/LabelDataSource.java
@@ -24,6 +24,7 @@ import org.junit.Test;
 import com.vaadin.data.util.ObjectProperty;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.server.AlwaysLockedVaadinSession;
 
 public class LabelDataSource {
 
@@ -39,7 +40,7 @@ public class LabelDataSource {
 
     @Before
     public void setup() {
-        vaadinSession = new VaadinSession(null);
+        vaadinSession = new AlwaysLockedVaadinSession(null);
         VaadinSession.setCurrent(vaadinSession);
 
         label = new Label();
diff --git a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
index 78be9b04fb..718a76804f 100644
--- a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
+++ b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
@@ -3,8 +3,6 @@ package com.vaadin.util;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.lang.reflect.InvocationTargetException;
-
 import org.junit.Test;
 
 public class ReflectToolsGetFieldValueByType {
diff --git a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
index b6774ae56a..ed611117d0 100644
--- a/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
+++ b/uitest/src/com/vaadin/tests/application/ThreadLocalInstances.java
@@ -52,7 +52,12 @@ public class ThreadLocalInstances extends AbstractTestCase {
     private final FlagSeResource resource = new FlagSeResource() {
         @Override
         public DownloadStream getStream() {
-            reportCurrentStatus("resource handler");
+            ThreadLocalInstances.this.getContext().lock();
+            try {
+                reportCurrentStatus("resource handler");
+            } finally {
+                ThreadLocalInstances.this.getContext().unlock();
+            }
             return super.getStream();
         }
     };
-- 
cgit v1.2.3


From 9586a30b64bfd1e8645574d9d7b6568d52dc9e25 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 25 Mar 2013 21:54:36 +0200
Subject: Made is possible to configure tooltip on the server (#8065)

Change-Id: I35af6df1dfa75ef1de1268eb630fc0f4b9306170
---
 client/src/com/vaadin/client/VTooltip.java         | 138 +++++++++++-
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  17 ++
 server/src/com/vaadin/ui/Tooltip.java              | 240 +++++++++++++++++++++
 server/src/com/vaadin/ui/UI.java                   |  11 +
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |  12 ++
 .../tests/components/ui/TooltipConfiguration.html  | 135 ++++++++++++
 .../tests/components/ui/TooltipConfiguration.java  | 107 +++++++++
 7 files changed, 650 insertions(+), 10 deletions(-)
 create mode 100644 server/src/com/vaadin/ui/Tooltip.java
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/VTooltip.java b/client/src/com/vaadin/client/VTooltip.java
index e6d9a79a5b..53770f4201 100644
--- a/client/src/com/vaadin/client/VTooltip.java
+++ b/client/src/com/vaadin/client/VTooltip.java
@@ -48,11 +48,6 @@ public class VTooltip extends VOverlay {
     public static final int TOOLTIP_EVENTS = Event.ONKEYDOWN
             | Event.ONMOUSEOVER | Event.ONMOUSEOUT | Event.ONMOUSEMOVE
             | Event.ONCLICK;
-    protected static final int MAX_WIDTH = 500;
-    private static final int QUICK_OPEN_TIMEOUT = 1000;
-    private static final int CLOSE_TIMEOUT = 300;
-    private static final int OPEN_DELAY = 750;
-    private static final int QUICK_OPEN_DELAY = 100;
     VErrorMessage em = new VErrorMessage();
     Element description = DOM.createDiv();
 
@@ -64,6 +59,13 @@ public class VTooltip extends VOverlay {
 
     private String uniqueId = DOM.createUniqueId();
     private Element layoutElement;
+    private int maxWidth;
+
+    // Delays for the tooltip, configurable on the server side
+    private int openDelay;
+    private int quickOpenDelay;
+    private int quickOpenTimeout;
+    private int closeTimeout;
 
     /**
      * Used to show tooltips; usually used via the singleton in
@@ -126,8 +128,8 @@ public class VTooltip extends VOverlay {
                 @Override
                 public void setPosition(int offsetWidth, int offsetHeight) {
 
-                    if (offsetWidth > MAX_WIDTH) {
-                        setWidth(MAX_WIDTH + "px");
+                    if (offsetWidth > getMaxWidth()) {
+                        setWidth(getMaxWidth() + "px");
 
                         // Check new height and width with reflowed content
                         offsetWidth = getOffsetWidth();
@@ -172,7 +174,7 @@ public class VTooltip extends VOverlay {
 
         // Schedule timer for showing the tooltip according to if it was
         // recently closed or not.
-        int timeout = justClosed ? QUICK_OPEN_DELAY : OPEN_DELAY;
+        int timeout = justClosed ? getQuickOpenDelay() : getOpenDelay();
         showTimer.schedule(timeout);
         opening = true;
     }
@@ -222,10 +224,10 @@ public class VTooltip extends VOverlay {
             // already about to close
             return;
         }
-        closeTimer.schedule(CLOSE_TIMEOUT);
+        closeTimer.schedule(getCloseTimeout());
         closing = true;
         justClosed = true;
-        justClosedTimer.schedule(QUICK_OPEN_TIMEOUT);
+        justClosedTimer.schedule(getQuickOpenTimeout());
     }
 
     @Override
@@ -466,4 +468,120 @@ public class VTooltip extends VOverlay {
 
         Roles.getTooltipRole().setAriaHiddenState(layoutElement, false);
     }
+
+    /**
+     * Returns the time (in ms) the tooltip should be displayed after an event
+     * that will cause it to be closed (e.g. mouse click outside the component,
+     * key down).
+     * 
+     * @return The close timeout (in ms)
+     */
+    public int getCloseTimeout() {
+        return closeTimeout;
+    }
+
+    /**
+     * Sets the time (in ms) the tooltip should be displayed after an event that
+     * will cause it to be closed (e.g. mouse click outside the component, key
+     * down).
+     * 
+     * @param closeTimeout
+     *            The close timeout (in ms)
+     */
+    public void setCloseTimeout(int closeTimeout) {
+        this.closeTimeout = closeTimeout;
+    }
+
+    /**
+     * Returns the time (in ms) during which {@link #getQuickOpenDelay()} should
+     * be used instead of {@link #getOpenDelay()}. The quick open delay is used
+     * when the tooltip has very recently been shown, is currently hidden but
+     * about to be shown again.
+     * 
+     * @return The quick open timeout (in ms)
+     */
+    public int getQuickOpenTimeout() {
+        return quickOpenTimeout;
+    }
+
+    /**
+     * Sets the time (in ms) that determines when {@link #getQuickOpenDelay()}
+     * should be used instead of {@link #getOpenDelay()}. The quick open delay
+     * is used when the tooltip has very recently been shown, is currently
+     * hidden but about to be shown again.
+     * 
+     * @param quickOpenTimeout
+     *            The quick open timeout (in ms)
+     */
+    public void setQuickOpenTimeout(int quickOpenTimeout) {
+        this.quickOpenTimeout = quickOpenTimeout;
+    }
+
+    /**
+     * Returns the time (in ms) that should elapse before a tooltip will be
+     * shown, in the situation when a tooltip has very recently been shown
+     * (within {@link #getQuickOpenDelay()} ms).
+     * 
+     * @return The quick open delay (in ms)
+     */
+    public int getQuickOpenDelay() {
+        return quickOpenDelay;
+    }
+
+    /**
+     * Sets the time (in ms) that should elapse before a tooltip will be shown,
+     * in the situation when a tooltip has very recently been shown (within
+     * {@link #getQuickOpenDelay()} ms).
+     * 
+     * @param quickOpenDelay
+     *            The quick open delay (in ms)
+     */
+    public void setQuickOpenDelay(int quickOpenDelay) {
+        this.quickOpenDelay = quickOpenDelay;
+    }
+
+    /**
+     * Returns the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @return The open delay (in ms)
+     */
+    public int getOpenDelay() {
+        return openDelay;
+    }
+
+    /**
+     * Sets the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @param openDelay
+     *            The open delay (in ms)
+     */
+    public void setOpenDelay(int openDelay) {
+        this.openDelay = openDelay;
+    }
+
+    /**
+     * Sets the maximum width of the tooltip popup.
+     * 
+     * @param maxWidth
+     *            The maximum width the tooltip popup (in pixels)
+     */
+    public void setMaxWidth(int maxWidth) {
+        this.maxWidth = maxWidth;
+    }
+
+    /**
+     * Returns the maximum width of the tooltip popup.
+     * 
+     * @return The maximum width the tooltip popup (in pixels)
+     */
+    public int getMaxWidth() {
+        return maxWidth;
+    }
+
 }
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 1df74afd2e..b8b7786d21 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -599,4 +599,21 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
             }
         });
     }
+
+    @Override
+    public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        super.onStateChanged(stateChangeEvent);
+        if (stateChangeEvent.hasPropertyChanged("tooltipConfiguration")) {
+            getConnection().getVTooltip().setCloseTimeout(
+                    getState().tooltipConfiguration.closeTimeout);
+            getConnection().getVTooltip().setOpenDelay(
+                    getState().tooltipConfiguration.openDelay);
+            getConnection().getVTooltip().setQuickOpenDelay(
+                    getState().tooltipConfiguration.quickOpenDelay);
+            getConnection().getVTooltip().setQuickOpenTimeout(
+                    getState().tooltipConfiguration.quickOpenTimeout);
+            getConnection().getVTooltip().setMaxWidth(
+                    getState().tooltipConfiguration.maxWidth);
+        }
+    }
 }
diff --git a/server/src/com/vaadin/ui/Tooltip.java b/server/src/com/vaadin/ui/Tooltip.java
new file mode 100644
index 0000000000..093bb33b51
--- /dev/null
+++ b/server/src/com/vaadin/ui/Tooltip.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.ui.UIState.TooltipConfiguration;
+
+/**
+ * Provides method for configuring the tooltip.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public interface Tooltip extends Serializable {
+    /**
+     * Returns the time (in ms) the tooltip should be displayed after an event
+     * that will cause it to be closed (e.g. mouse click outside the component,
+     * key down).
+     * 
+     * @return The close timeout
+     */
+    public int getCloseTimeout();
+
+    /**
+     * Sets the time (in ms) the tooltip should be displayed after an event that
+     * will cause it to be closed (e.g. mouse click outside the component, key
+     * down).
+     * 
+     * @param closeTimeout
+     *            The close timeout
+     */
+    public void setCloseTimeout(int closeTimeout);
+
+    /**
+     * Returns the time (in ms) during which {@link #getQuickOpenDelay()} should
+     * be used instead of {@link #getOpenDelay()}. The quick open delay is used
+     * when the tooltip has very recently been shown, is currently hidden but
+     * about to be shown again.
+     * 
+     * @return The quick open timeout
+     */
+    public int getQuickOpenTimeout();
+
+    /**
+     * Sets the time (in ms) that determines when {@link #getQuickOpenDelay()}
+     * should be used instead of {@link #getOpenDelay()}. The quick open delay
+     * is used when the tooltip has very recently been shown, is currently
+     * hidden but about to be shown again.
+     * 
+     * @param quickOpenTimeout
+     *            The quick open timeout
+     */
+    public void setQuickOpenTimeout(int quickOpenTimeout);
+
+    /**
+     * Returns the time (in ms) that should elapse before a tooltip will be
+     * shown, in the situation when a tooltip has very recently been shown
+     * (within {@link #getQuickOpenDelay()} ms).
+     * 
+     * @return The quick open delay
+     */
+    public int getQuickOpenDelay();
+
+    /**
+     * Sets the time (in ms) that should elapse before a tooltip will be shown,
+     * in the situation when a tooltip has very recently been shown (within
+     * {@link #getQuickOpenDelay()} ms).
+     * 
+     * @param quickOpenDelay
+     *            The quick open delay
+     */
+    public void setQuickOpenDelay(int quickOpenDelay);
+
+    /**
+     * Returns the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @return The open delay
+     */
+    public int getOpenDelay();
+
+    /**
+     * Sets the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @param openDelay
+     *            The open delay
+     */
+    public void setOpenDelay(int openDelay);
+
+    /**
+     * Returns the maximum width of the tooltip popup.
+     * 
+     * @return The maximum width the tooltip popup
+     */
+    public int getMaxWidth();
+
+    /**
+     * Sets the maximum width of the tooltip popup.
+     * 
+     * @param maxWidth
+     *            The maximum width the tooltip popup
+     */
+    public void setMaxWidth(int maxWidth);
+}
+
+class TooltipImpl implements Tooltip {
+    private UI ui;
+
+    public TooltipImpl(UI ui) {
+        this.ui = ui;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.UI.Tooltip#getCloseTimeout()
+     */
+    @Override
+    public int getCloseTimeout() {
+        return getState(false).closeTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setCloseTimeout(int)
+     */
+    @Override
+    public void setCloseTimeout(int closeTimeout) {
+        getState().closeTimeout = closeTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getQuickOpenTimeout()
+     */
+    @Override
+    public int getQuickOpenTimeout() {
+        return getState(false).quickOpenTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setQuickOpenTimeout(int)
+     */
+    @Override
+    public void setQuickOpenTimeout(int quickOpenTimeout) {
+        getState().quickOpenTimeout = quickOpenTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getQuickOpenDelay()
+     */
+    @Override
+    public int getQuickOpenDelay() {
+        return getState(false).quickOpenDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setQuickOpenDelay(int)
+     */
+    @Override
+    public void setQuickOpenDelay(int quickOpenDelay) {
+        getState().quickOpenDelay = quickOpenDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getOpenDelay()
+     */
+    @Override
+    public int getOpenDelay() {
+        return getState(false).openDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setOpenDelay(int)
+     */
+    @Override
+    public void setOpenDelay(int openDelay) {
+        getState().openDelay = openDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getMaxWidth()
+     */
+    @Override
+    public int getMaxWidth() {
+        return getState(false).maxWidth;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setMaxWidth(int)
+     */
+    @Override
+    public void setMaxWidth(int maxWidth) {
+        getState().maxWidth = maxWidth;
+    }
+
+    private TooltipConfiguration getState() {
+        return ui.getState().tooltipConfiguration;
+    }
+
+    private TooltipConfiguration getState(boolean markAsDirty) {
+        return ui.getState(markAsDirty).tooltipConfiguration;
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 47cfd471cd..e9499da7f3 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -155,6 +155,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private boolean closing = false;
 
+    private Tooltip tooltip = new TooltipImpl(this);
+
     /**
      * Creates a new empty UI without a caption. The content of the UI must be
      * set by calling {@link #setContent(Component)} before using the UI.
@@ -1095,4 +1097,13 @@ public abstract class UI extends AbstractSingleComponentContainer implements
         }
 
     }
+
+    /**
+     * Retrieves the object used for configuring tooltips.
+     * 
+     * @return The instance used for tooltip configuration
+     */
+    public Tooltip getTooltip() {
+        return tooltip;
+    }
 }
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 9abaf47f4b..cc6897dd0d 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -15,9 +15,21 @@
  */
 package com.vaadin.shared.ui.ui;
 
+import java.io.Serializable;
+
 import com.vaadin.shared.ui.TabIndexState;
 
 public class UIState extends TabIndexState {
+    public TooltipConfiguration tooltipConfiguration = new TooltipConfiguration();
+
+    public static class TooltipConfiguration implements Serializable {
+        public int openDelay = 750;
+        public int quickOpenDelay = 100;
+        public int quickOpenTimeout = 1000;
+        public int closeTimeout = 300;
+        public int maxWidth = 500;
+    }
+
     {
         primaryStyleName = "v-ui";
         // Default is 1 for legacy reasons
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
new file mode 100644
index 0000000000..5170d4408f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
@@ -0,0 +1,135 @@
+<?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.ui.TooltipConfiguration?restartApplication</td>
+	<td></td>
+</tr>
+<!--Short close delay-->
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td>
+	<td>0</td>
+</tr>
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>waitForElementPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-3</td>
+	<td>This is a short tooltip</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementNotPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<!--Long close delay-->
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td>
+	<td>3000</td>
+</tr>
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>waitForElementPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-3</td>
+	<td>This is a short tooltip</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td>
+	<td>60,9</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td>
+	<td>0</td>
+</tr>
+<!--Max width 500-->
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>waitForElementPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementWidth</td>
+	<td>id=gwt-uid-3</td>
+	<td>500</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td>
+	<td></td>
+</tr>
+<!--Max width 100-->
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SMax width</td>
+	<td>100</td>
+</tr>
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>waitForElementPresent</td>
+	<td>id=gwt-uid-3</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementWidth</td>
+	<td>id=gwt-uid-3</td>
+	<td>100</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
new file mode 100644
index 0000000000..b8998ff32e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
@@ -0,0 +1,107 @@
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.util.LoremIpsum;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+
+public class TooltipConfiguration extends AbstractTestUIWithLog {
+
+    private TextField closeTimeout;
+    private TextField quickOpenTimeout;
+    private TextField maxWidth;
+    private TextField openDelay;
+    private TextField quickOpenDelay;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        NativeButton componentWithShortTooltip = new NativeButton(
+                "Short tooltip");
+        componentWithShortTooltip.setDescription("This is a short tooltip");
+        componentWithShortTooltip.setId("shortTooltip");
+
+        NativeButton componentWithLongTooltip = new NativeButton("Long tooltip");
+        componentWithLongTooltip.setId("longTooltip");
+        componentWithLongTooltip.setDescription(LoremIpsum.get(5000));
+
+        closeTimeout = createIntegerTextField("Close timeout",
+                getState().tooltipConfiguration.closeTimeout);
+        closeTimeout.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getTooltip().setCloseTimeout(
+                        (Integer) closeTimeout.getConvertedValue());
+            }
+        });
+        maxWidth = createIntegerTextField("Max width",
+                getState().tooltipConfiguration.maxWidth);
+        maxWidth.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getTooltip()
+                        .setMaxWidth((Integer) maxWidth.getConvertedValue());
+            }
+        });
+        openDelay = createIntegerTextField("Open delay",
+                getState().tooltipConfiguration.openDelay);
+        openDelay.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getTooltip().setOpenDelay(
+                        (Integer) openDelay.getConvertedValue());
+            }
+        });
+
+        quickOpenDelay = createIntegerTextField("Quick open delay",
+                getState().tooltipConfiguration.quickOpenDelay);
+        quickOpenDelay
+                .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        getTooltip().setQuickOpenDelay(
+                                (Integer) quickOpenDelay.getConvertedValue());
+                    }
+                });
+
+        quickOpenTimeout = createIntegerTextField("Quick open timeout",
+                getState().tooltipConfiguration.quickOpenTimeout);
+        quickOpenTimeout
+                .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        getTooltip().setQuickOpenTimeout(
+                                (Integer) quickOpenTimeout.getConvertedValue());
+                    }
+                });
+
+        getLayout().addComponents(closeTimeout, openDelay, quickOpenDelay,
+                quickOpenTimeout, maxWidth);
+
+        getLayout().addComponents(componentWithShortTooltip,
+                componentWithLongTooltip);
+
+    }
+
+    private TextField createIntegerTextField(String caption, int initialValue) {
+        TextField tf = new TextField(caption);
+        tf.setId(caption);
+        tf.setConverter(Integer.class);
+        tf.setImmediate(true);
+        tf.setConvertedValue(initialValue);
+        return tf;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests that tooltip delays can be configured";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 8065;
+    }
+
+}
-- 
cgit v1.2.3


From ce2df6d10370c669a512e96f0693fc37cf02aca1 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 25 Mar 2013 23:37:45 +0200
Subject: Enable setting loading indicator delays from the server (#7448)

* Refactored LoadingIndicator to a separate class on client side to enable customization and to remove clutter from ApplicationConnection

Change-Id: I12e94294beed9c65a5710bdfe2486bc0f1b92bd9
---
 .../com/vaadin/client/ApplicationConnection.java   | 104 ++--------
 .../src/com/vaadin/client/VLoadingIndicator.java   | 218 +++++++++++++++++++++
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  10 +
 server/src/com/vaadin/ui/LoadingIndicator.java     | 159 +++++++++++++++
 server/src/com/vaadin/ui/UI.java                   |  12 ++
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |   7 +
 .../ui/LoadingIndicatorConfigurationTest.java      |  99 ++++++++++
 7 files changed, 526 insertions(+), 83 deletions(-)
 create mode 100644 client/src/com/vaadin/client/VLoadingIndicator.java
 create mode 100644 server/src/com/vaadin/ui/LoadingIndicator.java
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index a043ec6c0b..d59abc892a 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -177,11 +177,6 @@ public class ApplicationConnection {
 
     private VContextMenu contextMenu = null;
 
-    private Timer loadTimer;
-    private Timer loadTimer2;
-    private Timer loadTimer3;
-    private Element loadElement;
-
     private final UIConnector uIConnector;
 
     protected boolean applicationRunning = false;
@@ -378,6 +373,8 @@ public class ApplicationConnection {
 
     private CommunicationErrorHandler communicationErrorDelegate = null;
 
+    private VLoadingIndicator loadingIndicator;
+
     public static class MultiStepDuration extends Duration {
         private int previousStep = elapsedMillis();
 
@@ -404,6 +401,8 @@ public class ApplicationConnection {
         layoutManager = GWT.create(LayoutManager.class);
         layoutManager.setConnection(this);
         tooltip = GWT.create(VTooltip.class);
+        loadingIndicator = GWT.create(VLoadingIndicator.class);
+        loadingIndicator.setConnection(this);
     }
 
     public void init(WidgetSet widgetSet, ApplicationConfiguration cnf) {
@@ -436,7 +435,7 @@ public class ApplicationConnection {
 
         tooltip.setOwner(uIConnector.getWidget());
 
-        showLoadingIndicator();
+        getLoadingIndicator().trigger();
 
         scheduleHeartbeat();
 
@@ -987,7 +986,7 @@ public class ApplicationConnection {
      */
     protected boolean isCSSLoaded() {
         return cssLoaded
-                || DOM.getElementPropertyInt(loadElement, "offsetHeight") != 0;
+                || getLoadingIndicator().getElement().getOffsetHeight() != 0;
     }
 
     /**
@@ -1085,25 +1084,7 @@ public class ApplicationConnection {
         }
         hasActiveRequest = true;
         requestStartTime = new Date();
-        // show initial throbber
-        if (loadTimer == null) {
-            loadTimer = new Timer() {
-                @Override
-                public void run() {
-                    /*
-                     * IE7 does not properly cancel the event with
-                     * loadTimer.cancel() so we have to check that we really
-                     * should make it visible
-                     */
-                    if (loadTimer != null) {
-                        showLoadingIndicator();
-                    }
-
-                }
-            };
-            // First one kicks in at 300ms
-        }
-        loadTimer.schedule(300);
+        loadingIndicator.trigger();
         eventBus.fireEvent(new RequestStartingEvent(this));
     }
 
@@ -1129,7 +1110,7 @@ public class ApplicationConnection {
             @Override
             public void execute() {
                 if (!hasActiveRequest()) {
-                    hideLoadingIndicator();
+                    getLoadingIndicator().hide();
 
                     // If on Liferay and session expiration management is in
                     // use, extend session duration on each request.
@@ -1182,54 +1163,6 @@ public class ApplicationConnection {
         }
     }
 
-    private void showLoadingIndicator() {
-        // show initial throbber
-        if (loadElement == null) {
-            loadElement = DOM.createDiv();
-            DOM.setStyleAttribute(loadElement, "position", "absolute");
-            DOM.appendChild(uIConnector.getWidget().getElement(), loadElement);
-            VConsole.log("inserting load indicator");
-        }
-        DOM.setElementProperty(loadElement, "className", "v-loading-indicator");
-        DOM.setStyleAttribute(loadElement, "display", "block");
-        // Initialize other timers
-        loadTimer2 = new Timer() {
-            @Override
-            public void run() {
-                DOM.setElementProperty(loadElement, "className",
-                        "v-loading-indicator-delay");
-            }
-        };
-        // Second one kicks in at 1500ms from request start
-        loadTimer2.schedule(1200);
-
-        loadTimer3 = new Timer() {
-            @Override
-            public void run() {
-                DOM.setElementProperty(loadElement, "className",
-                        "v-loading-indicator-wait");
-            }
-        };
-        // Third one kicks in at 5000ms from request start
-        loadTimer3.schedule(4700);
-    }
-
-    private void hideLoadingIndicator() {
-        if (loadTimer != null) {
-            loadTimer.cancel();
-            loadTimer = null;
-        }
-        if (loadTimer2 != null) {
-            loadTimer2.cancel();
-            loadTimer3.cancel();
-            loadTimer2 = null;
-            loadTimer3 = null;
-        }
-        if (loadElement != null) {
-            DOM.setStyleAttribute(loadElement, "display", "none");
-        }
-    }
-
     /**
      * Checks if deferred commands are (potentially) still being executed as a
      * result of an update from the server. Returns true if a deferred command
@@ -1251,20 +1184,25 @@ public class ApplicationConnection {
         }
     }
 
+    /**
+     * Returns the loading indicator used by this ApplicationConnection
+     * 
+     * @return The loading indicator for this ApplicationConnection
+     */
+    public VLoadingIndicator getLoadingIndicator() {
+        return loadingIndicator;
+    }
+
     /**
      * Determines whether or not the loading indicator is showing.
      * 
      * @return true if the loading indicator is visible
+     * @deprecated As of 7.1. Use {@link #getLoadingIndicator()} and
+     *             {@link VLoadingIndicator#isVisible()}.isVisible() instead.
      */
+    @Deprecated
     public boolean isLoadingIndicatorVisible() {
-        if (loadElement == null) {
-            return false;
-        }
-        if (loadElement.getStyle().getProperty("display").equals("none")) {
-            return false;
-        }
-
-        return true;
+        return getLoadingIndicator().isVisible();
     }
 
     private static native ValueMap parseJSONResponse(String jsonText)
diff --git a/client/src/com/vaadin/client/VLoadingIndicator.java b/client/src/com/vaadin/client/VLoadingIndicator.java
new file mode 100644
index 0000000000..ca29d6a042
--- /dev/null
+++ b/client/src/com/vaadin/client/VLoadingIndicator.java
@@ -0,0 +1,218 @@
+package com.vaadin.client;
+
+import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Timer;
+
+/**
+ * Class representing the loading indicator for Vaadin applications. The loading
+ * indicator has four states: "triggered", "initial", "delay" and "wait". When
+ * {@link #trigger()} is called the indicator moves to its "triggered" state and
+ * then transitions from one state to the next when the timeouts specified using
+ * the set*StateDelay methods occur.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public class VLoadingIndicator {
+
+    private static final String PRIMARY_STYLE_NAME = "v-loading-indicator";
+
+    private ApplicationConnection connection;
+
+    private int initialStateDelay = 300;
+    private int delayStateDelay = 1500;
+    private int waitStateDelay = 5000;
+
+    private Timer initialTimer = new Timer() {
+        @Override
+        public void run() {
+            show();
+        }
+    };
+    private Timer delayStateTimer = new Timer() {
+        @Override
+        public void run() {
+            getElement().setClassName(PRIMARY_STYLE_NAME + "-delay");
+        }
+    };
+    private Timer waitStateTimer = new Timer() {
+        @Override
+        public void run() {
+            getElement().setClassName(PRIMARY_STYLE_NAME + "-wait");
+        }
+    };
+
+    private Element element;
+
+    /**
+     * Returns the delay (in ms) which must pass before the loading indicator
+     * moves into the "initial" state and is shown to the user
+     * 
+     * @return The delay (in ms) until moving into the "initial" state. Counted
+     *         from when {@link #trigger()} is called.
+     */
+    public int getInitialStateDelay() {
+        return initialStateDelay;
+    }
+
+    /**
+     * Sets the delay (in ms) which must pass before the loading indicator moves
+     * into the "initial" state and is shown to the user
+     * 
+     * @param initialStateDelay
+     *            The delay (in ms) until moving into the "initial" state.
+     *            Counted from when {@link #trigger()} is called.
+     */
+    public void setInitialStateDelay(int initialStateDelay) {
+        this.initialStateDelay = initialStateDelay;
+    }
+
+    /**
+     * Returns the delay (in ms) which must pass before the loading indicator
+     * moves to its "delay" state.
+     * 
+     * @return The delay (in ms) until the loading indicator moves into its
+     *         "delay" state. Counted from when {@link #trigger()} is called.
+     */
+    public int getDelayStateDelay() {
+        return delayStateDelay;
+    }
+
+    /**
+     * Sets the delay (in ms) which must pass before the loading indicator moves
+     * to its "delay" state.
+     * 
+     * @param delayStateDelay
+     *            The delay (in ms) until the loading indicator moves into its
+     *            "delay" state. Counted from when {@link #trigger()} is called.
+     */
+    public void setDelayStateDelay(int delayStateDelay) {
+        this.delayStateDelay = delayStateDelay;
+    }
+
+    /**
+     * Returns the delay (in ms) which must pass before the loading indicator
+     * moves to its "wait" state.
+     * 
+     * @return The delay (in ms) until the loading indicator moves into its
+     *         "wait" state. Counted from when {@link #trigger()} is called.
+     */
+    public int getWaitStateDelay() {
+        return waitStateDelay;
+    }
+
+    /**
+     * Sets the delay (in ms) which must pass before the loading indicator moves
+     * to its "wait" state.
+     * 
+     * @param loadingIndicatorThirdDelay
+     *            The delay (in ms) from the event until changing the loading
+     *            indicator into its "wait" state. Counted from when
+     *            {@link #trigger()} is called.
+     */
+    public void setWaitStateDelay(int loadingIndicatorThirdDelay) {
+        waitStateDelay = loadingIndicatorThirdDelay;
+    }
+
+    /**
+     * Triggers displaying of this loading indicator. The loading indicator will
+     * actually be shown by {@link #show()} when the initial delay (as specified
+     * by {@link #getInitialStateDelay()}) has passed.
+     * <p>
+     * The loading indicator will be hidden if shown when calling this method.
+     * </p>
+     */
+    public void trigger() {
+        hide();
+        initialTimer.schedule(getInitialStateDelay());
+    }
+
+    /**
+     * Shows the loading indicator in its standard state and triggers timers for
+     * transitioning into the "delay" and "wait" states.
+     */
+    public void show() {
+        // Reset possible style name and display mode
+        getElement().setClassName(PRIMARY_STYLE_NAME);
+        getElement().getStyle().setDisplay(Display.BLOCK);
+
+        // Schedule the "delay" loading indicator
+        int delayStateTimerDelay = getDelayStateDelay()
+                - getInitialStateDelay();
+        if (delayStateTimerDelay >= 0) {
+            delayStateTimer.schedule(delayStateTimerDelay);
+        }
+
+        // Schedule the "wait" loading indicator
+        int waitStateTimerDelay = getWaitStateDelay() - getInitialStateDelay();
+        if (waitStateTimerDelay >= 0) {
+            waitStateTimer.schedule(waitStateTimerDelay);
+        }
+    }
+
+    /**
+     * Returns the {@link ApplicationConnection} which uses this loading
+     * indicator
+     * 
+     * @return The ApplicationConnection for this loading indicator
+     */
+    public ApplicationConnection getConnection() {
+        return connection;
+    }
+
+    /**
+     * Sets the {@link ApplicationConnection} which uses this loading indicator.
+     * Only used internally.
+     * 
+     * @param connection
+     *            The ApplicationConnection for this loading indicator
+     */
+    void setConnection(ApplicationConnection connection) {
+        this.connection = connection;
+    }
+
+    /**
+     * Hides the loading indicator (if visible). Cancels any possibly running
+     * timers.
+     */
+    public void hide() {
+        initialTimer.cancel();
+        delayStateTimer.cancel();
+        waitStateTimer.cancel();
+
+        getElement().getStyle().setDisplay(Display.NONE);
+    }
+
+    /**
+     * Returns whether or not the loading indicator is showing.
+     * 
+     * @return true if the loading indicator is visible, false otherwise
+     */
+    public boolean isVisible() {
+        if (getElement().getStyle().getDisplay()
+                .equals(Display.NONE.getCssName())) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns the root element of the loading indicator
+     * 
+     * @return The loading indicator DOM element
+     */
+    public Element getElement() {
+        if (element == null) {
+            element = DOM.createDiv();
+            element.getStyle().setPosition(Position.ABSOLUTE);
+            getConnection().getUIConnector().getWidget().getElement()
+                    .appendChild(element);
+        }
+        return element;
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index b8b7786d21..f4524882fa 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -615,5 +615,15 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
             getConnection().getVTooltip().setMaxWidth(
                     getState().tooltipConfiguration.maxWidth);
         }
+
+        if (stateChangeEvent
+                .hasPropertyChanged("loadingIndicatorConfiguration")) {
+            getConnection().getLoadingIndicator().setInitialStateDelay(
+                    getState().loadingIndicatorConfiguration.initialDelay);
+            getConnection().getLoadingIndicator().setWaitStateDelay(
+                    getState().loadingIndicatorConfiguration.waitStateDelay);
+            getConnection().getLoadingIndicator().setDelayStateDelay(
+                    getState().loadingIndicatorConfiguration.delayStateDelay);
+        }
     }
 }
diff --git a/server/src/com/vaadin/ui/LoadingIndicator.java b/server/src/com/vaadin/ui/LoadingIndicator.java
new file mode 100644
index 0000000000..5740ee772d
--- /dev/null
+++ b/server/src/com/vaadin/ui/LoadingIndicator.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.ui.UIState.LoadingIndicatorConfiguration;
+
+/**
+ * Provides method for configuring the loading indicator.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public interface LoadingIndicator extends Serializable {
+    /**
+     * Sets the delay before the loading indicator is shown. The default is
+     * 300ms.
+     * 
+     * @param initialDelay
+     *            The initial delay (in ms)
+     */
+    public void setInitialDelay(int initialDelay);
+
+    /**
+     * Returns the delay before the loading indicator is shown.
+     * 
+     * @return The initial delay (in ms)
+     */
+    public int getInitialDelay();
+
+    /**
+     * Sets the delay before the loading indicator goes into the "delay" state.
+     * The delay is calculated from the time when the loading indicator was
+     * triggered. The default is 1500ms.
+     * 
+     * @param delayStateDelay
+     *            The delay before going into the "delay" state (in ms)
+     */
+    public void setDelayStateDelay(int delayStateDelay);
+
+    /**
+     * Returns the delay before the loading indicator goes into the "delay"
+     * state. The delay is calculated from the time when the loading indicator
+     * was triggered.
+     * 
+     * @return The delay before going into the "delay" state (in ms)
+     */
+    public int getDelayStateDelay();
+
+    /**
+     * Sets the delay before the loading indicator goes into the "wait" state.
+     * The delay is calculated from the time when the loading indicator was
+     * triggered. The default is 5000ms.
+     * 
+     * @param waitStateDelay
+     *            The delay before going into the "wait" state (in ms)
+     */
+    public void setWaitStateDelay(int waitStateDelay);
+
+    /**
+     * Returns the delay before the loading indicator goes into the "wait"
+     * state. The delay is calculated from the time when the loading indicator
+     * was triggered.
+     * 
+     * @return The delay before going into the "wait" state (in ms)
+     */
+    public int getWaitStateDelay();
+}
+
+class LoadingIndicatorImpl implements LoadingIndicator {
+    private UI ui;
+
+    public LoadingIndicatorImpl(UI ui) {
+        this.ui = ui;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setInitialDelay(int)
+     */
+    @Override
+    public void setInitialDelay(int initialDelay) {
+        getState().initialDelay = initialDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getInitialDelay()
+     */
+    @Override
+    public int getInitialDelay() {
+        return getState(false).initialDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setDelayStateDelay(int)
+     */
+    @Override
+    public void setDelayStateDelay(int delayStateDelay) {
+        getState().delayStateDelay = delayStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getDelayStateDelay()
+     */
+    @Override
+    public int getDelayStateDelay() {
+        return getState(false).delayStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setWaitStateDelay(int)
+     */
+    @Override
+    public void setWaitStateDelay(int waitStateDelay) {
+        getState().waitStateDelay = waitStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getWaitStateDelay()
+     */
+    @Override
+    public int getWaitStateDelay() {
+        return getState(false).waitStateDelay;
+    }
+
+    private LoadingIndicatorConfiguration getState() {
+        return ui.getState().loadingIndicatorConfiguration;
+    }
+
+    private LoadingIndicatorConfiguration getState(boolean markAsDirty) {
+        return ui.getState(markAsDirty).loadingIndicatorConfiguration;
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index e9499da7f3..a20c2b2087 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -116,6 +116,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private Page page = new Page(this);
 
+    private LoadingIndicator loadingIndicator = new LoadingIndicatorImpl(this);
+
     /**
      * Scroll Y position.
      */
@@ -1106,4 +1108,14 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     public Tooltip getTooltip() {
         return tooltip;
     }
+
+    /**
+     * Retrieves the object used for configuring the loading indicator.
+     * 
+     * @return The instance used for configuring the loading indicator
+     */
+    public LoadingIndicator getLoadingIndicator() {
+        return loadingIndicator;
+    }
+
 }
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index cc6897dd0d..d5ee4c30e6 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -21,6 +21,13 @@ import com.vaadin.shared.ui.TabIndexState;
 
 public class UIState extends TabIndexState {
     public TooltipConfiguration tooltipConfiguration = new TooltipConfiguration();
+    public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration();
+
+    public static class LoadingIndicatorConfiguration implements Serializable {
+        public int initialDelay = 300;
+        public int delayStateDelay = 1500;
+        public int waitStateDelay = 5000;
+    }
 
     public static class TooltipConfiguration implements Serializable {
         public int openDelay = 750;
diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
new file mode 100644
index 0000000000..0f15ff2fe0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
@@ -0,0 +1,99 @@
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.TextField;
+
+public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
+
+    private TextField initialDelay;
+    private TextField delayStateDelay;
+    private TextField waitStateDelay;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        final TextField delayField = new TextField("Delay (ms)");
+        delayField.setConverter(Integer.class);
+        delayField.setConvertedValue(1000);
+
+        NativeButton delayButton = new NativeButton("Wait");
+        delayButton.addClickListener(new ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                try {
+                    Thread.sleep((Integer) delayField.getConvertedValue());
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        initialDelay = createIntegerTextField("Initial delay (ms)",
+                getState().loadingIndicatorConfiguration.initialDelay);
+        initialDelay.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getLoadingIndicator().setInitialDelay(
+                        (Integer) initialDelay.getConvertedValue());
+            }
+        });
+        delayStateDelay = createIntegerTextField("Delay state delay (ms)",
+                getState().loadingIndicatorConfiguration.delayStateDelay);
+        delayStateDelay
+                .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        getLoadingIndicator().setDelayStateDelay(
+                                (Integer) delayStateDelay.getConvertedValue());
+                    }
+                });
+        waitStateDelay = createIntegerTextField("Wait state delay (ms)",
+                getState().loadingIndicatorConfiguration.waitStateDelay);
+        waitStateDelay
+                .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        getLoadingIndicator().setWaitStateDelay(
+                                (Integer) waitStateDelay.getConvertedValue());
+                    }
+                });
+
+        getLayout()
+                .addComponents(initialDelay, delayStateDelay, waitStateDelay);
+
+        HorizontalLayout hl = new HorizontalLayout();
+        hl.setMargin(true);
+        hl.setDefaultComponentAlignment(Alignment.BOTTOM_RIGHT);
+        hl.addComponents(delayField, delayButton);
+        addComponent(hl);
+
+    }
+
+    private TextField createIntegerTextField(String caption, int initialValue) {
+        TextField tf = new TextField(caption);
+        tf.setId(caption);
+        tf.setConverter(Integer.class);
+        tf.setImmediate(true);
+        tf.setConvertedValue(initialValue);
+        return tf;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests that loading indicator delay can be configured";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 7448;
+    }
+
+}
-- 
cgit v1.2.3


From bde44c29bdec4647dbec94b1ed2482baaf00cddf Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Wed, 27 Mar 2013 09:57:40 +0200
Subject: Implemented changes to CSS injection based on API review #5500

Change-Id: I2bed5f5a5c3cfc6b97e94cbd218bb06f446c7325
---
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  64 ++-----------
 server/src/com/vaadin/server/Page.java             | 104 ++++++++++-----------
 .../v71beta/CSSInjectWithColorpicker.java          |  18 ++--
 .../src/com/vaadin/tests/themes/CSSInjectTest.java |  10 +-
 4 files changed, 71 insertions(+), 125 deletions(-)

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index f4524882fa..69296b537c 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -17,7 +17,6 @@ package com.vaadin.client.ui.ui;
 
 import java.util.ArrayList;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 
 import com.google.gwt.core.client.Scheduler;
@@ -26,7 +25,6 @@ import com.google.gwt.dom.client.Document;
 import com.google.gwt.dom.client.HeadElement;
 import com.google.gwt.dom.client.LinkElement;
 import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.NodeList;
 import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.Position;
 import com.google.gwt.dom.client.StyleInjector;
@@ -62,7 +60,7 @@ import com.vaadin.client.ui.VNotification;
 import com.vaadin.client.ui.VUI;
 import com.vaadin.client.ui.layout.MayScrollChildren;
 import com.vaadin.client.ui.window.WindowConnector;
-import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.Page.Styles;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.ComponentStateUtil;
 import com.vaadin.shared.ui.Connect;
@@ -340,7 +338,7 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
     }
 
     /**
-     * Reads CSS strings and resources injected by {@link StyleSheet#inject}
+     * Reads CSS strings and resources injected by {@link Styles#inject}
      * from the UIDL stream.
      * 
      * @param uidl
@@ -354,8 +352,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
         /*
          * Search the UIDL stream for CSS resources and strings to be injected.
          */
-        final List<String> resourcesToInject = new LinkedList<String>();
-        final StringBuilder cssToInject = new StringBuilder();
         for (Iterator<?> it = uidl.getChildIterator(); it.hasNext();) {
             UIDL cssInjectionsUidl = (UIDL) it.next();
 
@@ -364,62 +360,22 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
                 String url = getWidget().connection
                         .translateVaadinUri(cssInjectionsUidl
                                 .getStringAttribute("url"));
-
-                // Check if url already has been injected
-                boolean injected = false;
-                NodeList<com.google.gwt.dom.client.Element> links = head
-                        .getElementsByTagName(LinkElement.TAG);
-                for (int i = 0; i < links.getLength(); i++) {
-                    LinkElement link = LinkElement.as(links.getItem(i));
-                    if (link.getHref().equals(url)) {
-                        injected = true;
-                        break;
-                    }
-                }
-
-                if (!injected) {
-                    // Ensure duplicates do not get injected
-                    resourcesToInject.add(url);
-                }
+                LinkElement link = LinkElement.as(DOM
+                        .createElement(LinkElement.TAG));
+                link.setRel("stylesheet");
+                link.setHref(url);
+                link.setType("text/css");
+                head.appendChild(link);
 
                 // Check if we have CSS string to inject
             } else if (cssInjectionsUidl.getTag().equals("css-string")) {
                 for (Iterator<?> it2 = cssInjectionsUidl.getChildIterator(); it2
                         .hasNext();) {
-                    cssToInject.append((String) it2.next());
+                    StyleInjector.injectAtEnd((String) it2.next());
+                    StyleInjector.flush();
                 }
             }
         }
-
-        /*
-         * Inject resources as deferred to ensure other Vaadin resources that
-         * are located before in the DOM get applied first so the injected ones
-         * can override them.
-         */
-        if (!resourcesToInject.isEmpty()) {
-            Scheduler.get().scheduleDeferred(new ScheduledCommand() {
-
-                @Override
-                public void execute() {
-                    for (String url : resourcesToInject) {
-                        LinkElement link = LinkElement.as(DOM
-                                .createElement(LinkElement.TAG));
-                        link.setRel("stylesheet");
-                        link.setHref(url);
-                        link.setType("text/css");
-                        head.appendChild(link);
-                    }
-                }
-            });
-        }
-
-        /*
-         * Inject the string CSS injections as a combined style tag. Not
-         * injected as deferred since StyleInjector will do it for us.
-         */
-        if (cssToInject.length() > 0) {
-            StyleInjector.injectAtEnd(cssToInject.toString());
-        }
     }
 
     public void init(String rootPanelId,
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index e84271e883..a7e0f7dcb3 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -21,9 +21,11 @@ import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.EventObject;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 import com.vaadin.event.EventRouter;
 import com.vaadin.shared.ui.BorderStyle;
@@ -309,25 +311,22 @@ public class Page implements Serializable {
      * 
      * @since 7.1
      */
-    public static class StyleSheet implements Serializable {
+    public static class Styles implements Serializable {
 
-        /*
-         * Points to last injected string injection
-         */
-        private int injectedStringPointer;
+        private final Map<Integer, String> stringInjections = new HashMap<Integer, String>();
 
-        private final List<String> stringInjections = new LinkedList<String>();
+        private final Map<Integer, Resource> resourceInjections = new HashMap<Integer, Resource>();
 
-        /*
-         * Points to last injected resource injection
-         */
-        private int injectedResourcesPointer;
+        // The combined injection counter between both string and resource
+        // injections. Used as the key for the injection maps
+        private int injectionCounter = 0;
 
-        private final List<Resource> resourceInjections = new LinkedList<Resource>();
+        // Points to the next injection that has not yet been made into the Page
+        private int nextInjectionPosition = 0;
 
         private final UI ui;
 
-        private StyleSheet(UI ui) {
+        private Styles(UI ui) {
             this.ui = ui;
         }
 
@@ -337,24 +336,13 @@ public class Page implements Serializable {
          * @param css
          *            The CSS to inject
          */
-        public void inject(String css) {
+        public void add(String css) {
             if (css == null) {
                 throw new IllegalArgumentException(
                         "Cannot inject null CSS string");
             }
 
-            /*
-             * Check if last injection was the same, in that case ignore it.
-             */
-            if (!stringInjections.isEmpty() && injectedStringPointer > 0) {
-                String lastInjection = stringInjections
-                        .get(injectedStringPointer - 1);
-                if (lastInjection.equals(css.trim())) {
-                    return;
-                }
-            }
-
-            stringInjections.add(css.trim());
+            stringInjections.put(injectionCounter++, css);
             ui.markAsDirty();
         }
 
@@ -364,13 +352,13 @@ public class Page implements Serializable {
          * @param resource
          *            The resource to inject.
          */
-        public void inject(Resource resource) {
+        public void add(Resource resource) {
             if (resource == null) {
                 throw new IllegalArgumentException(
                         "Cannot inject null resource");
             }
 
-            resourceInjections.add(resource);
+            resourceInjections.put(injectionCounter++, resource);
             ui.markAsDirty();
         }
 
@@ -378,37 +366,38 @@ public class Page implements Serializable {
 
             // If full repaint repaint all injections
             if (target.isFullRepaint()) {
-                injectedStringPointer = 0;
-                injectedResourcesPointer = 0;
+                nextInjectionPosition = 0;
             }
 
-            target.startTag("css-injections");
+            if (injectionCounter > nextInjectionPosition) {
 
-            // Paint pending string injections
-            List<String> injections = stringInjections.subList(
-                    injectedStringPointer, stringInjections.size());
+                target.startTag("css-injections");
 
-            for (String css : injections) {
-                target.startTag("css-string");
-                target.addText(css);
-                target.endTag("css-string");
-            }
+                while (injectionCounter > nextInjectionPosition) {
 
-            injectedStringPointer = stringInjections.size();
+                    String stringInjection = stringInjections
+                            .get(nextInjectionPosition);
+                    if (stringInjection != null) {
+                        target.startTag("css-string");
+                        target.addAttribute("id", nextInjectionPosition);
+                        target.addText(stringInjection);
+                        target.endTag("css-string");
+                    }
 
-            // Paint pending resource injections
-            List<Resource> resInjections = resourceInjections.subList(
-                    injectedResourcesPointer, resourceInjections.size());
+                    Resource resourceInjection = resourceInjections
+                            .get(nextInjectionPosition);
+                    if (resourceInjection != null) {
+                        target.startTag("css-resource");
+                        target.addAttribute("id", nextInjectionPosition);
+                        target.addAttribute("url", resourceInjection);
+                        target.endTag("css-resource");
+                    }
 
-            for (Resource res : resInjections) {
-                target.startTag("css-resource");
-                target.addAttribute("url", res);
-                target.endTag("css-resource");
-            }
-
-            target.endTag("css-injections");
+                    nextInjectionPosition++;
+                }
 
-            injectedResourcesPointer = resourceInjections.size();
+                target.endTag("css-injections");
+            }
         }
     }
 
@@ -421,7 +410,7 @@ public class Page implements Serializable {
 
     private JavaScript javaScript;
 
-    private StyleSheet styleSheet;
+    private Styles styles;
 
     /**
      * The current browser location.
@@ -696,11 +685,12 @@ public class Page implements Serializable {
      * 
      * @since 7.1
      */
-    public StyleSheet getStyleSheet() {
-        if (styleSheet == null) {
-            styleSheet = new StyleSheet(uI);
+    public Styles getStyles() {
+
+        if (styles == null) {
+            styles = new Styles(uI);
         }
-        return styleSheet;
+        return styles;
     }
 
     public void paintContent(PaintTarget target) throws PaintException {
@@ -760,8 +750,8 @@ public class Page implements Serializable {
                     location.toString());
         }
 
-        if (styleSheet != null) {
-            styleSheet.paint(target);
+        if (styles != null) {
+            styles.paint(target);
         }
     }
 
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
index 09c5f91293..e3b8f997e0 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
@@ -5,7 +5,7 @@ import java.util.Arrays;
 import com.vaadin.data.Property.ValueChangeEvent;
 import com.vaadin.data.Property.ValueChangeListener;
 import com.vaadin.server.Page;
-import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.Page.Styles;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.ui.MarginInfo;
 import com.vaadin.shared.ui.colorpicker.Color;
@@ -125,10 +125,10 @@ public class CSSInjectWithColorpicker extends UI {
                 Color color = event.getColor();
 
                 // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
+                Styles styles = Page.getCurrent().getStyles();
 
                 // inject the new background color
-                styles.inject(".v-app .v-textarea.text-label { background-color:"
+                styles.add(".v-app .v-textarea.text-label { background-color:"
                         + color.getCSS() + "; }");
             }
         });
@@ -153,10 +153,10 @@ public class CSSInjectWithColorpicker extends UI {
                 Color color = event.getColor();
 
                 // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
+                Styles styles = Page.getCurrent().getStyles();
 
                 // inject the new color as a style
-                styles.inject(".v-app .v-textarea.text-label { color:"
+                styles.add(".v-app .v-textarea.text-label { color:"
                         + color.getCSS() + "; }");
             }
         });
@@ -186,11 +186,11 @@ public class CSSInjectWithColorpicker extends UI {
                 String fontFamily = select.getValue().toString();
 
                 // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
+                Styles styles = Page.getCurrent().getStyles();
 
                 // inject the new font size as a style. We need .v-app to
                 // override Vaadin's default styles here
-                styles.inject(".v-app .v-textarea.text-label { font-family:"
+                styles.add(".v-app .v-textarea.text-label { font-family:"
                         + fontFamily + "; }");
             }
         });
@@ -220,11 +220,11 @@ public class CSSInjectWithColorpicker extends UI {
                 Integer fontSize = (Integer) select.getValue();
 
                 // Get the stylesheet of the page
-                StyleSheet styles = Page.getCurrent().getStyleSheet();
+                Styles styles = Page.getCurrent().getStyles();
 
                 // inject the new font size as a style. We need .v-app to
                 // override Vaadin's default styles here
-                styles.inject(".v-app .v-textarea.text-label { font-size:"
+                styles.add(".v-app .v-textarea.text-label { font-size:"
                         + String.valueOf(fontSize) + "px; }");
             }
         });
diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
index bedbf47fe2..f4448bf326 100644
--- a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
+++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
@@ -5,7 +5,7 @@ import java.io.InputStream;
 import java.util.UUID;
 
 import com.vaadin.server.Page;
-import com.vaadin.server.Page.StyleSheet;
+import com.vaadin.server.Page.Styles;
 import com.vaadin.server.StreamResource;
 import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.TestBase;
@@ -19,10 +19,10 @@ public class CSSInjectTest extends TestBase {
     @Override
     protected void setup() {
 
-        final StyleSheet stylesheet = Page.getCurrent().getStyleSheet();
+        final Styles stylesheet = Page.getCurrent().getStyles();
 
         // Inject some resources initially
-        stylesheet.inject(new StreamResource(new StreamResource.StreamSource() {
+        stylesheet.add(new StreamResource(new StreamResource.StreamSource() {
 
             @Override
             public InputStream getStream() {
@@ -44,7 +44,7 @@ public class CSSInjectTest extends TestBase {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                stylesheet.inject(cssToInject.getValue());
+                stylesheet.add(cssToInject.getValue());
                 cssToInject.setValue("");
             }
         });
@@ -58,7 +58,7 @@ public class CSSInjectTest extends TestBase {
 
                         final String css = cssToInject.getValue();
 
-                        stylesheet.inject(new StreamResource(
+                        stylesheet.add(new StreamResource(
                                 new StreamResource.StreamSource() {
 
                                     @Override
-- 
cgit v1.2.3


From 217ba18e53a8607a9e2480574ec1c3da11f4037f Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Wed, 27 Mar 2013 16:33:28 +0200
Subject: Integrate Calendar into core #11079

Everything else integrated, except TB3 tests (ticket #11090, old TB2 tests used instead)

Change-Id: If1700d7680a6c0a45f84d6e3c7b80e6536da78c8
---
 WebContent/VAADIN/themes/base/base.scss            |    2 +
 .../VAADIN/themes/base/calendar/calendar.scss      |  378 ++++
 .../VAADIN/themes/base/calendar/img/arrows.png     |  Bin 0 -> 248 bytes
 WebContent/VAADIN/themes/tests-calendar/styles.css |   96 ++
 client/src/com/vaadin/client/ui/VCalendar.java     | 1444 ++++++++++++++++
 .../client/ui/calendar/CalendarConnector.java      |  637 +++++++
 .../vaadin/client/ui/calendar/VCalendarAction.java |  138 ++
 .../client/ui/calendar/schedule/CalendarDay.java   |   55 +
 .../client/ui/calendar/schedule/CalendarEvent.java |  313 ++++
 .../client/ui/calendar/schedule/DateCell.java      |  808 +++++++++
 .../ui/calendar/schedule/DateCellContainer.java    |  114 ++
 .../ui/calendar/schedule/DateCellDayEvent.java     |  659 +++++++
 .../client/ui/calendar/schedule/DateCellGroup.java |   60 +
 .../client/ui/calendar/schedule/DateUtil.java      |   70 +
 .../client/ui/calendar/schedule/DayToolbar.java    |  179 ++
 .../calendar/schedule/FocusableComplexPanel.java   |  117 ++
 .../client/ui/calendar/schedule/FocusableGrid.java |  129 ++
 .../client/ui/calendar/schedule/FocusableHTML.java |  119 ++
 .../client/ui/calendar/schedule/HasTooltipKey.java |   33 +
 .../ui/calendar/schedule/MonthEventLabel.java      |  142 ++
 .../client/ui/calendar/schedule/MonthGrid.java     |  215 +++
 .../client/ui/calendar/schedule/SimpleDayCell.java |  696 ++++++++
 .../ui/calendar/schedule/SimpleDayToolbar.java     |   97 ++
 .../ui/calendar/schedule/SimpleWeekToolbar.java    |  108 ++
 .../client/ui/calendar/schedule/WeekGrid.java      |  677 ++++++++
 .../calendar/schedule/WeekGridMinuteTimeRange.java |   61 +
 .../client/ui/calendar/schedule/WeekLabel.java     |   51 +
 .../ui/calendar/schedule/WeeklyLongEvents.java     |  184 ++
 .../schedule/WeeklyLongEventsDateCell.java         |   67 +
 .../calendar/schedule/dd/CalendarDropHandler.java  |   64 +
 .../schedule/dd/CalendarMonthDropHandler.java      |  166 ++
 .../schedule/dd/CalendarWeekDropHandler.java       |  181 ++
 server/src/com/vaadin/ui/Calendar.java             | 1822 ++++++++++++++++++++
 .../calendar/CalendarComponentEvent.java           |   51 +
 .../calendar/CalendarComponentEvents.java          |  603 +++++++
 .../ui/components/calendar/CalendarDateRange.java  |   86 +
 .../components/calendar/CalendarTargetDetails.java |   80 +
 .../calendar/ContainerEventProvider.java           |  566 ++++++
 .../ui/components/calendar/event/BasicEvent.java   |  251 +++
 .../calendar/event/BasicEventProvider.java         |  173 ++
 .../event/CalendarEditableEventProvider.java       |   40 +
 .../components/calendar/event/CalendarEvent.java   |  146 ++
 .../calendar/event/CalendarEventProvider.java      |  112 ++
 .../calendar/event/EditableCalendarEvent.java      |   91 +
 .../calendar/handler/BasicBackwardHandler.java     |   78 +
 .../calendar/handler/BasicDateClickHandler.java    |   69 +
 .../calendar/handler/BasicEventMoveHandler.java    |   73 +
 .../calendar/handler/BasicEventResizeHandler.java  |   69 +
 .../calendar/handler/BasicForwardHandler.java      |   76 +
 .../calendar/handler/BasicWeekClickHandler.java    |   81 +
 .../server/component/calendar/CalendarBasics.java  |  210 +++
 .../component/calendar/ContainerDataSource.java    |  362 ++++
 .../shared/ui/calendar/CalendarClientRpc.java      |   28 +
 .../vaadin/shared/ui/calendar/CalendarEventId.java |   36 +
 .../shared/ui/calendar/CalendarServerRpc.java      |   49 +
 .../vaadin/shared/ui/calendar/CalendarState.java   |   69 +
 .../vaadin/shared/ui/calendar/DateConstants.java   |   33 +
 .../calendar/BeanItemContainerTestUI.java          |  181 ++
 .../components/calendar/CalendarActionsUI.java     |  107 ++
 .../tests/components/calendar/CalendarTest.java    | 1227 +++++++++++++
 .../components/calendar/CalendarTestEvent.java     |   48 +
 .../components/calendar/HiddenFwdBackButtons.java  |   61 +
 .../components/calendar/NotificationTestUI.java    |  101 ++
 .../vaadin/tests/components/calendar/actions.html  |   51 +
 .../tests/components/calendar/basicNavigation.html |  236 +++
 .../components/calendar/eventSizingNoOverlap.html  |  110 ++
 .../components/calendar/midnightEventsTest.html    |  116 ++
 .../components/calendar/monthlyViewNewEvent.html   |  170 ++
 .../components/calendar/monthlyViewNewEvents.html  |  410 +++++
 .../tests/components/calendar/notifications.html   |   41 +
 .../components/calendar/sizeTest1000x600px.html    |   41 +
 .../calendar/sizeTest100percentXundefined.html     |   41 +
 .../calendar/sizeTest100x100percent.html           |   41 +
 .../calendar/sizeTest300pxXundefined.html          |   41 +
 .../components/calendar/sizeTestSizeFull.html      |   41 +
 .../calendar/sizeTestUndefinedX100percent.html     |   41 +
 .../calendar/sizeTestUndefinedX300px.html          |   41 +
 .../calendar/sizeTestUndefinedXUndefined.html      |   41 +
 .../tests/components/calendar/visibleHours24H.html |   46 +
 .../components/calendar/weeklyViewNewEvents.html   |  657 +++++++
 80 files changed, 17204 insertions(+)
 create mode 100644 WebContent/VAADIN/themes/base/calendar/calendar.scss
 create mode 100644 WebContent/VAADIN/themes/base/calendar/img/arrows.png
 create mode 100644 WebContent/VAADIN/themes/tests-calendar/styles.css
 create mode 100644 client/src/com/vaadin/client/ui/VCalendar.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/VCalendarAction.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/CalendarDay.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DateUtil.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/HasTooltipKey.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayToolbar.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/WeekLabel.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEventsDateCell.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
 create mode 100644 client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
 create mode 100644 server/src/com/vaadin/ui/Calendar.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/CalendarComponentEvent.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/CalendarComponentEvents.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/CalendarDateRange.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/CalendarTargetDetails.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/CalendarEditableEventProvider.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/CalendarEvent.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/CalendarEventProvider.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/event/EditableCalendarEvent.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
 create mode 100644 server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
 create mode 100644 server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java
 create mode 100644 server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java
 create mode 100644 shared/src/com/vaadin/shared/ui/calendar/CalendarClientRpc.java
 create mode 100644 shared/src/com/vaadin/shared/ui/calendar/CalendarEventId.java
 create mode 100644 shared/src/com/vaadin/shared/ui/calendar/CalendarServerRpc.java
 create mode 100644 shared/src/com/vaadin/shared/ui/calendar/CalendarState.java
 create mode 100644 shared/src/com/vaadin/shared/ui/calendar/DateConstants.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/actions.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/notifications.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/base.scss b/WebContent/VAADIN/themes/base/base.scss
index 87754b6777..83e463fa00 100644
--- a/WebContent/VAADIN/themes/base/base.scss
+++ b/WebContent/VAADIN/themes/base/base.scss
@@ -4,6 +4,7 @@
 @import "button/nativebutton.scss";
 @import "button/checkbox.scss";
 @import "layout/layout.scss";
+@import "calendar/calendar.scss";
 @import "caption/caption.scss";
 @import "colorpicker/colorpicker.scss";
 @import "common/common.scss";
@@ -64,6 +65,7 @@ $line-height: normal;
 	@include base-checkbox;
 	@include base-caption;
 	@include base-colorpicker;
+	@include base-calendar;
 	
 	// here for now to preserve old semantics
 	@include base-common;
diff --git a/WebContent/VAADIN/themes/base/calendar/calendar.scss b/WebContent/VAADIN/themes/base/calendar/calendar.scss
new file mode 100644
index 0000000000..8ff97df0f9
--- /dev/null
+++ b/WebContent/VAADIN/themes/base/calendar/calendar.scss
@@ -0,0 +1,378 @@
+@mixin base-calendar($primaryStyleName : v-calendar) {
+
+/* Global resize style */
+.#{$primaryStyleName}-nresize DIV DIV {
+	cursor: n-resize !important;
+}
+
+.#{$primaryStyleName}-sresize DIV DIV {
+	cursor: s-resize !important;
+}
+
+/* Header bar */
+.#{$primaryStyleName} {
+	background-color: #fff;
+}
+
+.#{$primaryStyleName}-header-month,.#{$primaryStyleName}-header-week {
+	border-bottom: 1px solid #c1c1c1;
+}
+
+.#{$primaryStyleName}-header-day {
+	text-align: center;
+	color: #666;
+	font-size: 12px;
+	line-height: normal;
+}
+
+.#{$primaryStyleName}-header-week .#{$primaryStyleName}-header-day:hover {
+	cursor: pointer;
+	color: #222
+}
+
+.#{$primaryStyleName}-header-day-today {
+	font-weight: bold;
+	color: #444;
+}
+
+.#{$primaryStyleName}-header-month td:first-child {
+	padding-left: 19px;
+	/* Same as VCalendar.MONTHLY_WEEKTOOLBARWIDTH - .#{$primaryStyleName}-week-numbers border */
+}
+
+.#{$primaryStyleName}-header-week .#{$primaryStyleName}-back,.#{$primaryStyleName}-header-week .#{$primaryStyleName}-next
+	{
+	border: none;
+	padding: 0;
+	margin: 0;
+	height: 12px;
+	width: 12px;
+	overflow: hidden;
+	background: transparent url(img/arrows.png) no-repeat 50% 0;
+	opacity: .3;
+	filter: alpha(opacity = 30);
+	cursor: default;
+}
+
+.#{$primaryStyleName}-header-week .#{$primaryStyleName}-back:hover,.#{$primaryStyleName}-header-week .#{$primaryStyleName}-next:hover
+	{
+	opacity: .6;
+	filter: alpha(opacity = 60);
+}
+
+.#{$primaryStyleName}-header-week .#{$primaryStyleName}-back:active,.#{$primaryStyleName}-header-week .#{$primaryStyleName}-next:active
+	{
+	opacity: 1;
+	filter: alpha(opacity = 100);
+}
+
+.#{$primaryStyleName}-header-week .#{$primaryStyleName}-next {
+	background-position: 50% -12px;
+}
+
+/* Month grid */
+.#{$primaryStyleName}-month {
+	outline: none;
+}
+
+.#{$primaryStyleName}-week-numbers {
+	width: 20px;
+	border-right: 1px solid #ccc;
+}
+
+.#{$primaryStyleName}-week-number {
+	border: none;
+	background: transparent;
+	padding: 0;
+	margin: 0;
+	cursor: pointer;
+	opacity: .5;
+	width: 20px;
+	text-align: center;
+	border-bottom: 1px solid #ddd;
+}
+
+.#{$primaryStyleName}-week-number:hover {
+	opacity: 1;
+}
+
+.#{$primaryStyleName}-month-day {
+	border-bottom: 1px solid #ccc;
+	border-right: 1px solid #ccc;
+	outline: none;
+}
+
+.#{$primaryStyleName}-month-day-today {
+	background-color: #e7f0f5;
+}
+
+.#{$primaryStyleName}-month-day-selected {
+	background-color: #fffee7;
+}
+
+.#{$primaryStyleName}-month-day-dragemphasis {
+		background-color: #a8a8a8;
+}
+
+.#{$primaryStyleName}-month-day-scrollable {
+	overflow-y: scroll;
+}
+
+.#{$primaryStyleName}-day-number {
+	height: 18px;
+	line-height: 18px;
+	font-size: 12px;
+	text-align: right;
+	padding-right: 3px;
+	white-space: nowrap;
+}
+
+.#{$primaryStyleName}-day-number:hover {
+	cursor: pointer;
+	opacity: .6;
+	filter: alpha(opacity = 60);
+}
+
+.#{$primaryStyleName}-month .#{$primaryStyleName}-spacer,.#{$primaryStyleName}-month .#{$primaryStyleName}-bottom-spacer,.#{$primaryStyleName}-month .#{$primaryStyleName}-bottom-spacer-empty
+	{
+	/* Bottom spacer is used in GWT to measure the event height (offsetHeight) */
+	height: 15px;
+	font-size: 11px;
+}
+
+.#{$primaryStyleName}-month .#{$primaryStyleName}-bottom-spacer:hover {
+	cursor: pointer;
+	opacity: .6;
+	filter: alpha(opacity = 60);
+}
+
+.#{$primaryStyleName}-event {
+	line-height: 14px;
+	font-size: 11px;
+	padding: 0 0 0 4px;
+	cursor: pointer;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	
+	outline: none;
+}
+
+.#{$primaryStyleName}-event-month {
+	margin-bottom: 1px;
+	white-space: nowrap;
+}
+
+.#{$primaryStyleName}-event-month:hover {
+	text-decoration: underline;
+}
+
+.#{$primaryStyleName}-event-all-day {
+	background: #999;
+	display: block;
+	margin-left: -2px;
+}
+
+div.#{$primaryStyleName}-event-all-day {
+	color: #fff;
+	height: 14px;
+}
+
+.#{$primaryStyleName}-event-continued-from {
+	margin-left: 0;
+}
+
+.#{$primaryStyleName}-event-start {
+	-webkit-border-top-left-radius: 6px;
+	-webkit-border-bottom-left-radius: 6px;
+	-moz-border-radius-topleft: 6px;
+	-moz-border-radius-bottomleft: 6px;
+	border-top-left-radius: 6px;
+	border-bottom-left-radius: 6px;
+	margin-left: 0;
+}
+
+.#{$primaryStyleName}-event-end {
+	-webkit-border-top-right-radius: 6px;
+	-webkit-border-bottom-right-radius: 6px;
+	-moz-border-radius-topright: 6px;
+	-moz-border-radius-bottomright: 6px;
+	border-top-right-radius: 6px;
+	border-bottom-right-radius: 6px;
+}
+
+/* Week/day view */
+.#{$primaryStyleName}-week-wrapper {
+	position: relative;
+}
+
+/*.v-ie7 .#{$primaryStyleName}-week-wrapper TABLE{
+	table-layout: fixed;
+}*/
+.#{$primaryStyleName}-times {
+	width: 51px;
+}
+
+.#{$primaryStyleName}-time {
+	padding: 0 8px 7px 0;
+	margin-top: -7px;
+	text-align: right;
+	font-size: 11px;
+	color: #666;
+	border-right: 1px solid #ccc;
+}
+
+.#{$primaryStyleName}-weekly-longevents {
+	border-left: 1px solid #ccc;
+	border-bottom: 2px solid #bbb;
+	margin-left: 50px;
+}
+
+.#{$primaryStyleName}-weekly-longevents .#{$primaryStyleName}-datecell {
+	border-right: 1px solid #ccc;
+	padding: 1px 0 0;
+}
+
+.#{$primaryStyleName}-weekly-longevents .#{$primaryStyleName}-event {
+	height: 14px;
+	margin-bottom: 1px;
+}
+
+.#{$primaryStyleName}-weekly-longevents .#{$primaryStyleName}-event:hover {
+	text-decoration: underline;
+}
+
+.#{$primaryStyleName}-day-times {
+	border-right: 1px solid #ccc;
+	outline: none;
+}
+
+.#{$primaryStyleName}-day-times .v-datecellslot,.#{$primaryStyleName}-day-times .v-datecellslot-even {
+	border-bottom: 1px solid #ccc;
+}
+
+.#{$primaryStyleName}-day-times .v-datecellslot-even {
+	border-bottom-color: #eee;
+}
+
+.#{$primaryStyleName}-day-times .v-daterange {
+	background-color: #a8a8a8;
+}
+
+.#{$primaryStyleName}-day-times .v-reserved {
+	background-color: #FF3333;
+}
+
+.#{$primaryStyleName}-day-times .dragemphasis {
+	background-color: #a8a8a8;
+}
+
+.#{$primaryStyleName}-week-wrapper .#{$primaryStyleName}-event {
+	padding: 0;
+	-webkit-border-radius: 4px;
+	-moz-border-radius: 4px;
+	border-radius: 4px;
+	margin-top: -1px;
+}
+
+.#{$primaryStyleName}-event-caption {
+	position: absolute;
+	z-index: 1;
+	top: 2px;
+	left: 4px;
+	width: 100%;
+	overflow: hidden;
+	text-overflow: ellipsis;
+	line-height: normal;
+}
+
+.#{$primaryStyleName}-event-content {
+	-webkit-border-radius: 4px;
+	-moz-border-radius: 4px;
+	border-radius: 4px;
+	border: 1px solid #777;
+	background: #eee;
+	opacity: .8;
+	filter: alpha(opacity = 80);
+	height: 14px; /* "min-height" */
+}
+
+.#{$primaryStyleName}-current-time {
+	position: absolute;
+	left: 0;
+	width: 100%;
+	height: 1px;
+	overflow: hidden;
+	background: #5a6c86;
+	opacity: .6;
+	filter: alpha(opacity = 60);
+	z-index: 2;
+}
+
+.#{$primaryStyleName}-event-resizetop {
+	position: absolute;
+	cursor: n-resize;
+	height: 5%;
+	min-height: 3px;
+	top: 0;
+	width: 100%;
+	z-index: 1;
+}
+
+.#{$primaryStyleName}-event-resizebottom {
+	position: absolute;
+	cursor: s-resize;
+	height: 5%;
+	min-height: 3px;
+	bottom: 0;
+	width: 100%;
+	z-index: 1;
+}
+
+.#{$primaryStyleName}-month-sizedheight .#{$primaryStyleName}-month-day {
+	height: 100px;
+}
+
+.#{$primaryStyleName}-month-sizedwidth .#{$primaryStyleName}-month-day {
+	width: 100px;
+}
+
+.#{$primaryStyleName}-header-month-Hsized .#{$primaryStyleName}-header-day {
+	width: 101px;
+}
+
+/* for others */
+.#{$primaryStyleName}-header-month-Hsized td:first-child {
+	padding-left: 21px;
+}
+
+.#{$primaryStyleName}-header-day-Hsized {
+	width: 200px;
+}
+
+.#{$primaryStyleName}-week-numbers-Vsized .#{$primaryStyleName}-week-number {
+	height: 100px;
+	line-height: 100px;
+}
+
+.#{$primaryStyleName}-week-wrapper-Vsized {
+	height: 400px;
+	overflow-x: hidden !important;
+}
+
+.#{$primaryStyleName}-times-Vsized .#{$primaryStyleName}-time {
+	height: 38px;
+}
+
+.#{$primaryStyleName}-times-Hsized .#{$primaryStyleName}-time {
+	width: 42px;
+}
+
+.#{$primaryStyleName}-day-times-Vsized .v-datecellslot,.#{$primaryStyleName}-day-times-Vsized .v-datecellslot-even {
+	height: 18px;
+}
+
+.#{$primaryStyleName}-day-times-Hsized, .#{$primaryStyleName}-day-times-Hsized .v-datecellslot,.#{$primaryStyleName}-day-times-Hsized .v-datecellslot-even {
+	width: 200px;
+}
+
+}
\ No newline at end of file
diff --git a/WebContent/VAADIN/themes/base/calendar/img/arrows.png b/WebContent/VAADIN/themes/base/calendar/img/arrows.png
new file mode 100644
index 0000000000..9905c0b065
Binary files /dev/null and b/WebContent/VAADIN/themes/base/calendar/img/arrows.png differ
diff --git a/WebContent/VAADIN/themes/tests-calendar/styles.css b/WebContent/VAADIN/themes/tests-calendar/styles.css
new file mode 100644
index 0000000000..7a37fcfdaf
--- /dev/null
+++ b/WebContent/VAADIN/themes/tests-calendar/styles.css
@@ -0,0 +1,96 @@
+@import url(../reindeer/legacy-styles.css);
+
+.v-app {
+	background: #fff;
+	}
+
+
+/** Customized phase colors*/
+
+
+/**
+ * Green 
+ */
+
+/* For month view */
+.v-calendar .v-calendar-event-color1 {
+	color: #4f8324;
+	}
+.v-calendar .v-calendar-event-color1-all-day {
+	background-color: #61c114;
+	}
+
+/* For week/day view */
+.v-calendar .v-calendar-event-color1 .v-calendar-event-caption {
+	color: #4f8324;
+	}
+.v-calendar .v-calendar-event-color1 .v-calendar-event-content {
+	border-color: #61c114;
+	background-color: #daff70;
+	}
+
+
+/**
+ * Blue 
+ */
+
+/* For month view */
+.v-calendar .v-calendar-event-color2 {
+	color: #1c4b8b;
+	}
+.v-calendar .v-calendar-event-color2-all-day {
+	background-color: #0a56bc;
+	}
+
+/* For week/day view */
+.v-calendar .v-calendar-event-color2 .v-calendar-event-caption {
+	color: #1c4b8b;
+	}
+.v-calendar .v-calendar-event-color2 .v-calendar-event-content {
+	border-color: #0a56bc;
+	background-color: #529bff;
+	}
+
+
+/**
+ * Red 
+ */
+
+/* For month view */
+.v-calendar .v-calendar-event-color3 {
+	color: #831d1d;
+	}
+.v-calendar .v-calendar-event-color3-all-day {
+	background-color: #bd1a1a;
+	}
+
+/* For week/day view */
+.v-calendar .v-calendar-event-color3 .v-calendar-event-caption {
+	color: #831d1d;
+	}
+.v-calendar .v-calendar-event-color3 .v-calendar-event-content {
+	border-color: #bd1a1a;
+	background-color: #ff9d9d;
+	}
+
+
+/**
+ * Orange 
+ */
+
+/* For month view */
+.v-calendar .v-calendar-event-color4 {
+	color: #8b5923;
+	}
+.v-calendar .v-calendar-event-color4-all-day {
+	background-color: #cd6a00;
+	}
+
+/* For week/day view */
+.v-calendar .v-calendar-event-color4 .v-calendar-event-caption {
+	color: #8b5923;
+	}
+.v-calendar .v-calendar-event-color4 .v-calendar-event-content {
+	border-color: #cd6a00;
+	background-color: #faa345;
+	}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/VCalendar.java b/client/src/com/vaadin/client/ui/VCalendar.java
new file mode 100644
index 0000000000..e66a2d7552
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/VCalendar.java
@@ -0,0 +1,1444 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.event.dom.client.ContextMenuHandler;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.Composite;
+import com.google.gwt.user.client.ui.DockPanel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ui.calendar.schedule.CalendarDay;
+import com.vaadin.client.ui.calendar.schedule.CalendarEvent;
+import com.vaadin.client.ui.calendar.schedule.DayToolbar;
+import com.vaadin.client.ui.calendar.schedule.MonthGrid;
+import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
+import com.vaadin.client.ui.calendar.schedule.SimpleDayToolbar;
+import com.vaadin.client.ui.calendar.schedule.SimpleWeekToolbar;
+import com.vaadin.client.ui.calendar.schedule.WeekGrid;
+import com.vaadin.client.ui.calendar.schedule.WeeklyLongEvents;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * Client side implementation for Calendar
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class VCalendar extends Composite {
+
+    public static final String ATTR_FIRSTDAYOFWEEK = "firstDay";
+    public static final String ATTR_LASTDAYOFWEEK = "lastDay";
+    public static final String ATTR_FIRSTHOUROFDAY = "firstHour";
+    public static final String ATTR_LASTHOUROFDAY = "lastHour";
+
+    // private boolean hideWeekends;
+    private String[] monthNames;
+    private String[] dayNames;
+    private boolean format;
+    private final DockPanel outer = new DockPanel();
+    private int rows;
+
+    private boolean rangeSelectAllowed = true;
+    private boolean rangeMoveAllowed = true;
+    private boolean eventResizeAllowed = true;
+    private boolean eventMoveAllowed = true;
+
+    private final SimpleDayToolbar nameToolbar = new SimpleDayToolbar();
+
+    private final DayToolbar dayToolbar = new DayToolbar(this);
+    private final SimpleWeekToolbar weekToolbar;
+    private WeeklyLongEvents weeklyLongEvents;
+    private MonthGrid monthGrid;
+    private WeekGrid weekGrid;
+    private int intWidth = 0;
+    private int intHeight = 0;
+
+    protected final DateTimeFormat dateformat_datetime = DateTimeFormat
+            .getFormat("yyyy-MM-dd HH:mm:ss");
+    protected final DateTimeFormat dateformat_date = DateTimeFormat
+            .getFormat("yyyy-MM-dd");
+    protected final DateTimeFormat time12format_date = DateTimeFormat
+            .getFormat("h:mm a");
+    protected final DateTimeFormat time24format_date = DateTimeFormat
+            .getFormat("HH:mm");
+
+    private boolean readOnly = false;
+    private boolean disabled = false;
+
+    private boolean isHeightUndefined = false;
+
+    private boolean isWidthUndefined = false;
+    private int firstDay;
+    private int lastDay;
+    private int firstHour;
+    private int lastHour;
+
+    /**
+     * Listener interface for listening to event click events
+     */
+    public interface DateClickListener {
+        /**
+         * Triggered when a date was clicked
+         * 
+         * @param date
+         *            The date and time that was clicked
+         */
+        void dateClick(String date);
+    }
+
+    /**
+     * Listener interface for listening to week number click events
+     */
+    public interface WeekClickListener {
+        /**
+         * Called when a week number was selected.
+         * 
+         * @param event
+         *            The format of the vent string is "<year>w<week>"
+         */
+        void weekClick(String event);
+    }
+
+    /**
+     * Listener interface for listening to forward events
+     */
+    public interface ForwardListener {
+
+        /**
+         * Called when the calendar should move one view forward
+         */
+        void forward();
+    }
+
+    /**
+     * Listener interface for listening to backward events
+     */
+    public interface BackwardListener {
+
+        /**
+         * Called when the calendar should move one view backward
+         */
+        void backward();
+    }
+
+    /**
+     * Listener interface for listening to selection events
+     */
+    public interface RangeSelectListener {
+
+        /**
+         * Called when a user selected a new event by highlighting an area of
+         * the calendar.
+         * 
+         * FIXME Fix the value nonsense.
+         * 
+         * @param value
+         *            The format of the value string is
+         *            "<year>:<start-minutes>:<end-minutes>" if called from the
+         *            {@link SimpleWeekToolbar} and "<yyyy-MM-dd>TO<yyyy-MM-dd>"
+         *            if called from {@link MonthGrid}
+         */
+        void rangeSelected(String value);
+    }
+
+    /**
+     * Listener interface for listening to click events
+     */
+    public interface EventClickListener {
+        /**
+         * Called when an event was clicked
+         * 
+         * @param event
+         *            The event that was clicked
+         */
+        void eventClick(CalendarEvent event);
+    }
+
+    /**
+     * Listener interface for listening to event moved events. Occurs when a
+     * user drags an event to a new position
+     */
+    public interface EventMovedListener {
+        /**
+         * Triggered when an event was dragged to a new position and the start
+         * and end dates was changed
+         * 
+         * @param event
+         *            The event that was moved
+         */
+        void eventMoved(CalendarEvent event);
+    }
+
+    /**
+     * Listener interface for when an event gets resized (its start or end date
+     * changes)
+     */
+    public interface EventResizeListener {
+        /**
+         * Triggers when the time limits for the event was changed.
+         * 
+         * @param event
+         *            The event that was changed. The new time limits have been
+         *            updated in the event before calling this method
+         */
+        void eventResized(CalendarEvent event);
+    }
+
+    /**
+     * Listener interface for listening to scroll events.
+     */
+    public interface ScrollListener {
+        /**
+         * Triggered when the calendar is scrolled
+         * 
+         * @param scrollPosition
+         *            The scroll position in pixels as returned by
+         *            {@link ScrollPanel#getScrollPosition()}
+         */
+        void scroll(int scrollPosition);
+    }
+
+    /**
+     * Listener interface for listening to mouse events.
+     */
+    public interface MouseEventListener {
+        /**
+         * Triggered when a user wants an context menu
+         * 
+         * @param event
+         *            The context menu event
+         * 
+         * @param widget
+         *            The widget that the context menu should be added to
+         */
+        void contextMenu(ContextMenuEvent event, Widget widget);
+    }
+
+    /**
+     * Default constructor
+     */
+    public VCalendar() {
+        weekToolbar = new SimpleWeekToolbar(this);
+        initWidget(outer);
+        setStylePrimaryName("v-calendar");
+        blockSelect(getElement());
+    }
+
+    /**
+     * Hack for IE to not select text when dragging.
+     * 
+     * @param e
+     *            The element to apply the hack on
+     */
+    private native void blockSelect(Element e)
+    /*-{
+    	e.onselectstart = function() {
+    		return false;
+    	}
+
+    	e.ondragstart = function() {
+    		return false;
+    	}
+    }-*/;
+
+    private void updateEventsToWeekGrid(CalendarEvent[] events) {
+        List<CalendarEvent> allDayLong = new ArrayList<CalendarEvent>();
+        List<CalendarEvent> belowDayLong = new ArrayList<CalendarEvent>();
+
+        for (CalendarEvent e : events) {
+            if (e.isAllDay()) {
+                // Event is set on one "allDay" event or more than one.
+                allDayLong.add(e);
+
+            } else {
+                // Event is set only on one day.
+                belowDayLong.add(e);
+            }
+        }
+
+        weeklyLongEvents.addEvents(allDayLong);
+
+        for (CalendarEvent e : belowDayLong) {
+            weekGrid.addEvent(e);
+        }
+    }
+
+    /**
+     * Adds events to the month grid
+     * 
+     * @param events
+     *            The events to add
+     * @param drawImmediately
+     *            Should the grid be rendered immediately. (currently not in
+     *            use)
+     * 
+     */
+    public void updateEventsToMonthGrid(Collection<CalendarEvent> events,
+            boolean drawImmediately) {
+        for (CalendarEvent e : sortEventsByDuration(events)) {
+            // FIXME Why is drawImmediately not used ?????
+            addEventToMonthGrid(e, false);
+        }
+    }
+
+    private void addEventToMonthGrid(CalendarEvent e, boolean renderImmediately) {
+        Date when = e.getStart();
+        Date to = e.getEnd();
+        boolean eventAdded = false;
+        boolean inProgress = false; // Event adding has started
+        boolean eventMoving = false;
+        List<SimpleDayCell> dayCells = new ArrayList<SimpleDayCell>();
+        List<SimpleDayCell> timeCells = new ArrayList<SimpleDayCell>();
+        for (int row = 0; row < monthGrid.getRowCount(); row++) {
+            if (eventAdded) {
+                break;
+            }
+            for (int cell = 0; cell < monthGrid.getCellCount(row); cell++) {
+                SimpleDayCell sdc = (SimpleDayCell) monthGrid.getWidget(row,
+                        cell);
+                if (isEventInDay(when, to, sdc.getDate())
+                        && isEventInDayWithTime(when, to, sdc.getDate(),
+                                e.getEndTime(), e.isAllDay())) {
+                    if (!eventMoving) {
+                        eventMoving = sdc.getMoveEvent() != null;
+                    }
+                    long d = e.getRangeInMilliseconds();
+                    if ((d > 0 && d <= DateConstants.DAYINMILLIS)
+                            && !e.isAllDay()) {
+                        timeCells.add(sdc);
+                    } else {
+                        dayCells.add(sdc);
+                    }
+                    inProgress = true;
+                    continue;
+                } else if (inProgress) {
+                    eventAdded = true;
+                    inProgress = false;
+                    break;
+                }
+            }
+        }
+
+        updateEventSlotIndex(e, dayCells);
+        updateEventSlotIndex(e, timeCells);
+
+        for (SimpleDayCell sdc : dayCells) {
+            sdc.addCalendarEvent(e);
+        }
+        for (SimpleDayCell sdc : timeCells) {
+            sdc.addCalendarEvent(e);
+        }
+
+        if (renderImmediately) {
+            reDrawAllMonthEvents(!eventMoving);
+        }
+    }
+
+    /*
+     * We must also handle the special case when the event lasts exactly for 24
+     * hours, thus spanning two days e.g. from 1.1.2001 00:00 to 2.1.2001 00:00.
+     * That special case still should span one day when rendered.
+     */
+    @SuppressWarnings("deprecation")
+    // Date methods are not deprecated in GWT
+    private boolean isEventInDayWithTime(Date from, Date to, Date date,
+            Date endTime, boolean isAllDay) {
+        return (isAllDay || !(to.getDay() == date.getDay()
+                && from.getDay() != to.getDay() && isMidnight(endTime)));
+    }
+
+    private void updateEventSlotIndex(CalendarEvent e, List<SimpleDayCell> cells) {
+        if (cells.isEmpty()) {
+            return;
+        }
+
+        if (e.getSlotIndex() == -1) {
+            // Update slot index
+            int newSlot = -1;
+            for (SimpleDayCell sdc : cells) {
+                int slot = sdc.getEventCount();
+                if (slot > newSlot) {
+                    newSlot = slot;
+                }
+            }
+            newSlot++;
+
+            for (int i = 0; i < newSlot; i++) {
+                // check for empty slot
+                if (isSlotEmpty(e, i, cells)) {
+                    newSlot = i;
+                    break;
+                }
+            }
+            e.setSlotIndex(newSlot);
+        }
+    }
+
+    private void reDrawAllMonthEvents(boolean clearCells) {
+        for (int row = 0; row < monthGrid.getRowCount(); row++) {
+            for (int cell = 0; cell < monthGrid.getCellCount(row); cell++) {
+                SimpleDayCell sdc = (SimpleDayCell) monthGrid.getWidget(row,
+                        cell);
+                sdc.reDraw(clearCells);
+            }
+        }
+    }
+
+    private boolean isSlotEmpty(CalendarEvent addedEvent, int slotIndex,
+            List<SimpleDayCell> cells) {
+        for (SimpleDayCell sdc : cells) {
+            CalendarEvent e = sdc.getCalendarEvent(slotIndex);
+            if (e != null && !e.equals(addedEvent)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Remove a month event from the view
+     * 
+     * @param target
+     *            The event to remove
+     * 
+     * @param repaintImmediately
+     *            Should we repaint after the event was removed?
+     */
+    public void removeMonthEvent(CalendarEvent target,
+            boolean repaintImmediately) {
+        if (target != null && target.getSlotIndex() >= 0) {
+            // Remove event
+            for (int row = 0; row < monthGrid.getRowCount(); row++) {
+                for (int cell = 0; cell < monthGrid.getCellCount(row); cell++) {
+                    SimpleDayCell sdc = (SimpleDayCell) monthGrid.getWidget(
+                            row, cell);
+                    if (sdc == null) {
+                        return;
+                    }
+                    sdc.removeEvent(target, repaintImmediately);
+                }
+            }
+        }
+    }
+
+    /**
+     * Updates an event in the month grid
+     * 
+     * @param changedEvent
+     *            The event that has changed
+     */
+    public void updateEventToMonthGrid(CalendarEvent changedEvent) {
+        removeMonthEvent(changedEvent, true);
+        changedEvent.setSlotIndex(-1);
+        addEventToMonthGrid(changedEvent, true);
+    }
+
+    /**
+     * Sort the event by how long they are
+     * 
+     * @param events
+     *            The events to sort
+     * @return An array where the events has been sorted
+     */
+    public CalendarEvent[] sortEventsByDuration(Collection<CalendarEvent> events) {
+        CalendarEvent[] sorted = events
+                .toArray(new CalendarEvent[events.size()]);
+        Arrays.sort(sorted, getEventComparator());
+        return sorted;
+    }
+
+    /*
+     * Check if the given event occurs at the given date.
+     */
+    private boolean isEventInDay(Date eventWhen, Date eventTo, Date gridDate) {
+        if (eventWhen.compareTo(gridDate) <= 0
+                && eventTo.compareTo(gridDate) >= 0) {
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Re-render the week grid
+     * 
+     * @param daysCount
+     *            The amount of days to include in the week
+     * @param days
+     *            The days
+     * @param today
+     *            Todays date
+     * @param realDayNames
+     *            The names of the dates
+     */
+    @SuppressWarnings("deprecation")
+    public void updateWeekGrid(int daysCount, List<CalendarDay> days,
+            Date today, String[] realDayNames) {
+        weekGrid.setFirstHour(getFirstHourOfTheDay());
+        weekGrid.setLastHour(getLastHourOfTheDay());
+        weekGrid.getTimeBar().updateTimeBar(is24HFormat());
+
+        dayToolbar.clear();
+        dayToolbar.addBackButton();
+        dayToolbar.setVerticalSized(isHeightUndefined);
+        dayToolbar.setHorizontalSized(isWidthUndefined);
+        weekGrid.clearDates();
+        weekGrid.setDisabled(isDisabledOrReadOnly());
+
+        for (CalendarDay day : days) {
+            String date = day.getDate();
+            String localized_date_format = day.getLocalizedDateFormat();
+            Date d = dateformat_date.parse(date);
+            int dayOfWeek = day.getDayOfWeek();
+            if (dayOfWeek < getFirstDayNumber()
+                    || dayOfWeek > getLastDayNumber()) {
+                continue;
+            }
+            boolean isToday = false;
+            int dayOfMonth = d.getDate();
+            if (today.getDate() == dayOfMonth && today.getYear() == d.getYear()
+                    && today.getMonth() == d.getMonth()) {
+                isToday = true;
+            }
+            dayToolbar.add(realDayNames[dayOfWeek - 1], date,
+                    localized_date_format, isToday ? "today" : null);
+            weeklyLongEvents.addDate(d);
+            weekGrid.addDate(d);
+            if (isToday) {
+                weekGrid.setToday(d, today);
+            }
+        }
+        dayToolbar.addNextButton();
+    }
+
+    /**
+     * Updates the events in the Month view
+     * 
+     * @param daysCount
+     *            How many days there are
+     * @param daysUidl
+     * 
+     * @param today
+     *            Todays date
+     */
+    @SuppressWarnings("deprecation")
+    public void updateMonthGrid(int daysCount, List<CalendarDay> days,
+            Date today) {
+        int columns = getLastDayNumber() - getFirstDayNumber() + 1;
+        rows = (int) Math.ceil(daysCount / (double) 7);
+
+        monthGrid = new MonthGrid(this, rows, columns);
+        monthGrid.setEnabled(!isDisabledOrReadOnly());
+        weekToolbar.removeAllRows();
+        int pos = 0;
+        boolean monthNameDrawn = true;
+        boolean firstDayFound = false;
+        boolean lastDayFound = false;
+
+        for (CalendarDay day : days) {
+            String date = day.getDate();
+            Date d = dateformat_date.parse(date);
+            int dayOfWeek = day.getDayOfWeek();
+            int week = day.getWeek();
+
+            int dayOfMonth = d.getDate();
+
+            // reset at start of each month
+            if (dayOfMonth == 1) {
+                monthNameDrawn = false;
+                if (firstDayFound) {
+                    lastDayFound = true;
+                }
+                firstDayFound = true;
+            }
+
+            if (dayOfWeek < getFirstDayNumber()
+                    || dayOfWeek > getLastDayNumber()) {
+                continue;
+            }
+            int y = (pos / columns);
+            int x = pos - (y * columns);
+            if (x == 0 && daysCount > 7) {
+                // Add week to weekToolbar for navigation
+                weekToolbar.addWeek(week, d.getYear());
+            }
+            final SimpleDayCell cell = new SimpleDayCell(this, y, x);
+            cell.setMonthGrid(monthGrid);
+            cell.setDate(d);
+            cell.addDomHandler(new ContextMenuHandler() {
+                public void onContextMenu(ContextMenuEvent event) {
+                    if (mouseEventListener != null) {
+                        event.preventDefault();
+                        event.stopPropagation();
+                        mouseEventListener.contextMenu(event, cell);
+                    }
+                }
+            }, ContextMenuEvent.getType());
+
+            if (!firstDayFound) {
+                cell.addStyleDependentName("prev-month");
+            } else if (lastDayFound) {
+                cell.addStyleDependentName("next-month");
+            }
+
+            if (dayOfMonth >= 1 && !monthNameDrawn) {
+                cell.setMonthNameVisible(true);
+                monthNameDrawn = true;
+            }
+
+            if (today.getDate() == dayOfMonth && today.getYear() == d.getYear()
+                    && today.getMonth() == d.getMonth()) {
+                cell.setToday(true);
+
+            }
+            monthGrid.setWidget(y, x, cell);
+            pos++;
+        }
+    }
+
+    public void setSizeForChildren(int newWidth, int newHeight) {
+        intWidth = newWidth;
+        intHeight = newHeight;
+        isWidthUndefined = intWidth == -1;
+        dayToolbar.setVerticalSized(isHeightUndefined);
+        dayToolbar.setHorizontalSized(isWidthUndefined);
+        recalculateWidths();
+        recalculateHeights();
+    }
+
+    /**
+     * Recalculates the heights of the sub-components in the calendar
+     */
+    protected void recalculateHeights() {
+        if (monthGrid != null) {
+
+            if (intHeight == -1) {
+                monthGrid.addStyleDependentName("sizedheight");
+            } else {
+                monthGrid.removeStyleDependentName("sizedheight");
+            }
+
+            monthGrid.updateCellSizes(intWidth - weekToolbar.getOffsetWidth(),
+                    intHeight - nameToolbar.getOffsetHeight());
+            weekToolbar.setHeightPX((intHeight == -1) ? intHeight : intHeight
+                    - nameToolbar.getOffsetHeight());
+
+        } else if (weekGrid != null) {
+            weekGrid.setHeightPX((intHeight == -1) ? intHeight : intHeight
+                    - weeklyLongEvents.getOffsetHeight()
+                    - dayToolbar.getOffsetHeight());
+        }
+    }
+
+    /**
+     * Recalculates the widths of the sub-components in the calendar
+     */
+    protected void recalculateWidths() {
+        if (!isWidthUndefined) {
+            nameToolbar.setWidthPX(intWidth);
+            dayToolbar.setWidthPX(intWidth);
+
+            if (monthGrid != null) {
+                monthGrid.updateCellSizes(
+                        intWidth - weekToolbar.getOffsetWidth(), intHeight
+                                - nameToolbar.getOffsetHeight());
+            } else if (weekGrid != null) {
+                weekGrid.setWidthPX(intWidth);
+                weeklyLongEvents.setWidthPX(weekGrid.getInternalWidth());
+            }
+        } else {
+            dayToolbar.setWidthPX(intWidth);
+            nameToolbar.setWidthPX(intWidth);
+
+            if (monthGrid != null) {
+                if (intWidth == -1) {
+                    monthGrid.addStyleDependentName("sizedwidth");
+
+                } else {
+                    monthGrid.removeStyleDependentName("sizedwidth");
+                }
+            } else if (weekGrid != null) {
+                weekGrid.setWidthPX(intWidth);
+                weeklyLongEvents.setWidthPX(weekGrid.getInternalWidth());
+            }
+        }
+    }
+
+    /**
+     * Get the date format used to format dates only (excludes time)
+     * 
+     * @return
+     */
+    public DateTimeFormat getDateFormat() {
+        return dateformat_date;
+    }
+
+    /**
+     * Get the time format used to format time only (excludes date)
+     * 
+     * @return
+     */
+    public DateTimeFormat getTimeFormat() {
+        if (is24HFormat()) {
+            return time24format_date;
+        }
+        return time12format_date;
+    }
+
+    /**
+     * Get the date and time format to format the dates (includes both date and
+     * time)
+     * 
+     * @return
+     */
+    public DateTimeFormat getDateTimeFormat() {
+        return dateformat_datetime;
+    }
+
+    /**
+     * Is the calendar either disabled or readonly
+     * 
+     * @return
+     */
+    public boolean isDisabledOrReadOnly() {
+        return disabled || readOnly;
+    }
+
+    /**
+     * Is the component disabled
+     */
+    public boolean isDisabled() {
+        return disabled;
+    }
+
+    /**
+     * Is the component disabled
+     * 
+     * @param disabled
+     *            True if disabled
+     */
+    public void setDisabled(boolean disabled) {
+        this.disabled = disabled;
+    }
+
+    /**
+     * Is the component read-only
+     */
+    public boolean isReadOnly() {
+        return readOnly;
+    }
+
+    /**
+     * Is the component read-only
+     * 
+     * @param readOnly
+     *            True if component is readonly
+     */
+    public void setReadOnly(boolean readOnly) {
+        this.readOnly = readOnly;
+    }
+
+    /**
+     * Get the month grid component
+     * 
+     * @return
+     */
+    public MonthGrid getMonthGrid() {
+        return monthGrid;
+    }
+
+    /**
+     * Get he week grid component
+     * 
+     * @return
+     */
+    public WeekGrid getWeekGrid() {
+        return weekGrid;
+    }
+
+    /**
+     * Calculates correct size for all cells (size / amount of cells ) and
+     * distributes any overflow over all the cells.
+     * 
+     * @param totalSize
+     *            the total amount of size reserved for all cells
+     * @param numberOfCells
+     *            the number of cells
+     * @param sizeModifier
+     *            a modifier which is applied to all cells before distributing
+     *            the overflow
+     * @return an integer array that contains the correct size for each cell
+     */
+    public static int[] distributeSize(int totalSize, int numberOfCells,
+            int sizeModifier) {
+        int[] cellSizes = new int[numberOfCells];
+        int startingSize = totalSize / numberOfCells;
+        int cellSizeOverFlow = totalSize % numberOfCells;
+
+        for (int i = 0; i < numberOfCells; i++) {
+            cellSizes[i] = startingSize + sizeModifier;
+        }
+
+        // distribute size overflow amongst all slots
+        int j = 0;
+        while (cellSizeOverFlow > 0) {
+            cellSizes[j]++;
+            cellSizeOverFlow--;
+            j++;
+            if (j >= numberOfCells) {
+                j = 0;
+            }
+        }
+
+        // cellSizes[numberOfCells - 1] += cellSizeOverFlow;
+
+        return cellSizes;
+    }
+
+    /**
+     * Returns a comparator which can compare calendar events.
+     * 
+     * @return
+     */
+    public static Comparator<CalendarEvent> getEventComparator() {
+        return new Comparator<CalendarEvent>() {
+
+            public int compare(CalendarEvent o1, CalendarEvent o2) {
+                if (o1.isAllDay() != o2.isAllDay()) {
+                    if (o2.isAllDay()) {
+                        return 1;
+                    }
+                    return -1;
+                }
+
+                Long d1 = o1.getRangeInMilliseconds();
+                Long d2 = o2.getRangeInMilliseconds();
+                int r = 0;
+                if (!d1.equals(0L) && !d2.equals(0L)) {
+                    r = d2.compareTo(d1);
+                    return (r == 0) ? ((Integer) o2.getIndex()).compareTo(o1
+                            .getIndex()) : r;
+                }
+
+                if (d2.equals(0L) && d1.equals(0L)) {
+                    return ((Integer) o2.getIndex()).compareTo(o1.getIndex());
+                } else if (d2.equals(0L) && d1 >= DateConstants.DAYINMILLIS) {
+                    return -1;
+                } else if (d2.equals(0L) && d1 < DateConstants.DAYINMILLIS) {
+                    return 1;
+                } else if (d1.equals(0L) && d2 >= DateConstants.DAYINMILLIS) {
+                    return 1;
+                } else if (d1.equals(0L) && d2 < DateConstants.DAYINMILLIS) {
+                    return -1;
+                }
+                r = d2.compareTo(d1);
+                return (r == 0) ? ((Integer) o2.getIndex()).compareTo(o1
+                        .getIndex()) : r;
+            }
+        };
+    }
+
+    /**
+     * Is the date at midnight
+     * 
+     * @param date
+     *            The date to check
+     * 
+     * @return
+     */
+    @SuppressWarnings("deprecation")
+    public static boolean isMidnight(Date date) {
+        return (date.getHours() == 0 && date.getMinutes() == 0 && date
+                .getSeconds() == 0);
+    }
+
+    /**
+     * Are the dates equal (uses second resolution)
+     * 
+     * @param date1
+     *            The first the to compare
+     * @param date2
+     *            The second date to compare
+     * @return
+     */
+    @SuppressWarnings("deprecation")
+    public static boolean areDatesEqualToSecond(Date date1, Date date2) {
+        return date1.getYear() == date2.getYear()
+                && date1.getMonth() == date2.getMonth()
+                && date1.getDay() == date2.getDay()
+                && date1.getHours() == date2.getHours()
+                && date1.getSeconds() == date2.getSeconds();
+    }
+
+    /**
+     * Is the calendar event zero seconds long and is occurring at midnight
+     * 
+     * @param event
+     *            The event to check
+     * @return
+     */
+    public static boolean isZeroLengthMidnightEvent(CalendarEvent event) {
+        return areDatesEqualToSecond(event.getStartTime(), event.getEndTime())
+                && isMidnight(event.getEndTime());
+    }
+
+    /**
+     * Should the 24h time format be used
+     * 
+     * @param format
+     *            True if the 24h format should be used else the 12h format is
+     *            used
+     */
+    public void set24HFormat(boolean format) {
+        this.format = format;
+    }
+
+    /**
+     * Is the 24h time format used
+     */
+    public boolean is24HFormat() {
+        return format;
+    }
+
+    /**
+     * Set the names of the week days
+     * 
+     * @param names
+     *            The names of the days (Monday, Thursday,...)
+     */
+    public void setDayNames(String[] names) {
+        assert (names.length == 7);
+        dayNames = names;
+    }
+
+    /**
+     * Get the names of the week days
+     */
+    public String[] getDayNames() {
+        return dayNames;
+    }
+
+    /**
+     * Set the names of the months
+     * 
+     * @param names
+     *            The names of the months (January, February,...)
+     */
+    public void setMonthNames(String[] names) {
+        assert (names.length == 12);
+        monthNames = names;
+    }
+
+    /**
+     * Get the month names
+     */
+    public String[] getMonthNames() {
+        return monthNames;
+    }
+
+    /**
+     * Set the number when a week starts
+     * 
+     * @param dayNumber
+     *            The number of the day
+     */
+    public void setFirstDayNumber(int dayNumber) {
+        assert (dayNumber >= 1 && dayNumber <= 7);
+        firstDay = dayNumber;
+    }
+
+    /**
+     * Get the number when a week starts
+     */
+    public int getFirstDayNumber() {
+        return firstDay;
+    }
+
+    /**
+     * Set the number when a week ends
+     * 
+     * @param dayNumber
+     *            The number of the day
+     */
+    public void setLastDayNumber(int dayNumber) {
+        assert (dayNumber >= 1 && dayNumber <= 7);
+        lastDay = dayNumber;
+    }
+
+    /**
+     * Get the number when a week ends
+     */
+    public int getLastDayNumber() {
+        return lastDay;
+    }
+
+    /**
+     * Set the number when a week starts
+     * 
+     * @param dayNumber
+     *            The number of the day
+     */
+    public void setFirstHourOfTheDay(int hour) {
+        assert (hour >= 0 && hour <= 23);
+        firstHour = hour;
+    }
+
+    /**
+     * Get the number when a week starts
+     */
+    public int getFirstHourOfTheDay() {
+        return firstHour;
+    }
+
+    /**
+     * Set the number when a week ends
+     * 
+     * @param dayNumber
+     *            The number of the day
+     */
+    public void setLastHourOfTheDay(int hour) {
+        assert (hour >= 0 && hour <= 23);
+        lastHour = hour;
+    }
+
+    /**
+     * Get the number when a week ends
+     */
+    public int getLastHourOfTheDay() {
+        return lastHour;
+    }
+
+    /**
+     * Re-renders the whole week view
+     * 
+     * @param scroll
+     *            The amount of pixels to scroll the week view
+     * @param today
+     *            Todays date
+     * @param daysInMonth
+     *            How many days are there in the month
+     * @param firstDayOfWeek
+     *            The first day of the week
+     * @param events
+     *            The events to render
+     */
+    public void updateWeekView(int scroll, Date today, int daysInMonth,
+            int firstDayOfWeek, Collection<CalendarEvent> events,
+            List<CalendarDay> days) {
+
+        while (outer.getWidgetCount() > 0) {
+            outer.remove(0);
+        }
+
+        monthGrid = null;
+        String[] realDayNames = new String[getDayNames().length];
+        int j = 0;
+
+        if (firstDayOfWeek == 2) {
+            for (int i = 1; i < getDayNames().length; i++) {
+                realDayNames[j++] = getDayNames()[i];
+            }
+            realDayNames[j] = getDayNames()[0];
+        } else {
+            for (int i = 0; i < getDayNames().length; i++) {
+                realDayNames[j++] = getDayNames()[i];
+            }
+
+        }
+
+        weeklyLongEvents = new WeeklyLongEvents(this);
+        if (weekGrid == null) {
+            weekGrid = new WeekGrid(this, is24HFormat());
+        }
+        updateWeekGrid(daysInMonth, days, today, realDayNames);
+        updateEventsToWeekGrid(sortEventsByDuration(events));
+        outer.add(dayToolbar, DockPanel.NORTH);
+        outer.add(weeklyLongEvents, DockPanel.NORTH);
+        outer.add(weekGrid, DockPanel.SOUTH);
+        weekGrid.setVerticalScrollPosition(scroll);
+    }
+
+    /**
+     * Re-renders the whole month view
+     * 
+     * @param firstDayOfWeek
+     *            The first day of the week
+     * @param today
+     *            Todays date
+     * @param daysInMonth
+     *            Amount of days in the month
+     * @param events
+     *            The events to render
+     * @param days
+     *            The day information
+     */
+    public void updateMonthView(int firstDayOfWeek, Date today,
+            int daysInMonth, Collection<CalendarEvent> events,
+            List<CalendarDay> days) {
+
+        // Remove all week numbers from bar
+        while (outer.getWidgetCount() > 0) {
+            outer.remove(0);
+        }
+
+        int firstDay = getFirstDayNumber();
+        int lastDay = getLastDayNumber();
+        int daysPerWeek = lastDay - firstDay + 1;
+        int j = 0;
+
+        String[] dayNames = getDayNames();
+        String[] realDayNames = new String[daysPerWeek];
+
+        if (firstDayOfWeek == 2) {
+            for (int i = firstDay; i < lastDay + 1; i++) {
+                if (i == 7) {
+                    realDayNames[j++] = dayNames[0];
+                } else {
+                    realDayNames[j++] = dayNames[i];
+                }
+            }
+        } else {
+            for (int i = firstDay - 1; i < lastDay; i++) {
+                realDayNames[j++] = dayNames[i];
+            }
+        }
+
+        nameToolbar.setDayNames(realDayNames);
+
+        weeklyLongEvents = null;
+        weekGrid = null;
+
+        updateMonthGrid(daysInMonth, days, today);
+
+        outer.add(nameToolbar, DockPanel.NORTH);
+        outer.add(weekToolbar, DockPanel.WEST);
+        weekToolbar.updateCellHeights();
+        outer.add(monthGrid, DockPanel.CENTER);
+
+        updateEventsToMonthGrid(events, false);
+    }
+
+    private DateClickListener dateClickListener;
+
+    /**
+     * Sets the listener for listening to event clicks
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(DateClickListener listener) {
+        dateClickListener = listener;
+    }
+
+    /**
+     * Gets the listener for listening to event clicks
+     * 
+     * @return
+     */
+    public DateClickListener getDateClickListener() {
+        return dateClickListener;
+    }
+
+    private ForwardListener forwardListener;
+
+    /**
+     * Set the listener which listens to forward events from the calendar
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(ForwardListener listener) {
+        forwardListener = listener;
+    }
+
+    /**
+     * Get the listener which listens to forward events from the calendar
+     * 
+     * @return
+     */
+    public ForwardListener getForwardListener() {
+        return forwardListener;
+    }
+
+    private BackwardListener backwardListener;
+
+    /**
+     * Set the listener which listens to backward events from the calendar
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(BackwardListener listener) {
+        backwardListener = listener;
+    }
+
+    /**
+     * Set the listener which listens to backward events from the calendar
+     * 
+     * @return
+     */
+    public BackwardListener getBackwardListener() {
+        return backwardListener;
+    }
+
+    private WeekClickListener weekClickListener;
+
+    /**
+     * Set the listener that listens to user clicking on the week numbers
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(WeekClickListener listener) {
+        weekClickListener = listener;
+    }
+
+    /**
+     * Get the listener that listens to user clicking on the week numbers
+     * 
+     * @return
+     */
+    public WeekClickListener getWeekClickListener() {
+        return weekClickListener;
+    }
+
+    private RangeSelectListener rangeSelectListener;
+
+    /**
+     * Set the listener that listens to the user highlighting a region in the
+     * calendar
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(RangeSelectListener listener) {
+        rangeSelectListener = listener;
+    }
+
+    /**
+     * Get the listener that listens to the user highlighting a region in the
+     * calendar
+     * 
+     * @return
+     */
+    public RangeSelectListener getRangeSelectListener() {
+        return rangeSelectListener;
+    }
+
+    private EventClickListener eventClickListener;
+
+    /**
+     * Get the listener that listens to the user clicking on the events
+     */
+    public EventClickListener getEventClickListener() {
+        return eventClickListener;
+    }
+
+    /**
+     * Set the listener that listens to the user clicking on the events
+     * 
+     * @param listener
+     *            The listener to use
+     */
+    public void setListener(EventClickListener listener) {
+        eventClickListener = listener;
+    }
+
+    private EventMovedListener eventMovedListener;
+
+    /**
+     * Get the listener that listens to when event is dragged to a new location
+     * 
+     * @return
+     */
+    public EventMovedListener getEventMovedListener() {
+        return eventMovedListener;
+    }
+
+    /**
+     * Set the listener that listens to when event is dragged to a new location
+     * 
+     * @param eventMovedListener
+     *            The listener to use
+     */
+    public void setListener(EventMovedListener eventMovedListener) {
+        this.eventMovedListener = eventMovedListener;
+    }
+
+    private ScrollListener scrollListener;
+
+    /**
+     * Get the listener that listens to when the calendar widget is scrolled
+     * 
+     * @return
+     */
+    public ScrollListener getScrollListener() {
+        return scrollListener;
+    }
+
+    /**
+     * Set the listener that listens to when the calendar widget is scrolled
+     * 
+     * @param scrollListener
+     *            The listener to use
+     */
+    public void setListener(ScrollListener scrollListener) {
+        this.scrollListener = scrollListener;
+    }
+
+    private EventResizeListener eventResizeListener;
+
+    /**
+     * Get the listener that listens to when an events time limits are being
+     * adjusted
+     * 
+     * @return
+     */
+    public EventResizeListener getEventResizeListener() {
+        return eventResizeListener;
+    }
+
+    /**
+     * Set the listener that listens to when an events time limits are being
+     * adjusted
+     * 
+     * @param eventResizeListener
+     *            The listener to use
+     */
+    public void setListener(EventResizeListener eventResizeListener) {
+        this.eventResizeListener = eventResizeListener;
+    }
+
+    private MouseEventListener mouseEventListener;
+    private boolean forwardNavigationEnabled = true;
+    private boolean backwardNavigationEnabled = true;
+
+    /**
+     * Get the listener that listen to mouse events
+     * 
+     * @return
+     */
+    public MouseEventListener getMouseEventListener() {
+        return mouseEventListener;
+    }
+
+    /**
+     * Set the listener that listen to mouse events
+     * 
+     * @param mouseEventListener
+     *            The listener to use
+     */
+    public void setListener(MouseEventListener mouseEventListener) {
+        this.mouseEventListener = mouseEventListener;
+    }
+
+    /**
+     * Is selecting a range allowed?
+     */
+    public boolean isRangeSelectAllowed() {
+        return rangeSelectAllowed;
+    }
+
+    /**
+     * Set selecting a range allowed
+     * 
+     * @param rangeSelectAllowed
+     *            Should selecting a range be allowed
+     */
+    public void setRangeSelectAllowed(boolean rangeSelectAllowed) {
+        this.rangeSelectAllowed = rangeSelectAllowed;
+    }
+
+    /**
+     * Is moving a range allowed
+     * 
+     * @return
+     */
+    public boolean isRangeMoveAllowed() {
+        return rangeMoveAllowed;
+    }
+
+    /**
+     * Is moving a range allowed
+     * 
+     * @param rangeMoveAllowed
+     *            Is it allowed
+     */
+    public void setRangeMoveAllowed(boolean rangeMoveAllowed) {
+        this.rangeMoveAllowed = rangeMoveAllowed;
+    }
+
+    /**
+     * Is resizing an event allowed
+     */
+    public boolean isEventResizeAllowed() {
+        return eventResizeAllowed;
+    }
+
+    /**
+     * Is resizing an event allowed
+     * 
+     * @param eventResizeAllowed
+     *            True if allowed false if not
+     */
+    public void setEventResizeAllowed(boolean eventResizeAllowed) {
+        this.eventResizeAllowed = eventResizeAllowed;
+    }
+
+    /**
+     * Is moving an event allowed
+     */
+    public boolean isEventMoveAllowed() {
+        return eventMoveAllowed;
+    }
+
+    /**
+     * Is moving an event allowed
+     * 
+     * @param eventMoveAllowed
+     *            True if moving is allowed, false if not
+     */
+    public void setEventMoveAllowed(boolean eventMoveAllowed) {
+        this.eventMoveAllowed = eventMoveAllowed;
+    }
+
+    public boolean isBackwardNavigationEnabled() {
+        return backwardNavigationEnabled;
+    }
+
+    public void setBackwardNavigationEnabled(boolean enabled) {
+        backwardNavigationEnabled = enabled;
+    }
+
+    public boolean isForwardNavigationEnabled() {
+        return forwardNavigationEnabled;
+    }
+
+    public void setForwardNavigationEnabled(boolean enabled) {
+        forwardNavigationEnabled = enabled;
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
new file mode 100644
index 0000000000..120a65d842
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
@@ -0,0 +1,637 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar;
+
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import com.google.gwt.core.shared.GWT;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.TooltipInfo;
+import com.vaadin.client.UIDL;
+import com.vaadin.client.Util;
+import com.vaadin.client.VConsole;
+import com.vaadin.client.communication.RpcProxy;
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.client.ui.Action;
+import com.vaadin.client.ui.ActionOwner;
+import com.vaadin.client.ui.SimpleManagedLayout;
+import com.vaadin.client.ui.VCalendar;
+import com.vaadin.client.ui.VCalendar.BackwardListener;
+import com.vaadin.client.ui.VCalendar.DateClickListener;
+import com.vaadin.client.ui.VCalendar.EventClickListener;
+import com.vaadin.client.ui.VCalendar.EventMovedListener;
+import com.vaadin.client.ui.VCalendar.EventResizeListener;
+import com.vaadin.client.ui.VCalendar.ForwardListener;
+import com.vaadin.client.ui.VCalendar.MouseEventListener;
+import com.vaadin.client.ui.VCalendar.RangeSelectListener;
+import com.vaadin.client.ui.VCalendar.WeekClickListener;
+import com.vaadin.client.ui.calendar.schedule.CalendarDay;
+import com.vaadin.client.ui.calendar.schedule.CalendarEvent;
+import com.vaadin.client.ui.calendar.schedule.DateCell;
+import com.vaadin.client.ui.calendar.schedule.DateCell.DateCellSlot;
+import com.vaadin.client.ui.calendar.schedule.DateUtil;
+import com.vaadin.client.ui.calendar.schedule.DateCellDayEvent;
+import com.vaadin.client.ui.calendar.schedule.HasTooltipKey;
+import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
+import com.vaadin.client.ui.calendar.schedule.dd.CalendarDropHandler;
+import com.vaadin.client.ui.dd.VHasDropHandler;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.ui.calendar.CalendarClientRpc;
+import com.vaadin.shared.ui.calendar.CalendarEventId;
+import com.vaadin.shared.ui.calendar.CalendarServerRpc;
+import com.vaadin.shared.ui.calendar.CalendarState;
+import com.vaadin.shared.ui.calendar.DateConstants;
+import com.vaadin.ui.Calendar;
+
+/**
+ * Handles communication between Calendar on the server side and
+ * {@link VCalendar} on the client side.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@Connect(value = Calendar.class, loadStyle = LoadStyle.LAZY)
+public class CalendarConnector extends AbstractComponentConnector implements
+        VHasDropHandler, ActionOwner, SimpleManagedLayout {
+
+    private CalendarServerRpc rpc = RpcProxy.create(CalendarServerRpc.class,
+            this);
+
+    private CalendarDropHandler dropHandler;
+
+    private final HashMap<String, String> actionMap = new HashMap<String, String>();
+    private HashMap<Object, String> tooltips = new HashMap<Object, String>();
+
+    /**
+     * 
+     */
+    public CalendarConnector() {
+
+        // Listen to events
+        registerListeners();
+    }
+
+    @Override
+    protected void init() {
+        super.init();
+        registerRpc(CalendarClientRpc.class, new CalendarClientRpc() {
+            @Override
+            public void scroll(int scrollPosition) {
+                // TODO widget scroll
+            }
+        });
+        getLayoutManager().registerDependency(this, getWidget().getElement());
+    }
+
+    @Override
+    public void onUnregister() {
+        super.onUnregister();
+        getLayoutManager().unregisterDependency(this, getWidget().getElement());
+    }
+
+    @Override
+    public VCalendar getWidget() {
+        return (VCalendar) super.getWidget();
+    }
+
+    @Override
+    public CalendarState getState() {
+        return (CalendarState) super.getState();
+    }
+
+    /**
+     * Registers listeners on the calendar so server can be notified of the
+     * events
+     */
+    protected void registerListeners() {
+        getWidget().setListener(new DateClickListener() {
+            public void dateClick(String date) {
+                if (!getWidget().isDisabledOrReadOnly()
+                        && hasEventListener(CalendarEventId.DATECLICK)) {
+                    rpc.dateClick(date);
+                }
+            }
+        });
+        getWidget().setListener(new ForwardListener() {
+            public void forward() {
+                if (hasEventListener(CalendarEventId.FORWARD)) {
+                    rpc.forward();
+                }
+            }
+        });
+        getWidget().setListener(new BackwardListener() {
+            public void backward() {
+                if (hasEventListener(CalendarEventId.BACKWARD)) {
+                    rpc.backward();
+                }
+            }
+        });
+        getWidget().setListener(new RangeSelectListener() {
+            public void rangeSelected(String value) {
+                if (hasEventListener(CalendarEventId.RANGESELECT)) {
+                    rpc.rangeSelect(value);
+                }
+            }
+        });
+        getWidget().setListener(new WeekClickListener() {
+            public void weekClick(String event) {
+                if (!getWidget().isDisabledOrReadOnly()
+                        && hasEventListener(CalendarEventId.WEEKCLICK)) {
+                    rpc.weekClick(event);
+                }
+            }
+        });
+        getWidget().setListener(new EventMovedListener() {
+            public void eventMoved(CalendarEvent event) {
+                if (hasEventListener(CalendarEventId.EVENTMOVE)) {
+                    StringBuilder sb = new StringBuilder();
+                    sb.append(DateUtil.formatClientSideDate(event.getStart()));
+                    sb.append("-");
+                    sb.append(DateUtil.formatClientSideTime(event
+                            .getStartTime()));
+                    rpc.eventMove(event.getIndex(), sb.toString());
+                }
+            }
+        });
+        getWidget().setListener(new EventResizeListener() {
+            public void eventResized(CalendarEvent event) {
+                if (hasEventListener(CalendarEventId.EVENTRESIZE)) {
+                    StringBuilder buffer = new StringBuilder();
+
+                    buffer.append(DateUtil.formatClientSideDate(event
+                            .getStart()));
+                    buffer.append("-");
+                    buffer.append(DateUtil.formatClientSideTime(event
+                            .getStartTime()));
+
+                    String newStartDate = buffer.toString();
+
+                    buffer = new StringBuilder();
+                    buffer.append(DateUtil.formatClientSideDate(event.getEnd()));
+                    buffer.append("-");
+                    buffer.append(DateUtil.formatClientSideTime(event
+                            .getEndTime()));
+
+                    String newEndDate = buffer.toString();
+
+                    rpc.eventResize(event.getIndex(), newStartDate, newEndDate);
+                }
+            }
+        });
+        getWidget().setListener(new VCalendar.ScrollListener() {
+            public void scroll(int scrollPosition) {
+                // This call is @Delayed (== non-immediate)
+                rpc.scroll(scrollPosition);
+            }
+        });
+        getWidget().setListener(new EventClickListener() {
+            public void eventClick(CalendarEvent event) {
+                if (hasEventListener(CalendarEventId.EVENTCLICK)) {
+                    rpc.eventClick(event.getIndex());
+                }
+            }
+        });
+        getWidget().setListener(new MouseEventListener() {
+            public void contextMenu(ContextMenuEvent event, final Widget widget) {
+                final NativeEvent ne = event.getNativeEvent();
+                int left = ne.getClientX();
+                int top = ne.getClientY();
+                top += Window.getScrollTop();
+                left += Window.getScrollLeft();
+                getClient().getContextMenu().showAt(new ActionOwner() {
+                    public String getPaintableId() {
+                        return CalendarConnector.this.getPaintableId();
+                    }
+
+                    public ApplicationConnection getClient() {
+                        return CalendarConnector.this.getClient();
+                    }
+
+                    @SuppressWarnings("deprecation")
+                    public Action[] getActions() {
+                        if (widget instanceof SimpleDayCell) {
+                            /*
+                             * Month view
+                             */
+                            SimpleDayCell cell = (SimpleDayCell) widget;
+                            Date start = new Date(cell.getDate().getYear(),
+                                    cell.getDate().getMonth(), cell.getDate()
+                                            .getDate(), 0, 0, 0);
+
+                            Date end = new Date(cell.getDate().getYear(), cell
+                                    .getDate().getMonth(), cell.getDate()
+                                    .getDate(), 23, 59, 59);
+
+                            return CalendarConnector.this.getActionsBetween(
+                                    start, end);
+                        } else if (widget instanceof DateCell) {
+                            /*
+                             * Week and Day view
+                             */
+                            DateCell cell = (DateCell) widget;
+                            int slotIndex = DOM.getChildIndex(
+                                    cell.getElement(), (Element) ne
+                                            .getEventTarget().cast());
+                            DateCellSlot slot = cell.getSlot(slotIndex);
+                            return CalendarConnector.this.getActionsBetween(
+                                    slot.getFrom(), slot.getTo());
+                        } else if (widget instanceof DateCellDayEvent) {
+                            /*
+                             * Context menu on event
+                             */
+                            DateCellDayEvent dayEvent = (DateCellDayEvent) widget;
+                            CalendarEvent event = dayEvent.getCalendarEvent();
+                            Action[] actions = CalendarConnector.this
+                                    .getActionsBetween(event.getStartTime(),
+                                            event.getEndTime());
+                            for (Action action : actions) {
+                                ((VCalendarAction) action).setEvent(event);
+                            }
+                            return actions;
+
+                        }
+                        return null;
+                    }
+                }, left, top);
+            }
+        });
+    }
+
+    @Override
+    public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        super.onStateChanged(stateChangeEvent);
+
+        CalendarState state = getState();
+        VCalendar widget = getWidget();
+        boolean monthView = state.days.size() > 7;
+
+        // Enable or disable the forward and backward navigation buttons
+        widget.setForwardNavigationEnabled(hasEventListener(CalendarEventId.FORWARD));
+        widget.setBackwardNavigationEnabled(hasEventListener(CalendarEventId.BACKWARD));
+
+        widget.set24HFormat(state.format24H);
+        widget.setDayNames(state.dayNames);
+        widget.setMonthNames(state.monthNames);
+        widget.setFirstDayNumber(state.firstVisibleDayOfWeek);
+        widget.setLastDayNumber(state.lastVisibleDayOfWeek);
+        widget.setFirstHourOfTheDay(state.firstHourOfDay);
+        widget.setLastHourOfTheDay(state.lastHourOfDay);
+        widget.setReadOnly(state.readOnly);
+        widget.setDisabled(!state.enabled);
+
+        widget.setRangeSelectAllowed(hasEventListener(CalendarEventId.RANGESELECT));
+        widget.setRangeMoveAllowed(hasEventListener(CalendarEventId.EVENTMOVE));
+        widget.setEventMoveAllowed(hasEventListener(CalendarEventId.EVENTMOVE));
+        widget.setEventResizeAllowed(hasEventListener(CalendarEventId.EVENTRESIZE));
+
+        List<CalendarState.Day> days = state.days;
+        List<CalendarState.Event> events = state.events;
+
+        if (monthView) {
+            updateMonthView(days, events);
+        } else {
+            updateWeekView(days, events);
+        }
+
+        updateSizes();
+
+        registerEventToolTips(state.events);
+        updateActionMap(state.actions);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal
+     * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection)
+     */
+    public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
+
+        // check for DD -related access criteria
+        // Iterator<Object> childIterator = uidl.getChildIterator();
+        // while (childIterator.hasNext()) {
+        // UIDL child = (UIDL) childIterator.next();
+        //
+        // // Drag&drop
+        // if (ACCESSCRITERIA.equals(child.getTag())) {
+        // if (monthView
+        // && !(getDropHandler() instanceof CalendarMonthDropHandler)) {
+        // setDropHandler(new CalendarMonthDropHandler());
+        //
+        // } else if (!monthView
+        // && !(getDropHandler() instanceof CalendarWeekDropHandler)) {
+        // setDropHandler(new CalendarWeekDropHandler());
+        // }
+        //
+        // getDropHandler().setCalendarPaintable(this);
+        // getDropHandler().updateAcceptRules(child);
+        //
+        // } else {
+        // setDropHandler(null);
+        // }
+        //
+        // }
+    }
+
+    /**
+     * Returns the ApplicationConnection used to connect to the server side
+     */
+    @Override
+    public ApplicationConnection getClient() {
+        return getConnection();
+    }
+
+    /**
+     * Register the description of the events as tooltips. This way, any event
+     * displaying widget can use the event index as a key to display the
+     * tooltip.
+     */
+    private void registerEventToolTips(List<CalendarState.Event> events) {
+        for (CalendarState.Event e : events) {
+            if (e.description != null && !"".equals(e.description)) {
+                tooltips.put(e.index, e.description);
+            } else {
+                tooltips.remove(e.index);
+            }
+        }
+    }
+
+    @Override
+    public TooltipInfo getTooltipInfo(com.google.gwt.dom.client.Element element) {
+        TooltipInfo tooltipInfo = null;
+        Widget w = Util.findWidget((Element) element, null);
+        if (w instanceof HasTooltipKey) {
+            tooltipInfo = GWT.create(TooltipInfo.class);
+            String title = tooltips.get(((HasTooltipKey) w).getTooltipKey());
+            tooltipInfo.setTitle(title != null ? title : "");
+        }
+        if (tooltipInfo == null) {
+            tooltipInfo = super.getTooltipInfo(element);
+        }
+        return tooltipInfo;
+    }
+
+    private void updateMonthView(List<CalendarState.Day> days,
+            List<CalendarState.Event> events) {
+        CalendarState state = getState();
+        getWidget().updateMonthView(state.firstDayOfWeek,
+                getWidget().getDateTimeFormat().parse(state.now), days.size(),
+                calendarEventListOf(events, state.format24H),
+                calendarDayListOf(days));
+    }
+
+    private void updateWeekView(List<CalendarState.Day> days,
+            List<CalendarState.Event> events) {
+        CalendarState state = getState();
+        getWidget().updateWeekView(state.scroll,
+                getWidget().getDateTimeFormat().parse(state.now), days.size(),
+                state.firstDayOfWeek,
+                calendarEventListOf(events, state.format24H),
+                calendarDayListOf(days));
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler#getDropHandler()
+     */
+    public CalendarDropHandler getDropHandler() {
+        return dropHandler;
+    }
+
+    /**
+     * Set the drop handler
+     * 
+     * @param dropHandler
+     *            The drophandler to use
+     */
+    public void setDropHandler(CalendarDropHandler dropHandler) {
+        this.dropHandler = dropHandler;
+    }
+
+    private Action[] getActionsBetween(Date start, Date end) {
+        List<Action> actions = new ArrayList<Action>();
+        for (int i = 0; i < actionKeys.size(); i++) {
+            final String actionKey = actionKeys.get(i);
+            Date actionStartDate;
+            Date actionEndDate;
+            try {
+                actionStartDate = getActionStartDate(actionKey);
+                actionEndDate = getActionEndDate(actionKey);
+            } catch (ParseException pe) {
+                VConsole.error("Failed to parse action date");
+                continue;
+            }
+
+            boolean startIsValid = start.compareTo(actionStartDate) >= 0;
+            boolean endIsValid = end.compareTo(actionEndDate) <= 0;
+            if (startIsValid && endIsValid) {
+                VCalendarAction a = new VCalendarAction(this, rpc, actionKey);
+                a.setCaption(getActionCaption(actionKey));
+                a.setIconUrl(getActionIcon(actionKey));
+                a.setActionStartDate(start);
+                a.setActionEndDate(end);
+                actions.add(a);
+            }
+        }
+
+        return actions.toArray(new Action[actions.size()]);
+    }
+
+    private List<String> actionKeys = new ArrayList<String>();
+
+    private void updateActionMap(List<CalendarState.Action> actions) {
+        actionMap.clear();
+        actionKeys.clear();
+
+        if (actions == null) {
+            return;
+        }
+
+        for (CalendarState.Action action : actions) {
+            String id = action.actionKey + "-" + action.startDate + "-"
+                    + action.endDate;
+            actionMap.put(id + "_c", action.caption);
+            actionMap.put(id + "_s", action.startDate);
+            actionMap.put(id + "_e", action.endDate);
+            actionKeys.add(id);
+            if (action.iconKey != null) {
+                actionMap.put(id + "_i", getResourceUrl(action.iconKey));
+
+            } else {
+                actionMap.remove(id + "_i");
+            }
+        }
+    }
+
+    /**
+     * Get the text that is displayed for a context menu item
+     * 
+     * @param actionKey
+     *            The unique action key
+     * @return
+     */
+    public String getActionCaption(String actionKey) {
+        return actionMap.get(actionKey + "_c");
+    }
+
+    /**
+     * Get the icon url for a context menu item
+     * 
+     * @param actionKey
+     *            The unique action key
+     * @return
+     */
+    public String getActionIcon(String actionKey) {
+        return actionMap.get(actionKey + "_i");
+    }
+
+    /**
+     * Get the start date for an action item
+     * 
+     * @param actionKey
+     *            The unique action key
+     * @return
+     * @throws ParseException
+     */
+    public Date getActionStartDate(String actionKey) throws ParseException {
+        String dateStr = actionMap.get(actionKey + "_s");
+        DateTimeFormat formatter = DateTimeFormat
+                .getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);
+        return formatter.parse(dateStr);
+    }
+
+    /**
+     * Get the end date for an action item
+     * 
+     * @param actionKey
+     *            The unique action key
+     * @return
+     * @throws ParseException
+     */
+    public Date getActionEndDate(String actionKey) throws ParseException {
+        String dateStr = actionMap.get(actionKey + "_e");
+        DateTimeFormat formatter = DateTimeFormat
+                .getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);
+        return formatter.parse(dateStr);
+    }
+
+    /**
+     * Returns ALL currently registered events. Use {@link #getActions(Date)} to
+     * get the actions for a specific date
+     */
+    public Action[] getActions() {
+        List<Action> actions = new ArrayList<Action>();
+        for (int i = 0; i < actionKeys.size(); i++) {
+            final String actionKey = actionKeys.get(i);
+            final VCalendarAction a = new VCalendarAction(this, rpc, actionKey);
+            a.setCaption(getActionCaption(actionKey));
+            a.setIconUrl(getActionIcon(actionKey));
+
+            try {
+                a.setActionStartDate(getActionStartDate(actionKey));
+                a.setActionEndDate(getActionEndDate(actionKey));
+            } catch (ParseException pe) {
+                VConsole.error(pe);
+            }
+
+            actions.add(a);
+        }
+        return actions.toArray(new Action[actions.size()]);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.terminal.gwt.client.ui.ActionOwner#getPaintableId()
+     */
+    public String getPaintableId() {
+        return getConnectorId();
+    }
+
+    private List<CalendarEvent> calendarEventListOf(
+            List<CalendarState.Event> events, boolean format24h) {
+        List<CalendarEvent> list = new ArrayList<CalendarEvent>(events.size());
+        for (CalendarState.Event event : events) {
+            final String dateFrom = event.dateFrom;
+            final String dateTo = event.dateTo;
+            final String timeFrom = event.timeFrom;
+            final String timeTo = event.timeTo;
+            CalendarEvent calendarEvent = new CalendarEvent();
+            calendarEvent.setAllDay(event.allDay);
+            calendarEvent.setCaption(event.caption);
+            calendarEvent.setDescription(event.description);
+            calendarEvent.setStart(getWidget().getDateFormat().parse(dateFrom));
+            calendarEvent.setEnd(getWidget().getDateFormat().parse(dateTo));
+            calendarEvent.setFormat24h(format24h);
+            calendarEvent.setStartTime(getWidget().getDateTimeFormat().parse(
+                    dateFrom + " " + timeFrom));
+            calendarEvent.setEndTime(getWidget().getDateTimeFormat().parse(
+                    dateTo + " " + timeTo));
+            calendarEvent.setStyleName(event.styleName);
+            calendarEvent.setIndex(event.index);
+            list.add(calendarEvent);
+        }
+        return list;
+    }
+
+    private List<CalendarDay> calendarDayListOf(List<CalendarState.Day> days) {
+        List<CalendarDay> list = new ArrayList<CalendarDay>(days.size());
+        for (CalendarState.Day day : days) {
+            CalendarDay d = new CalendarDay(day.date, day.localizedDateFormat,
+                    day.dayOfWeek, day.week);
+
+            list.add(d);
+        }
+        return list;
+    }
+
+    @Override
+    public void layout() {
+        updateSizes();
+    }
+
+    private void updateSizes() {
+        int height = getLayoutManager()
+                .getOuterHeight(getWidget().getElement());
+        int width = getLayoutManager().getOuterWidth(getWidget().getElement());
+
+        if (isUndefinedWidth()) {
+            width = -1;
+        }
+        if (isUndefinedHeight()) {
+            height = -1;
+        }
+
+        getWidget().setSizeForChildren(width, height);
+
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/VCalendarAction.java b/client/src/com/vaadin/client/ui/calendar/VCalendarAction.java
new file mode 100644
index 0000000000..2a529354e5
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/VCalendarAction.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar;
+
+import java.util.Date;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.vaadin.client.ui.Action;
+import com.vaadin.client.ui.calendar.schedule.CalendarEvent;
+import com.vaadin.shared.ui.calendar.CalendarServerRpc;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * Action performed by the calendar
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class VCalendarAction extends Action {
+
+    private CalendarServerRpc rpc;
+
+    private String actionKey = "";
+
+    private Date actionStartDate;
+
+    private Date actionEndDate;
+
+    private CalendarEvent event;
+
+    private final DateTimeFormat dateformat_datetime = DateTimeFormat
+            .getFormat(DateConstants.ACTION_DATE_FORMAT_PATTERN);
+
+    /**
+     * 
+     * @param owner
+     */
+    public VCalendarAction(CalendarConnector owner) {
+        super(owner);
+    }
+
+    /**
+     * Constructor
+     * 
+     * @param owner
+     *            The owner who trigger this kinds of events
+     * @param rpc
+     *            The CalendarRpc which is used for executing actions
+     * @param key
+     *            The unique action key which identifies this particular action
+     */
+    public VCalendarAction(CalendarConnector owner, CalendarServerRpc rpc,
+            String key) {
+        this(owner);
+        this.rpc = rpc;
+        actionKey = key;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.terminal.gwt.client.ui.Action#execute()
+     */
+    @Override
+    public void execute() {
+        String startDate = dateformat_datetime.format(actionStartDate);
+        String endDate = dateformat_datetime.format(actionEndDate);
+
+        if (event == null) {
+            rpc.actionOnEmptyCell(actionKey.split("-")[0], startDate, endDate);
+        } else {
+            rpc.actionOnEvent(actionKey.split("-")[0], startDate, endDate,
+                    event.getIndex());
+        }
+
+        owner.getClient().getContextMenu().hide();
+    }
+
+    /**
+     * Get the date and time when the action starts
+     * 
+     * @return
+     */
+    public Date getActionStartDate() {
+        return actionStartDate;
+    }
+
+    /**
+     * Set the date when the actions start
+     * 
+     * @param actionStartDate
+     *            The date and time when the action starts
+     */
+    public void setActionStartDate(Date actionStartDate) {
+        this.actionStartDate = actionStartDate;
+    }
+
+    /**
+     * Get the date and time when the action ends
+     * 
+     * @return
+     */
+    public Date getActionEndDate() {
+        return actionEndDate;
+    }
+
+    /**
+     * Set the date and time when the action ends
+     * 
+     * @param actionEndDate
+     *            The date and time when the action ends
+     */
+    public void setActionEndDate(Date actionEndDate) {
+        this.actionEndDate = actionEndDate;
+    }
+
+    public CalendarEvent getEvent() {
+        return event;
+    }
+
+    public void setEvent(CalendarEvent event) {
+        this.event = event;
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/CalendarDay.java b/client/src/com/vaadin/client/ui/calendar/schedule/CalendarDay.java
new file mode 100644
index 0000000000..ca176c08c1
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/CalendarDay.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+/**
+ * Utility class used to represent a day when updating views. Only used
+ * internally.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class CalendarDay {
+    private String date;
+    private String localizedDateFormat;
+    private int dayOfWeek;
+    private int week;
+
+    public CalendarDay(String date, String localizedDateFormat, int dayOfWeek,
+            int week) {
+        super();
+        this.date = date;
+        this.localizedDateFormat = localizedDateFormat;
+        this.dayOfWeek = dayOfWeek;
+        this.week = week;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public String getLocalizedDateFormat() {
+        return localizedDateFormat;
+    }
+
+    public int getDayOfWeek() {
+        return dayOfWeek;
+    }
+
+    public int getWeek() {
+        return week;
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java b/client/src/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java
new file mode 100644
index 0000000000..e2c06d41ea
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/CalendarEvent.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * A client side implementation of a calendar event
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class CalendarEvent {
+    private int index;
+    private String caption;
+    private Date start, end;
+    private String styleName;
+    private Date startTime, endTime;
+    private String description;
+    private int slotIndex = -1;
+    private boolean format24h;
+
+    DateTimeFormat dateformat_date = DateTimeFormat.getFormat("h:mm a");
+    DateTimeFormat dateformat_date24 = DateTimeFormat.getFormat("H:mm");
+    private boolean allDay;
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStyleName()
+     */
+    public String getStyleName() {
+        return styleName;
+    }
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStart()
+     */
+    public Date getStart() {
+        return start;
+    }
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStyleName()
+     * @param style
+     */
+    public void setStyleName(String style) {
+        styleName = style;
+    }
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStart()
+     * @param start
+     */
+    public void setStart(Date start) {
+        this.start = start;
+    }
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getEnd()
+     * @return
+     */
+    public Date getEnd() {
+        return end;
+    }
+
+    /**
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getEnd()
+     * @param end
+     */
+    public void setEnd(Date end) {
+        this.end = end;
+    }
+
+    /**
+     * Returns the start time of the event
+     * 
+     * @return Time embedded in the {@link Date} object
+     */
+    public Date getStartTime() {
+        return startTime;
+    }
+
+    /**
+     * Set the start time of the event
+     * 
+     * @param startTime
+     *            The time of the event. Use the time fields in the {@link Date}
+     *            object
+     */
+    public void setStartTime(Date startTime) {
+        this.startTime = startTime;
+    }
+
+    /**
+     * Get the end time of the event
+     * 
+     * @return Time embedded in the {@link Date} object
+     */
+    public Date getEndTime() {
+        return endTime;
+    }
+
+    /**
+     * Set the end time of the event
+     * 
+     * @param endTime
+     *            Time embedded in the {@link Date} object
+     */
+    public void setEndTime(Date endTime) {
+        this.endTime = endTime;
+    }
+
+    /**
+     * Get the (server side) index of the event
+     * 
+     * @return
+     */
+    public int getIndex() {
+        return index;
+    }
+
+    /**
+     * Get the index of the slot where the event in rendered
+     * 
+     * @return
+     */
+    public int getSlotIndex() {
+        return slotIndex;
+    }
+
+    /**
+     * Set the index of the slot where the event in rendered
+     * 
+     * @param index
+     *            The index of the slot
+     */
+    public void setSlotIndex(int index) {
+        slotIndex = index;
+    }
+
+    /**
+     * Set the (server side) index of the event
+     * 
+     * @param index
+     *            The index
+     */
+    public void setIndex(int index) {
+        this.index = index;
+    }
+
+    /**
+     * Get the caption of the event. The caption is the text displayed in the
+     * calendar on the event.
+     * 
+     * @return
+     */
+    public String getCaption() {
+        return caption;
+    }
+
+    /**
+     * Set the caption of the event. The caption is the text displayed in the
+     * calendar on the event.
+     * 
+     * @param caption
+     *            The visible caption of the event
+     */
+    public void setCaption(String caption) {
+        this.caption = caption;
+    }
+
+    /**
+     * Get the description of the event. The description is the text displayed
+     * when hoovering over the event with the mouse
+     * 
+     * @return
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * Set the description of the event. The description is the text displayed
+     * when hoovering over the event with the mouse
+     * 
+     * @param description
+     */
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * Does the event use the 24h time format
+     * 
+     * @param format24h
+     *            True if it uses the 24h format, false if it uses the 12h time
+     *            format
+     */
+    public void setFormat24h(boolean format24h) {
+        this.format24h = format24h;
+    }
+
+    /**
+     * Is the event an all day event.
+     * 
+     * @param allDay
+     *            True if the event should be rendered all day
+     */
+    public void setAllDay(boolean allDay) {
+        this.allDay = allDay;
+    }
+
+    /**
+     * Is the event an all day event.
+     * 
+     * @return
+     */
+    public boolean isAllDay() {
+        return allDay;
+    }
+
+    /**
+     * Get the time as a formatted string
+     * 
+     * @return
+     */
+    public String getTimeAsText() {
+        if (format24h) {
+            return dateformat_date24.format(startTime);
+        } else {
+            return dateformat_date.format(startTime);
+        }
+    }
+
+    /**
+     * Get the amount of milliseconds between the start and end of the event
+     * 
+     * @return
+     */
+    public long getRangeInMilliseconds() {
+        return getEndTime().getTime() - getStartTime().getTime();
+    }
+
+    /**
+     * Get the amount of minutes between the start and end of the event
+     * 
+     * @return
+     */
+    public long getRangeInMinutes() {
+        return (getRangeInMilliseconds() / DateConstants.MINUTEINMILLIS);
+    }
+
+    /**
+     * Get the amount of minutes for the event on a specific day. This is useful
+     * if the event spans several days.
+     * 
+     * @param targetDay
+     *            The date to check
+     * @return
+     */
+    public long getRangeInMinutesForDay(Date targetDay) {
+        if (isTimeOnDifferentDays()) {
+            // Time range is on different days. Calculate the second day's
+            // range.
+            long range = (getEndTime().getTime() - getEnd().getTime())
+                    / DateConstants.MINUTEINMILLIS;
+
+            if (getEnd().compareTo(targetDay) != 0) {
+                // Calculate first day's range.
+                return getRangeInMinutes() - range;
+            }
+
+            return range;
+        } else {
+            return getRangeInMinutes();
+        }
+    }
+
+    /**
+     * Does the event span several days
+     * 
+     * @return
+     */
+    @SuppressWarnings("deprecation")
+    public boolean isTimeOnDifferentDays() {
+        if (getEndTime().getTime() - getStart().getTime() > DateConstants.DAYINMILLIS) {
+            return true;
+        }
+
+        if (getStart().compareTo(getEnd()) != 0) {
+            if (getEndTime().getHours() == 0 && getEndTime().getMinutes() == 0) {
+                return false;
+            }
+            return true;
+        }
+        return false;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
new file mode 100644
index 0000000000..05e2a808fe
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
@@ -0,0 +1,808 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.Node;
+import com.google.gwt.dom.client.NodeList;
+import com.google.gwt.dom.client.Style.Display;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.event.dom.client.ContextMenuHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.Util;
+
+public class DateCell extends FocusableComplexPanel implements
+        MouseDownHandler, MouseMoveHandler, MouseUpHandler, KeyDownHandler,
+        ContextMenuHandler {
+    private static final String DRAGEMPHASISSTYLE = " dragemphasis";
+    private Date date;
+    private int width;
+    private int eventRangeStart = -1;
+    private int eventRangeStop = -1;
+    final WeekGrid weekgrid;
+    private boolean disabled = false;
+    private int height;
+    private final Element[] slotElements;
+    private final List<DateCellSlot> slots = new ArrayList<DateCell.DateCellSlot>();
+    private int[] slotElementHeights;
+    private int startingSlotHeight;
+    private Date today;
+    private Element todaybar;
+    private final List<HandlerRegistration> handlers;
+    private final int numberOfSlots;
+    private final int firstHour;
+    private final int lastHour;
+
+    public class DateCellSlot extends Widget {
+
+        private final DateCell cell;
+
+        private final Date from;
+
+        private final Date to;
+
+        public DateCellSlot(DateCell cell, Date from, Date to) {
+            setElement(DOM.createDiv());
+            getElement().setInnerHTML("&nbsp;");
+            this.cell = cell;
+            this.from = from;
+            this.to = to;
+        }
+
+        public Date getFrom() {
+            return from;
+        }
+
+        public Date getTo() {
+            return to;
+        }
+
+        public DateCell getParentCell() {
+            return cell;
+        }
+    }
+
+    public DateCell(WeekGrid parent, Date date) {
+        weekgrid = parent;
+        Element mainElement = DOM.createDiv();
+        setElement(mainElement);
+        makeFocusable();
+        setDate(date);
+
+        addStyleName("v-calendar-day-times");
+
+        handlers = new LinkedList<HandlerRegistration>();
+
+        // 2 slots / hour
+        firstHour = weekgrid.getFirstHour();
+        lastHour = weekgrid.getLastHour();
+        numberOfSlots = (lastHour - firstHour + 1) * 2;
+        long slotTime = Math.round(((lastHour - firstHour + 1) * 3600000.0)
+                / numberOfSlots);
+
+        slotElements = new Element[numberOfSlots];
+        slotElementHeights = new int[numberOfSlots];
+
+        slots.clear();
+        long start = getDate().getTime() + firstHour * 3600000;
+        long end = start + slotTime;
+        for (int i = 0; i < numberOfSlots; i++) {
+            DateCellSlot slot = new DateCellSlot(this, new Date(
+                    start), new Date(end));
+            if (i % 2 == 0) {
+                slot.setStyleName("v-datecellslot-even");
+            } else {
+                slot.setStyleName("v-datecellslot");
+            }
+            Event.sinkEvents(slot.getElement(), Event.MOUSEEVENTS);
+            mainElement.appendChild(slot.getElement());
+            slotElements[i] = slot.getElement();
+            slots.add(slot);
+            start = end;
+            end = start + slotTime;
+        }
+
+        // Sink events for tooltip handling
+        Event.sinkEvents(mainElement, Event.MOUSEEVENTS);
+    }
+
+    public int getFirstHour() {
+        return firstHour;
+    }
+
+    public int getLastHour() {
+        return lastHour;
+    }
+
+    @Override
+    protected void onAttach() {
+        super.onAttach();
+
+        handlers.add(addHandler(this, MouseDownEvent.getType()));
+        handlers.add(addHandler(this, MouseUpEvent.getType()));
+        handlers.add(addHandler(this, MouseMoveEvent.getType()));
+        handlers.add(addDomHandler(this, ContextMenuEvent.getType()));
+        handlers.add(addKeyDownHandler(this));
+    }
+
+    @Override
+    protected void onDetach() {
+        for (HandlerRegistration handler : handlers) {
+            handler.removeHandler();
+        }
+        handlers.clear();
+
+        super.onDetach();
+    }
+
+    public int getSlotIndex(Element slotElement) {
+        for (int i = 0; i < slotElements.length; i++) {
+            if (slotElement == slotElements[i]) {
+                return i;
+            }
+        }
+
+        throw new IllegalArgumentException(
+                "Element not found in this DateCell");
+    }
+
+    public DateCellSlot getSlot(int index) {
+        return slots.get(index);
+    }
+
+    public int getNumberOfSlots() {
+        return numberOfSlots;
+    }
+
+    public void setTimeBarWidth(int timebarWidth) {
+        todaybar.getStyle().setWidth(timebarWidth, Unit.PX);
+    }
+
+    /**
+     * @param isHorizontalSized
+     *            if true, this DateCell is sized with CSS and not via
+     *            {@link #setWidthPX(int)}
+     */
+    public void setHorizontalSized(boolean isHorizontalSized) {
+        if (isHorizontalSized) {
+            addStyleDependentName("Hsized");
+
+            width = getOffsetWidth()
+                    - Util.measureHorizontalBorder(getElement());
+            recalculateEventWidths();
+        } else {
+            removeStyleDependentName("Hsized");
+        }
+    }
+
+    /**
+     * @param isVerticalSized
+     *            if true, this DateCell is sized with CSS and not via
+     *            {@link #setHeightPX(int)}
+     */
+    public void setVerticalSized(boolean isVerticalSized) {
+        if (isVerticalSized) {
+            addStyleDependentName("Vsized");
+
+            // recalc heights&size for events. all other height sizes come
+            // from css
+            startingSlotHeight = slotElements[0].getOffsetHeight();
+            recalculateEventPositions();
+
+            if (isToday()) {
+                recalculateTimeBarPosition();
+            }
+
+        } else {
+            removeStyleDependentName("Vsized");
+        }
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public void setWidthPX(int cellWidth) {
+        width = cellWidth;
+        setWidth(cellWidth + "px");
+        recalculateEventWidths();
+    }
+
+    public void setHeightPX(int height, int[] cellHeights) {
+        this.height = height;
+        slotElementHeights = cellHeights;
+        setHeight(height + "px");
+        recalculateCellHeights();
+        recalculateEventPositions();
+        if (today != null) {
+            recalculateTimeBarPosition();
+        }
+    }
+
+    // date methods are not deprecated in GWT
+    @SuppressWarnings("deprecation")
+    private void recalculateTimeBarPosition() {
+        int h = today.getHours();
+        int m = today.getMinutes();
+        if (h >= firstHour && h <= lastHour) {
+            int pixelTop = weekgrid.getPixelTopFor(m + 60 * h);
+            todaybar.getStyle().clearDisplay();
+            todaybar.getStyle().setTop(pixelTop, Unit.PX);
+        } else {
+            todaybar.getStyle().setDisplay(Display.NONE);
+        }
+    }
+
+    private void recalculateEventPositions() {
+        for (int i = 0; i < getWidgetCount(); i++) {
+            DateCellDayEvent dayEvent = (DateCellDayEvent) getWidget(i);
+            updatePositionFor(dayEvent, getDate(),
+                    dayEvent.getCalendarEvent());
+        }
+    }
+
+    public void recalculateEventWidths() {
+        List<DateCellGroup> groups = new ArrayList<DateCellGroup>();
+
+        int count = getWidgetCount();
+
+        List<Integer> handled = new ArrayList<Integer>();
+
+        // Iterate through all events and group them. Events that overlaps
+        // with each other, are added to the same group.
+        for (int i = 0; i < count; i++) {
+            if (handled.contains(i)) {
+                continue;
+            }
+
+            DateCellGroup curGroup = getOverlappingEvents(i);
+            handled.addAll(curGroup.getItems());
+
+            boolean newGroup = true;
+            // No need to check other groups, if size equals the count
+            if (curGroup.getItems().size() != count) {
+                // Check other groups. When the whole group overlaps with
+                // other group, the group is merged to the other.
+                for (DateCellGroup g : groups) {
+
+                    if (WeekGridMinuteTimeRange.doesOverlap(
+                            curGroup.getDateRange(), g.getDateRange())) {
+                        newGroup = false;
+                        updateGroup(g, curGroup);
+                    }
+                }
+            } else {
+                if (newGroup) {
+                    groups.add(curGroup);
+                }
+                break;
+            }
+
+            if (newGroup) {
+                groups.add(curGroup);
+            }
+        }
+
+        drawDayEvents(groups);
+    }
+
+    private void recalculateCellHeights() {
+        startingSlotHeight = height / numberOfSlots;
+
+        for (int i = 0; i < slotElements.length; i++) {
+            slotElements[i].getStyle().setHeight(slotElementHeights[i],
+                    Unit.PX);
+        }
+
+        Iterator<Widget> it = iterator();
+        while (it.hasNext()) {
+            Widget child = it.next();
+            if (child instanceof DateCellDayEvent) {
+                ((DateCellDayEvent) child).setSlotHeightInPX(getSlotHeight());
+            }
+
+        }
+    }
+
+    public int getSlotHeight() {
+        return startingSlotHeight;
+    }
+
+    public int getSlotBorder() {
+        return Util
+                .measureVerticalBorder((com.google.gwt.user.client.Element) slotElements[0]);
+    }
+
+    private void drawDayEvents(List<DateCellGroup> groups) {
+        for (DateCellGroup g : groups) {
+            int col = 0;
+            int colCount = 0;
+            List<Integer> order = new ArrayList<Integer>();
+            Map<Integer, Integer> columns = new HashMap<Integer, Integer>();
+            for (Integer eventIndex : g.getItems()) {
+                DateCellDayEvent d = (DateCellDayEvent) getWidget(eventIndex);
+                d.setMoveWidth(width);
+
+                int freeSpaceCol = findFreeColumnSpaceOnLeft(
+                        new WeekGridMinuteTimeRange(d.getCalendarEvent()
+                                .getStartTime(), d.getCalendarEvent()
+                                .getEndTime()), order, columns);
+                if (freeSpaceCol >= 0) {
+                    col = freeSpaceCol;
+                    columns.put(eventIndex, col);
+                    int newOrderindex = 0;
+                    for (Integer i : order) {
+                        if (columns.get(i) >= col) {
+                            newOrderindex = order.indexOf(i);
+                            break;
+                        }
+                    }
+                    order.add(newOrderindex, eventIndex);
+                } else {
+                    // New column
+                    col = colCount++;
+                    columns.put(eventIndex, col);
+                    order.add(eventIndex);
+                }
+            }
+
+            // Update widths and left position
+            int eventWidth = (width / colCount);
+            for (Integer index : g.getItems()) {
+                DateCellDayEvent d = (DateCellDayEvent) getWidget(index);
+                d.getElement()
+                        .getStyle()
+                        .setMarginLeft((eventWidth * columns.get(index)),
+                                Unit.PX);
+                d.setWidth(eventWidth + "px");
+                d.setSlotHeightInPX(getSlotHeight());
+            }
+        }
+    }
+
+    private int findFreeColumnSpaceOnLeft(WeekGridMinuteTimeRange dateRange,
+            List<Integer> order, Map<Integer, Integer> columns) {
+        int freeSpot = -1;
+        int skipIndex = -1;
+        for (Integer eventIndex : order) {
+            int col = columns.get(eventIndex);
+            if (col == skipIndex) {
+                continue;
+            }
+
+            if (freeSpot != -1 && freeSpot != col) {
+                // Free spot found
+                return freeSpot;
+            }
+
+            DateCellDayEvent d = (DateCellDayEvent) getWidget(eventIndex);
+            WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d
+                    .getCalendarEvent().getStartTime(), d
+                    .getCalendarEvent().getEndTime());
+
+            if (WeekGridMinuteTimeRange.doesOverlap(dateRange, nextRange)) {
+                skipIndex = col;
+                freeSpot = -1;
+            } else {
+                freeSpot = col;
+            }
+        }
+
+        return freeSpot;
+    }
+
+    /* Update top and bottom date range values. Add new index to the group. */
+    private void updateGroup(DateCellGroup targetGroup, DateCellGroup byGroup) {
+        Date newStart = targetGroup.getStart();
+        Date newEnd = targetGroup.getEnd();
+        if (byGroup.getStart().before(targetGroup.getStart())) {
+            newStart = byGroup.getEnd();
+        }
+        if (byGroup.getStart().after(targetGroup.getEnd())) {
+            newStart = byGroup.getStart();
+        }
+
+        targetGroup.setDateRange(new WeekGridMinuteTimeRange(newStart, newEnd));
+
+        for (Integer index : byGroup.getItems()) {
+            if (!targetGroup.getItems().contains(index)) {
+                targetGroup.add(index);
+            }
+        }
+    }
+
+    /**
+     * Returns all overlapping DayEvent indexes in the Group. Including the
+     * target.
+     * 
+     * @param targetIndex
+     *            Index of DayEvent in the current DateCell widget.
+     * @return Group that contains all Overlapping DayEvent indexes
+     */
+    public DateCellGroup getOverlappingEvents(int targetIndex) {
+        DateCellGroup g = new DateCellGroup(targetIndex);
+
+        int count = getWidgetCount();
+        DateCellDayEvent target = (DateCellDayEvent) getWidget(targetIndex);
+        WeekGridMinuteTimeRange targetRange = new WeekGridMinuteTimeRange(target
+                .getCalendarEvent().getStartTime(), target
+                .getCalendarEvent().getEndTime());
+        Date groupStart = targetRange.getStart();
+        Date groupEnd = targetRange.getEnd();
+
+        for (int i = 0; i < count; i++) {
+            if (targetIndex == i) {
+                continue;
+            }
+
+            DateCellDayEvent d = (DateCellDayEvent) getWidget(i);
+            WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d
+                    .getCalendarEvent().getStartTime(), d
+                    .getCalendarEvent().getEndTime());
+            if (WeekGridMinuteTimeRange.doesOverlap(targetRange, nextRange)) {
+                g.add(i);
+
+                // Update top & bottom values to the greatest
+                if (nextRange.getStart().before(targetRange.getStart())) {
+                    groupStart = targetRange.getStart();
+                }
+                if (nextRange.getEnd().after(targetRange.getEnd())) {
+                    groupEnd = targetRange.getEnd();
+                }
+            }
+        }
+
+        g.setDateRange(new WeekGridMinuteTimeRange(groupStart, groupEnd));
+        return g;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void addEvent(Date targetDay, CalendarEvent calendarEvent) {
+        Element main = getElement();
+        DateCellDayEvent dayEvent = new DateCellDayEvent(this, weekgrid, calendarEvent);
+        dayEvent.setSlotHeightInPX(getSlotHeight());
+        dayEvent.setDisabled(isDisabled());
+
+        if (startingSlotHeight > 0) {
+            updatePositionFor(dayEvent, targetDay, calendarEvent);
+        }
+
+        add(dayEvent, (com.google.gwt.user.client.Element) main);
+    }
+
+    // date methods are not deprecated in GWT
+    @SuppressWarnings("deprecation")
+    private void updatePositionFor(DateCellDayEvent dayEvent, Date targetDay,
+            CalendarEvent calendarEvent) {
+        if (canDisplay(calendarEvent)) {
+
+            dayEvent.getElement().getStyle().clearDisplay();
+
+            Date fromDt = calendarEvent.getStartTime();
+            int h = fromDt.getHours();
+            int m = fromDt.getMinutes();
+            long range = calendarEvent.getRangeInMinutesForDay(targetDay);
+
+            boolean onDifferentDays = calendarEvent.isTimeOnDifferentDays();
+            if (onDifferentDays) {
+                if (calendarEvent.getStart().compareTo(targetDay) != 0) {
+                    // Current day slot is for the end date. Lets fix also
+                    // the
+                    // start & end times.
+                    h = 0;
+                    m = 0;
+                }
+            }
+
+            int startFromMinutes = (h * 60) + m;
+            dayEvent.updatePosition(startFromMinutes, range);
+
+        } else {
+            dayEvent.getElement().getStyle().setDisplay(Display.NONE);
+        }
+    }
+
+    public void addEvent(DateCellDayEvent dayEvent) {
+        Element main = getElement();
+        int index = 0;
+        List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+
+        // events are the only widgets in this panel
+        // slots are just elements
+        for (; index < getWidgetCount(); index++) {
+            DateCellDayEvent dc = (DateCellDayEvent) getWidget(index);
+            dc.setDisabled(isDisabled());
+            events.add(dc.getCalendarEvent());
+        }
+        events.add(dayEvent.getCalendarEvent());
+
+        index = 0;
+        for (CalendarEvent e : weekgrid.getCalendar().sortEventsByDuration(
+                events)) {
+            if (e.equals(dayEvent.getCalendarEvent())) {
+                break;
+            }
+            index++;
+        }
+        this.insert(dayEvent, (com.google.gwt.user.client.Element) main,
+                index, true);
+    }
+
+    public void removeEvent(DateCellDayEvent dayEvent) {
+        remove(dayEvent);
+    }
+
+    /**
+     * 
+     * @param event
+     * @return
+     */
+    // Date methods not deprecated in GWT
+    @SuppressWarnings("deprecation")
+    private boolean canDisplay(CalendarEvent event) {
+        Date eventStart = event.getStartTime();
+        Date eventEnd = event.getEndTime();
+
+        int eventStartHours = eventStart.getHours();
+        int eventEndHours = eventEnd.getHours();
+
+        return (eventStartHours <= lastHour)
+                && (eventEndHours >= firstHour);
+    }
+
+    public void onKeyDown(KeyDownEvent event) {
+        int keycode = event.getNativeEvent().getKeyCode();
+        if (keycode == KeyCodes.KEY_ESCAPE && eventRangeStart > -1) {
+            cancelRangeSelect();
+        }
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+        if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
+            Element e = Element.as(event.getNativeEvent().getEventTarget());
+            if (e.getClassName().contains("reserved") || isDisabled()
+                    || !weekgrid.getParentCalendar().isRangeSelectAllowed()) {
+                eventRangeStart = -1;
+            } else {
+                eventRangeStart = event.getY();
+                eventRangeStop = eventRangeStart;
+                Event.setCapture(getElement());
+                setFocus(true);
+            }
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    public void onMouseUp(MouseUpEvent event) {
+        if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+            return;
+        }
+        Event.releaseCapture(getElement());
+        setFocus(false);
+        int dragDistance = Math.abs(eventRangeStart - event.getY());
+        if (dragDistance > 0 && eventRangeStart >= 0) {
+            Element main = getElement();
+            if (eventRangeStart > eventRangeStop) {
+                if (eventRangeStop <= -1) {
+                    eventRangeStop = 0;
+                }
+                int temp = eventRangeStart;
+                eventRangeStart = eventRangeStop;
+                eventRangeStop = temp;
+            }
+
+            NodeList<Node> nodes = main.getChildNodes();
+
+            int slotStart = -1;
+            int slotEnd = -1;
+
+            // iterate over all child nodes, until we find first the start,
+            // and then the end
+            for (int i = 0; i < nodes.getLength(); i++) {
+                Element element = (Element) nodes.getItem(i);
+                boolean isRangeElement = element.getClassName().contains(
+                        "v-daterange");
+
+                if (isRangeElement && slotStart == -1) {
+                    slotStart = i;
+                    slotEnd = i; // to catch one-slot selections
+
+                } else if (isRangeElement) {
+                    slotEnd = i;
+
+                } else if (slotStart != -1 && slotEnd != -1) {
+                    break;
+                }
+            }
+
+            clearSelectionRange();
+
+            int startMinutes = firstHour * 60 + slotStart * 30;
+            int endMinutes = (firstHour * 60) + (slotEnd + 1) * 30;
+            Date currentDate = getDate();
+            String yr = (currentDate.getYear() + 1900) + "-"
+                    + (currentDate.getMonth() + 1) + "-"
+                    + currentDate.getDate();
+            if (weekgrid.getCalendar().getRangeSelectListener() != null) {
+                weekgrid.getCalendar()
+                        .getRangeSelectListener()
+                        .rangeSelected(
+                                yr + ":" + startMinutes + ":" + endMinutes);
+            }
+            eventRangeStart = -1;
+        } else {
+            // Click event
+            eventRangeStart = -1;
+            cancelRangeSelect();
+
+        }
+    }
+
+    public void onMouseMove(MouseMoveEvent event) {
+        if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+            return;
+        }
+
+        if (eventRangeStart >= 0) {
+            int newY = event.getY();
+            int fromY = 0;
+            int toY = 0;
+            if (newY < eventRangeStart) {
+                fromY = newY;
+                toY = eventRangeStart;
+            } else {
+                fromY = eventRangeStart;
+                toY = newY;
+            }
+            Element main = getElement();
+            eventRangeStop = newY;
+            NodeList<Node> nodes = main.getChildNodes();
+            for (int i = 0; i < nodes.getLength(); i++) {
+                Element c = (Element) nodes.getItem(i);
+
+                if (todaybar != c) {
+
+                    int elemStart = c.getOffsetTop();
+                    int elemStop = elemStart + getSlotHeight();
+                    if (elemStart >= fromY && elemStart <= toY) {
+                        c.addClassName("v-daterange");
+                    } else if (elemStop >= fromY && elemStop <= toY) {
+                        c.addClassName("v-daterange");
+                    } else if (elemStop >= fromY && elemStart <= toY) {
+                        c.addClassName("v-daterange");
+                    } else {
+                        c.removeClassName("v-daterange");
+                    }
+                }
+            }
+        }
+
+        event.preventDefault();
+    }
+
+    public void cancelRangeSelect() {
+        Event.releaseCapture(getElement());
+        setFocus(false);
+
+        clearSelectionRange();
+    }
+
+    private void clearSelectionRange() {
+        if (eventRangeStart > -1) {
+            // clear all "selected" class names
+            Element main = getElement();
+            NodeList<Node> nodes = main.getChildNodes();
+
+            for (int i = 0; i <= 47; i++) {
+                Element c = (Element) nodes.getItem(i);
+                if (c == null) {
+                    continue;
+                }
+                c.removeClassName("v-daterange");
+            }
+
+            eventRangeStart = -1;
+        }
+    }
+
+    public void setToday(Date today, int width) {
+        this.today = today;
+        addStyleDependentName("today");
+        Element lastChild = (Element) getElement().getLastChild();
+        if (lastChild.getClassName().equals("v-calendar-current-time")) {
+            todaybar = lastChild;
+        } else {
+            todaybar = DOM.createDiv();
+            todaybar.setClassName("v-calendar-current-time");
+            getElement().appendChild(todaybar);
+        }
+
+        if (width != -1) {
+            todaybar.getStyle().setWidth(width, Unit.PX);
+        }
+
+        // position is calculated later, when we know the cell heights
+    }
+
+    public Element getTodaybarElement() {
+        return todaybar;
+    }
+
+    public void setDisabled(boolean disabled) {
+        this.disabled = disabled;
+    }
+
+    public boolean isDisabled() {
+        return disabled;
+    }
+
+    public void setDateColor(String styleName) {
+        this.setStyleName("v-calendar-datecell " + styleName);
+    }
+
+    public boolean isToday() {
+        return today != null;
+    }
+
+    public void addEmphasisStyle(
+            com.google.gwt.user.client.Element elementOver) {
+        String originalStylename = getStyleName(elementOver);
+        setStyleName(elementOver, originalStylename + DRAGEMPHASISSTYLE);
+    }
+
+    public void removeEmphasisStyle(
+            com.google.gwt.user.client.Element elementOver) {
+        String originalStylename = getStyleName(elementOver);
+        setStyleName(
+                elementOver,
+                originalStylename.substring(0, originalStylename.length()
+                        - DRAGEMPHASISSTYLE.length()));
+    }
+
+    public void onContextMenu(ContextMenuEvent event) {
+        if (weekgrid.getCalendar().getMouseEventListener() != null) {
+            event.preventDefault();
+            event.stopPropagation();
+            weekgrid.getCalendar().getMouseEventListener()
+                    .contextMenu(event, DateCell.this);
+        }
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
new file mode 100644
index 0000000000..f1b45c83c5
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * Internally used class by the Calendar
+ * 
+ * since 7.1
+ */
+public class DateCellContainer extends FlowPanel implements
+        MouseDownHandler, MouseUpHandler {
+
+    private Date date;
+
+    private Widget clickTargetWidget;
+
+    private VCalendar calendar;
+
+    private static int borderWidth = -1;
+
+    public DateCellContainer() {
+        setStylePrimaryName("v-calendar-datecell");
+    }
+
+    public static int measureBorderWidth(DateCellContainer dc) {
+        if (borderWidth == -1) {
+            borderWidth = Util.measureHorizontalBorder(dc.getElement());
+        }
+        return borderWidth;
+    }
+
+    public void setCalendar(VCalendar calendar) {
+        this.calendar = calendar;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public boolean hasEvent(int slotIndex) {
+        return hasDateCell(slotIndex)
+                && ((WeeklyLongEventsDateCell) getChildren().get(slotIndex)).getEvent() != null;
+    }
+
+    public boolean hasDateCell(int slotIndex) {
+        return (getChildren().size() - 1) >= slotIndex;
+    }
+
+    public WeeklyLongEventsDateCell getDateCell(int slotIndex) {
+        if (!hasDateCell(slotIndex)) {
+            addEmptyEventCells(slotIndex - (getChildren().size() - 1));
+        }
+        return (WeeklyLongEventsDateCell) getChildren().get(slotIndex);
+    }
+
+    public void addEmptyEventCells(int eventCount) {
+        for (int i = 0; i < eventCount; i++) {
+            addEmptyEventCell();
+        }
+    }
+
+    public void addEmptyEventCell() {
+        WeeklyLongEventsDateCell dateCell = new WeeklyLongEventsDateCell();
+        dateCell.addMouseDownHandler(this);
+        dateCell.addMouseUpHandler(this);
+        add(dateCell);
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+        clickTargetWidget = (Widget) event.getSource();
+
+        event.stopPropagation();
+    }
+
+    public void onMouseUp(MouseUpEvent event) {
+        if (event.getSource() == clickTargetWidget
+                && clickTargetWidget instanceof WeeklyLongEventsDateCell
+                && !calendar.isDisabledOrReadOnly()) {
+            CalendarEvent calendarEvent = ((WeeklyLongEventsDateCell) clickTargetWidget)
+                    .getEvent();
+            if (calendar.getEventClickListener() != null) {
+                calendar.getEventClickListener().eventClick(calendarEvent);
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
new file mode 100644
index 0000000000..039a00e25a
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
@@ -0,0 +1,659 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.EventTarget;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Position;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ContextMenuEvent;
+import com.google.gwt.event.dom.client.ContextMenuHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.VCalendar;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * Internally used by the calendar
+ * 
+ * @since 7.1
+ */
+public class DateCellDayEvent extends FocusableHTML implements
+        MouseDownHandler, MouseUpHandler, MouseMoveHandler,
+        KeyDownHandler, ContextMenuHandler, HasTooltipKey {
+
+    private final DateCell dateCell;
+    private Element caption = null;
+    private final Element eventContent;
+    private CalendarEvent calendarEvent = null;
+    private HandlerRegistration moveRegistration;
+    private int startY = -1;
+    private int startX = -1;
+    private String moveWidth;
+    public static final int halfHourInMilliSeconds = 1800 * 1000;
+    private Date startDatetimeFrom;
+    private Date startDatetimeTo;
+    private boolean mouseMoveStarted;
+    private int top;
+    private int startYrelative;
+    private int startXrelative;
+    private boolean disabled;
+    private final WeekGrid weekGrid;
+    private com.google.gwt.user.client.Element topResizeBar;
+    private com.google.gwt.user.client.Element bottomResizeBar;
+    private Element clickTarget;
+    private final Integer eventIndex;
+    private int slotHeight;
+    private final List<HandlerRegistration> handlers;
+    private boolean mouseMoveCanceled;
+
+    public DateCellDayEvent(DateCell dateCell, WeekGrid parent, CalendarEvent event) {
+        super();
+        this.dateCell = dateCell;
+
+        handlers = new LinkedList<HandlerRegistration>();
+
+        setStylePrimaryName("v-calendar-event");
+        setCalendarEvent(event);
+
+        weekGrid = parent;
+
+        Style s = getElement().getStyle();
+        if (event.getStyleName().length() > 0) {
+            addStyleDependentName(event.getStyleName());
+        }
+        s.setPosition(Position.ABSOLUTE);
+
+        caption = DOM.createDiv();
+        caption.addClassName("v-calendar-event-caption");
+        getElement().appendChild(caption);
+
+        eventContent = DOM.createDiv();
+        eventContent.addClassName("v-calendar-event-content");
+        getElement().appendChild(eventContent);
+
+        VCalendar calendar = weekGrid.getCalendar();
+        if (weekGrid.getCalendar().isEventResizeAllowed()) {
+            topResizeBar = DOM.createDiv();
+            bottomResizeBar = DOM.createDiv();
+
+            topResizeBar.addClassName("v-calendar-event-resizetop");
+            bottomResizeBar
+                    .addClassName("v-calendar-event-resizebottom");
+
+            getElement().appendChild(topResizeBar);
+            getElement().appendChild(bottomResizeBar);
+        }
+
+        eventIndex = event.getIndex();
+    }
+
+    @Override
+    protected void onAttach() {
+        super.onAttach();
+        handlers.add(addMouseDownHandler(this));
+        handlers.add(addMouseUpHandler(this));
+        handlers.add(addKeyDownHandler(this));
+        handlers.add(addDomHandler(this, ContextMenuEvent.getType()));
+    }
+
+    @Override
+    protected void onDetach() {
+        for (HandlerRegistration handler : handlers) {
+            handler.removeHandler();
+        }
+        handlers.clear();
+        super.onDetach();
+    }
+
+    public void setSlotHeightInPX(int slotHeight) {
+        this.slotHeight = slotHeight;
+    }
+
+    public void updatePosition(long startFromMinutes,
+            long durationInMinutes) {
+        if (startFromMinutes < 0) {
+            startFromMinutes = 0;
+        }
+        top = weekGrid.getPixelTopFor((int) startFromMinutes);
+
+        getElement().getStyle().setTop(top, Unit.PX);
+        if (durationInMinutes > 0) {
+            int heightMinutes = weekGrid.getPixelLengthFor(
+                    (int) startFromMinutes, (int) durationInMinutes);
+            setHeight(heightMinutes);
+        } else {
+            setHeight(-1);
+        }
+
+        boolean multiRowCaption = (durationInMinutes > 30);
+        updateCaptions(multiRowCaption);
+    }
+
+    public int getTop() {
+        return top;
+    }
+
+    public void setMoveWidth(int width) {
+        moveWidth = width + "px";
+    }
+
+    public void setHeight(int h) {
+        if (h == -1) {
+            getElement().getStyle().setProperty("height", "");
+            eventContent.getStyle().setProperty("height", "");
+        } else {
+            getElement().getStyle().setHeight(h, Unit.PX);
+            // FIXME measure the border height (2px) from the DOM
+            eventContent.getStyle().setHeight(h - 2, Unit.PX);
+        }
+    }
+
+    /**
+     * @param bigMode
+     *            If false, event is so small that caption must be in
+     *            time-row
+     */
+    private void updateCaptions(boolean bigMode) {
+        String separator = bigMode ? "<br />" : ": ";
+        caption.setInnerHTML("<span>" + calendarEvent.getTimeAsText()
+                + "</span>" + separator
+                + Util.escapeHTML(calendarEvent.getCaption()));
+        eventContent.setInnerHTML("");
+    }
+
+    public void onKeyDown(KeyDownEvent event) {
+        int keycode = event.getNativeEvent().getKeyCode();
+        if (keycode == KeyCodes.KEY_ESCAPE && mouseMoveStarted) {
+            cancelMouseMove();
+        }
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+        startX = event.getClientX();
+        startY = event.getClientY();
+        if (isDisabled()
+                || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+            return;
+        }
+
+        clickTarget = Element.as(event.getNativeEvent()
+                .getEventTarget());
+        mouseMoveCanceled = false;
+
+        if (weekGrid.getCalendar().isEventMoveAllowed()
+                || clickTargetsResize()) {
+            moveRegistration = addMouseMoveHandler(this);
+            setFocus(true);
+            try {
+                startYrelative = (int) ((double) event
+                        .getRelativeY(caption) % slotHeight);
+                startXrelative = (event.getRelativeX(weekGrid
+                        .getElement()) - weekGrid.timebar
+                        .getOffsetWidth())
+                        % getDateCellWidth();
+            } catch (Exception e) {
+                GWT.log("Exception calculating relative start position",
+                        e);
+            }
+            mouseMoveStarted = false;
+            Style s = getElement().getStyle();
+            s.setZIndex(1000);
+            startDatetimeFrom = (Date) calendarEvent.getStartTime()
+                    .clone();
+            startDatetimeTo = (Date) calendarEvent.getEndTime().clone();
+            Event.setCapture(getElement());
+        }
+
+        // make sure the right cursor is always displayed
+        if (clickTargetsResize()) {
+            addGlobalResizeStyle();
+        }
+
+        /*
+         * We need to stop the event propagation or else the WeekGrid
+         * range select will kick in
+         */
+        event.stopPropagation();
+        event.preventDefault();
+    }
+
+    public void onMouseUp(MouseUpEvent event) {
+        if (mouseMoveCanceled) {
+            return;
+        }
+
+        Event.releaseCapture(getElement());
+        setFocus(false);
+        if (moveRegistration != null) {
+            moveRegistration.removeHandler();
+            moveRegistration = null;
+        }
+        int endX = event.getClientX();
+        int endY = event.getClientY();
+        int xDiff = startX - endX;
+        int yDiff = startY - endY;
+        startX = -1;
+        startY = -1;
+        mouseMoveStarted = false;
+        Style s = getElement().getStyle();
+        s.setZIndex(1);
+        if (!clickTargetsResize()) {
+            // check if mouse has moved over threshold of 3 pixels
+            boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);
+
+            if (!weekGrid.getCalendar().isDisabledOrReadOnly()
+                    && mouseMoved) {
+                // Event Move:
+                // - calendar must be enabled
+                // - calendar must not be in read-only mode
+                weekGrid.eventMoved(this);
+            } else if (!weekGrid.getCalendar().isDisabled()) {
+                // Event Click:
+                // - calendar must be enabled (read-only is allowed)
+                EventTarget et = event.getNativeEvent()
+                        .getEventTarget();
+                Element e = Element.as(et);
+                if (e == caption || e == eventContent
+                        || e.getParentElement() == caption) {
+                    if (weekGrid.getCalendar().getEventClickListener() != null) {
+                        weekGrid.getCalendar().getEventClickListener()
+                                .eventClick(calendarEvent);
+                    }
+                }
+            }
+
+        } else { // click targeted resize bar
+            removeGlobalResizeStyle();
+            if (weekGrid.getCalendar().getEventResizeListener() != null) {
+                weekGrid.getCalendar().getEventResizeListener()
+                        .eventResized(calendarEvent);
+            }
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    public void onMouseMove(MouseMoveEvent event) {
+        if (startY < 0 && startX < 0) {
+            return;
+        }
+        if (isDisabled()) {
+            Event.releaseCapture(getElement());
+            mouseMoveStarted = false;
+            startY = -1;
+            startX = -1;
+            removeGlobalResizeStyle();
+            return;
+        }
+        int currentY = event.getClientY();
+        int currentX = event.getClientX();
+        int moveY = (currentY - startY);
+        int moveX = (currentX - startX);
+        if ((moveY < 5 && moveY > -6) && (moveX < 5 && moveX > -6)) {
+            return;
+        }
+        if (!mouseMoveStarted) {
+            setWidth(moveWidth);
+            getElement().getStyle().setMarginLeft(0, Unit.PX);
+            mouseMoveStarted = true;
+        }
+
+        HorizontalPanel parent = (HorizontalPanel) getParent()
+                .getParent();
+        int relativeX = event.getRelativeX(parent.getElement())
+                - weekGrid.timebar.getOffsetWidth();
+        int halfHourDiff = 0;
+        if (moveY > 0) {
+            halfHourDiff = (startYrelative + moveY) / slotHeight;
+        } else {
+            halfHourDiff = (moveY - startYrelative) / slotHeight;
+        }
+
+        int dateCellWidth = getDateCellWidth();
+        long dayDiff = 0;
+        if (moveX >= 0) {
+            dayDiff = (startXrelative + moveX) / dateCellWidth;
+        } else {
+            dayDiff = (moveX - (dateCellWidth - startXrelative))
+                    / dateCellWidth;
+        }
+
+        int dayOffset = relativeX / dateCellWidth;
+
+        // sanity check for right side overflow
+        int dateCellCount = weekGrid.getDateCellCount();
+        if (dayOffset >= dateCellCount) {
+            dayOffset--;
+            dayDiff--;
+        }
+
+        int dayOffsetPx = calculateDateCellOffsetPx(dayOffset)
+                + weekGrid.timebar.getOffsetWidth();
+
+        GWT.log("DateCellWidth: " + dateCellWidth + " dayDiff: "
+                + dayDiff + " dayOffset: " + dayOffset
+                + " dayOffsetPx: " + dayOffsetPx + " startXrelative: "
+                + startXrelative + " moveX: " + moveX);
+
+        if (relativeX < 0 || relativeX >= getDatesWidth()) {
+            return;
+        }
+
+        Style s = getElement().getStyle();
+
+        Date from = calendarEvent.getStartTime();
+        Date to = calendarEvent.getEndTime();
+        long duration = to.getTime() - from.getTime();
+
+        if (!clickTargetsResize()
+                && weekGrid.getCalendar().isEventMoveAllowed()) {
+            long daysMs = dayDiff * DateConstants.DAYINMILLIS;
+            from.setTime(startDatetimeFrom.getTime() + daysMs);
+            from.setTime(from.getTime()
+                    + ((long) halfHourInMilliSeconds * halfHourDiff));
+            to.setTime((from.getTime() + duration));
+
+            calendarEvent.setStartTime(from);
+            calendarEvent.setEndTime(to);
+            calendarEvent.setStart(new Date(from.getTime()));
+            calendarEvent.setEnd(new Date(to.getTime()));
+
+            // Set new position for the event
+            long startFromMinutes = (from.getHours() * 60)
+                    + from.getMinutes();
+            long range = calendarEvent.getRangeInMinutes();
+            startFromMinutes = calculateStartFromMinute(
+                    startFromMinutes, from, to, dayOffsetPx);
+            if (startFromMinutes < 0) {
+                range += startFromMinutes;
+            }
+            updatePosition(startFromMinutes, range);
+
+            s.setLeft(dayOffsetPx, Unit.PX);
+
+            if (weekGrid.getDateCellWidths() != null) {
+                s.setWidth(weekGrid.getDateCellWidths()[dayOffset],
+                        Unit.PX);
+            } else {
+                setWidth(moveWidth);
+            }
+
+        } else if (clickTarget == topResizeBar) {
+            long oldStartTime = startDatetimeFrom.getTime();
+            long newStartTime = oldStartTime
+                    + ((long) halfHourInMilliSeconds * halfHourDiff);
+
+            if (!isTimeRangeTooSmall(newStartTime,
+                    startDatetimeTo.getTime())) {
+                newStartTime = startDatetimeTo.getTime()
+                        - getMinTimeRange();
+            }
+
+            from.setTime(newStartTime);
+
+            calendarEvent.setStartTime(from);
+            calendarEvent.setStart(new Date(from.getTime()));
+
+            // Set new position for the event
+            long startFromMinutes = (from.getHours() * 60)
+                    + from.getMinutes();
+            long range = calendarEvent.getRangeInMinutes();
+
+            updatePosition(startFromMinutes, range);
+
+        } else if (clickTarget == bottomResizeBar) {
+            long oldEndTime = startDatetimeTo.getTime();
+            long newEndTime = oldEndTime
+                    + ((long) halfHourInMilliSeconds * halfHourDiff);
+
+            if (!isTimeRangeTooSmall(startDatetimeFrom.getTime(),
+                    newEndTime)) {
+                newEndTime = startDatetimeFrom.getTime()
+                        + getMinTimeRange();
+            }
+
+            to.setTime(newEndTime);
+
+            calendarEvent.setEndTime(to);
+            calendarEvent.setEnd(new Date(to.getTime()));
+
+            // Set new position for the event
+            long startFromMinutes = (startDatetimeFrom.getHours() * 60)
+                    + startDatetimeFrom.getMinutes();
+            long range = calendarEvent.getRangeInMinutes();
+            startFromMinutes = calculateStartFromMinute(
+                    startFromMinutes, from, to, dayOffsetPx);
+            if (startFromMinutes < 0) {
+                range += startFromMinutes;
+            }
+            updatePosition(startFromMinutes, range);
+        }
+    }
+
+    private void cancelMouseMove() {
+        mouseMoveCanceled = true;
+
+        // reset and remove everything related to the event handling
+        Event.releaseCapture(getElement());
+        setFocus(false);
+
+        if (moveRegistration != null) {
+            moveRegistration.removeHandler();
+            moveRegistration = null;
+        }
+
+        mouseMoveStarted = false;
+        removeGlobalResizeStyle();
+
+        Style s = getElement().getStyle();
+        s.setZIndex(1);
+
+        // reset the position of the event
+        int dateCellWidth = getDateCellWidth();
+        int dayOffset = startXrelative / dateCellWidth;
+        s.clearLeft();
+
+        calendarEvent.setStartTime(startDatetimeFrom);
+        calendarEvent.setEndTime(startDatetimeTo);
+
+        long startFromMinutes = (startDatetimeFrom.getHours() * 60)
+                + startDatetimeFrom.getMinutes();
+        long range = calendarEvent.getRangeInMinutes();
+
+        startFromMinutes = calculateStartFromMinute(startFromMinutes,
+                startDatetimeFrom, startDatetimeTo, dayOffset);
+        if (startFromMinutes < 0) {
+            range += startFromMinutes;
+        }
+
+        updatePosition(startFromMinutes, range);
+
+        startY = -1;
+        startX = -1;
+
+        // to reset the event width
+        ((DateCell) getParent()).recalculateEventWidths();
+    }
+
+    // date methods are not deprecated in GWT
+    @SuppressWarnings("deprecation")
+    private long calculateStartFromMinute(long startFromMinutes,
+            Date from, Date to, int dayOffset) {
+        boolean eventStartAtDifferentDay = from.getDate() != to
+                .getDate();
+        if (eventStartAtDifferentDay) {
+            long minutesOnPrevDay = (getTargetDateByCurrentPosition(
+                    dayOffset).getTime() - from.getTime())
+                    / DateConstants.MINUTEINMILLIS;
+            startFromMinutes = -1 * minutesOnPrevDay;
+        }
+
+        return startFromMinutes;
+    }
+
+    /**
+     * @param dateOffset
+     * @return the amount of pixels the given date is from the left side
+     */
+    private int calculateDateCellOffsetPx(int dateOffset) {
+        int dateCellOffset = 0;
+        int[] dateWidths = weekGrid.getDateCellWidths();
+
+        if (dateWidths != null) {
+            for (int i = 0; i < dateOffset; i++) {
+                dateCellOffset += dateWidths[i] + 1;
+            }
+        } else {
+            dateCellOffset = dateOffset * weekGrid.getDateCellWidth();
+        }
+
+        return dateCellOffset;
+    }
+
+    /**
+     * Check if the given time range is too small for events
+     * 
+     * @param start
+     * @param end
+     * @return
+     */
+    private boolean isTimeRangeTooSmall(long start, long end) {
+        return (end - start) >= getMinTimeRange();
+    }
+
+    /**
+     * @return the minimum amount of ms that an event must last when
+     *         resized
+     */
+    private long getMinTimeRange() {
+        return DateConstants.MINUTEINMILLIS * 30;
+    }
+
+    /**
+     * Build the string for sending resize events to server
+     * 
+     * @param event
+     * @return
+     */
+    private String buildResizeString(CalendarEvent event) {
+        StringBuilder buffer = new StringBuilder();
+        buffer.append(event.getIndex());
+        buffer.append(",");
+        buffer.append(DateUtil.formatClientSideDate(event.getStart()));
+        buffer.append("-");
+        buffer.append(DateUtil.formatClientSideTime(event
+                .getStartTime()));
+        buffer.append(",");
+        buffer.append(DateUtil.formatClientSideDate(event.getEnd()));
+        buffer.append("-");
+        buffer.append(DateUtil.formatClientSideTime(event.getEndTime()));
+
+        return buffer.toString();
+    }
+
+    private Date getTargetDateByCurrentPosition(int left) {
+        DateCell newParent = (DateCell) weekGrid.content
+                .getWidget((left / getDateCellWidth()) + 1);
+        Date targetDate = newParent.getDate();
+        return targetDate;
+    }
+
+    private int getDateCellWidth() {
+        return weekGrid.getDateCellWidth();
+    }
+
+    /* Returns total width of all date cells. */
+    private int getDatesWidth() {
+        if (weekGrid.width == -1) {
+            // Undefined width. Needs to be calculated by the known cell
+            // widths.
+            int count = weekGrid.content.getWidgetCount() - 1;
+            return count * getDateCellWidth();
+        }
+
+        return weekGrid.getInternalWidth();
+    }
+
+    /**
+     * @return true if the current mouse movement is resizing
+     */
+    private boolean clickTargetsResize() {
+        return weekGrid.getCalendar().isEventResizeAllowed()
+                && (clickTarget == topResizeBar || clickTarget == bottomResizeBar);
+    }
+
+    private void addGlobalResizeStyle() {
+        if (clickTarget == topResizeBar) {
+            weekGrid.getCalendar().addStyleDependentName("nresize");
+        } else if (clickTarget == bottomResizeBar) {
+            weekGrid.getCalendar().addStyleDependentName("sresize");
+        }
+    }
+
+    private void removeGlobalResizeStyle() {
+        weekGrid.getCalendar().removeStyleDependentName("nresize");
+        weekGrid.getCalendar().removeStyleDependentName("sresize");
+    }
+
+    public void setCalendarEvent(CalendarEvent calendarEvent) {
+        this.calendarEvent = calendarEvent;
+    }
+
+    public CalendarEvent getCalendarEvent() {
+        return calendarEvent;
+    }
+
+    public void setDisabled(boolean disabled) {
+        this.disabled = disabled;
+    }
+
+    public boolean isDisabled() {
+        return disabled;
+    }
+
+    public void onContextMenu(ContextMenuEvent event) {
+        if (this.dateCell.weekgrid.getCalendar().getMouseEventListener() != null) {
+            event.preventDefault();
+            event.stopPropagation();
+            this.dateCell.weekgrid.getCalendar().getMouseEventListener()
+                    .contextMenu(event, this);
+        }
+    }
+
+    @Override
+    public Object getTooltipKey() {
+        return eventIndex;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
new file mode 100644
index 0000000000..d2add53389
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * Internally used by the calendar
+ * 
+ * @since 7.1
+ */
+public class DateCellGroup {
+    private WeekGridMinuteTimeRange range;
+    private final List<Integer> items;
+
+    public DateCellGroup(Integer index) {
+        items = new ArrayList<Integer>();
+        items.add(index);
+    }
+
+    public WeekGridMinuteTimeRange getDateRange() {
+        return range;
+    }
+
+    public Date getStart() {
+        return range.getStart();
+    }
+
+    public Date getEnd() {
+        return range.getEnd();
+    }
+
+    public void setDateRange(WeekGridMinuteTimeRange range) {
+        this.range = range;
+    }
+
+    public List<Integer> getItems() {
+        return items;
+    }
+
+    public void add(Integer index) {
+        items.add(index);
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateUtil.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateUtil.java
new file mode 100644
index 0000000000..84726327e2
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateUtil.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.i18n.client.DateTimeFormat;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * Utility class for {@link Date} operations
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class DateUtil {
+
+    /**
+     * Checks if dates are same day without checking datetimes.
+     * 
+     * @param date1
+     * @param date2
+     * @return
+     */
+    @SuppressWarnings("deprecation")
+    public static boolean compareDate(Date date1, Date date2) {
+        if (date1.getDate() == date2.getDate()
+                && date1.getYear() == date2.getYear()
+                && date1.getMonth() == date2.getMonth()) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param date
+     *            the date to format
+     * 
+     * @return given Date as String, for communicating to server-side
+     */
+    public static String formatClientSideDate(Date date) {
+        DateTimeFormat dateformat_date = DateTimeFormat
+                .getFormat(DateConstants.CLIENT_DATE_FORMAT);
+        return dateformat_date.format(date);
+    }
+
+    /**
+     * @param date
+     *            the date to format
+     * @return given Date as String, for communicating to server-side
+     */
+    public static String formatClientSideTime(Date date) {
+        DateTimeFormat dateformat_date = DateTimeFormat
+                .getFormat(DateConstants.CLIENT_TIME_FORMAT);
+        return dateformat_date.format(date);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
new file mode 100644
index 0000000000..bb0155d892
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Iterator;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class DayToolbar extends HorizontalPanel implements ClickHandler {
+    private int width = 0;
+    protected static final int MARGINLEFT = 50;
+    protected static final int MARGINRIGHT = 20;
+    protected Button backLabel;
+    protected Button nextLabel;
+    private boolean verticalSized;
+    private boolean horizontalSized;
+    private VCalendar calendar;
+
+    public DayToolbar(VCalendar vcalendar) {
+        calendar = vcalendar;
+
+        setStylePrimaryName("v-calendar-header-week");
+        backLabel = new Button();
+        backLabel.setStylePrimaryName("v-calendar-back");
+        nextLabel = new Button();
+        nextLabel.addClickHandler(this);
+        nextLabel.setStylePrimaryName("v-calendar-next");
+        backLabel.addClickHandler(this);
+        setBorderWidth(0);
+        setSpacing(0);
+    }
+
+    public void setWidthPX(int width) {
+        this.width = (width - MARGINLEFT) - MARGINRIGHT;
+        // super.setWidth(this.width + "px");
+        if (getWidgetCount() == 0) {
+            return;
+        }
+        updateCellWidths();
+    }
+
+    public void updateCellWidths() {
+        int count = getWidgetCount();
+        if (count > 0) {
+            setCellWidth(backLabel, MARGINLEFT + "px");
+            setCellWidth(nextLabel, MARGINRIGHT + "px");
+            setCellHorizontalAlignment(nextLabel, ALIGN_RIGHT);
+            int cellw = width / (count - 2);
+            int remain = width % (count - 2);
+            int cellw2 = cellw + 1;
+            if (cellw > 0) {
+                int[] cellWidths = VCalendar
+                        .distributeSize(width, count - 2, 0);
+                for (int i = 1; i < count - 1; i++) {
+                    Widget widget = getWidget(i);
+                    // if (remain > 0) {
+                    // setCellWidth(widget, cellw2 + "px");
+                    // remain--;
+                    // } else {
+                    // setCellWidth(widget, cellw + "px");
+                    // }
+                    setCellWidth(widget, cellWidths[i - 1] + "px");
+                    widget.setWidth(cellWidths[i - 1] + "px");
+                }
+            }
+        }
+    }
+
+    public void add(String dayName, final String date,
+            String localized_date_format, String extraClass) {
+        Label l = new Label(dayName + " " + localized_date_format);
+        l.setStylePrimaryName("v-calendar-header-day");
+
+        if (extraClass != null) {
+            l.addStyleDependentName(extraClass);
+        }
+
+        if (verticalSized) {
+            l.addStyleDependentName("Vsized");
+        }
+        if (horizontalSized) {
+            l.addStyleDependentName("Hsized");
+        }
+
+        l.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                if (calendar.getDateClickListener() != null) {
+                    calendar.getDateClickListener().dateClick(date);
+                }
+            }
+        });
+
+        add(l);
+    }
+
+    public void addBackButton() {
+        if (!calendar.isBackwardNavigationEnabled()) {
+            nextLabel.getElement().getStyle().setHeight(0, Unit.PX);
+        }
+        add(backLabel);
+    }
+
+    public void addNextButton() {
+        if (!calendar.isForwardNavigationEnabled()) {
+            backLabel.getElement().getStyle().setHeight(0, Unit.PX);
+        }
+        add(nextLabel);
+    }
+
+    public void onClick(ClickEvent event) {
+        if (!calendar.isDisabledOrReadOnly()) {
+            if (event.getSource() == nextLabel) {
+                if (calendar.getForwardListener() != null) {
+                    calendar.getForwardListener().forward();
+                }
+            } else if (event.getSource() == backLabel) {
+                if (calendar.getBackwardListener() != null) {
+                    calendar.getBackwardListener().backward();
+                }
+            }
+        }
+    }
+
+    public void setVerticalSized(boolean sized) {
+        verticalSized = sized;
+        updateDayLabelSizedStyleNames();
+    }
+
+    public void setHorizontalSized(boolean sized) {
+        horizontalSized = sized;
+        updateDayLabelSizedStyleNames();
+    }
+
+    private void updateDayLabelSizedStyleNames() {
+        Iterator<Widget> it = iterator();
+        while (it.hasNext()) {
+            updateWidgetSizedStyleName(it.next());
+        }
+    }
+
+    private void updateWidgetSizedStyleName(Widget w) {
+        if (verticalSized) {
+            w.addStyleDependentName("Vsized");
+        } else {
+            w.removeStyleDependentName("VSized");
+        }
+        if (horizontalSized) {
+            w.addStyleDependentName("Hsized");
+        } else {
+            w.removeStyleDependentName("HSized");
+        }
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
new file mode 100644
index 0000000000..62332385d2
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.dom.client.HasKeyDownHandlers;
+import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.ComplexPanel;
+import com.google.gwt.user.client.ui.impl.FocusImpl;
+import com.vaadin.client.Focusable;
+
+/**
+ * A ComplexPanel that can be focused
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class FocusableComplexPanel extends ComplexPanel implements
+        HasFocusHandlers, HasBlurHandlers, HasKeyDownHandlers,
+        HasKeyPressHandlers, Focusable {
+
+    protected void makeFocusable() {
+        // make focusable, as we don't need access key magic we don't need to
+        // use FocusImpl.createFocusable
+        getElement().setTabIndex(0);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
+     * google.gwt.event.dom.client.FocusHandler)
+     */
+    public HandlerRegistration addFocusHandler(FocusHandler handler) {
+        return addDomHandler(handler, FocusEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
+     * .gwt.event.dom.client.BlurHandler)
+     */
+    public HandlerRegistration addBlurHandler(BlurHandler handler) {
+        return addDomHandler(handler, BlurEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
+     * com.google.gwt.event.dom.client.KeyDownHandler)
+     */
+    public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
+        return addDomHandler(handler, KeyDownEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
+     * (com.google.gwt.event.dom.client.KeyPressHandler)
+     */
+    public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
+        return addDomHandler(handler, KeyPressEvent.getType());
+    }
+
+    /**
+     * Sets/Removes the keyboard focus to the panel.
+     * 
+     * @param focus
+     *            If set to true then the focus is moved to the panel, if set to
+     *            false the focus is removed
+     */
+    public void setFocus(boolean focus) {
+        if (focus) {
+            FocusImpl.getFocusImplForPanel().focus(getElement());
+        } else {
+            FocusImpl.getFocusImplForPanel().blur(getElement());
+        }
+    }
+
+    /**
+     * Focus the panel
+     */
+    public void focus() {
+        setFocus(true);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
new file mode 100644
index 0000000000..d3177362bf
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.dom.client.HasKeyDownHandlers;
+import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.Grid;
+import com.google.gwt.user.client.ui.impl.FocusImpl;
+import com.vaadin.client.Focusable;
+
+/**
+ * A Grid that can be focused
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class FocusableGrid extends Grid implements HasFocusHandlers,
+        HasBlurHandlers, HasKeyDownHandlers, HasKeyPressHandlers, Focusable {
+
+    /**
+     * Constructor
+     */
+    public FocusableGrid() {
+        super();
+        makeFocusable();
+    }
+
+    public FocusableGrid(int rows, int columns) {
+        super(rows, columns);
+        makeFocusable();
+    }
+
+    protected void makeFocusable() {
+        // make focusable, as we don't need access key magic we don't need to
+        // use FocusImpl.createFocusable
+        getElement().setTabIndex(0);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
+     * google.gwt.event.dom.client.FocusHandler)
+     */
+    public HandlerRegistration addFocusHandler(FocusHandler handler) {
+        return addDomHandler(handler, FocusEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
+     * .gwt.event.dom.client.BlurHandler)
+     */
+    public HandlerRegistration addBlurHandler(BlurHandler handler) {
+        return addDomHandler(handler, BlurEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
+     * com.google.gwt.event.dom.client.KeyDownHandler)
+     */
+    public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
+        return addDomHandler(handler, KeyDownEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
+     * (com.google.gwt.event.dom.client.KeyPressHandler)
+     */
+    public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
+        return addDomHandler(handler, KeyPressEvent.getType());
+    }
+
+    /**
+     * Sets/Removes the keyboard focus to the panel.
+     * 
+     * @param focus
+     *            If set to true then the focus is moved to the panel, if set to
+     *            false the focus is removed
+     */
+    public void setFocus(boolean focus) {
+        if (focus) {
+            FocusImpl.getFocusImplForPanel().focus(getElement());
+        } else {
+            FocusImpl.getFocusImplForPanel().blur(getElement());
+        }
+    }
+
+    /**
+     * Focus the panel
+     */
+    public void focus() {
+        setFocus(true);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
new file mode 100644
index 0000000000..c3fe1958f0
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.dom.client.HasKeyDownHandlers;
+import com.google.gwt.event.dom.client.HasKeyPressHandlers;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.impl.FocusImpl;
+import com.vaadin.client.Focusable;
+
+/**
+ * A HTML widget that can be focused
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class FocusableHTML extends HTML implements HasFocusHandlers,
+        HasBlurHandlers, HasKeyDownHandlers, HasKeyPressHandlers, Focusable {
+
+    /**
+     * Constructor
+     */
+    public FocusableHTML() {
+        // make focusable, as we don't need access key magic we don't need to
+        // use FocusImpl.createFocusable
+        getElement().setTabIndex(0);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
+     * google.gwt.event.dom.client.FocusHandler)
+     */
+    public HandlerRegistration addFocusHandler(FocusHandler handler) {
+        return addDomHandler(handler, FocusEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
+     * .gwt.event.dom.client.BlurHandler)
+     */
+    public HandlerRegistration addBlurHandler(BlurHandler handler) {
+        return addDomHandler(handler, BlurEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
+     * com.google.gwt.event.dom.client.KeyDownHandler)
+     */
+    public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
+        return addDomHandler(handler, KeyDownEvent.getType());
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
+     * (com.google.gwt.event.dom.client.KeyPressHandler)
+     */
+    public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
+        return addDomHandler(handler, KeyPressEvent.getType());
+    }
+
+    /**
+     * Sets/Removes the keyboard focus to the panel.
+     * 
+     * @param focus
+     *            If set to true then the focus is moved to the panel, if set to
+     *            false the focus is removed
+     */
+    public void setFocus(boolean focus) {
+        if (focus) {
+            FocusImpl.getFocusImplForPanel().focus(getElement());
+        } else {
+            FocusImpl.getFocusImplForPanel().blur(getElement());
+        }
+    }
+
+    /**
+     * Focus the panel
+     */
+    public void focus() {
+        setFocus(true);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/HasTooltipKey.java b/client/src/com/vaadin/client/ui/calendar/schedule/HasTooltipKey.java
new file mode 100644
index 0000000000..5827068840
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/HasTooltipKey.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+/**
+ * For Calendar client-side internal use only.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public interface HasTooltipKey {
+    /**
+     * Gets the key associated for the Widget implementing this interface. This
+     * key is used for getting a tooltip title identified by the key
+     * 
+     * @return the tooltip key
+     */
+    Object getTooltipKey();
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
new file mode 100644
index 0000000000..b7f6ee7a3c
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/MonthEventLabel.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * The label in a month cell
+ * 
+ * @since 7.1
+ */
+public class MonthEventLabel extends HTML implements HasTooltipKey {
+
+    private static final String STYLENAME = "v-calendar-event";
+
+    private boolean timeSpecificEvent = false;
+    private Integer eventIndex;
+    private VCalendar calendar;
+    private String caption;
+    private Date time;
+
+    /**
+     * Default constructor
+     */
+    public MonthEventLabel() {
+        setStylePrimaryName(STYLENAME);
+    }
+
+    /**
+     * Set the time of the event label
+     * 
+     * @param date
+     *            The date object that specifies the time
+     */
+    public void setTime(Date date) {
+        time = date;
+        renderCaption();
+    }
+
+    /**
+     * Set the caption of the event label
+     * 
+     * @param caption
+     *            The caption string, can be HTML
+     */
+    public void setCaption(String caption) {
+        this.caption = caption;
+        renderCaption();
+    }
+
+    /**
+     * Renders the caption in the DIV element
+     */
+    private void renderCaption() {
+        StringBuilder html = new StringBuilder();
+        if (caption != null && time != null) {
+            html.append("<span class=\"" + STYLENAME + "-time\">");
+            html.append(calendar.getTimeFormat().format(time));
+            html.append("</span> ");
+            html.append(caption);
+        } else if (caption != null) {
+            html.append(caption);
+        } else if (time != null) {
+            html.append("<span class=\"" + STYLENAME + "-time\">");
+            html.append(calendar.getTimeFormat().format(time));
+            html.append("</span>");
+        }
+        super.setHTML(html.toString());
+    }
+
+    /**
+     * Set the (server side) index of the event
+     * 
+     * @param index
+     *            The integer index
+     */
+    public void setEventIndex(int index) {
+        eventIndex = index;
+    }
+
+    /**
+     * Set the Calendar instance this label belongs to
+     * 
+     * @param calendar
+     *            The calendar instance
+     */
+    public void setCalendar(VCalendar calendar) {
+        this.calendar = calendar;
+    }
+
+    /**
+     * Is the event bound to a specific time
+     * 
+     * @return
+     */
+    public boolean isTimeSpecificEvent() {
+        return timeSpecificEvent;
+    }
+
+    /**
+     * Is the event bound to a specific time
+     * 
+     * @param timeSpecificEvent
+     *            True if the event is bound to a time, false if it is only
+     *            bound to the day
+     */
+    public void setTimeSpecificEvent(boolean timeSpecificEvent) {
+        this.timeSpecificEvent = timeSpecificEvent;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.google.gwt.user.client.ui.HTML#setHTML(java.lang.String)
+     */
+    @Override
+    public void setHTML(String html) {
+        throw new UnsupportedOperationException(
+                "Use setCaption() and setTime() instead");
+    }
+
+    @Override
+    public Object getTooltipKey() {
+        return eventIndex;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
new file mode 100644
index 0000000000..f5afd12e42
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class MonthGrid extends FocusableGrid implements KeyDownHandler {
+
+    private SimpleDayCell selectionStart;
+    private SimpleDayCell selectionEnd;
+    private final VCalendar calendar;
+    private boolean rangeSelectDisabled;
+    private boolean disabled;
+    private boolean enabled = true;
+    private final HandlerRegistration keyDownHandler;
+
+    public MonthGrid(VCalendar parent, int rows, int columns) {
+        super(rows, columns);
+        calendar = parent;
+        setCellSpacing(0);
+        setCellPadding(0);
+        setStylePrimaryName("v-calendar-month");
+
+        keyDownHandler = addKeyDownHandler(this);
+    }
+
+    @Override
+    protected void onUnload() {
+        keyDownHandler.removeHandler();
+        super.onUnload();
+    }
+
+    public void setSelectionEnd(SimpleDayCell simpleDayCell) {
+        selectionEnd = simpleDayCell;
+        updateSelection();
+    }
+
+    public void setSelectionStart(SimpleDayCell simpleDayCell) {
+        if (!rangeSelectDisabled && isEnabled()) {
+            selectionStart = simpleDayCell;
+            setFocus(true);
+        }
+
+    }
+
+    private void updateSelection() {
+        if (selectionStart == null) {
+            return;
+        }
+        if (selectionStart != null && selectionEnd != null) {
+            Date startDate = selectionStart.getDate();
+            Date endDate = selectionEnd.getDate();
+            for (int row = 0; row < getRowCount(); row++) {
+                for (int cell = 0; cell < getCellCount(row); cell++) {
+                    SimpleDayCell sdc = (SimpleDayCell) getWidget(row, cell);
+                    if (sdc == null) {
+                        return;
+                    }
+                    Date d = sdc.getDate();
+                    if (startDate.compareTo(d) <= 0
+                            && endDate.compareTo(d) >= 0) {
+                        sdc.addStyleDependentName("selected");
+                    } else if (startDate.compareTo(d) >= 0
+                            && endDate.compareTo(d) <= 0) {
+                        sdc.addStyleDependentName("selected");
+                    } else {
+                        sdc.removeStyleDependentName("selected");
+                    }
+                }
+            }
+        }
+    }
+
+    public void setSelectionReady() {
+        if (selectionStart != null && selectionEnd != null) {
+            String value = "";
+            Date startDate = selectionStart.getDate();
+            Date endDate = selectionEnd.getDate();
+            if (startDate.compareTo(endDate) > 0) {
+                Date temp = startDate;
+                startDate = endDate;
+                endDate = temp;
+            }
+
+            if (calendar.getRangeSelectListener() != null) {
+                value = calendar.getDateFormat().format(startDate) + "TO"
+                        + calendar.getDateFormat().format(endDate);
+                calendar.getRangeSelectListener().rangeSelected(value);
+            }
+            selectionStart = null;
+            selectionEnd = null;
+            setFocus(false);
+        }
+    }
+
+    public void cancelRangeSelection() {
+        if (selectionStart != null && selectionEnd != null) {
+            for (int row = 0; row < getRowCount(); row++) {
+                for (int cell = 0; cell < getCellCount(row); cell++) {
+                    SimpleDayCell sdc = (SimpleDayCell) getWidget(row, cell);
+                    if (sdc == null) {
+                        return;
+                    }
+                    sdc.removeStyleDependentName("selected");
+                }
+            }
+        }
+        setFocus(false);
+        selectionStart = null;
+    }
+
+    public void updateCellSizes(int totalWidthPX, int totalHeightPX) {
+        boolean setHeight = totalHeightPX > 0;
+        boolean setWidth = totalWidthPX > 0;
+        int rows = getRowCount();
+        int cells = getCellCount(0);
+        int cellWidth = (totalWidthPX / cells) - 1;
+        int widthRemainder = totalWidthPX % cells;
+        // Division for cells might not be even. Distribute it evenly to
+        // will whole space.
+        int heightPX = totalHeightPX;
+        int cellHeight = heightPX / rows;
+        int heightRemainder = heightPX % rows;
+
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cells; j++) {
+                SimpleDayCell sdc = (SimpleDayCell) getWidget(i, j);
+
+                if (setWidth) {
+                    if (widthRemainder > 0) {
+                        sdc.setWidth(cellWidth + 1 + "px");
+                        widthRemainder--;
+
+                    } else {
+                        sdc.setWidth(cellWidth + "px");
+                    }
+                }
+
+                if (setHeight) {
+                    if (heightRemainder > 0) {
+                        sdc.setHeightPX(cellHeight + 1, true);
+
+                    } else {
+                        sdc.setHeightPX(cellHeight, true);
+                    }
+                } else {
+                    sdc.setHeightPX(-1, true);
+                }
+            }
+            heightRemainder--;
+        }
+    }
+
+    /**
+     * Disable or enable possibility to select ranges
+     */
+    public void setRangeSelect(boolean b) {
+        rangeSelectDisabled = !b;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    public void onKeyDown(KeyDownEvent event) {
+        int keycode = event.getNativeKeyCode();
+        if (KeyCodes.KEY_ESCAPE == keycode && selectionStart != null) {
+            cancelRangeSelection();
+        }
+    }
+
+    public int getDayCellIndex(SimpleDayCell dayCell) {
+        int rows = getRowCount();
+        int cells = getCellCount(0);
+        for (int i = 0; i < rows; i++) {
+            for (int j = 0; j < cells; j++) {
+                SimpleDayCell sdc = (SimpleDayCell) getWidget(i, j);
+                if (dayCell == sdc) {
+                    return i * cells + j;
+                }
+            }
+        }
+
+        return -1;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
new file mode 100644
index 0000000000..8d1ca0fcda
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
@@ -0,0 +1,696 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.NativeEvent;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseDownHandler;
+import com.google.gwt.event.dom.client.MouseMoveEvent;
+import com.google.gwt.event.dom.client.MouseMoveHandler;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseOverHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ui.FocusableFlowPanel;
+import com.vaadin.client.ui.VCalendar;
+import com.vaadin.shared.ui.calendar.DateConstants;
+
+/**
+ * A class representing a single cell within the calendar in month-view
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class SimpleDayCell extends FocusableFlowPanel implements
+        MouseUpHandler, MouseDownHandler, MouseOverHandler, MouseMoveHandler {
+
+    private static int BOTTOMSPACERHEIGHT = -1;
+    private static int EVENTHEIGHT = -1;
+    private static final int BORDERPADDINGSIZE = 1;
+
+    private final VCalendar calendar;
+    private Date date;
+    private int intHeight;
+    private final HTML bottomspacer;
+    private final Label caption;
+    private final CalendarEvent[] events = new CalendarEvent[10];
+    private final int cell;
+    private final int row;
+    private boolean monthNameVisible;
+    private HandlerRegistration mouseUpRegistration;
+    private HandlerRegistration mouseDownRegistration;
+    private HandlerRegistration mouseOverRegistration;
+    private boolean monthEventMouseDown;
+    private boolean labelMouseDown;
+    private int eventCount = 0;
+
+    private int startX = -1;
+    private int startY = -1;
+    private int startYrelative;
+    private int startXrelative;
+    private Date startDateFrom;
+    private Date startDateTo;
+    private int prevDayDiff = 0;
+    private int prevWeekDiff = 0;
+    private HandlerRegistration moveRegistration;
+    private CalendarEvent moveEvent;
+    private Widget clickedWidget;
+    private HandlerRegistration bottomSpacerMouseDownHandler;
+    private boolean scrollable = false;
+    private boolean eventCanceled;
+    private MonthGrid monthGrid;
+    private HandlerRegistration keyDownHandler;
+
+    public SimpleDayCell(VCalendar calendar, int row, int cell) {
+        this.calendar = calendar;
+        this.row = row;
+        this.cell = cell;
+        setStylePrimaryName("v-calendar-month-day");
+        caption = new Label();
+        bottomspacer = new HTML();
+        bottomspacer.setStyleName("v-calendar-bottom-spacer-empty");
+        bottomspacer.setWidth(3 + "em");
+        caption.setStyleName("v-calendar-day-number");
+        add(caption);
+        add(bottomspacer);
+        caption.addMouseDownHandler(this);
+        caption.addMouseUpHandler(this);
+    }
+
+    @Override
+    public void onLoad() {
+        BOTTOMSPACERHEIGHT = bottomspacer.getOffsetHeight();
+        EVENTHEIGHT = BOTTOMSPACERHEIGHT;
+    }
+
+    public void setMonthGrid(MonthGrid monthGrid) {
+        this.monthGrid = monthGrid;
+    }
+
+    public MonthGrid getMonthGrid() {
+        return monthGrid;
+    }
+
+    @SuppressWarnings("deprecation")
+    public void setDate(Date date) {
+        int dateOfMonth = date.getDate();
+        if (monthNameVisible) {
+            caption.setText(dateOfMonth + " "
+                    + calendar.getMonthNames()[date.getMonth()]);
+        } else {
+            caption.setText("" + dateOfMonth);
+        }
+        this.date = date;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void reDraw(boolean clear) {
+        setHeightPX(intHeight + BORDERPADDINGSIZE, clear);
+    }
+
+    /*
+     * Events and whole cell content are drawn by this method. By the
+     * clear-argument, you can choose to clear all old content. Notice that
+     * clearing will also remove all element's event handlers.
+     */
+    public void setHeightPX(int px, boolean clear) {
+        // measure from DOM if needed
+        if (px < 0) {
+            intHeight = getOffsetHeight() - BORDERPADDINGSIZE;
+        } else {
+            intHeight = px - BORDERPADDINGSIZE;
+        }
+
+        // Couldn't measure height or it ended up negative. Don't bother
+        // continuing
+        if (intHeight == -1) {
+            return;
+        }
+
+        if (clear) {
+            while (getWidgetCount() > 1) {
+                remove(1);
+            }
+        }
+
+        // How many events can be shown in UI
+        int slots = 0;
+        if (scrollable) {
+            for (int i = 0; i < events.length; i++) {
+                if (events[i] != null) {
+                    slots = i + 1;
+                }
+            }
+            setHeight(intHeight + "px"); // Fixed height
+        } else {
+            // Dynamic height by the content
+            DOM.removeElementAttribute(getElement(), "height");
+            slots = (intHeight - caption.getOffsetHeight() - BOTTOMSPACERHEIGHT)
+                    / EVENTHEIGHT;
+            if (slots > 10) {
+                slots = 10;
+            }
+        }
+
+        updateEvents(slots, clear);
+
+    }
+
+    public void updateEvents(int slots, boolean clear) {
+        int eventsAdded = 0;
+
+        for (int i = 0; i < slots; i++) {
+            CalendarEvent e = events[i];
+            if (e == null) {
+                // Empty slot
+                HTML slot = new HTML();
+                slot.setStyleName("v-calendar-spacer");
+                if (!clear) {
+                    remove(i + 1);
+                    insert(slot, i + 1);
+                } else {
+                    add(slot);
+                }
+            } else {
+                // Event slot
+                eventsAdded++;
+                if (!clear) {
+                    Widget w = getWidget(i + 1);
+                    if (!(w instanceof MonthEventLabel)) {
+                        remove(i + 1);
+                        insert(createMonthEventLabel(e), i + 1);
+                    }
+                } else {
+                    add(createMonthEventLabel(e));
+                }
+            }
+        }
+
+        int remainingSpace = intHeight
+                - ((slots * EVENTHEIGHT) + BOTTOMSPACERHEIGHT + caption
+                        .getOffsetHeight());
+        int newHeight = remainingSpace + BOTTOMSPACERHEIGHT;
+        if (newHeight < 0) {
+            newHeight = EVENTHEIGHT;
+        }
+        bottomspacer.setHeight(newHeight + "px");
+
+        if (clear) {
+            add(bottomspacer);
+        }
+
+        int more = eventCount - eventsAdded;
+        if (more > 0) {
+            if (bottomSpacerMouseDownHandler == null) {
+                bottomSpacerMouseDownHandler = bottomspacer
+                        .addMouseDownHandler(this);
+            }
+            bottomspacer.setStyleName("v-calendar-bottom-spacer");
+            bottomspacer.setText("+ " + more);
+        } else {
+            if (!scrollable && bottomSpacerMouseDownHandler != null) {
+                bottomSpacerMouseDownHandler.removeHandler();
+                bottomSpacerMouseDownHandler = null;
+            }
+
+            if (scrollable) {
+                bottomspacer.setText("[ - ]");
+            } else {
+                bottomspacer.setStyleName("v-calendar-bottom-spacer-empty");
+                bottomspacer.setText("");
+            }
+        }
+    }
+
+    private MonthEventLabel createMonthEventLabel(CalendarEvent e) {
+        long rangeInMillis = e.getRangeInMilliseconds();
+        boolean timeEvent = rangeInMillis <= DateConstants.DAYINMILLIS
+                && !e.isAllDay();
+        Date fromDatetime = e.getStartTime();
+
+        // Create a new MonthEventLabel
+        MonthEventLabel eventDiv = new MonthEventLabel();
+        eventDiv.addStyleDependentName("month");
+        eventDiv.addMouseDownHandler(this);
+        eventDiv.addMouseUpHandler(this);
+        eventDiv.setCalendar(calendar);
+        eventDiv.setEventIndex(e.getIndex());
+
+        if (timeEvent) {
+            eventDiv.setTimeSpecificEvent(true);
+            if (e.getStyleName() != null) {
+                eventDiv.addStyleDependentName(e.getStyleName());
+            }
+            eventDiv.setCaption(e.getCaption());
+            eventDiv.setTime(fromDatetime);
+
+        } else {
+            eventDiv.setTimeSpecificEvent(false);
+            Date from = e.getStart();
+            Date to = e.getEnd();
+            if (e.getStyleName().length() > 0) {
+                eventDiv.addStyleName("month-event " + e.getStyleName());
+            } else {
+                eventDiv.addStyleName("month-event");
+            }
+            int fromCompareToDate = from.compareTo(date);
+            int toCompareToDate = to.compareTo(date);
+            eventDiv.addStyleDependentName("all-day");
+            if (fromCompareToDate == 0) {
+                eventDiv.addStyleDependentName("start");
+                eventDiv.setCaption(e.getCaption());
+
+            } else if (fromCompareToDate < 0 && cell == 0) {
+                eventDiv.addStyleDependentName("continued-from");
+                eventDiv.setCaption(e.getCaption());
+            }
+            if (toCompareToDate == 0) {
+                eventDiv.addStyleDependentName("end");
+            } else if (toCompareToDate > 0
+                    && (cell + 1) == getMonthGrid().getCellCount(row)) {
+                eventDiv.addStyleDependentName("continued-to");
+            }
+            if (e.getStyleName() != null) {
+                eventDiv.addStyleDependentName(e.getStyleName() + "-all-day");
+            }
+        }
+
+        return eventDiv;
+    }
+
+    private void setUnlimitedCellHeight() {
+        scrollable = true;
+        addStyleDependentName("scrollable");
+    }
+
+    private void setLimitedCellHeight() {
+        scrollable = false;
+        removeStyleDependentName("scrollable");
+    }
+
+    public void addCalendarEvent(CalendarEvent e) {
+        eventCount++;
+        int slot = e.getSlotIndex();
+        if (slot == -1) {
+            for (int i = 0; i < events.length; i++) {
+                if (events[i] == null) {
+                    events[i] = e;
+                    e.setSlotIndex(i);
+                    break;
+                }
+            }
+        } else {
+            events[slot] = e;
+        }
+    }
+
+    @SuppressWarnings("deprecation")
+    public void setMonthNameVisible(boolean b) {
+        monthNameVisible = b;
+        int dateOfMonth = date.getDate();
+        caption.setText(dateOfMonth + " "
+                + calendar.getMonthNames()[date.getMonth()]);
+    }
+
+    public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
+        return addDomHandler(handler, MouseMoveEvent.getType());
+    }
+
+    @Override
+    protected void onAttach() {
+        super.onAttach();
+        mouseUpRegistration = addDomHandler(this, MouseUpEvent.getType());
+        mouseDownRegistration = addDomHandler(this, MouseDownEvent.getType());
+        mouseOverRegistration = addDomHandler(this, MouseOverEvent.getType());
+    }
+
+    @Override
+    protected void onDetach() {
+        mouseUpRegistration.removeHandler();
+        mouseDownRegistration.removeHandler();
+        mouseOverRegistration.removeHandler();
+        super.onDetach();
+    }
+
+    public void onMouseUp(MouseUpEvent event) {
+        if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+            return;
+        }
+
+        Widget w = (Widget) event.getSource();
+        if (moveRegistration != null) {
+            Event.releaseCapture(getElement());
+            moveRegistration.removeHandler();
+            moveRegistration = null;
+            keyDownHandler.removeHandler();
+            keyDownHandler = null;
+        }
+
+        if (w == bottomspacer && monthEventMouseDown) {
+            GWT.log("Mouse up over bottomspacer");
+
+        } else if (clickedWidget instanceof MonthEventLabel
+                && monthEventMouseDown) {
+            MonthEventLabel mel = (MonthEventLabel) clickedWidget;
+
+            int endX = event.getClientX();
+            int endY = event.getClientY();
+            int xDiff = startX - endX;
+            int yDiff = startY - endY;
+            startX = -1;
+            startY = -1;
+            prevDayDiff = 0;
+            prevWeekDiff = 0;
+
+            if (!mel.isTimeSpecificEvent()
+                    && (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3)) {
+                eventMoved(moveEvent);
+
+            } else if (calendar.getEventClickListener() != null) {
+                CalendarEvent e = getEventByWidget(mel);
+                calendar.getEventClickListener().eventClick(e);
+            }
+
+            moveEvent = null;
+        } else if (w == this) {
+            getMonthGrid().setSelectionReady();
+
+        } else if (w instanceof Label && labelMouseDown) {
+            String clickedDate = calendar.getDateFormat().format(date);
+            if (calendar.getDateClickListener() != null) {
+                calendar.getDateClickListener().dateClick(clickedDate);
+            }
+        }
+        monthEventMouseDown = false;
+        labelMouseDown = false;
+        clickedWidget = null;
+    }
+
+    public void onMouseDown(MouseDownEvent event) {
+        if (calendar.isDisabled()
+                || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+            return;
+        }
+
+        Widget w = (Widget) event.getSource();
+        clickedWidget = w;
+
+        if (w instanceof MonthEventLabel) {
+            // event clicks should be allowed even when read-only
+            monthEventMouseDown = true;
+
+            if (w instanceof MonthEventLabel) {
+                startCalendarEventDrag(event, (MonthEventLabel) w);
+            }
+        } else if (!calendar.isReadOnly()) {
+            // these are not allowed when in read-only
+            if (w == bottomspacer) {
+                if (scrollable) {
+                    setLimitedCellHeight();
+                } else {
+                    setUnlimitedCellHeight();
+                }
+                reDraw(true);
+
+            } else if (w == this && !scrollable) {
+                MonthGrid grid = getMonthGrid();
+                if (grid.isEnabled() && calendar.isRangeSelectAllowed()) {
+                    grid.setSelectionStart(this);
+                    grid.setSelectionEnd(this);
+                }
+            } else if (w instanceof Label) {
+                labelMouseDown = true;
+            }
+        }
+
+        event.stopPropagation();
+        event.preventDefault();
+    }
+
+    public void onMouseOver(MouseOverEvent event) {
+        event.preventDefault();
+        getMonthGrid().setSelectionEnd(this);
+    }
+
+    public void onMouseMove(MouseMoveEvent event) {
+        if (clickedWidget instanceof MonthEventLabel && !monthEventMouseDown
+                || (startY < 0 && startX < 0)) {
+            return;
+        }
+
+        MonthEventLabel w = (MonthEventLabel) clickedWidget;
+
+        if (calendar.isDisabledOrReadOnly()) {
+            Event.releaseCapture(getElement());
+            monthEventMouseDown = false;
+            startY = -1;
+            startX = -1;
+            return;
+        }
+
+        int currentY = event.getClientY();
+        int currentX = event.getClientX();
+        int moveY = (currentY - startY);
+        int moveX = (currentX - startX);
+        if ((moveY < 5 && moveY > -6) && (moveX < 5 && moveX > -6)) {
+            return;
+        }
+
+        int dateCellWidth = getWidth();
+        int dateCellHeigth = getHeigth();
+
+        Element parent = getMonthGrid().getElement();
+        int relativeX = event.getRelativeX(parent);
+        int relativeY = event.getRelativeY(parent);
+        int weekDiff = 0;
+        if (moveY > 0) {
+            weekDiff = (startYrelative + moveY) / dateCellHeigth;
+        } else {
+            weekDiff = (moveY - (dateCellHeigth - startYrelative))
+                    / dateCellHeigth;
+        }
+
+        int dayDiff = 0;
+        if (moveX >= 0) {
+            dayDiff = (startXrelative + moveX) / dateCellWidth;
+        } else {
+            dayDiff = (moveX - (dateCellWidth - startXrelative))
+                    / dateCellWidth;
+        }
+        // Check boundaries
+        if (relativeY < 0
+                || relativeY >= (calendar.getMonthGrid().getRowCount() * dateCellHeigth)
+                || relativeX < 0
+                || relativeX >= (calendar.getMonthGrid().getColumnCount() * dateCellWidth)) {
+            return;
+        }
+
+        GWT.log("Event moving delta: " + weekDiff + " weeks " + dayDiff
+                + " days" + " (" + getCell() + "," + getRow() + ")");
+
+        CalendarEvent e = moveEvent;
+        if (e == null) {
+            e = getEventByWidget(w);
+        }
+
+        Date from = e.getStart();
+        Date to = e.getEnd();
+        long duration = to.getTime() - from.getTime();
+
+        long daysMs = dayDiff * DateConstants.DAYINMILLIS;
+        long weeksMs = weekDiff * DateConstants.WEEKINMILLIS;
+        from.setTime(startDateFrom.getTime() + weeksMs + daysMs);
+        to.setTime((from.getTime() + duration));
+        e.setStart(from);
+        e.setEnd(to);
+        e.setStartTime(new Date(from.getTime()));
+        e.setEndTime(new Date(to.getTime()));
+
+        updateDragPosition(w, dayDiff, weekDiff);
+    }
+
+    private void eventMoved(CalendarEvent e) {
+        calendar.updateEventToMonthGrid(e);
+        if (calendar.getEventMovedListener() != null) {
+            calendar.getEventMovedListener().eventMoved(e);
+        }
+    }
+
+    public void startCalendarEventDrag(MouseDownEvent event,
+            final MonthEventLabel w) {
+        if (w.isTimeSpecificEvent()) {
+            return;
+        }
+
+        moveRegistration = addMouseMoveHandler(this);
+        startX = event.getClientX();
+        startY = event.getClientY();
+        startYrelative = event.getRelativeY(w.getParent().getElement())
+                % getHeigth();
+        startXrelative = event.getRelativeX(w.getParent().getElement())
+                % getWidth();
+
+        CalendarEvent e = getEventByWidget(w);
+        startDateFrom = (Date) e.getStart().clone();
+        startDateTo = (Date) e.getEnd().clone();
+
+        Event.setCapture(getElement());
+        keyDownHandler = addKeyDownHandler(new KeyDownHandler() {
+
+            public void onKeyDown(KeyDownEvent event) {
+                if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
+                    cancelEventDrag(w);
+                }
+            }
+
+        });
+
+        focus();
+
+        GWT.log("Start drag");
+    }
+
+    protected void cancelEventDrag(MonthEventLabel w) {
+        if (moveRegistration != null) {
+            // reset position
+            if (moveEvent == null) {
+                moveEvent = getEventByWidget(w);
+            }
+
+            moveEvent.setStart(startDateFrom);
+            moveEvent.setEnd(startDateTo);
+            calendar.updateEventToMonthGrid(moveEvent);
+
+            // reset drag-related properties
+            Event.releaseCapture(getElement());
+            moveRegistration.removeHandler();
+            moveRegistration = null;
+            keyDownHandler.removeHandler();
+            keyDownHandler = null;
+            setFocus(false);
+            monthEventMouseDown = false;
+            startY = -1;
+            startX = -1;
+            moveEvent = null;
+            labelMouseDown = false;
+            clickedWidget = null;
+        }
+    }
+
+    public void updateDragPosition(MonthEventLabel w, int dayDiff, int weekDiff) {
+        // Draw event to its new position only when position has changed
+        if (dayDiff == prevDayDiff && weekDiff == prevWeekDiff) {
+            return;
+        }
+
+        prevDayDiff = dayDiff;
+        prevWeekDiff = weekDiff;
+
+        if (moveEvent == null) {
+            moveEvent = getEventByWidget(w);
+        }
+
+        calendar.updateEventToMonthGrid(moveEvent);
+    }
+
+    public int getRow() {
+        return row;
+    }
+
+    public int getCell() {
+        return cell;
+    }
+
+    public int getHeigth() {
+        return intHeight + BORDERPADDINGSIZE;
+    }
+
+    public int getWidth() {
+        return getOffsetWidth() - BORDERPADDINGSIZE;
+    }
+
+    public void setToday(boolean today) {
+        if (today) {
+            addStyleDependentName("today");
+        } else {
+            removeStyleDependentName("today");
+        }
+    }
+
+    public boolean removeEvent(CalendarEvent targetEvent,
+            boolean reDrawImmediately) {
+        int slot = targetEvent.getSlotIndex();
+        if (slot < 0) {
+            return false;
+        }
+
+        CalendarEvent e = getCalendarEvent(slot);
+        if (targetEvent.equals(e)) {
+            events[slot] = null;
+            eventCount--;
+            if (reDrawImmediately) {
+                reDraw(moveEvent == null);
+            }
+            return true;
+        }
+        return false;
+    }
+
+    private CalendarEvent getEventByWidget(MonthEventLabel eventWidget) {
+        int index = getWidgetIndex(eventWidget);
+        return getCalendarEvent(index - 1);
+    }
+
+    public CalendarEvent getCalendarEvent(int i) {
+        return events[i];
+    }
+
+    public CalendarEvent[] getEvents() {
+        return events;
+    }
+
+    public int getEventCount() {
+        return eventCount;
+    }
+
+    public CalendarEvent getMoveEvent() {
+        return moveEvent;
+    }
+
+    public void addEmphasisStyle() {
+        addStyleDependentName("dragemphasis");
+    }
+
+    public void removeEmphasisStyle() {
+        removeStyleDependentName("dragemphasis");
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayToolbar.java
new file mode 100644
index 0000000000..fc75136b93
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayToolbar.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ * 
+ */
+public class SimpleDayToolbar extends HorizontalPanel {
+    private int width = 0;
+    private boolean isWidthUndefined = false;
+
+    public SimpleDayToolbar() {
+        setStylePrimaryName("v-calendar-header-month");
+    }
+
+    public void setDayNames(String[] dayNames) {
+        clear();
+        for (int i = 0; i < dayNames.length; i++) {
+            Label l = new Label(dayNames[i]);
+            l.setStylePrimaryName("v-calendar-header-day");
+            add(l);
+        }
+        updateCellWidth();
+    }
+
+    public void setWidthPX(int width) {
+        this.width = width;
+
+        setWidthUndefined(width == -1);
+
+        if (!isWidthUndefined()) {
+            super.setWidth(this.width + "px");
+            if (getWidgetCount() == 0) {
+                return;
+            }
+        }
+        updateCellWidth();
+    }
+
+    private boolean isWidthUndefined() {
+        return isWidthUndefined;
+    }
+
+    private void setWidthUndefined(boolean isWidthUndefined) {
+        this.isWidthUndefined = isWidthUndefined;
+
+        if (isWidthUndefined) {
+            addStyleDependentName("Hsized");
+
+        } else {
+            removeStyleDependentName("Hsized");
+        }
+    }
+
+    private void updateCellWidth() {
+        int cellw = -1;
+        int widgetCount = getWidgetCount();
+        if (widgetCount <= 0) {
+            return;
+        }
+        if (isWidthUndefined()) {
+            Widget widget = getWidget(0);
+            String w = widget.getElement().getStyle().getWidth();
+            if (w.length() > 2) {
+                cellw = Integer.parseInt(w.substring(0, w.length() - 2));
+            }
+        } else {
+            cellw = width / getWidgetCount();
+        }
+        if (cellw > 0) {
+            for (int i = 0; i < getWidgetCount(); i++) {
+                Widget widget = getWidget(i);
+                setCellWidth(widget, cellw + "px");
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
new file mode 100644
index 0000000000..f86ba03053
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class SimpleWeekToolbar extends FlexTable implements ClickHandler {
+    private int height;
+    private VCalendar calendar;
+    private boolean isHeightUndefined;
+
+    public SimpleWeekToolbar(VCalendar parent) {
+        calendar = parent;
+        setCellSpacing(0);
+        setCellPadding(0);
+        setStyleName("v-calendar-week-numbers");
+    }
+
+    public void addWeek(int week, int year) {
+        WeekLabel l = new WeekLabel(week + "", week, year);
+        l.addClickHandler(this);
+        int rowCount = getRowCount();
+        insertRow(rowCount);
+        setWidget(rowCount, 0, l);
+        updateCellHeights();
+    }
+
+    public void updateCellHeights() {
+        if (!isHeightUndefined()) {
+            int rowCount = getRowCount();
+            if (rowCount == 0) {
+                return;
+            }
+            int cellheight = (height / rowCount) - 1;
+            int remainder = height % rowCount;
+            if (cellheight < 0) {
+                cellheight = 0;
+            }
+            for (int i = 0; i < rowCount; i++) {
+                if (remainder > 0) {
+                    getWidget(i, 0).setHeight(cellheight + 1 + "px");
+                } else {
+                    getWidget(i, 0).setHeight(cellheight + "px");
+                }
+                getWidget(i, 0).getElement().getStyle()
+                        .setProperty("lineHeight", cellheight + "px");
+                remainder--;
+            }
+        } else {
+            for (int i = 0; i < getRowCount(); i++) {
+                getWidget(i, 0).setHeight("");
+                getWidget(i, 0).getElement().getStyle()
+                        .setProperty("lineHeight", "");
+            }
+        }
+    }
+
+    public void setHeightPX(int intHeight) {
+        setHeightUndefined(intHeight == -1);
+        height = intHeight;
+        updateCellHeights();
+    }
+
+    public boolean isHeightUndefined() {
+        return isHeightUndefined;
+    }
+
+    public void setHeightUndefined(boolean isHeightUndefined) {
+        this.isHeightUndefined = isHeightUndefined;
+
+        if (isHeightUndefined) {
+            addStyleDependentName("Vsized");
+
+        } else {
+            removeStyleDependentName("Vsized");
+        }
+    }
+
+    public void onClick(ClickEvent event) {
+        WeekLabel wl = (WeekLabel) event.getSource();
+        if (calendar.getWeekClickListener() != null) {
+            calendar.getWeekClickListener().weekClick(
+                    wl.getYear() + "w" + wl.getWeek());
+        }
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
new file mode 100644
index 0000000000..c5646f97ae
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
@@ -0,0 +1,677 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Arrays;
+import java.util.Date;
+
+import com.google.gwt.dom.client.Element;
+import com.google.gwt.dom.client.Style;
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.event.dom.client.ScrollEvent;
+import com.google.gwt.event.dom.client.ScrollHandler;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Panel;
+import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.DateTimeService;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class WeekGrid extends SimplePanel {
+
+    int width = 0;
+    private int height = 0;
+    final HorizontalPanel content;
+    private VCalendar calendar;
+    private boolean disabled;
+    final Timebar timebar;
+    private Panel wrapper;
+    private boolean verticalScrollEnabled;
+    private boolean horizontalScrollEnabled;
+    private int[] cellHeights;
+    private final int slotInMinutes = 30;
+    private int dateCellBorder;
+    private DateCell dateCellOfToday;
+    private int[] cellWidths;
+    private int firstHour;
+    private int lastHour;
+
+    public WeekGrid(VCalendar parent, boolean format24h) {
+        setCalendar(parent);
+        content = new HorizontalPanel();
+        timebar = new Timebar(format24h);
+        content.add(timebar);
+
+        wrapper = new SimplePanel();
+        wrapper.setStylePrimaryName("v-calendar-week-wrapper");
+        wrapper.add(content);
+
+        setWidget(wrapper);
+    }
+
+    private void setVerticalScroll(boolean isVerticalScrollEnabled) {
+        if (isVerticalScrollEnabled && !(isVerticalScrollable())) {
+            verticalScrollEnabled = true;
+            horizontalScrollEnabled = false;
+            wrapper.remove(content);
+
+            final ScrollPanel scrollPanel = new ScrollPanel();
+            scrollPanel.setStylePrimaryName("v-calendar-week-wrapper");
+            scrollPanel.setWidget(content);
+
+            scrollPanel.addScrollHandler(new ScrollHandler() {
+                public void onScroll(ScrollEvent event) {
+                    if (calendar.getScrollListener() != null) {
+                        calendar.getScrollListener().scroll(
+                                scrollPanel.getVerticalScrollPosition());
+                    }
+                }
+            });
+
+            setWidget(scrollPanel);
+            wrapper = scrollPanel;
+
+        } else if (!isVerticalScrollEnabled && (isVerticalScrollable())) {
+            verticalScrollEnabled = false;
+            horizontalScrollEnabled = false;
+            wrapper.remove(content);
+
+            SimplePanel simplePanel = new SimplePanel();
+            simplePanel.setStylePrimaryName("v-calendar-week-wrapper");
+            simplePanel.setWidget(content);
+
+            setWidget(simplePanel);
+            wrapper = simplePanel;
+        }
+    }
+
+    public void setVerticalScrollPosition(int verticalScrollPosition) {
+        if (isVerticalScrollable()) {
+            ((ScrollPanel) wrapper)
+                    .setVerticalScrollPosition(verticalScrollPosition);
+        }
+    }
+
+    public int getInternalWidth() {
+        return width;
+    }
+
+    public void addDate(Date d) {
+        final DateCell dc = new DateCell(this, d);
+        dc.setDisabled(isDisabled());
+        dc.setHorizontalSized(isHorizontalScrollable() || width < 0);
+        dc.setVerticalSized(isVerticalScrollable());
+        content.add(dc);
+    }
+
+    /**
+     * @param dateCell
+     * @return get the index of the given date cell in this week, starting from
+     *         0
+     */
+    public int getDateCellIndex(DateCell dateCell) {
+        return content.getWidgetIndex(dateCell) - 1;
+    }
+
+    /**
+     * @return get the slot border in pixels
+     */
+    public int getDateSlotBorder() {
+        return ((DateCell) content.getWidget(1)).getSlotBorder();
+    }
+
+    private boolean isVerticalScrollable() {
+        return verticalScrollEnabled;
+    }
+
+    private boolean isHorizontalScrollable() {
+        return horizontalScrollEnabled;
+    }
+
+    public void setWidthPX(int width) {
+        if (isHorizontalScrollable()) {
+            updateCellWidths();
+
+            // Otherwise the scroll wrapper is somehow too narrow = horizontal
+            // scroll
+            wrapper.setWidth(content.getOffsetWidth()
+                    + Util.getNativeScrollbarSize() + "px");
+
+            this.width = content.getOffsetWidth() - timebar.getOffsetWidth();
+
+        } else {
+            this.width = (width == -1) ? width : width
+                    - timebar.getOffsetWidth();
+
+            if (isVerticalScrollable() && width != -1) {
+                this.width = this.width - Util.getNativeScrollbarSize();
+            }
+            updateCellWidths();
+        }
+    }
+
+    public void setHeightPX(int intHeight) {
+        height = intHeight;
+
+        setVerticalScroll(height <= -1);
+
+        // if not scrollable, use any height given
+        if (!isVerticalScrollable() && height > 0) {
+
+            content.setHeight(height + "px");
+            setHeight(height + "px");
+            wrapper.setHeight(height + "px");
+            wrapper.removeStyleDependentName("Vsized");
+            updateCellHeights();
+            timebar.setCellHeights(cellHeights);
+            timebar.setHeightPX(height);
+
+        } else if (isVerticalScrollable()) {
+            updateCellHeights();
+            wrapper.addStyleDependentName("Vsized");
+            timebar.setCellHeights(cellHeights);
+            timebar.setHeightPX(height);
+        }
+    }
+
+    public void clearDates() {
+        while (content.getWidgetCount() > 1) {
+            content.remove(1);
+        }
+
+        dateCellOfToday = null;
+    }
+
+    /**
+     * @return true if this weekgrid contains a date that is today
+     */
+    public boolean hasToday() {
+        return dateCellOfToday != null;
+    }
+
+    public void updateCellWidths() {
+        if (!isHorizontalScrollable() && width != -1) {
+            int count = content.getWidgetCount();
+            int datesWidth = width;
+            if (datesWidth > 0 && count > 1) {
+                cellWidths = VCalendar
+                        .distributeSize(datesWidth, count - 1, -1);
+
+                for (int i = 1; i < count; i++) {
+                    DateCell dc = (DateCell) content.getWidget(i);
+                    dc.setHorizontalSized(isHorizontalScrollable() || width < 0);
+                    dc.setWidthPX(cellWidths[i - 1]);
+                    if (dc.isToday()) {
+                        dc.setTimeBarWidth(getOffsetWidth());
+                    }
+                }
+            }
+
+        } else {
+            int count = content.getWidgetCount();
+            if (count > 1) {
+                for (int i = 1; i < count; i++) {
+                    DateCell dc = (DateCell) content.getWidget(i);
+                    dc.setHorizontalSized(isHorizontalScrollable() || width < 0);
+                }
+            }
+        }
+    }
+
+    /**
+     * @return an int-array containing the widths of the cells (days)
+     */
+    public int[] getDateCellWidths() {
+        return cellWidths;
+    }
+
+    public void updateCellHeights() {
+        if (!isVerticalScrollable()) {
+            int count = content.getWidgetCount();
+            if (count > 1) {
+                DateCell first = (DateCell) content.getWidget(1);
+                dateCellBorder = first.getSlotBorder();
+                cellHeights = VCalendar.distributeSize(height,
+                        first.getNumberOfSlots(), -dateCellBorder);
+                for (int i = 1; i < count; i++) {
+                    DateCell dc = (DateCell) content.getWidget(i);
+                    dc.setHeightPX(height, cellHeights);
+                }
+            }
+
+        } else {
+            int count = content.getWidgetCount();
+            if (count > 1) {
+                DateCell first = (DateCell) content.getWidget(1);
+                dateCellBorder = first.getSlotBorder();
+                int dateHeight = (first.getOffsetHeight() / first
+                        .getNumberOfSlots()) - dateCellBorder;
+                cellHeights = new int[48];
+                Arrays.fill(cellHeights, dateHeight);
+
+                for (int i = 1; i < count; i++) {
+                    DateCell dc = (DateCell) content.getWidget(i);
+                    dc.setVerticalSized(isVerticalScrollable());
+                }
+            }
+        }
+    }
+
+    public void addEvent(CalendarEvent e) {
+        int dateCount = content.getWidgetCount();
+        Date from = e.getStart();
+        Date toTime = e.getEndTime();
+        for (int i = 1; i < dateCount; i++) {
+            DateCell dc = (DateCell) content.getWidget(i);
+            Date dcDate = dc.getDate();
+            int comp = dcDate.compareTo(from);
+            int comp2 = dcDate.compareTo(toTime);
+            if (comp >= 0
+                    && comp2 < 0
+                    || (comp == 0 && comp2 == 0 && VCalendar
+                            .isZeroLengthMidnightEvent(e))) {
+                // Same event may be over two DateCells if event's date
+                // range floats over one day. It can't float over two days,
+                // because event which range is over 24 hours, will be handled
+                // as a "fullDay" event.
+                dc.addEvent(dcDate, e);
+            }
+        }
+    }
+
+    public int getPixelLengthFor(int startFromMinutes, int durationInMinutes) {
+        int pixelLength = 0;
+        int currentSlot = 0;
+
+        int firstHourInMinutes = firstHour * 60;
+
+        if (firstHourInMinutes > startFromMinutes) {
+            startFromMinutes = 0;
+        } else {
+            startFromMinutes -= firstHourInMinutes;
+        }
+
+        // calculate full slots to event
+        int slotsTillEvent = startFromMinutes / slotInMinutes;
+        int startOverFlowTime = slotInMinutes
+                - (startFromMinutes % slotInMinutes);
+        if (startOverFlowTime == slotInMinutes) {
+            startOverFlowTime = 0;
+            currentSlot = slotsTillEvent;
+        } else {
+            currentSlot = slotsTillEvent + 1;
+        }
+
+        int durationInSlots = 0;
+        int endOverFlowTime = 0;
+
+        if (startOverFlowTime > 0) {
+            durationInSlots = (durationInMinutes - startOverFlowTime)
+                    / slotInMinutes;
+            endOverFlowTime = (durationInMinutes - startOverFlowTime)
+                    % slotInMinutes;
+
+        } else {
+            durationInSlots = durationInMinutes / slotInMinutes;
+            endOverFlowTime = durationInMinutes % slotInMinutes;
+        }
+
+        // calculate slot overflow at start
+        if (startOverFlowTime > 0 && currentSlot < cellHeights.length) {
+            int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder;
+            pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * startOverFlowTime);
+        }
+
+        // calculate length in full slots
+        int lastFullSlot = currentSlot + durationInSlots;
+        for (; currentSlot < lastFullSlot && currentSlot < cellHeights.length; currentSlot++) {
+            pixelLength += cellHeights[currentSlot] + dateCellBorder;
+        }
+
+        // calculate overflow at end
+        if (endOverFlowTime > 0 && currentSlot < cellHeights.length) {
+            int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder;
+            pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * endOverFlowTime);
+        }
+
+        // reduce possible underflow at end
+        if (endOverFlowTime < 0) {
+            int lastSlotHeight = cellHeights[currentSlot] + dateCellBorder;
+            pixelLength += (int) (((double) lastSlotHeight / (double) slotInMinutes) * endOverFlowTime);
+        }
+
+        return pixelLength;
+    }
+
+    public int getPixelTopFor(int startFromMinutes) {
+        int pixelsToTop = 0;
+        int slotIndex = 0;
+
+        int firstHourInMinutes = firstHour * 60;
+
+        if (firstHourInMinutes > startFromMinutes) {
+            startFromMinutes = 0;
+        } else {
+            startFromMinutes -= firstHourInMinutes;
+        }
+
+        // calculate full slots to event
+        int slotsTillEvent = startFromMinutes / slotInMinutes;
+        int overFlowTime = startFromMinutes % slotInMinutes;
+        if (slotsTillEvent > 0) {
+            for (slotIndex = 0; slotIndex < slotsTillEvent; slotIndex++) {
+                pixelsToTop += cellHeights[slotIndex] + dateCellBorder;
+            }
+        }
+
+        // calculate lengths less than one slot
+        if (overFlowTime > 0) {
+            int lastSlotHeight = cellHeights[slotIndex] + dateCellBorder;
+            pixelsToTop += ((double) lastSlotHeight / (double) slotInMinutes)
+                    * overFlowTime;
+        }
+
+        return pixelsToTop;
+    }
+
+    public void eventMoved(DateCellDayEvent dayEvent) {
+        Style s = dayEvent.getElement().getStyle();
+        int left = Integer.parseInt(s.getLeft().substring(0,
+                s.getLeft().length() - 2));
+        DateCell previousParent = (DateCell) dayEvent.getParent();
+        DateCell newParent = (DateCell) content
+                .getWidget((left / getDateCellWidth()) + 1);
+        CalendarEvent se = dayEvent.getCalendarEvent();
+        previousParent.removeEvent(dayEvent);
+        newParent.addEvent(dayEvent);
+        if (!previousParent.equals(newParent)) {
+            previousParent.recalculateEventWidths();
+        }
+        newParent.recalculateEventWidths();
+        if (calendar.getEventMovedListener() != null) {
+            calendar.getEventMovedListener().eventMoved(se);
+        }
+    }
+
+    public void setToday(Date todayDate, Date todayTimestamp) {
+        int count = content.getWidgetCount();
+        if (count > 1) {
+            for (int i = 1; i < count; i++) {
+                DateCell dc = (DateCell) content.getWidget(i);
+                if (dc.getDate().getTime() == todayDate.getTime()) {
+                    if (isVerticalScrollable()) {
+                        dc.setToday(todayTimestamp, -1);
+                    } else {
+                        dc.setToday(todayTimestamp, getOffsetWidth());
+                    }
+                }
+                dateCellOfToday = dc;
+            }
+        }
+    }
+
+    public DateCell getDateCellOfToday() {
+        return dateCellOfToday;
+    }
+
+    public void setDisabled(boolean disabled) {
+        this.disabled = disabled;
+    }
+
+    public boolean isDisabled() {
+        return disabled;
+    }
+
+    public Timebar getTimeBar() {
+        return timebar;
+    }
+
+    public void setDateColor(Date when, Date to, String styleName) {
+        int dateCount = content.getWidgetCount();
+        for (int i = 1; i < dateCount; i++) {
+            DateCell dc = (DateCell) content.getWidget(i);
+            Date dcDate = dc.getDate();
+            int comp = dcDate.compareTo(when);
+            int comp2 = dcDate.compareTo(to);
+            if (comp >= 0 && comp2 <= 0) {
+                dc.setDateColor(styleName);
+            }
+        }
+    }
+
+    /**
+     * @param calendar
+     *            the calendar to set
+     */
+    public void setCalendar(VCalendar calendar) {
+        this.calendar = calendar;
+    }
+
+    /**
+     * @return the calendar
+     */
+    public VCalendar getCalendar() {
+        return calendar;
+    }
+
+    /**
+     * Get width of the single date cell
+     * 
+     * @return Date cell width
+     */
+    public int getDateCellWidth() {
+        int count = content.getWidgetCount() - 1;
+        int cellWidth = -1;
+        if (count <= 0) {
+            return cellWidth;
+        }
+
+        if (width == -1) {
+            Widget firstWidget = content.getWidget(1);
+            cellWidth = firstWidget.getElement().getOffsetWidth();
+        } else {
+            cellWidth = getInternalWidth() / count;
+        }
+        return cellWidth;
+    }
+
+    /**
+     * @return the number of day cells in this week
+     */
+    public int getDateCellCount() {
+        return content.getWidgetCount() - 1;
+    }
+
+    public void setFirstHour(int firstHour) {
+        this.firstHour = firstHour;
+        timebar.setFirstHour(firstHour);
+    }
+
+    public void setLastHour(int lastHour) {
+        this.lastHour = lastHour;
+        timebar.setLastHour(lastHour);
+    }
+
+    public int getFirstHour() {
+        return firstHour;
+    }
+
+    public int getLastHour() {
+        return lastHour;
+    }
+
+    public static class Timebar extends HTML {
+
+        private static final int[] timesFor12h = { 12, 1, 2, 3, 4, 5, 6, 7, 8,
+                9, 10, 11 };
+
+        private int height;
+
+        private final int verticalPadding = 7; // FIXME measure this from DOM
+
+        private int[] slotCellHeights;
+
+        private int firstHour;
+
+        private int lastHour;
+
+        public Timebar(boolean format24h) {
+            createTimeBar(format24h);
+        }
+
+        public void setLastHour(int lastHour) {
+            this.lastHour = lastHour;
+        }
+
+        public void setFirstHour(int firstHour) {
+            this.firstHour = firstHour;
+
+        }
+
+        public void setCellHeights(int[] cellHeights) {
+            slotCellHeights = cellHeights;
+        }
+
+        private void createTimeBar(boolean format24h) {
+            setStylePrimaryName("v-calendar-times");
+
+            // Fist "time" is empty
+            Element e = DOM.createDiv();
+            setStyleName(e, "v-calendar-time");
+            e.setInnerText("");
+            getElement().appendChild(e);
+
+            DateTimeService dts = new DateTimeService();
+
+            if (format24h) {
+                for (int i = firstHour + 1; i <= lastHour; i++) {
+                    e = DOM.createDiv();
+                    setStyleName(e, "v-calendar-time");
+                    String delimiter = dts.getClockDelimeter();
+                    e.setInnerHTML("<span>" + i + "</span>" + delimiter + "00");
+                    getElement().appendChild(e);
+                }
+            } else {
+                // FIXME Use dts.getAmPmStrings(); and make sure that
+                // DateTimeService has a some Locale set.
+                String[] ampm = new String[] { "AM", "PM" };
+
+                int amStop = (lastHour < 11) ? lastHour : 11;
+                int pmStart = (firstHour > 11) ? firstHour % 11 : 0;
+
+                if (firstHour < 12) {
+                    for (int i = firstHour + 1; i <= amStop; i++) {
+                        e = DOM.createDiv();
+                        setStyleName(e, "v-calendar-time");
+                        e.setInnerHTML("<span>" + timesFor12h[i] + "</span>"
+                                + " " + ampm[0]);
+                        getElement().appendChild(e);
+                    }
+                }
+
+                if (lastHour > 11) {
+                    for (int i = pmStart; i < lastHour - 11; i++) {
+                        e = DOM.createDiv();
+                        setStyleName(e, "v-calendar-time");
+                        e.setInnerHTML("<span>" + timesFor12h[i] + "</span>"
+                                + " " + ampm[1]);
+                        getElement().appendChild(e);
+                    }
+                }
+            }
+        }
+
+        public void updateTimeBar(boolean format24h) {
+            clear();
+            createTimeBar(format24h);
+        }
+
+        private void clear() {
+            while (getElement().getChildCount() > 0) {
+                getElement().removeChild(getElement().getChild(0));
+            }
+        }
+
+        public void setHeightPX(int pixelHeight) {
+            height = pixelHeight;
+
+            if (pixelHeight > -1) {
+                // as the negative margins on children pulls the whole element
+                // upwards, we must compensate. otherwise the element would be
+                // too short
+                super.setHeight((height + verticalPadding) + "px");
+                removeStyleDependentName("Vsized");
+                updateChildHeights();
+
+            } else {
+                addStyleDependentName("Vsized");
+                updateChildHeights();
+            }
+        }
+
+        private void updateChildHeights() {
+            int childCount = getElement().getChildCount();
+
+            if (height != -1) {
+
+                // 23 hours + first is empty
+                // we try to adjust the height of time labels to the distributed
+                // heights of the time slots
+                int hoursPerDay = lastHour - firstHour + 1;
+
+                int slotsPerHour = slotCellHeights.length / hoursPerDay;
+                int[] cellHeights = new int[slotCellHeights.length
+                        / slotsPerHour];
+
+                int slotHeightPosition = 0;
+                for (int i = 0; i < cellHeights.length; i++) {
+                    for (int j = slotHeightPosition; j < slotHeightPosition
+                            + slotsPerHour; j++) {
+                        cellHeights[i] += slotCellHeights[j] + 1;
+                        // 1px more for borders
+                        // FIXME measure from DOM
+                    }
+                    slotHeightPosition += slotsPerHour;
+                }
+
+                for (int i = 0; i < childCount; i++) {
+                    Element e = (Element) getElement().getChild(i);
+                    e.getStyle().setHeight(cellHeights[i], Unit.PX);
+                }
+
+            } else {
+                for (int i = 0; i < childCount; i++) {
+                    Element e = (Element) getElement().getChild(i);
+                    e.getStyle().setProperty("height", "");
+                }
+            }
+        }
+    }
+
+    public VCalendar getParentCalendar() {
+        return calendar;
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
new file mode 100644
index 0000000000..27ace91c4e
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+/**
+ * Internally used by the calendar
+ * 
+ * @since 7.1
+ */
+public class WeekGridMinuteTimeRange {
+    private final Date start;
+    private final Date end;
+
+    /**
+     * Creates a Date time range between start and end date. Drops seconds
+     * from the range.
+     * 
+     * @param start
+     *            Start time of the range
+     * @param end
+     *            End time of the range
+     * @param clearSeconds
+     *            Boolean Indicates, if seconds should be dropped from the
+     *            range start and end
+     */
+    public WeekGridMinuteTimeRange(Date start, Date end) {
+        this.start = new Date(start.getTime());
+        this.end = new Date(end.getTime());
+        this.start.setSeconds(0);
+        this.end.setSeconds(0);
+    }
+
+    public Date getStart() {
+        return start;
+    }
+
+    public Date getEnd() {
+        return end;
+    }
+
+    public static boolean doesOverlap(WeekGridMinuteTimeRange a, WeekGridMinuteTimeRange b) {
+        boolean overlaps = a.getStart().compareTo(b.getEnd()) < 0
+                && a.getEnd().compareTo(b.getStart()) > 0;
+        return overlaps;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeekLabel.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeekLabel.java
new file mode 100644
index 0000000000..bde8675435
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeekLabel.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import com.google.gwt.user.client.ui.Label;
+
+/**
+ * A label in the {@link SimpleWeekToolbar}
+ * 
+ * @since 7.1
+ */
+public class WeekLabel extends Label {
+    private int week;
+    private int year;
+
+    public WeekLabel(String string, int week2, int year2) {
+        super(string);
+        setStylePrimaryName("v-calendar-week-number");
+        week = week2;
+        year = year2;
+    }
+
+    public int getWeek() {
+        return week;
+    }
+
+    public void setWeek(int week) {
+        this.week = week;
+    }
+
+    public int getYear() {
+        return year;
+    }
+
+    public void setYear(int year) {
+        this.year = year;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
new file mode 100644
index 0000000000..e3b7d5d7fe
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+import java.util.List;
+
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public class WeeklyLongEvents extends HorizontalPanel implements HasTooltipKey {
+
+    public static final int EVENT_HEIGTH = 15;
+
+    public static final int EVENT_MARGIN = 1;
+
+    private int rowCount = 0;
+
+    private VCalendar calendar;
+
+    private boolean undefinedWidth;
+
+    public WeeklyLongEvents(VCalendar calendar) {
+        setStylePrimaryName("v-calendar-weekly-longevents");
+        this.calendar = calendar;
+    }
+
+    public void addDate(Date d) {
+        DateCellContainer dcc = new DateCellContainer();
+        dcc.setDate(d);
+        dcc.setCalendar(calendar);
+        add(dcc);
+    }
+
+    public void setWidthPX(int width) {
+        if (getWidgetCount() == 0) {
+            return;
+        }
+        undefinedWidth = (width < 0);
+
+        updateCellWidths();
+    }
+
+    public void addEvents(List<CalendarEvent> events) {
+        for (CalendarEvent e : events) {
+            addEvent(e);
+        }
+    }
+
+    public void addEvent(CalendarEvent calendarEvent) {
+        updateEventSlot(calendarEvent);
+
+        int dateCount = getWidgetCount();
+        Date from = calendarEvent.getStart();
+        Date to = calendarEvent.getEnd();
+        boolean started = false;
+        for (int i = 0; i < dateCount; i++) {
+            DateCellContainer dc = (DateCellContainer) getWidget(i);
+            Date dcDate = dc.getDate();
+            int comp = dcDate.compareTo(from);
+            int comp2 = dcDate.compareTo(to);
+            WeeklyLongEventsDateCell eventLabel = dc.getDateCell(calendarEvent.getSlotIndex());
+            eventLabel.setStylePrimaryName("v-calendar-event");
+            if (comp >= 0 && comp2 <= 0) {
+                eventLabel.setEvent(calendarEvent);
+                eventLabel.setCalendar(calendar);
+
+                eventLabel.addStyleDependentName("all-day");
+                if (comp == 0) {
+                    eventLabel.addStyleDependentName("start");
+                }
+                if (comp2 == 0) {
+                    eventLabel.addStyleDependentName("end");
+                }
+                if (!started && comp > 0 && comp2 <= 0) {
+                    eventLabel.addStyleDependentName("continued-from");
+                } else if (i == (dateCount - 1)) {
+                    eventLabel.addStyleDependentName("continued-to");
+                }
+                final String extraStyle = calendarEvent.getStyleName();
+                if (extraStyle != null && extraStyle.length() > 0) {
+                    eventLabel.addStyleDependentName(extraStyle + "-all-day");
+                }
+                if (!started) {
+                    eventLabel.setText(calendarEvent.getCaption());
+                    started = true;
+                }
+            }
+        }
+    }
+
+    private void updateEventSlot(CalendarEvent e) {
+        boolean foundFreeSlot = false;
+        int slot = 0;
+        while (!foundFreeSlot) {
+            if (isSlotFree(slot, e.getStart(), e.getEnd())) {
+                e.setSlotIndex(slot);
+                foundFreeSlot = true;
+
+            } else {
+                slot++;
+            }
+        }
+    }
+
+    private boolean isSlotFree(int slot, Date start, Date end) {
+        int dateCount = getWidgetCount();
+
+        // Go over all dates this week
+        for (int i = 0; i < dateCount; i++) {
+            DateCellContainer dc = (DateCellContainer) getWidget(i);
+            Date dcDate = dc.getDate();
+            int comp = dcDate.compareTo(start);
+            int comp2 = dcDate.compareTo(end);
+
+            // check if the date is in the range we need
+            if (comp >= 0 && comp2 <= 0) {
+
+                // check if the slot is taken
+                if (dc.hasEvent(slot)) {
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    public int getRowCount() {
+        return rowCount;
+    }
+
+    public void updateCellWidths() {
+        int cells = getWidgetCount();
+        if (cells <= 0) {
+            return;
+        }
+
+        int cellWidth = -1;
+
+        // if width is undefined, use the width of the first cell
+        // otherwise use distributed sizes
+        if (undefinedWidth) {
+            cellWidth = calendar.getWeekGrid().getDateCellWidth()
+                    - calendar.getWeekGrid().getDateSlotBorder();
+        }
+
+        for (int i = 0; i < cells; i++) {
+            DateCellContainer dc = (DateCellContainer) getWidget(i);
+
+            if (undefinedWidth) {
+                dc.setWidth(cellWidth + "px");
+
+            } else {
+                dc.setWidth(calendar.getWeekGrid().getDateCellWidths()[i]
+                        + "px");
+            }
+        }
+    }
+
+    @Override
+    public String getTooltipKey() {
+        return null;
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEventsDateCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEventsDateCell.java
new file mode 100644
index 0000000000..a97d352e81
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEventsDateCell.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule;
+
+import java.util.Date;
+
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.ui.VCalendar;
+
+/**
+ * Represents a cell used in {@link WeeklyLongEvents}
+ * 
+ * @since 7.1
+ */
+public class WeeklyLongEventsDateCell extends HTML implements HasTooltipKey {
+    private Date date;
+    private CalendarEvent calendarEvent;
+    private VCalendar calendar;
+
+    public WeeklyLongEventsDateCell() {
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setEvent(CalendarEvent event) {
+        calendarEvent = event;
+    }
+
+    public CalendarEvent getEvent() {
+        return calendarEvent;
+    }
+
+    public void setCalendar(VCalendar calendar) {
+        this.calendar = calendar;
+    }
+
+    public VCalendar getCalendar() {
+        return calendar;
+    }
+
+    @Override
+    public Object getTooltipKey() {
+        if (calendarEvent != null) {
+            return calendarEvent.getIndex();
+        }
+        return null;
+    }
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
new file mode 100644
index 0000000000..03db4d091e
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule.dd;
+
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ui.calendar.CalendarConnector;
+import com.vaadin.client.ui.dd.VAbstractDropHandler;
+
+/**
+ * Abstract base class for calendar drop handlers.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public abstract class CalendarDropHandler extends VAbstractDropHandler {
+
+    protected CalendarConnector calendarConnector;
+
+    /**
+     * Set the calendar instance
+     * 
+     * @param calendarPaintable
+     */
+    public void setConnector(CalendarConnector calendarConnector) {
+        this.calendarConnector = calendarConnector;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#getConnector()
+     */
+    @Override
+    public CalendarConnector getConnector() {
+        return calendarConnector;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VDropHandler#getApplicationConnection
+     * ()
+     */
+    public ApplicationConnection getApplicationConnection() {
+        return calendarConnector.getClient();
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
new file mode 100644
index 0000000000..6e57fb6fef
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
@@ -0,0 +1,166 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule.dd;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
+import com.vaadin.client.ui.dd.VAcceptCallback;
+import com.vaadin.client.ui.dd.VDragEvent;
+
+/**
+ * Handles DD when the monthly view is showing in the Calendar. In the monthly
+ * view, drops are only allowed in the the day cells. Only the day index is
+ * included in the drop details sent to the server.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class CalendarMonthDropHandler extends CalendarDropHandler {
+
+    private Element currentTargetElement;
+    private SimpleDayCell currentTargetDay;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragAccepted
+     * (com.vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    protected void dragAccepted(VDragEvent drag) {
+        deEmphasis();
+        currentTargetElement = drag.getElementOver();
+        currentTargetDay = Util.findWidget(currentTargetElement,
+                SimpleDayCell.class);
+        emphasis();
+    }
+
+    /**
+     * Removed the emphasis CSS style name from the currently emphasized day
+     */
+    private void deEmphasis() {
+        if (currentTargetElement != null && currentTargetDay != null) {
+            currentTargetDay.removeEmphasisStyle();
+            currentTargetElement = null;
+        }
+    }
+
+    /**
+     * Add CSS style name for the currently emphasized day
+     */
+    private void emphasis() {
+        if (currentTargetElement != null && currentTargetDay != null) {
+            currentTargetDay.addEmphasisStyle();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragOver(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragOver(final VDragEvent drag) {
+        if (isLocationValid(drag.getElementOver())) {
+            validate(new VAcceptCallback() {
+                public void accepted(VDragEvent event) {
+                    dragAccepted(drag);
+                }
+            }, drag);
+        }
+    }
+
+    /**
+     * Checks if the one can perform a drop in a element
+     * 
+     * @param elementOver
+     *            The element to check
+     * @return
+     */
+    private boolean isLocationValid(
+            com.google.gwt.user.client.Element elementOver) {
+        com.google.gwt.user.client.Element monthGridElement = calendarConnector
+                .getWidget().getMonthGrid().getElement();
+
+        // drops are not allowed in:
+        // - weekday header
+        // - week number bart
+        return DOM.isOrHasChild(monthGridElement, elementOver);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragEnter(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragEnter(VDragEvent drag) {
+        // NOOP, we determine drag acceptance in dragOver
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#drop(com.vaadin
+     * .terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public boolean drop(VDragEvent drag) {
+        if (isLocationValid(drag.getElementOver())) {
+            updateDropDetails(drag);
+            deEmphasis();
+            return super.drop(drag);
+
+        } else {
+            deEmphasis();
+            return false;
+        }
+    }
+
+    /**
+     * Updates the drop details sent to the server
+     * 
+     * @param drag
+     *            The drag event
+     */
+    private void updateDropDetails(VDragEvent drag) {
+        int dayIndex = calendarConnector.getWidget().getMonthGrid()
+                .getDayCellIndex(currentTargetDay);
+
+        drag.getDropDetails().put("dropDayIndex", dayIndex);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragLeave(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragLeave(VDragEvent drag) {
+        deEmphasis();
+        super.dragLeave(drag);
+    }
+}
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
new file mode 100644
index 0000000000..fa7aaa428b
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
@@ -0,0 +1,181 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.client.ui.calendar.schedule.dd;
+
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.vaadin.client.Util;
+import com.vaadin.client.ui.calendar.schedule.DateCell;
+import com.vaadin.client.ui.calendar.schedule.DateCellDayEvent;
+import com.vaadin.client.ui.dd.VAcceptCallback;
+import com.vaadin.client.ui.dd.VDragEvent;
+
+/**
+ * Handles DD when the weekly view is showing in the Calendar. In the weekly
+ * view, drops are only allowed in the the time slots for each day. The slot
+ * index and the day index are included in the drop details sent to the server.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class CalendarWeekDropHandler extends CalendarDropHandler {
+
+    private com.google.gwt.user.client.Element currentTargetElement;
+    private DateCell currentTargetDay;
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragAccepted
+     * (com.vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    protected void dragAccepted(VDragEvent drag) {
+        deEmphasis();
+        currentTargetElement = drag.getElementOver();
+        currentTargetDay = Util
+                .findWidget(currentTargetElement, DateCell.class);
+        emphasis();
+    }
+
+    /**
+     * Removes the CSS style name from the emphasized element
+     */
+    private void deEmphasis() {
+        if (currentTargetElement != null) {
+            currentTargetDay.removeEmphasisStyle(currentTargetElement);
+            currentTargetElement = null;
+        }
+    }
+
+    /**
+     * Add a CSS stylen name to current target element
+     */
+    private void emphasis() {
+        currentTargetDay.addEmphasisStyle(currentTargetElement);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragOver(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragOver(final VDragEvent drag) {
+        if (isLocationValid(drag.getElementOver())) {
+            validate(new VAcceptCallback() {
+                public void accepted(VDragEvent event) {
+                    dragAccepted(drag);
+                }
+            }, drag);
+        }
+    }
+
+    /**
+     * Checks if the location is a valid drop location
+     * 
+     * @param elementOver
+     *            The element to check
+     * @return
+     */
+    private boolean isLocationValid(
+            com.google.gwt.user.client.Element elementOver) {
+        com.google.gwt.user.client.Element weekGridElement = calendarConnector
+                .getWidget().getWeekGrid().getElement();
+        com.google.gwt.user.client.Element timeBarElement = calendarConnector
+                .getWidget().getWeekGrid().getTimeBar().getElement();
+
+        com.google.gwt.user.client.Element todayBarElement = null;
+        if (calendarConnector.getWidget().getWeekGrid().hasToday()) {
+            todayBarElement = (Element) calendarConnector.getWidget()
+                    .getWeekGrid().getDateCellOfToday().getTodaybarElement();
+        }
+
+        // drops are not allowed in:
+        // - weekday header
+        // - allday event list
+        // - todaybar
+        // - timebar
+        // - events
+        return DOM.isOrHasChild(weekGridElement, elementOver)
+                && !DOM.isOrHasChild(timeBarElement, elementOver)
+                && todayBarElement != elementOver
+                && (Util.findWidget(elementOver, DateCellDayEvent.class) == null);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragEnter(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragEnter(VDragEvent drag) {
+        // NOOP, we determine drag acceptance in dragOver
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#drop(com.vaadin
+     * .terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public boolean drop(VDragEvent drag) {
+        if (isLocationValid(drag.getElementOver())) {
+            updateDropDetails(drag);
+            deEmphasis();
+            return super.drop(drag);
+
+        } else {
+            deEmphasis();
+            return false;
+        }
+    }
+
+    /**
+     * Update the drop details sent to the server
+     * 
+     * @param drag
+     *            The drag event
+     */
+    private void updateDropDetails(VDragEvent drag) {
+        int slotIndex = currentTargetDay.getSlotIndex(currentTargetElement);
+        int dayIndex = calendarConnector.getWidget().getWeekGrid()
+                .getDateCellIndex(currentTargetDay);
+
+        drag.getDropDetails().put("dropDayIndex", dayIndex);
+        drag.getDropDetails().put("dropSlotIndex", slotIndex);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler#dragLeave(com
+     * .vaadin.terminal.gwt.client.ui.dd.VDragEvent)
+     */
+    @Override
+    public void dragLeave(VDragEvent drag) {
+        deEmphasis();
+        super.dragLeave(drag);
+    }
+}
diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java
new file mode 100644
index 0000000000..4bf2885a8c
--- /dev/null
+++ b/server/src/com/vaadin/ui/Calendar.java
@@ -0,0 +1,1822 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.lang.reflect.Method;
+import java.text.DateFormat;
+import java.text.DateFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.EventListener;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.TimeZone;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.event.Action;
+import com.vaadin.event.Action.Handler;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.DropTarget;
+import com.vaadin.event.dd.TargetDetails;
+import com.vaadin.server.KeyMapper;
+import com.vaadin.shared.ui.calendar.CalendarEventId;
+import com.vaadin.shared.ui.calendar.CalendarServerRpc;
+import com.vaadin.shared.ui.calendar.CalendarState;
+import com.vaadin.shared.ui.calendar.DateConstants;
+import com.vaadin.ui.components.calendar.CalendarComponentEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventMoveHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResize;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResizeHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.MoveEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClickHandler;
+import com.vaadin.ui.components.calendar.CalendarDateRange;
+import com.vaadin.ui.components.calendar.CalendarTargetDetails;
+import com.vaadin.ui.components.calendar.ContainerEventProvider;
+import com.vaadin.ui.components.calendar.event.BasicEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEditableEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeListener;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+import com.vaadin.ui.components.calendar.handler.BasicBackwardHandler;
+import com.vaadin.ui.components.calendar.handler.BasicDateClickHandler;
+import com.vaadin.ui.components.calendar.handler.BasicEventMoveHandler;
+import com.vaadin.ui.components.calendar.handler.BasicEventResizeHandler;
+import com.vaadin.ui.components.calendar.handler.BasicForwardHandler;
+import com.vaadin.ui.components.calendar.handler.BasicWeekClickHandler;
+
+/**
+ * <p>
+ * Vaadin Calendar is for visualizing events in a calendar. Calendar events can
+ * be visualized in the variable length view depending on the start and end
+ * dates.
+ * </p>
+ * 
+ * <li>You can set the viewable date range with the {@link #setStartDate(Date)}
+ * and {@link #setEndDate(Date)} methods. Calendar has a default date range of
+ * one week</li>
+ * 
+ * <li>Calendar has two kind of views: monthly and weekly view</li>
+ * 
+ * <li>If date range is seven days or shorter, the weekly view is used.</li>
+ * 
+ * <li>Calendar queries its events by using a
+ * {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+ * CalendarEventProvider}. By default, a
+ * {@link com.vaadin.addon.calendar.event.BasicEventProvider BasicEventProvider}
+ * is used.</li>
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class Calendar extends AbstractComponent implements
+        CalendarComponentEvents.NavigationNotifier,
+        CalendarComponentEvents.EventMoveNotifier,
+        CalendarComponentEvents.RangeSelectNotifier,
+        CalendarComponentEvents.EventResizeNotifier,
+        CalendarEventProvider.EventSetChangeListener, DropTarget,
+        CalendarEditableEventProvider, Action.Container {
+
+    /**
+     * Calendar can use either 12 hours clock or 24 hours clock.
+     */
+    public enum TimeFormat {
+
+        Format12H(), Format24H();
+    }
+
+    /** Defines currently active format for time. 12H/24H. */
+    protected TimeFormat currentTimeFormat;
+
+    /** Internal calendar data source. */
+    protected java.util.Calendar currentCalendar = java.util.Calendar
+            .getInstance();
+
+    /** Defines the component's active time zone. */
+    protected TimeZone timezone;
+
+    /** Defines the calendar's date range starting point. */
+    protected Date startDate = null;
+
+    /** Defines the calendar's date range ending point. */
+    protected Date endDate = null;
+
+    /** Event provider. */
+    private CalendarEventProvider calendarEventProvider;
+
+    /**
+     * Internal buffer for the events that are retrieved from the event
+     * provider.
+     */
+    protected List<CalendarEvent> events;
+
+    /** Date format that will be used in the UIDL for dates. */
+    protected DateFormat df_date = new SimpleDateFormat("yyyy-MM-dd");
+
+    /** Time format that will be used in the UIDL for time. */
+    protected DateFormat df_time = new SimpleDateFormat("HH:mm:ss");
+
+    /** Date format that will be used in the UIDL for both date and time. */
+    protected DateFormat df_date_time = new SimpleDateFormat(
+            DateConstants.CLIENT_DATE_FORMAT + "-"
+                    + DateConstants.CLIENT_TIME_FORMAT);
+
+    /**
+     * Week view's scroll position. Client sends updates to this value so that
+     * scroll position wont reset all the time.
+     */
+    private int scrollTop = 0;
+
+    /** Caption format for the weekly view */
+    private String weeklyCaptionFormat = null;
+
+    /** Map from event ids to event handlers */
+    private final Map<String, EventListener> handlers;
+
+    /**
+     * Drop Handler for Vaadin DD. By default null.
+     */
+    private DropHandler dropHandler;
+
+    /**
+     * First day to show for a week
+     */
+    private int firstDay = 1;
+
+    /**
+     * Last day to show for a week
+     */
+    private int lastDay = 7;
+
+    /**
+     * First hour to show for a day
+     */
+    private int firstHour = 0;
+
+    /**
+     * Last hour to show for a day
+     */
+    private int lastHour = 23;
+
+    /**
+     * List of action handlers.
+     */
+    private LinkedList<Action.Handler> actionHandlers = null;
+
+    /**
+     * Action mapper.
+     */
+    private KeyMapper<Action> actionMapper = null;
+
+    /**
+     * 
+     */
+    private CalendarServerRpcImpl rpc = new CalendarServerRpcImpl();
+
+    /**
+     * Returns the logger for the calendar
+     */
+    protected Logger getLogger() {
+        return Logger.getLogger(Calendar.class.getName());
+    }
+
+    /**
+     * Construct a Vaadin Calendar with a BasicEventProvider and no caption.
+     * Default date range is one week.
+     */
+    public Calendar() {
+        this(null, new BasicEventProvider());
+    }
+
+    /**
+     * Construct a Vaadin Calendar with a BasicEventProvider and the provided
+     * caption. Default date range is one week.
+     * 
+     * @param caption
+     */
+    public Calendar(String caption) {
+        this(caption, new BasicEventProvider());
+    }
+
+    /**
+     * <p>
+     * Construct a Vaadin Calendar with event provider. Event provider is
+     * obligatory, because calendar component will query active events through
+     * it.
+     * </p>
+     * 
+     * <p>
+     * By default, Vaadin Calendar will show dates from the start of the current
+     * week to the end of the current week. Use {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)} to change this.
+     * </p>
+     * 
+     * @param eventProvider
+     *            Event provider, cannot be null.
+     */
+    public Calendar(CalendarEventProvider eventProvider) {
+        this(null, eventProvider);
+    }
+
+    /**
+     * <p>
+     * Construct a Vaadin Calendar with event provider and a caption. Event
+     * provider is obligatory, because calendar component will query active
+     * events through it.
+     * </p>
+     * 
+     * <p>
+     * By default, Vaadin Calendar will show dates from the start of the current
+     * week to the end of the current week. Use {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)} to change this.
+     * </p>
+     * 
+     * @param eventProvider
+     *            Event provider, cannot be null.
+     */
+    // this is the constructor every other constructor calls
+    public Calendar(String caption, CalendarEventProvider eventProvider) {
+        registerRpc(rpc);
+        setCaption(caption);
+        handlers = new HashMap<String, EventListener>();
+        setDefaultHandlers();
+        currentCalendar.setTime(new Date());
+        setEventProvider(eventProvider);
+        getState().firstDayOfWeek = firstDay;
+        getState().lastVisibleDayOfWeek = lastDay;
+        getState().firstHourOfDay = firstHour;
+        getState().lastHourOfDay = lastHour;
+        setTimeFormat(null);
+
+    }
+
+    @Override
+    public CalendarState getState() {
+        return (CalendarState) super.getState();
+    }
+
+    @Override
+    public void beforeClientResponse(boolean initial) {
+        super.beforeClientResponse(initial);
+
+        initCalendarWithLocale();
+
+        getState().format24H = TimeFormat.Format24H == getTimeFormat();
+        setupDaysAndActions();
+        setupCalendarEvents();
+        rpc.scroll(scrollTop);
+    }
+
+    /**
+     * Set all the wanted default handlers here. This is always called after
+     * constructing this object. All other events have default handlers except
+     * range and event click.
+     */
+    protected void setDefaultHandlers() {
+        setHandler(new BasicBackwardHandler());
+        setHandler(new BasicForwardHandler());
+        setHandler(new BasicWeekClickHandler());
+        setHandler(new BasicDateClickHandler());
+        setHandler(new BasicEventMoveHandler());
+        setHandler(new BasicEventResizeHandler());
+    }
+
+    /**
+     * Gets the calendar's start date.
+     * 
+     * @return First visible date.
+     */
+    public Date getStartDate() {
+        if (startDate == null) {
+            currentCalendar.set(java.util.Calendar.DAY_OF_WEEK,
+                    currentCalendar.getFirstDayOfWeek());
+            return currentCalendar.getTime();
+        }
+        return startDate;
+    }
+
+    /**
+     * Sets start date for the calendar. This and {@link #setEndDate(Date)}
+     * control the range of dates visible on the component. The default range is
+     * one week.
+     * 
+     * @param date
+     *            First visible date to show.
+     */
+    public void setStartDate(Date date) {
+        if (!date.equals(startDate)) {
+            startDate = date;
+            markAsDirty();
+        }
+    }
+
+    /**
+     * Gets the calendar's end date.
+     * 
+     * @return Last visible date.
+     */
+    public Date getEndDate() {
+        if (endDate == null) {
+            currentCalendar.set(java.util.Calendar.DAY_OF_WEEK,
+                    currentCalendar.getFirstDayOfWeek() + 6);
+            return currentCalendar.getTime();
+        }
+        return endDate;
+    }
+
+    /**
+     * Sets end date for the calendar. Starting from startDate, only six weeks
+     * will be shown if duration to endDate is longer than six weeks.
+     * 
+     * This and {@link #setStartDate(Date)} control the range of dates visible
+     * on the component. The default range is one week.
+     * 
+     * @param date
+     *            Last visible date to show.
+     */
+    public void setEndDate(Date date) {
+        if (startDate != null && startDate.after(date)) {
+            startDate = (Date) date.clone();
+            markAsDirty();
+        } else if (!date.equals(endDate)) {
+            endDate = date;
+            markAsDirty();
+        }
+    }
+
+    /**
+     * Sets the locale to be used in the Calendar component.
+     * 
+     * @see com.vaadin.ui.AbstractComponent#setLocale(java.util.Locale)
+     */
+    @Override
+    public void setLocale(Locale newLocale) {
+        super.setLocale(newLocale);
+        initCalendarWithLocale();
+    }
+
+    /**
+     * Initialize the java calendar instance with the current locale and
+     * timezone.
+     */
+    private void initCalendarWithLocale() {
+        if (timezone != null) {
+            currentCalendar = java.util.Calendar.getInstance(timezone,
+                    getLocale());
+
+        } else {
+            currentCalendar = java.util.Calendar.getInstance(getLocale());
+        }
+    }
+
+    private void setupCalendarEvents() {
+        int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) / DateConstants.DAYINMILLIS);
+        durationInDays++;
+        if (durationInDays > 60) {
+            throw new RuntimeException("Daterange is too big (max 60) = "
+                    + durationInDays);
+        }
+
+        Date firstDateToShow = expandStartDate(startDate, durationInDays > 7);
+        Date lastDateToShow = expandEndDate(endDate, durationInDays > 7);
+
+        currentCalendar.setTime(firstDateToShow);
+        events = getEventProvider().getEvents(firstDateToShow, lastDateToShow);
+
+        List<CalendarState.Event> calendarStateEvents = new ArrayList<CalendarState.Event>();
+        if (events != null) {
+            for (int i = 0; i < events.size(); i++) {
+                CalendarEvent e = events.get(i);
+                CalendarState.Event event = new CalendarState.Event();
+                event.index = i;
+                event.caption = e.getCaption() == null ? "" : e.getCaption();
+                event.dateFrom = df_date.format(e.getStart());
+                event.dateTo = df_date.format(e.getEnd());
+                event.timeFrom = df_time.format(e.getStart());
+                event.timeTo = df_time.format(e.getEnd());
+                event.description = e.getDescription() == null ? "" : e
+                        .getDescription();
+                event.styleName = e.getStyleName() == null ? "" : e
+                        .getStyleName();
+                event.allDay = e.isAllDay();
+                calendarStateEvents.add(event);
+            }
+        }
+        getState().events = calendarStateEvents;
+    }
+
+    private void setupDaysAndActions() {
+        // Make sure we have a up-to-date locale
+        initCalendarWithLocale();
+
+        CalendarState state = getState();
+
+        state.firstDayOfWeek = currentCalendar.getFirstDayOfWeek();
+
+        // If only one is null, throw exception
+        // If both are null, set defaults
+        if (startDate == null ^ endDate == null) {
+            String message = "Schedule cannot be painted without a proper date range.\n";
+            if (startDate == null) {
+                throw new IllegalStateException(message
+                        + "You must set a start date using setStartDate(Date).");
+
+            } else {
+                throw new IllegalStateException(message
+                        + "You must set an end date using setEndDate(Date).");
+            }
+
+        } else if (startDate == null && endDate == null) {
+            // set defaults
+            startDate = getStartDate();
+            endDate = getEndDate();
+        }
+
+        int durationInDays = (int) (((endDate.getTime()) - startDate.getTime()) / DateConstants.DAYINMILLIS);
+        durationInDays++;
+        if (durationInDays > 60) {
+            throw new RuntimeException("Daterange is too big (max 60) = "
+                    + durationInDays);
+        }
+
+        state.dayNames = getDayNamesShort();
+        state.monthNames = getMonthNamesShort();
+
+        // Use same timezone in all dates this component handles.
+        // Show "now"-marker in browser within given timezone.
+        Date now = new Date();
+        currentCalendar.setTime(now);
+        now = currentCalendar.getTime();
+
+        // Reset time zones for custom date formats
+        df_date.setTimeZone(currentCalendar.getTimeZone());
+        df_time.setTimeZone(currentCalendar.getTimeZone());
+
+        state.now = (df_date.format(now) + " " + df_time.format(now));
+
+        Date firstDateToShow = expandStartDate(startDate, durationInDays > 7);
+        Date lastDateToShow = expandEndDate(endDate, durationInDays > 7);
+
+        currentCalendar.setTime(firstDateToShow);
+
+        DateFormat weeklyCaptionFormatter = getWeeklyCaptionFormatter();
+        weeklyCaptionFormatter.setTimeZone(currentCalendar.getTimeZone());
+
+        Map<CalendarDateRange, Set<Action>> actionMap = new HashMap<CalendarDateRange, Set<Action>>();
+
+        List<CalendarState.Day> days = new ArrayList<CalendarState.Day>();
+
+        // Send all dates to client from server. This
+        // approach was taken because gwt doesn't
+        // support date localization properly.
+        while (currentCalendar.getTime().compareTo(lastDateToShow) < 1) {
+            final Date date = currentCalendar.getTime();
+            final CalendarState.Day day = new CalendarState.Day();
+            day.date = df_date.format(date);
+            day.localizedDateFormat = weeklyCaptionFormatter.format(date);
+            day.dayOfWeek = getDowByLocale(currentCalendar);
+            day.week = currentCalendar.get(java.util.Calendar.WEEK_OF_YEAR);
+
+            days.add(day);
+
+            // Get actions for a specific date
+            if (actionHandlers != null) {
+                for (Action.Handler actionHandler : actionHandlers) {
+
+                    // Create calendar which omits time
+                    GregorianCalendar cal = new GregorianCalendar(
+                            getTimeZone(), getLocale());
+                    cal.clear();
+                    cal.set(currentCalendar.get(java.util.Calendar.YEAR),
+                            currentCalendar.get(java.util.Calendar.MONTH),
+                            currentCalendar.get(java.util.Calendar.DATE));
+
+                    // Get day start and end times
+                    Date start = cal.getTime();
+                    cal.add(java.util.Calendar.DATE, 1);
+                    Date end = cal.getTime();
+
+                    boolean monthView = (durationInDays > 7);
+
+                    /**
+                     * If in day or week view add actions for each half-an-hour.
+                     * If in month view add actions for each day
+                     */
+                    if (monthView) {
+                        setActionsForDay(actionMap, start, end, actionHandler);
+                    } else {
+                        setActionsForEachHalfHour(actionMap, start, end,
+                                actionHandler);
+                    }
+
+                }
+            }
+
+            currentCalendar.add(java.util.Calendar.DATE, 1);
+        }
+        state.days = days;
+        state.actions = createActionsList(actionMap);
+    }
+
+    private void setActionsForEachHalfHour(
+            Map<CalendarDateRange, Set<Action>> actionMap, Date start,
+            Date end, Action.Handler actionHandler) {
+        GregorianCalendar cal = new GregorianCalendar(getTimeZone(),
+                getLocale());
+        cal.setTime(start);
+        while (cal.getTime().before(end)) {
+            Date s = cal.getTime();
+            cal.add(java.util.Calendar.MINUTE, 30);
+            Date e = cal.getTime();
+            CalendarDateRange range = new CalendarDateRange(s, e, getTimeZone());
+            Action[] actions = actionHandler.getActions(range, this);
+            if (actions != null) {
+                Set<Action> actionSet = new HashSet<Action>(
+                        Arrays.asList(actions));
+                actionMap.put(range, actionSet);
+            }
+        }
+    }
+
+    private void setActionsForDay(
+            Map<CalendarDateRange, Set<Action>> actionMap, Date start,
+            Date end, Action.Handler actionHandler) {
+        CalendarDateRange range = new CalendarDateRange(start, end,
+                getTimeZone());
+        Action[] actions = actionHandler.getActions(range, this);
+        if (actions != null) {
+            Set<Action> actionSet = new HashSet<Action>(Arrays.asList(actions));
+            actionMap.put(range, actionSet);
+        }
+    }
+
+    private List<CalendarState.Action> createActionsList(
+            Map<CalendarDateRange, Set<Action>> actionMap) {
+        if (actionMap.isEmpty()) {
+            return null;
+        }
+
+        List<CalendarState.Action> calendarActions = new ArrayList<CalendarState.Action>();
+
+        SimpleDateFormat formatter = new SimpleDateFormat(
+                DateConstants.ACTION_DATE_FORMAT_PATTERN);
+        formatter.setTimeZone(getTimeZone());
+
+        for (Entry<CalendarDateRange, Set<Action>> entry : actionMap.entrySet()) {
+            CalendarDateRange range = entry.getKey();
+            Set<Action> actions = entry.getValue();
+            for (Action action : actions) {
+                String key = actionMapper.key(action);
+                CalendarState.Action calendarAction = new CalendarState.Action();
+                calendarAction.actionKey = key;
+                calendarAction.caption = action.getCaption();
+                setResource(key, action.getIcon());
+                calendarAction.iconKey = key;
+                calendarAction.startDate = formatter.format(range.getStart());
+                calendarAction.endDate = formatter.format(range.getEnd());
+                calendarActions.add(calendarAction);
+            }
+        }
+
+        return calendarActions;
+    }
+
+    /**
+     * Gets currently active time format. Value is either TimeFormat.Format12H
+     * or TimeFormat.Format24H.
+     * 
+     * @return TimeFormat Format for the time.
+     */
+    public TimeFormat getTimeFormat() {
+        if (currentTimeFormat == null) {
+            SimpleDateFormat f = (SimpleDateFormat) SimpleDateFormat
+                    .getTimeInstance(SimpleDateFormat.SHORT, getLocale());
+            String p = f.toPattern();
+            if (p.indexOf("HH") != -1 || p.indexOf("H") != -1) {
+                return TimeFormat.Format24H;
+            }
+            return TimeFormat.Format12H;
+        }
+        return currentTimeFormat;
+    }
+
+    /**
+     * Example: <code>setTimeFormat(TimeFormat.Format12H);</code></br> Set to
+     * null, if you want the format being defined by the locale.
+     * 
+     * @param format
+     *            Set 12h or 24h format. Default is defined by the locale.
+     */
+    public void setTimeFormat(TimeFormat format) {
+        currentTimeFormat = format;
+        markAsDirty();
+    }
+
+    /**
+     * Returns a time zone that is currently used by this component.
+     * 
+     * @return Component's Time zone
+     */
+    public TimeZone getTimeZone() {
+        if (timezone == null) {
+            return currentCalendar.getTimeZone();
+        }
+        return timezone;
+    }
+
+    /**
+     * Set time zone that this component will use. Null value sets the default
+     * time zone.
+     * 
+     * @param zone
+     *            Time zone to use
+     */
+    public void setTimeZone(TimeZone zone) {
+        timezone = zone;
+        if (!currentCalendar.getTimeZone().equals(zone)) {
+            if (zone == null) {
+                zone = TimeZone.getDefault();
+            }
+            currentCalendar.setTimeZone(zone);
+            df_date_time.setTimeZone(zone);
+            markAsDirty();
+        }
+    }
+
+    /**
+     * Get the internally used Calendar instance. This is the currently used
+     * instance of {@link java.util.Calendar} but is bound to change during the
+     * lifetime of the component.
+     * 
+     * @return the currently used java calendar
+     */
+    public java.util.Calendar getInternalCalendar() {
+        return currentCalendar;
+    }
+
+    /**
+     * <p>
+     * This method restricts the weekdays that are shown. This affects both the
+     * monthly and the weekly view. The general contract is that <b>firstDay <
+     * lastDay</b>.
+     * </p>
+     * 
+     * <p>
+     * Note that this only affects the rendering process. Events are still
+     * requested by the dates set by {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)}.
+     * </p>
+     * 
+     * @param firstDay
+     *            the first day of the week to show, between 1 and 7
+     */
+    public void setFirstVisibleDayOfWeek(int firstDay) {
+        if (this.firstDay != firstDay && firstDay >= 1 && firstDay <= 7
+                && getLastVisibleDayOfWeek() >= firstDay) {
+            this.firstDay = firstDay;
+            getState().firstVisibleDayOfWeek = firstDay;
+        }
+    }
+
+    /**
+     * Get the first visible day of the week. Returns the weekdays as integers
+     * represented by {@link java.util.Calendar#DAY_OF_WEEK}
+     * 
+     * @return An integer representing the week day according to
+     *         {@link java.util.Calendar#DAY_OF_WEEK}
+     */
+    public int getFirstVisibleDayOfWeek() {
+        return firstDay;
+    }
+
+    /**
+     * <p>
+     * This method restricts the weekdays that are shown. This affects both the
+     * monthly and the weekly view. The general contract is that <b>firstDay <
+     * lastDay</b>.
+     * </p>
+     * 
+     * <p>
+     * Note that this only affects the rendering process. Events are still
+     * requested by the dates set by {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)}.
+     * </p>
+     * 
+     * @param lastDay
+     *            the first day of the week to show, between 1 and 7
+     */
+    public void setLastVisibleDayOfWeek(int lastDay) {
+        if (this.lastDay != lastDay && lastDay >= 1 && lastDay <= 7
+                && getFirstVisibleDayOfWeek() <= lastDay) {
+            this.lastDay = lastDay;
+            getState().lastVisibleDayOfWeek = lastDay;
+        }
+    }
+
+    /**
+     * Get the last visible day of the week. Returns the weekdays as integers
+     * represented by {@link java.util.Calendar#DAY_OF_WEEK}
+     * 
+     * @return An integer representing the week day according to
+     *         {@link java.util.Calendar#DAY_OF_WEEK}
+     */
+    public int getLastVisibleDayOfWeek() {
+        return lastDay;
+    }
+
+    /**
+     * <p>
+     * This method restricts the hours that are shown per day. This affects the
+     * weekly view. The general contract is that <b>firstHour < lastHour</b>.
+     * </p>
+     * 
+     * <p>
+     * Note that this only affects the rendering process. Events are still
+     * requested by the dates set by {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)}.
+     * </p>
+     * 
+     * @param firstHour
+     *            the first hour of the day to show, between 0 and 23
+     */
+    public void setFirstVisibleHourOfDay(int firstHour) {
+        if (this.firstHour != firstHour && firstHour >= 0 && firstHour <= 23
+                && firstHour <= getLastVisibleHourOfDay()) {
+            this.firstHour = firstHour;
+            getState().firstHourOfDay = firstHour;
+        }
+    }
+
+    /**
+     * Returns the first visible hour in the week view. Returns the hour using a
+     * 24h time format
+     * 
+     */
+    public int getFirstVisibleHourOfDay() {
+        return firstHour;
+    }
+
+    /**
+     * <p>
+     * This method restricts the hours that are shown per day. This affects the
+     * weekly view. The general contract is that <b>firstHour < lastHour</b>.
+     * </p>
+     * 
+     * <p>
+     * Note that this only affects the rendering process. Events are still
+     * requested by the dates set by {@link #setStartDate(Date)} and
+     * {@link #setEndDate(Date)}.
+     * </p>
+     * 
+     * @param lastHour
+     *            the first hour of the day to show, between 0 and 23
+     */
+    public void setLastVisibleHourOfDay(int lastHour) {
+        if (this.lastHour != lastHour && lastHour >= 0 && lastHour <= 23
+                && lastHour >= getFirstVisibleHourOfDay()) {
+            this.lastHour = lastHour;
+            getState().lastHourOfDay = lastHour;
+        }
+    }
+
+    /**
+     * Returns the last visible hour in the week view. Returns the hour using a
+     * 24h time format
+     * 
+     */
+    public int getLastVisibleHourOfDay() {
+        return lastHour;
+    }
+
+    /**
+     * Gets the date caption format for the weekly view.
+     * 
+     * @return The pattern used in caption of dates in weekly view.
+     */
+    public String getWeeklyCaptionFormat() {
+        return weeklyCaptionFormat;
+    }
+
+    /**
+     * Sets custom date format for the weekly view. This is the caption of the
+     * date. Format could be like "mmm MM/dd".
+     * 
+     * @param dateFormatPattern
+     *            The date caption pattern.
+     */
+    public void setWeeklyCaptionFormat(String dateFormatPattern) {
+        if ((weeklyCaptionFormat == null && dateFormatPattern != null)
+                || (weeklyCaptionFormat != null && !weeklyCaptionFormat
+                        .equals(dateFormatPattern))) {
+            weeklyCaptionFormat = dateFormatPattern;
+            markAsDirty();
+        }
+    }
+
+    private DateFormat getWeeklyCaptionFormatter() {
+        if (weeklyCaptionFormat != null) {
+            return new SimpleDateFormat(weeklyCaptionFormat, getLocale());
+        } else {
+            return SimpleDateFormat.getDateInstance(SimpleDateFormat.SHORT,
+                    getLocale());
+        }
+    }
+
+    /**
+     * Get the day of week by the given calendar and its locale
+     * 
+     * @param calendar
+     *            The calendar to use
+     * @return
+     */
+    private static int getDowByLocale(java.util.Calendar calendar) {
+        int fow = calendar.get(java.util.Calendar.DAY_OF_WEEK);
+
+        // monday first
+        if (calendar.getFirstDayOfWeek() == java.util.Calendar.MONDAY) {
+            fow = (fow == java.util.Calendar.SUNDAY) ? 7 : fow - 1;
+        }
+
+        return fow;
+    }
+
+    /**
+     * Is the user allowed to trigger events which alters the events
+     * 
+     * @return true if the client is allowed to send changes to server
+     * @see #isEventClickAllowed()
+     */
+    protected boolean isClientChangeAllowed() {
+        return !isReadOnly() && isEnabled();
+    }
+
+    /**
+     * Is the user allowed to trigger click events
+     * 
+     * @return true if the client is allowed to click events
+     * @see #isClientChangeAllowed()
+     */
+    protected boolean isEventClickAllowed() {
+        return isEnabled();
+    }
+
+    /**
+     * Fires an event when the user selecing moving forward/backward in the
+     * calendar.
+     * 
+     * @param forward
+     *            True if the calendar moved forward else backward is assumed.
+     */
+    protected void fireNavigationEvent(boolean forward) {
+        if (forward) {
+            fireEvent(new ForwardEvent(this));
+        } else {
+            fireEvent(new BackwardEvent(this));
+        }
+    }
+
+    /**
+     * Fires an event move event to all server side move listerners
+     * 
+     * @param index
+     *            The index of the event in the events list
+     * @param newFromDatetime
+     *            The changed from date time
+     */
+    protected void fireEventMove(int index, Date newFromDatetime) {
+        MoveEvent event = new MoveEvent(this, events.get(index),
+                newFromDatetime);
+
+        if (calendarEventProvider instanceof EventMoveHandler) {
+            // Notify event provider if it is an event move handler
+            ((EventMoveHandler) calendarEventProvider).eventMove(event);
+        }
+
+        // Notify event move handler attached by using the
+        // setHandler(EventMoveHandler) method
+        fireEvent(event);
+    }
+
+    /**
+     * Fires event when a week was clicked in the calendar.
+     * 
+     * @param week
+     *            The week that was clicked
+     * @param year
+     *            The year of the week
+     */
+    protected void fireWeekClick(int week, int year) {
+        fireEvent(new WeekClick(this, week, year));
+    }
+
+    /**
+     * Fires event when a date was clicked in the calendar. Uses an existing
+     * event from the event cache.
+     * 
+     * @param index
+     *            The index of the event in the event cache.
+     */
+    protected void fireEventClick(Integer index) {
+        fireEvent(new EventClick(this, events.get(index)));
+    }
+
+    /**
+     * Fires event when a date was clicked in the calendar. Creates a new event
+     * for the date and passes it to the listener.
+     * 
+     * @param date
+     *            The date and time that was clicked
+     */
+    protected void fireDateClick(Date date) {
+        fireEvent(new DateClickEvent(this, date));
+    }
+
+    /**
+     * Fires an event range selected event. The event is fired when a user
+     * highlights an area in the calendar. The highlighted areas start and end
+     * dates are returned as arguments.
+     * 
+     * @param from
+     *            The start date and time of the highlighted area
+     * @param to
+     *            The end date and time of the highlighted area
+     * @param monthlyMode
+     *            Is the calendar in monthly mode
+     */
+    protected void fireRangeSelect(Date from, Date to, boolean monthlyMode) {
+        fireEvent(new RangeSelectEvent(this, from, to, monthlyMode));
+    }
+
+    /**
+     * Fires an event resize event. The event is fired when a user resizes the
+     * event in the calendar causing the time range of the event to increase or
+     * decrease. The new start and end times are returned as arguments to this
+     * method.
+     * 
+     * @param index
+     *            The index of the event in the event cache
+     * @param startTime
+     *            The new start date and time of the event
+     * @param endTime
+     *            The new end date and time of the event
+     */
+    protected void fireEventResize(int index, Date startTime, Date endTime) {
+        EventResize event = new EventResize(this, events.get(index), startTime,
+                endTime);
+
+        if (calendarEventProvider instanceof EventResizeHandler) {
+            // Notify event provider if it is an event resize handler
+            ((EventResizeHandler) calendarEventProvider).eventResize(event);
+        }
+
+        // Notify event resize handler attached by using the
+        // setHandler(EventMoveHandler) method
+        fireEvent(event);
+    }
+
+    /**
+     * Localized display names for week days starting from sunday. Returned
+     * array's length is always 7.
+     * 
+     * @return Array of localized weekday names.
+     */
+    protected String[] getDayNamesShort() {
+        DateFormatSymbols s = new DateFormatSymbols(getLocale());
+        return Arrays.copyOfRange(s.getWeekdays(), 1, 8);
+    }
+
+    /**
+     * Localized display names for months starting from January. Returned
+     * array's length is always 12.
+     * 
+     * @return Array of localized month names.
+     */
+    protected String[] getMonthNamesShort() {
+        DateFormatSymbols s = new DateFormatSymbols(getLocale());
+        return Arrays.copyOf(s.getShortMonths(), 12);
+    }
+
+    /**
+     * Gets a date that is first day in the week that target given date belongs
+     * to.
+     * 
+     * @param date
+     *            Target date
+     * @return Date that is first date in same week that given date is.
+     */
+    protected Date getFirstDateForWeek(Date date) {
+        int firstDayOfWeek = currentCalendar.getFirstDayOfWeek();
+        currentCalendar.setTime(date);
+        while (firstDayOfWeek != currentCalendar
+                .get(java.util.Calendar.DAY_OF_WEEK)) {
+            currentCalendar.add(java.util.Calendar.DATE, -1);
+        }
+        return currentCalendar.getTime();
+    }
+
+    /**
+     * Gets a date that is last day in the week that target given date belongs
+     * to.
+     * 
+     * @param date
+     *            Target date
+     * @return Date that is last date in same week that given date is.
+     */
+    protected Date getLastDateForWeek(Date date) {
+        currentCalendar.setTime(date);
+        currentCalendar.add(java.util.Calendar.DATE, 1);
+        int firstDayOfWeek = currentCalendar.getFirstDayOfWeek();
+        // Roll to weeks last day using firstdayofweek. Roll until FDofW is
+        // found and then roll back one day.
+        while (firstDayOfWeek != currentCalendar
+                .get(java.util.Calendar.DAY_OF_WEEK)) {
+            currentCalendar.add(java.util.Calendar.DATE, 1);
+        }
+        currentCalendar.add(java.util.Calendar.DATE, -1);
+        return currentCalendar.getTime();
+    }
+
+    /**
+     * Calculates the end time of the day using the given calendar and date
+     * 
+     * @param date
+     * @param calendar
+     *            the calendar instance to be used in the calculation. The given
+     *            instance is unchanged in this operation.
+     * @return the given date, with time set to the end of the day
+     */
+    private static Date getEndOfDay(java.util.Calendar calendar, Date date) {
+        java.util.Calendar calendarClone = (java.util.Calendar) calendar
+                .clone();
+
+        calendarClone.setTime(date);
+        calendarClone.set(java.util.Calendar.MILLISECOND,
+                calendarClone.getActualMaximum(java.util.Calendar.MILLISECOND));
+        calendarClone.set(java.util.Calendar.SECOND,
+                calendarClone.getActualMaximum(java.util.Calendar.SECOND));
+        calendarClone.set(java.util.Calendar.MINUTE,
+                calendarClone.getActualMaximum(java.util.Calendar.MINUTE));
+        calendarClone.set(java.util.Calendar.HOUR,
+                calendarClone.getActualMaximum(java.util.Calendar.HOUR));
+        calendarClone.set(java.util.Calendar.HOUR_OF_DAY,
+                calendarClone.getActualMaximum(java.util.Calendar.HOUR_OF_DAY));
+
+        return calendarClone.getTime();
+    }
+
+    /**
+     * Calculates the end time of the day using the given calendar and date
+     * 
+     * @param date
+     * @param calendar
+     *            the calendar instance to be used in the calculation. The given
+     *            instance is unchanged in this operation.
+     * @return the given date, with time set to the end of the day
+     */
+    private static Date getStartOfDay(java.util.Calendar calendar, Date date) {
+        java.util.Calendar calendarClone = (java.util.Calendar) calendar
+                .clone();
+
+        calendarClone.setTime(date);
+        calendarClone.set(java.util.Calendar.MILLISECOND, 0);
+        calendarClone.set(java.util.Calendar.SECOND, 0);
+        calendarClone.set(java.util.Calendar.MINUTE, 0);
+        calendarClone.set(java.util.Calendar.HOUR, 0);
+        calendarClone.set(java.util.Calendar.HOUR_OF_DAY, 0);
+
+        return calendarClone.getTime();
+    }
+
+    /**
+     * Finds the first day of the week and returns a day representing the start
+     * of that day
+     * 
+     * @param start
+     *            The actual date
+     * @param expandToFullWeek
+     *            Should the returned date be moved to the start of the week
+     * @return If expandToFullWeek is set then it returns the first day of the
+     *         week, else it returns a clone of the actual date with the time
+     *         set to the start of the day
+     */
+    protected Date expandStartDate(Date start, boolean expandToFullWeek) {
+        // If the duration is more than week, use monthly view and get startweek
+        // and endweek. Example if views daterange is from tuesday to next weeks
+        // wednesday->expand to monday to nextweeks sunday. If firstdayofweek =
+        // monday
+        if (expandToFullWeek) {
+            start = getFirstDateForWeek(start);
+
+        } else {
+            start = (Date) start.clone();
+        }
+
+        // Always expand to the start of the first day to the end of the last
+        // day
+        start = getStartOfDay(currentCalendar, start);
+
+        return start;
+    }
+
+    /**
+     * Finds the last day of the week and returns a day representing the end of
+     * that day
+     * 
+     * @param end
+     *            The actual date
+     * @param expandToFullWeek
+     *            Should the returned date be moved to the end of the week
+     * @return If expandToFullWeek is set then it returns the last day of the
+     *         week, else it returns a clone of the actual date with the time
+     *         set to the end of the day
+     */
+    protected Date expandEndDate(Date end, boolean expandToFullWeek) {
+        // If the duration is more than week, use monthly view and get startweek
+        // and endweek. Example if views daterange is from tuesday to next weeks
+        // wednesday->expand to monday to nextweeks sunday. If firstdayofweek =
+        // monday
+        if (expandToFullWeek) {
+            end = getLastDateForWeek(end);
+
+        } else {
+            end = (Date) end.clone();
+        }
+
+        // Always expand to the start of the first day to the end of the last
+        // day
+        end = getEndOfDay(currentCalendar, end);
+
+        return end;
+    }
+
+    /**
+     * Set the {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+     * CalendarEventProvider} to be used with this calendar. The EventProvider
+     * is used to query for events to show, and must be non-null. By default a
+     * {@link com.vaadin.addon.calendar.event.BasicEventProvider
+     * BasicEventProvider} is used.
+     * 
+     * @param calendarEventProvider
+     *            the calendarEventProvider to set. Cannot be null.
+     */
+    public void setEventProvider(CalendarEventProvider calendarEventProvider) {
+        if (calendarEventProvider == null) {
+            throw new IllegalArgumentException(
+                    "Calendar event provider cannot be null");
+        }
+
+        // remove old listener
+        if (getEventProvider() instanceof EventSetChangeNotifier) {
+            ((EventSetChangeNotifier) getEventProvider()).removeEventSetChangeListener(this);
+        }
+
+        this.calendarEventProvider = calendarEventProvider;
+
+        // add new listener
+        if (calendarEventProvider instanceof EventSetChangeNotifier) {
+            ((EventSetChangeNotifier) calendarEventProvider).addEventSetChangeListener(this);
+        }
+    }
+
+    /**
+     * @return the {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+     *         CalendarEventProvider} currently used
+     */
+    public CalendarEventProvider getEventProvider() {
+        return calendarEventProvider;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarEvents.EventChangeListener#eventChange
+     * (com.vaadin.addon.calendar.ui.CalendarEvents.EventChange)
+     */
+    public void eventSetChange(EventSetChangeEvent changeEvent) {
+        // sanity check
+        if (calendarEventProvider == changeEvent.getProvider()) {
+            markAsDirty();
+        }
+    }
+
+    /**
+     * Set the handler for the given type information. Mirrors
+     * {@link #addListener(String, Class, Object, Method) addListener} from
+     * AbstractComponent
+     * 
+     * @param eventId
+     *            A unique id for the event. Usually one of
+     *            {@link CalendarEventId}
+     * @param eventType
+     *            The class of the event, most likely a subclass of
+     *            {@link CalendarComponentEvent}
+     * @param listener
+     *            A listener that listens to the given event
+     * @param listenerMethod
+     *            The method on the lister to call when the event is triggered
+     */
+    protected void setHandler(String eventId, Class<?> eventType,
+            EventListener listener, Method listenerMethod) {
+        if (handlers.get(eventId) != null) {
+            removeListener(eventId, eventType, handlers.get(eventId));
+            handlers.remove(eventId);
+        }
+
+        if (listener != null) {
+            addListener(eventId, eventType, listener, listenerMethod);
+            handlers.put(eventId, listener);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.NavigationNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler)
+     */
+    public void setHandler(ForwardHandler listener) {
+        setHandler(ForwardEvent.EVENT_ID, ForwardEvent.class, listener,
+                ForwardHandler.forwardMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.NavigationNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.BackwardHandler)
+     */
+    public void setHandler(BackwardHandler listener) {
+        setHandler(BackwardEvent.EVENT_ID, BackwardEvent.class, listener,
+                BackwardHandler.backwardMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.NavigationNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.DateClickHandler)
+     */
+    public void setHandler(DateClickHandler listener) {
+        setHandler(DateClickEvent.EVENT_ID, DateClickEvent.class, listener,
+                DateClickHandler.dateClickMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.NavigationNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventClickHandler)
+     */
+    public void setHandler(EventClickHandler listener) {
+        setHandler(EventClick.EVENT_ID, EventClick.class, listener,
+                EventClickHandler.eventClickMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.NavigationNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.WeekClickHandler)
+     */
+    public void setHandler(WeekClickHandler listener) {
+        setHandler(WeekClick.EVENT_ID, WeekClick.class, listener,
+                WeekClickHandler.weekClickMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResizeNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResizeHandler
+     * )
+     */
+    public void setHandler(EventResizeHandler listener) {
+        setHandler(EventResize.EVENT_ID, EventResize.class, listener,
+                EventResizeHandler.eventResizeMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.RangeSelectNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.RangeSelectHandler
+     * )
+     */
+    public void setHandler(RangeSelectHandler listener) {
+        setHandler(RangeSelectEvent.EVENT_ID, RangeSelectEvent.class, listener,
+                RangeSelectHandler.rangeSelectMethod);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventMoveNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventMoveHandler)
+     */
+    public void setHandler(EventMoveHandler listener) {
+        setHandler(MoveEvent.EVENT_ID, MoveEvent.class, listener,
+                EventMoveHandler.eventMoveMethod);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.CalendarEventNotifier
+     * #getHandler(java.lang.String)
+     */
+    public EventListener getHandler(String eventId) {
+        return handlers.get(eventId);
+    }
+
+    /**
+     * Get the currently active drop handler
+     */
+    public DropHandler getDropHandler() {
+        return dropHandler;
+    }
+
+    /**
+     * Set the drop handler for the calendar See {@link DropHandler} for
+     * implementation details.
+     * 
+     * @param dropHandler
+     *            The drop handler to set
+     */
+    public void setDropHandler(DropHandler dropHandler) {
+        this.dropHandler = dropHandler;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.event.dd.DropTarget#translateDropTargetDetails(java.util.Map)
+     */
+    public TargetDetails translateDropTargetDetails(
+            Map<String, Object> clientVariables) {
+        Map<String, Object> serverVariables = new HashMap<String, Object>(1);
+
+        if (clientVariables.containsKey("dropSlotIndex")) {
+            int slotIndex = (Integer) clientVariables.get("dropSlotIndex");
+            int dayIndex = (Integer) clientVariables.get("dropDayIndex");
+
+            currentCalendar.setTime(getStartOfDay(currentCalendar, startDate));
+            currentCalendar.add(java.util.Calendar.DATE, dayIndex);
+
+            // change this if slot length is modified
+            currentCalendar.add(java.util.Calendar.MINUTE, slotIndex * 30);
+
+            serverVariables.put("dropTime", currentCalendar.getTime());
+
+        } else {
+            int dayIndex = (Integer) clientVariables.get("dropDayIndex");
+            currentCalendar.setTime(expandStartDate(startDate, true));
+            currentCalendar.add(java.util.Calendar.DATE, dayIndex);
+            serverVariables.put("dropDay", currentCalendar.getTime());
+        }
+
+        CalendarTargetDetails td = new CalendarTargetDetails(serverVariables,
+                this);
+        td.setHasDropTime(clientVariables.containsKey("dropSlotIndex"));
+
+        return td;
+    }
+
+    /**
+     * Sets a container as a data source for the events in the calendar.
+     * Equivalent for doing
+     * <code>Calendar.setEventProvider(new ContainerEventProvider(container))</code>
+     * 
+     * Use this method if you are adding a container which uses the default
+     * property ids like {@link BeanItemContainer} for instance. If you are
+     * using custom properties instead use
+     * {@link Calendar#setContainerDataSource(com.vaadin.data.Container.Indexed, Object, Object, Object, Object, Object)}
+     * 
+     * Please note that the container must be sorted by date!
+     * 
+     * @param container
+     *            The container to use as a datasource
+     */
+    public void setContainerDataSource(Container.Indexed container) {
+        ContainerEventProvider provider = new ContainerEventProvider(container);
+        provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() {
+            public void eventSetChange(EventSetChangeEvent changeEvent) {
+                // Repaint if events change
+                markAsDirty();
+            }
+        });
+        provider.addEventChangeListener(new EventChangeListener() {
+            public void eventChange(EventChangeEvent changeEvent) {
+                // Repaint if event changes
+                markAsDirty();
+            }
+        });
+        setEventProvider(provider);
+    }
+
+    /**
+     * Sets a container as a data source for the events in the calendar.
+     * Equivalent for doing
+     * <code>Calendar.setEventProvider(new ContainerEventProvider(container))</code>
+     * 
+     * Please note that the container must be sorted by date!
+     * 
+     * @param container
+     *            The container to use as a data source
+     * @param captionProperty
+     *            The property that has the caption, null if no caption property
+     *            is present
+     * @param descriptionProperty
+     *            The property that has the description, null if no description
+     *            property is present
+     * @param startDateProperty
+     *            The property that has the starting date
+     * @param endDateProperty
+     *            The property that has the ending date
+     * @param styleNameProperty
+     *            The property that has the stylename, null if no stylname
+     *            property is present
+     */
+    public void setContainerDataSource(Container.Indexed container,
+            Object captionProperty, Object descriptionProperty,
+            Object startDateProperty, Object endDateProperty,
+            Object styleNameProperty) {
+        ContainerEventProvider provider = new ContainerEventProvider(container);
+        provider.setCaptionProperty(captionProperty);
+        provider.setDescriptionProperty(descriptionProperty);
+        provider.setStartDateProperty(startDateProperty);
+        provider.setEndDateProperty(endDateProperty);
+        provider.setStyleNameProperty(styleNameProperty);
+        provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() {
+            public void eventSetChange(EventSetChangeEvent changeEvent) {
+                // Repaint if events change
+                markAsDirty();
+            }
+        });
+        provider.addEventChangeListener(new EventChangeListener() {
+            public void eventChange(EventChangeEvent changeEvent) {
+                // Repaint if event changes
+                markAsDirty();
+            }
+        });
+        setEventProvider(provider);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
+     * util.Date, java.util.Date)
+     */
+    public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
+        return getEventProvider().getEvents(startDate, endDate);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void addEvent(CalendarEvent event) {
+        if (getEventProvider() instanceof CalendarEditableEventProvider) {
+            CalendarEditableEventProvider provider = (CalendarEditableEventProvider) getEventProvider();
+            provider.addEvent(event);
+            markAsDirty();
+        } else {
+            throw new UnsupportedOperationException(
+                    "Event provider does not support adding events");
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void removeEvent(CalendarEvent event) {
+        if (getEventProvider() instanceof CalendarEditableEventProvider) {
+            CalendarEditableEventProvider provider = (CalendarEditableEventProvider) getEventProvider();
+            provider.removeEvent(event);
+            markAsDirty();
+        } else {
+            throw new UnsupportedOperationException(
+                    "Event provider does not support removing events");
+        }
+    }
+
+    /**
+     * Adds an action handler to the calender that handles event produced by the
+     * context menu.
+     * 
+     * <p>
+     * The {@link Handler#getActions(Object, Object)} parameters depend on what
+     * view the Calendar is in:
+     * <ul>
+     * <li>If the Calendar is in <i>Day or Week View</i> then the target
+     * parameter will be a {@link CalendarDateRange} with a range of
+     * half-an-hour. The {@link Handler#getActions(Object, Object)} method will
+     * be called once per half-hour slot.</li>
+     * <li>If the Calendar is in <i>Month View</i> then the target parameter
+     * will be a {@link CalendarDateRange} with a range of one day. The
+     * {@link Handler#getActions(Object, Object)} will be called once for each
+     * day.
+     * </ul>
+     * The Dates passed into the {@link CalendarDateRange} are in the same
+     * timezone as the calendar is.
+     * </p>
+     * 
+     * <p>
+     * The {@link Handler#handleAction(Action, Object, Object)} parameters
+     * depend on what the context menu is called upon:
+     * <ul>
+     * <li>If the context menu is called upon an event then the target parameter
+     * is the event, i.e. instanceof {@link CalendarEvent}</li>
+     * <li>If the context menu is called upon an empty slot then the target is a
+     * {@link Date} representing that slot
+     * </ul>
+     * </p>
+     */
+    public void addActionHandler(Handler actionHandler) {
+        if (actionHandler != null) {
+            if (actionHandlers == null) {
+                actionHandlers = new LinkedList<Action.Handler>();
+                actionMapper = new KeyMapper<Action>();
+            }
+            if (!actionHandlers.contains(actionHandler)) {
+                actionHandlers.add(actionHandler);
+                markAsDirty();
+            }
+        }
+    }
+
+    /**
+     * Is the calendar in a mode where all days of the month is shown
+     * 
+     * @return Returns true if calendar is in monthly mode and false if it is in
+     *         weekly mode
+     */
+    public boolean isMonthlyMode() {
+        CalendarState state = (CalendarState) getState(false);
+        if (state.days != null) {
+            return state.days.size() > 7;
+        } else {
+            // Default mode
+            return true;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.event.Action.Container#removeActionHandler(com.vaadin.event
+     * .Action.Handler)
+     */
+    public void removeActionHandler(Handler actionHandler) {
+        if (actionHandlers != null && actionHandlers.contains(actionHandler)) {
+            actionHandlers.remove(actionHandler);
+            if (actionHandlers.isEmpty()) {
+                actionHandlers = null;
+                actionMapper = null;
+            }
+            markAsDirty();
+        }
+    }
+
+    private class CalendarServerRpcImpl implements CalendarServerRpc {
+
+        @Override
+        public void eventMove(int eventIndex, String newDate) {
+            if (!isClientChangeAllowed()) {
+                return;
+            }
+            if (newDate != null) {
+                try {
+                    Date d = df_date_time.parse(newDate);
+                    if (eventIndex >= 0 && eventIndex < events.size()
+                            && events.get(eventIndex) != null) {
+                        fireEventMove(eventIndex, d);
+                    }
+                } catch (ParseException e) {
+                    getLogger().log(Level.WARNING, e.getMessage());
+                }
+            }
+        }
+
+        @Override
+        public void rangeSelect(String range) {
+            if (!isClientChangeAllowed()) {
+                return;
+            }
+
+            if (range != null && range.length() > 14 && range.contains("TO")) {
+                String[] dates = range.split("TO");
+                try {
+                    Date d1 = df_date.parse(dates[0]);
+                    Date d2 = df_date.parse(dates[1]);
+
+                    fireRangeSelect(d1, d2, true);
+
+                } catch (ParseException e) {
+                    // NOP
+                }
+            } else if (range != null && range.length() > 12
+                    && range.contains(":")) {
+                String[] dates = range.split(":");
+                if (dates.length == 3) {
+                    try {
+                        Date d = df_date.parse(dates[0]);
+                        currentCalendar.setTime(d);
+                        int startMinutes = Integer.parseInt(dates[1]);
+                        int endMinutes = Integer.parseInt(dates[2]);
+                        currentCalendar.add(java.util.Calendar.MINUTE,
+                                startMinutes);
+                        Date start = currentCalendar.getTime();
+                        currentCalendar.add(java.util.Calendar.MINUTE,
+                                endMinutes - startMinutes);
+                        Date end = currentCalendar.getTime();
+                        fireRangeSelect(start, end, false);
+                    } catch (ParseException e) {
+                        // NOP
+                    } catch (NumberFormatException e) {
+                        // NOP
+                    }
+                }
+            }
+        }
+
+        @Override
+        public void forward() {
+            fireEvent(new ForwardEvent(Calendar.this));
+        }
+
+        @Override
+        public void backward() {
+            fireEvent(new BackwardEvent(Calendar.this));
+        }
+
+        @Override
+        public void dateClick(String date) {
+            if (!isClientChangeAllowed()) {
+                return;
+            }
+            if (date != null && date.length() > 6) {
+                try {
+                    Date d = df_date.parse(date);
+                    fireDateClick(d);
+                } catch (ParseException e) {
+                }
+            }
+        }
+
+        @Override
+        public void weekClick(String event) {
+            if (!isClientChangeAllowed()) {
+                return;
+            }
+            if (event.length() > 0 && event.contains("w")) {
+                String[] splitted = event.split("w");
+                if (splitted.length == 2) {
+                    try {
+                        int yr = 1900 + Integer.parseInt(splitted[0]);
+                        int week = Integer.parseInt(splitted[1]);
+                        fireWeekClick(week, yr);
+                    } catch (NumberFormatException e) {
+                        // NOP
+                    }
+                }
+            }
+        }
+
+        @Override
+        public void eventClick(int eventIndex) {
+            if (!isEventClickAllowed()) {
+                return;
+            }
+            if (eventIndex >= 0 && eventIndex < events.size()
+                    && events.get(eventIndex) != null) {
+                fireEventClick(eventIndex);
+            }
+        }
+
+        @Override
+        public void eventResize(int eventIndex, String newStartDate,
+                String newEndDate) {
+            if (!isClientChangeAllowed()) {
+                return;
+            }
+            if (newStartDate != null && !"".equals(newStartDate)
+                    && newEndDate != null && !"".equals(newEndDate)) {
+                try {
+                    Date newStartTime = df_date_time.parse(newStartDate);
+                    Date newEndTime = df_date_time.parse(newEndDate);
+
+                    fireEventResize(eventIndex, newStartTime, newEndTime);
+                } catch (ParseException e) {
+                    // NOOP
+                }
+            }
+        }
+
+        @Override
+        public void scroll(int scrollPosition) {
+            scrollTop = scrollPosition;
+            markAsDirty();
+        }
+
+        @Override
+        public void actionOnEmptyCell(String actionKey, String startDate,
+                String endDate) {
+            Action action = actionMapper.get(actionKey);
+            SimpleDateFormat formatter = new SimpleDateFormat(
+                    DateConstants.ACTION_DATE_FORMAT_PATTERN);
+            formatter.setTimeZone(getTimeZone());
+            try {
+                Date start = formatter.parse(startDate);
+                for (Action.Handler ah : actionHandlers) {
+                    ah.handleAction(action, this, start);
+                }
+
+            } catch (ParseException e) {
+                getLogger().log(Level.WARNING,
+                        "Could not parse action date string");
+            }
+
+        }
+
+        @Override
+        public void actionOnEvent(String actionKey, String startDate,
+                String endDate, int eventIndex) {
+            Action action = actionMapper.get(actionKey);
+            SimpleDateFormat formatter = new SimpleDateFormat(
+                    DateConstants.ACTION_DATE_FORMAT_PATTERN);
+            formatter.setTimeZone(getTimeZone());
+            for (Action.Handler ah : actionHandlers) {
+                ah.handleAction(action, this, events.get(eventIndex));
+            }
+        }
+    }
+}
\ No newline at end of file
diff --git a/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvent.java b/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvent.java
new file mode 100644
index 0000000000..1f012157b5
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvent.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar;
+
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.Component;
+
+/**
+ * All Calendar events extends this class.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+@SuppressWarnings("serial")
+public class CalendarComponentEvent extends Component.Event {
+
+    /**
+     * Set the source of the event
+     * 
+     * @param source
+     *            The source calendar
+     * 
+     */
+    public CalendarComponentEvent(Calendar source) {
+        super(source);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Component.Event#getComponent()
+     */
+    @Override
+    public Calendar getComponent() {
+        return (Calendar) super.getComponent();
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvents.java b/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvents.java
new file mode 100644
index 0000000000..1904d69898
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/CalendarComponentEvents.java
@@ -0,0 +1,603 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.EventListener;
+
+import com.vaadin.shared.ui.calendar.CalendarEventId;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.util.ReflectTools;
+
+/**
+ * Interface for all Vaadin Calendar events.
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+public interface CalendarComponentEvents extends Serializable {
+
+    /**
+     * Notifier interface for notifying listener of calendar events
+     */
+    public interface CalendarEventNotifier extends Serializable {
+        /**
+         * Get the assigned event handler for the given eventId.
+         * 
+         * @param eventId
+         * @return the assigned eventHandler, or null if no handler is assigned
+         */
+        public EventListener getHandler(String eventId);
+    }
+
+    /**
+     * Notifier interface for event drag & drops.
+     */
+    public interface EventMoveNotifier extends CalendarEventNotifier {
+
+        /**
+         * Set the EventMoveHandler.
+         * 
+         * @param listener
+         *            EventMoveHandler to be added
+         */
+        public void setHandler(EventMoveHandler listener);
+
+    }
+
+    /**
+     * MoveEvent is sent when existing event is dragged to a new position.
+     */
+    @SuppressWarnings("serial")
+    public class MoveEvent extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.EVENTMOVE;
+
+        /** Index for the moved Schedule.Event. */
+        private CalendarEvent calendarEvent;
+
+        /** New starting date for the moved Calendar.Event. */
+        private Date newStart;
+
+        /**
+         * MoveEvent needs the target event and new start date.
+         * 
+         * @param source
+         *            Calendar component.
+         * @param calendarEvent
+         *            Target event.
+         * @param newStart
+         *            Target event's new start date.
+         */
+        public MoveEvent(Calendar source, CalendarEvent calendarEvent,
+                Date newStart) {
+            super(source);
+
+            this.calendarEvent = calendarEvent;
+            this.newStart = newStart;
+        }
+
+        /**
+         * Get target event.
+         * 
+         * @return Target event.
+         */
+        public CalendarEvent getCalendarEvent() {
+            return calendarEvent;
+        }
+
+        /**
+         * Get new start date.
+         * 
+         * @return New start date.
+         */
+        public Date getNewStart() {
+            return newStart;
+        }
+    }
+
+    /**
+     * Handler interface for when events are being dragged on the calendar
+     * 
+     */
+    public interface EventMoveHandler extends EventListener, Serializable {
+
+        /** Trigger method for the MoveEvent. */
+        public static final Method eventMoveMethod = ReflectTools.findMethod(
+                EventMoveHandler.class, "eventMove", MoveEvent.class);
+
+        /**
+         * This method will be called when event has been moved to a new
+         * position.
+         * 
+         * @param event
+         *            MoveEvent containing specific information of the new
+         *            position and target event.
+         */
+        public void eventMove(MoveEvent event);
+    }
+
+    /**
+     * Handler interface for day or time cell drag-marking with mouse.
+     */
+    public interface RangeSelectNotifier extends Serializable,
+            CalendarEventNotifier {
+
+        /**
+         * Set the RangeSelectHandler that listens for drag-marking.
+         * 
+         * @param listener
+         *            RangeSelectHandler to be added.
+         */
+        public void setHandler(RangeSelectHandler listener);
+    }
+
+    /**
+     * RangeSelectEvent is sent when day or time cells are drag-marked with
+     * mouse.
+     */
+    @SuppressWarnings("serial")
+    public class RangeSelectEvent extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.RANGESELECT;
+
+        /** Calendar event's start date. */
+        private Date start;
+
+        /** Calendar event's end date. */
+        private Date end;
+
+        /**
+         * Defines the event's view mode.
+         */
+        private boolean monthlyMode;
+
+        /**
+         * RangeSelectEvent needs a start and end date.
+         * 
+         * @param source
+         *            Calendar component.
+         * @param start
+         *            Start date.
+         * @param end
+         *            End date.
+         * @param monthlyMode
+         *            Calendar view mode.
+         */
+        public RangeSelectEvent(Calendar source, Date start, Date end,
+                boolean monthlyMode) {
+            super(source);
+            this.start = start;
+            this.end = end;
+            this.monthlyMode = monthlyMode;
+        }
+
+        /**
+         * Get start date.
+         * 
+         * @return Start date.
+         */
+        public Date getStart() {
+            return start;
+        }
+
+        /**
+         * Get end date.
+         * 
+         * @return End date.
+         */
+        public Date getEnd() {
+            return end;
+        }
+
+        /**
+         * Gets the event's view mode. Calendar can be be either in monthly or
+         * weekly mode, depending on the active date range.
+         * 
+         * @deprecated User {@link Calendar#isMonthlyMode()} instead
+         * 
+         * @return Returns true when monthly view is active.
+         */
+        @Deprecated
+        public boolean isMonthlyMode() {
+            return monthlyMode;
+        }
+    }
+
+    /** RangeSelectHandler handles RangeSelectEvent. */
+    public interface RangeSelectHandler extends EventListener, Serializable {
+
+        /** Trigger method for the RangeSelectEvent. */
+        public static final Method rangeSelectMethod = ReflectTools
+                .findMethod(RangeSelectHandler.class, "rangeSelect",
+                        RangeSelectEvent.class);
+
+        /**
+         * This method will be called when day or time cells are drag-marked
+         * with mouse.
+         * 
+         * @param event
+         *            RangeSelectEvent that contains range start and end date.
+         */
+        public void rangeSelect(RangeSelectEvent event);
+    }
+
+    /** Notifier interface for navigation listening. */
+    public interface NavigationNotifier extends Serializable {
+        /**
+         * Add a forward navigation listener.
+         * 
+         * @param handler
+         *            ForwardHandler to be added.
+         */
+        public void setHandler(ForwardHandler handler);
+
+        /**
+         * Add a backward navigation listener.
+         * 
+         * @param handler
+         *            BackwardHandler to be added.
+         */
+        public void setHandler(BackwardHandler handler);
+
+        /**
+         * Add a date click listener.
+         * 
+         * @param handler
+         *            DateClickHandler to be added.
+         */
+        public void setHandler(DateClickHandler handler);
+
+        /**
+         * Add a event click listener.
+         * 
+         * @param handler
+         *            EventClickHandler to be added.
+         */
+        public void setHandler(EventClickHandler handler);
+
+        /**
+         * Add a week click listener.
+         * 
+         * @param handler
+         *            WeekClickHandler to be added.
+         */
+        public void setHandler(WeekClickHandler handler);
+    }
+
+    /**
+     * ForwardEvent is sent when forward navigation button is clicked.
+     */
+    @SuppressWarnings("serial")
+    public class ForwardEvent extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.FORWARD;
+
+        /**
+         * ForwardEvent needs only the source component.
+         * 
+         * @param source
+         *            Calendar component.
+         */
+        public ForwardEvent(Calendar source) {
+            super(source);
+        }
+    }
+
+    /** ForwardHandler handles ForwardEvent. */
+    public interface ForwardHandler extends EventListener, Serializable {
+
+        /** Trigger method for the ForwardEvent. */
+        public static final Method forwardMethod = ReflectTools.findMethod(
+                ForwardHandler.class, "forward", ForwardEvent.class);
+
+        /**
+         * This method will be called when date range is moved forward.
+         * 
+         * @param event
+         *            ForwardEvent
+         */
+        public void forward(ForwardEvent event);
+    }
+
+    /**
+     * BackwardEvent is sent when backward navigation button is clicked.
+     */
+    @SuppressWarnings("serial")
+    public class BackwardEvent extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.BACKWARD;
+
+        /**
+         * BackwardEvent needs only the source source component.
+         * 
+         * @param source
+         *            Calendar component.
+         */
+        public BackwardEvent(Calendar source) {
+            super(source);
+        }
+    }
+
+    /** BackwardHandler handles BackwardEvent. */
+    public interface BackwardHandler extends EventListener, Serializable {
+
+        /** Trigger method for the BackwardEvent. */
+        public static final Method backwardMethod = ReflectTools.findMethod(
+                BackwardHandler.class, "backward", BackwardEvent.class);
+
+        /**
+         * This method will be called when date range is moved backwards.
+         * 
+         * @param event
+         *            BackwardEvent
+         */
+        public void backward(BackwardEvent event);
+    }
+
+    /**
+     * DateClickEvent is sent when a date is clicked.
+     */
+    @SuppressWarnings("serial")
+    public class DateClickEvent extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.DATECLICK;
+
+        /** Date that was clicked. */
+        private Date date;
+
+        /** DateClickEvent needs the target date that was clicked. */
+        public DateClickEvent(Calendar source, Date date) {
+            super(source);
+            this.date = date;
+        }
+
+        /**
+         * Get clicked date.
+         * 
+         * @return Clicked date.
+         */
+        public Date getDate() {
+            return date;
+        }
+    }
+
+    /** DateClickHandler handles DateClickEvent. */
+    public interface DateClickHandler extends EventListener, Serializable {
+
+        /** Trigger method for the DateClickEvent. */
+        public static final Method dateClickMethod = ReflectTools.findMethod(
+                DateClickHandler.class, "dateClick", DateClickEvent.class);
+
+        /**
+         * This method will be called when a date is clicked.
+         * 
+         * @param event
+         *            DateClickEvent containing the target date.
+         */
+        public void dateClick(DateClickEvent event);
+    }
+
+    /**
+     * EventClick is sent when an event is clicked.
+     */
+    @SuppressWarnings("serial")
+    public class EventClick extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.EVENTCLICK;
+
+        /** Clicked source event. */
+        private CalendarEvent calendarEvent;
+
+        /** Target source event is needed for the EventClick. */
+        public EventClick(Calendar source, CalendarEvent calendarEvent) {
+            super(source);
+            this.calendarEvent = calendarEvent;
+        }
+
+        /**
+         * Get the clicked event.
+         * 
+         * @return Clicked event.
+         */
+        public CalendarEvent getCalendarEvent() {
+            return calendarEvent;
+        }
+    }
+
+    /** EventClickHandler handles EventClick. */
+    public interface EventClickHandler extends EventListener, Serializable {
+
+        /** Trigger method for the EventClick. */
+        public static final Method eventClickMethod = ReflectTools.findMethod(
+                EventClickHandler.class, "eventClick", EventClick.class);
+
+        /**
+         * This method will be called when an event is clicked.
+         * 
+         * @param event
+         *            EventClick containing the target event.
+         */
+        public void eventClick(EventClick event);
+    }
+
+    /**
+     * WeekClick is sent when week is clicked.
+     */
+    @SuppressWarnings("serial")
+    public class WeekClick extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.WEEKCLICK;
+
+        /** Target week. */
+        private int week;
+
+        /** Target year. */
+        private int year;
+
+        /**
+         * WeekClick needs a target year and week.
+         * 
+         * @param source
+         *            Target source.
+         * @param week
+         *            Target week.
+         * @param year
+         *            Target year.
+         */
+        public WeekClick(Calendar source, int week, int year) {
+            super(source);
+            this.week = week;
+            this.year = year;
+        }
+
+        /**
+         * Get week as a integer. See {@link java.util.Calendar} for the allowed
+         * values.
+         * 
+         * @return Week as a integer.
+         */
+        public int getWeek() {
+            return week;
+        }
+
+        /**
+         * Get year as a integer. See {@link java.util.Calendar} for the allowed
+         * values.
+         * 
+         * @return Year as a integer
+         */
+        public int getYear() {
+            return year;
+        }
+    }
+
+    /** WeekClickHandler handles WeekClicks. */
+    public interface WeekClickHandler extends EventListener, Serializable {
+
+        /** Trigger method for the WeekClick. */
+        public static final Method weekClickMethod = ReflectTools.findMethod(
+                WeekClickHandler.class, "weekClick", WeekClick.class);
+
+        /**
+         * This method will be called when a week is clicked.
+         * 
+         * @param event
+         *            WeekClick containing the target week and year.
+         */
+        public void weekClick(WeekClick event);
+    }
+
+    /**
+     * EventResize is sent when an event is resized
+     */
+    @SuppressWarnings("serial")
+    public class EventResize extends CalendarComponentEvent {
+
+        public static final String EVENT_ID = CalendarEventId.EVENTRESIZE;
+
+        private CalendarEvent calendarEvent;
+
+        private Date startTime;
+
+        private Date endTime;
+
+        public EventResize(Calendar source, CalendarEvent calendarEvent,
+                Date startTime, Date endTime) {
+            super(source);
+            this.calendarEvent = calendarEvent;
+            this.startTime = startTime;
+            this.endTime = endTime;
+        }
+
+        /**
+         * Get target event.
+         * 
+         * @return Target event.
+         */
+        public CalendarEvent getCalendarEvent() {
+            return calendarEvent;
+        }
+
+        /**
+         * @deprecated Use {@link #getNewStart()} instead
+         * 
+         * @return the new start time
+         */
+        @Deprecated
+        public Date getNewStartTime() {
+            return startTime;
+        }
+
+        /**
+         * Returns the updated start date/time of the event
+         * 
+         * @return The new date for the event
+         */
+        public Date getNewStart() {
+            return startTime;
+        }
+
+        /**
+         * @deprecated Use {@link #getNewEnd()} instead
+         * 
+         * @return the new end time
+         */
+        @Deprecated
+        public Date getNewEndTime() {
+            return endTime;
+        }
+
+        /**
+         * Returns the updates end date/time of the event
+         * 
+         * @return The new date for the event
+         */
+        public Date getNewEnd() {
+            return endTime;
+        }
+    }
+
+    /**
+     * Notifier interface for event resizing.
+     */
+    public interface EventResizeNotifier extends Serializable {
+
+        /**
+         * Set a EventResizeHandler.
+         * 
+         * @param handler
+         *            EventResizeHandler to be set
+         */
+        public void setHandler(EventResizeHandler handler);
+    }
+
+    /**
+     * Handler for EventResize event.
+     */
+    public interface EventResizeHandler extends EventListener, Serializable {
+
+        /** Trigger method for the EventResize. */
+        public static final Method eventResizeMethod = ReflectTools.findMethod(
+                EventResizeHandler.class, "eventResize", EventResize.class);
+
+        void eventResize(EventResize event);
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/CalendarDateRange.java b/server/src/com/vaadin/ui/components/calendar/CalendarDateRange.java
new file mode 100644
index 0000000000..01b766a6db
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/CalendarDateRange.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.TimeZone;
+
+/**
+ * Class for representing a date range.
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ * 
+ */
+@SuppressWarnings("serial")
+public class CalendarDateRange implements Serializable {
+
+    private Date start;
+
+    private Date end;
+
+    private final transient TimeZone tz;
+
+    /**
+     * Constructor
+     * 
+     * @param start
+     *            The start date and time of the date range
+     * @param end
+     *            The end date and time of the date range
+     */
+    public CalendarDateRange(Date start, Date end, TimeZone tz) {
+        super();
+        this.start = start;
+        this.end = end;
+        this.tz = tz;
+    }
+
+    /**
+     * Get the start date of the date range
+     * 
+     * @return the start Date of the range
+     */
+    public Date getStart() {
+        return start;
+    }
+
+    /**
+     * Get the end date of the date range
+     * 
+     * @return the end Date of the range
+     */
+    public Date getEnd() {
+        return end;
+    }
+
+    /**
+     * Is a date in the date range
+     * 
+     * @param date
+     *            The date to check
+     * @return true if the date range contains a date start and end of range
+     *         inclusive; false otherwise
+     */
+    public boolean inRange(Date date) {
+        if (date == null) {
+            return false;
+        }
+
+        return date.compareTo(start) >= 0 && date.compareTo(end) <= 0;
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/CalendarTargetDetails.java b/server/src/com/vaadin/ui/components/calendar/CalendarTargetDetails.java
new file mode 100644
index 0000000000..1a3ef67377
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/CalendarTargetDetails.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar;
+
+import java.util.Date;
+import java.util.Map;
+
+import com.vaadin.event.dd.DropTarget;
+import com.vaadin.event.dd.TargetDetailsImpl;
+import com.vaadin.ui.Calendar;
+
+/**
+ * Drop details for {@link com.vaadin.ui.addon.calendar.ui.Calendar Calendar}.
+ * When something is dropped on the Calendar, this class contains the specific
+ * details of the drop point. Specifically, this class gives access to the date
+ * where the drop happened. If the Calendar was in weekly mode, the date also
+ * includes the start time of the slot.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class CalendarTargetDetails extends TargetDetailsImpl {
+
+    private boolean hasDropTime;
+
+    public CalendarTargetDetails(Map<String, Object> rawDropData,
+            DropTarget dropTarget) {
+        super(rawDropData, dropTarget);
+    }
+
+    /**
+     * @return true if {@link #getDropTime()} will return a date object with the
+     *         time set to the start of the time slot where the drop happened
+     */
+    public boolean hasDropTime() {
+        return hasDropTime;
+    }
+
+    /**
+     * Does the dropped item have a time associated with it
+     * 
+     * @param hasDropTime
+     */
+    public void setHasDropTime(boolean hasDropTime) {
+        this.hasDropTime = hasDropTime;
+    }
+
+    /**
+     * @return the date where the drop happened
+     */
+    public Date getDropTime() {
+        if (hasDropTime) {
+            return (Date) getData("dropTime");
+        } else {
+            return (Date) getData("dropDay");
+        }
+    }
+
+    /**
+     * @return the {@link com.vaadin.ui.addon.calendar.ui.Calendar Calendar}
+     *         instance which was the target of the drop
+     */
+    public Calendar getTargetCalendar() {
+        return (Calendar) getTarget();
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java b/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
new file mode 100644
index 0000000000..b01140eb88
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
@@ -0,0 +1,566 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.vaadin.data.Container;
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.data.Container.ItemSetChangeEvent;
+import com.vaadin.data.Container.ItemSetChangeNotifier;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeNotifier;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventMoveHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResize;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResizeHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.MoveEvent;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEditableEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeListener;
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeNotifier;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider.EventSetChangeNotifier;
+
+/**
+ * A event provider which uses a {@link Container} as a datasource. Container
+ * used as data source.
+ * 
+ * NOTE: The data source must be sorted by date!
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class ContainerEventProvider implements CalendarEditableEventProvider,
+        EventSetChangeNotifier, EventChangeNotifier, EventMoveHandler,
+        EventResizeHandler, Container.ItemSetChangeListener,
+        Property.ValueChangeListener {
+
+    // Default property ids
+    public static final String CAPTION_PROPERTY = "caption";
+    public static final String DESCRIPTION_PROPERTY = "description";
+    public static final String STARTDATE_PROPERTY = "start";
+    public static final String ENDDATE_PROPERTY = "end";
+    public static final String STYLENAME_PROPERTY = "styleName";
+
+    /**
+     * Internal class to keep the container index which item this event
+     * represents
+     * 
+     */
+    private class ContainerCalendarEvent extends BasicEvent {
+        private final int index;
+
+        public ContainerCalendarEvent(int containerIndex) {
+            super();
+            index = containerIndex;
+        }
+
+        public int getContainerIndex() {
+            return index;
+        }
+    }
+
+    /**
+     * Listeners attached to the container
+     */
+    private final List<EventSetChangeListener> eventSetChangeListeners = new LinkedList<CalendarEventProvider.EventSetChangeListener>();
+    private final List<EventChangeListener> eventChangeListeners = new LinkedList<CalendarEvent.EventChangeListener>();
+
+    /**
+     * The event cache contains the events previously created by
+     * {@link #getEvents(Date, Date)}
+     */
+    private final List<CalendarEvent> eventCache = new LinkedList<CalendarEvent>();
+
+    /**
+     * The container used as datasource
+     */
+    private Indexed container;
+
+    /**
+     * Container properties. Defaults based on using the {@link BasicEvent}
+     * helper class.
+     */
+    private Object captionProperty = CAPTION_PROPERTY;
+    private Object descriptionProperty = DESCRIPTION_PROPERTY;
+    private Object startDateProperty = STARTDATE_PROPERTY;
+    private Object endDateProperty = ENDDATE_PROPERTY;
+    private Object styleNameProperty = STYLENAME_PROPERTY;
+
+    /**
+     * Constructor
+     * 
+     * @param container
+     *            Container to use as a data source.
+     */
+    public ContainerEventProvider(Container.Indexed container) {
+        this.container = container;
+        listenToContainerEvents();
+    }
+
+    /**
+     * Set the container data source
+     * 
+     * @param container
+     *            The container to use as datasource
+     * 
+     */
+    public void setContainerDataSource(Container.Indexed container) {
+        // Detach the previous container
+        detachContainerDataSource();
+
+        this.container = container;
+        listenToContainerEvents();
+    }
+
+    /**
+     * Returns the container used as data source
+     * 
+     */
+    public Container.Indexed getContainerDataSource() {
+        return container;
+    }
+
+    /**
+     * Attaches listeners to the container so container events can be processed
+     */
+    private void listenToContainerEvents() {
+        if (container instanceof ItemSetChangeNotifier) {
+            ((ItemSetChangeNotifier) container).addItemSetChangeListener(this);
+        }
+        if (container instanceof ValueChangeNotifier) {
+            ((ValueChangeNotifier) container).addValueChangeListener(this);
+        }
+    }
+
+    /**
+     * Removes listeners from the container so no events are processed
+     */
+    private void ignoreContainerEvents() {
+        if (container instanceof ItemSetChangeNotifier) {
+            ((ItemSetChangeNotifier) container)
+                    .removeItemSetChangeListener(this);
+        }
+        if (container instanceof ValueChangeNotifier) {
+            ((ValueChangeNotifier) container).removeValueChangeListener(this);
+        }
+    }
+
+    /**
+     * Converts an event in the container to an {@link CalendarEvent}
+     * 
+     * @param index
+     *            The index of the item in the container to get the event for
+     * @return
+     */
+    private CalendarEvent getEvent(int index) {
+
+        // Check the event cache first
+        for (CalendarEvent e : eventCache) {
+            if (e instanceof ContainerCalendarEvent
+                    && ((ContainerCalendarEvent) e).getContainerIndex() == index) {
+                return e;
+            } else if (container.getIdByIndex(index) == e) {
+                return e;
+            }
+        }
+
+        final Object id = container.getIdByIndex(index);
+        Item item = container.getItem(id);
+        CalendarEvent event;
+        if (id instanceof CalendarEvent) {
+            /*
+             * If we are using the BeanItemContainer or another container which
+             * stores the objects as ids then just return the instances
+             */
+            event = (CalendarEvent) id;
+
+        } else {
+            /*
+             * Else we use the properties to create the event
+             */
+            BasicEvent basicEvent = new ContainerCalendarEvent(index);
+
+            // Set values from property values
+            if (captionProperty != null
+                    && item.getItemPropertyIds().contains(captionProperty)) {
+                basicEvent.setCaption(String.valueOf(item.getItemProperty(
+                        captionProperty).getValue()));
+            }
+            if (descriptionProperty != null
+                    && item.getItemPropertyIds().contains(descriptionProperty)) {
+                basicEvent.setDescription(String.valueOf(item.getItemProperty(
+                        descriptionProperty).getValue()));
+            }
+            if (startDateProperty != null
+                    && item.getItemPropertyIds().contains(startDateProperty)) {
+                basicEvent.setStart((Date) item.getItemProperty(
+                        startDateProperty).getValue());
+            }
+            if (endDateProperty != null
+                    && item.getItemPropertyIds().contains(endDateProperty)) {
+                basicEvent.setEnd((Date) item.getItemProperty(endDateProperty)
+                        .getValue());
+            }
+            if (styleNameProperty != null
+                    && item.getItemPropertyIds().contains(styleNameProperty)) {
+                basicEvent.setDescription(String.valueOf(item.getItemProperty(
+                        descriptionProperty).getValue()));
+            }
+            event = basicEvent;
+        }
+        return event;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
+     * util.Date, java.util.Date)
+     */
+    public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
+        eventCache.clear();
+
+        int[] rangeIndexes = getFirstAndLastEventIndex(startDate, endDate);
+        for (int i = rangeIndexes[0]; i <= rangeIndexes[1]
+                && i < container.size(); i++) {
+            eventCache.add(getEvent(i));
+        }
+        return Collections.unmodifiableList(eventCache);
+    }
+
+    /**
+     * Get the first event for a date
+     * 
+     * @param date
+     *            The date to search for, NUll returns first event in container
+     * @return Returns an array where the first item is the start index and the
+     *         second item is the end item
+     */
+    private int[] getFirstAndLastEventIndex(Date start, Date end) {
+        int startIndex = 0;
+        int size = container.size();
+        int endIndex = size - 1;
+
+        if (start != null) {
+            /*
+             * Iterating from the start of the container, if range is in the end
+             * of the container then this will be slow TODO This could be
+             * improved by using some sort of divide and conquer algorithm
+             */
+            while (startIndex < size) {
+                Object id = container.getIdByIndex(startIndex);
+                Item item = container.getItem(id);
+                Date d = (Date) item.getItemProperty(startDateProperty)
+                        .getValue();
+                if (d.compareTo(start) >= 0) {
+                    break;
+                }
+                startIndex++;
+            }
+        }
+
+        if (end != null) {
+            /*
+             * Iterate from the start index until range ends
+             */
+            endIndex = startIndex;
+            while (endIndex < size - 1) {
+                Object id = container.getIdByIndex(endIndex);
+                Item item = container.getItem(id);
+                Date d = (Date) item.getItemProperty(endDateProperty)
+                        .getValue();
+                if (d == null) {
+                    // No end date present, use start date
+                    d = (Date) item.getItemProperty(startDateProperty)
+                            .getValue();
+                }
+                if (d.compareTo(end) >= 0) {
+                    endIndex--;
+                    break;
+                }
+                endIndex++;
+            }
+        }
+
+        return new int[] { startIndex, endIndex };
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventProvider.EventSetChangeNotifier
+     * #addListener(com.vaadin.addon.calendar.event.CalendarEventProvider.
+     * EventSetChangeListener)
+     */
+    public void addEventSetChangeListener(EventSetChangeListener listener) {
+        if (!eventSetChangeListeners.contains(listener)) {
+            eventSetChangeListeners.add(listener);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventProvider.EventSetChangeNotifier
+     * #removeListener(com.vaadin.addon.calendar.event.CalendarEventProvider.
+     * EventSetChangeListener)
+     */
+    public void removeEventSetChangeListener(EventSetChangeListener listener) {
+        eventSetChangeListeners.remove(listener);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEvent.EventChangeNotifier#addListener
+     * (com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener)
+     */
+    public void addEventChangeListener(EventChangeListener listener) {
+        if (eventChangeListeners.contains(listener)) {
+            eventChangeListeners.add(listener);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent.EventChangeNotifier#
+     * removeListener
+     * (com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener)
+     */
+    public void removeEventChangeListener(EventChangeListener listener) {
+        eventChangeListeners.remove(listener);
+    }
+
+    /**
+     * Get the property which provides the caption of the event
+     */
+    public Object getCaptionProperty() {
+        return captionProperty;
+    }
+
+    /**
+     * Set the property which provides the caption of the event
+     */
+    public void setCaptionProperty(Object captionProperty) {
+        this.captionProperty = captionProperty;
+    }
+
+    /**
+     * Get the property which provides the description of the event
+     */
+    public Object getDescriptionProperty() {
+        return descriptionProperty;
+    }
+
+    /**
+     * Set the property which provides the description of the event
+     */
+    public void setDescriptionProperty(Object descriptionProperty) {
+        this.descriptionProperty = descriptionProperty;
+    }
+
+    /**
+     * Get the property which provides the starting date and time of the event
+     */
+    public Object getStartDateProperty() {
+        return startDateProperty;
+    }
+
+    /**
+     * Set the property which provides the starting date and time of the event
+     */
+    public void setStartDateProperty(Object startDateProperty) {
+        this.startDateProperty = startDateProperty;
+    }
+
+    /**
+     * Get the property which provides the ending date and time of the event
+     */
+    public Object getEndDateProperty() {
+        return endDateProperty;
+    }
+
+    /**
+     * Set the property which provides the ending date and time of the event
+     */
+    public void setEndDateProperty(Object endDateProperty) {
+        this.endDateProperty = endDateProperty;
+    }
+
+    /**
+     * Get the property which provides the style name for the event
+     */
+    public Object getStyleNameProperty() {
+        return styleNameProperty;
+    }
+
+    /**
+     * Set the property which provides the style name for the event
+     */
+    public void setStyleNameProperty(Object styleNameProperty) {
+        this.styleNameProperty = styleNameProperty;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.data.Container.ItemSetChangeListener#containerItemSetChange
+     * (com.vaadin.data.Container.ItemSetChangeEvent)
+     */
+    public void containerItemSetChange(ItemSetChangeEvent event) {
+        if (event.getContainer() == container) {
+            // Trigger an eventset change event when the itemset changes
+            for (EventSetChangeListener listener : eventSetChangeListeners) {
+                listener.eventSetChange(new EventSetChangeEvent(this));
+            }
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data
+     * .Property.ValueChangeEvent)
+     */
+    public void valueChange(ValueChangeEvent event) {
+        /*
+         * TODO Need to figure out how to get the item which triggered the the
+         * valuechange event and then trigger a EventChange event to the
+         * listeners
+         */
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventMoveHandler
+     * #eventMove
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.MoveEvent)
+     */
+    public void eventMove(MoveEvent event) {
+        CalendarEvent ce = event.getCalendarEvent();
+        if (eventCache.contains(ce)) {
+            int index;
+            if (ce instanceof ContainerCalendarEvent) {
+                index = ((ContainerCalendarEvent) ce).getContainerIndex();
+            } else {
+                index = container.indexOfId(ce);
+            }
+
+            long eventLength = ce.getEnd().getTime() - ce.getStart().getTime();
+            Date newEnd = new Date(event.getNewStart().getTime() + eventLength);
+
+            ignoreContainerEvents();
+            Item item = container.getItem(container.getIdByIndex(index));
+            item.getItemProperty(startDateProperty).setValue(
+                    event.getNewStart());
+            item.getItemProperty(endDateProperty).setValue(newEnd);
+            listenToContainerEvents();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResizeHandler
+     * #eventResize
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResize)
+     */
+    public void eventResize(EventResize event) {
+        CalendarEvent ce = event.getCalendarEvent();
+        if (eventCache.contains(ce)) {
+            int index;
+            if (ce instanceof ContainerCalendarEvent) {
+                index = ((ContainerCalendarEvent) ce).getContainerIndex();
+            } else {
+                index = container.indexOfId(ce);
+            }
+            ignoreContainerEvents();
+            Item item = container.getItem(container.getIdByIndex(index));
+            item.getItemProperty(startDateProperty).setValue(
+                    event.getNewStart());
+            item.getItemProperty(endDateProperty).setValue(event.getNewEnd());
+            listenToContainerEvents();
+        }
+    }
+
+    /**
+     * If you are reusing the container which previously have been attached to
+     * this ContainerEventProvider call this method to remove this event
+     * providers container listeners before attaching it to an other
+     * ContainerEventProvider
+     */
+    public void detachContainerDataSource() {
+        ignoreContainerEvents();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void addEvent(CalendarEvent event) {
+        Item item;
+        try {
+            item = container.addItem(event);
+        } catch (UnsupportedOperationException uop) {
+            // Thrown if container does not support adding items with custom
+            // ids. JPAContainer for example.
+            item = container.getItem(container.addItem());
+        }
+        if (item != null) {
+            item.getItemProperty(getCaptionProperty()).setValue(
+                    event.getCaption());
+            item.getItemProperty(getStartDateProperty()).setValue(
+                    event.getStart());
+            item.getItemProperty(getEndDateProperty()).setValue(event.getEnd());
+            item.getItemProperty(getStyleNameProperty()).setValue(
+                    event.getStyleName());
+            item.getItemProperty(getDescriptionProperty()).setValue(
+                    event.getDescription());
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void removeEvent(CalendarEvent event) {
+        container.removeItem(event);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java b/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
new file mode 100644
index 0000000000..ab342dfabf
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.event;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeNotifier;
+
+/**
+ * Simple implementation of
+ * {@link com.vaadin.addon.calendar.event.CalendarEvent CalendarEvent}. Has
+ * setters for all required fields and fires events when this event is changed.
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
+
+    private String caption;
+    private String description;
+    private Date end;
+    private Date start;
+    private String styleName;
+    private transient List<EventChangeListener> listeners = new ArrayList<EventChangeListener>();
+
+    private boolean isAllDay;
+
+    /**
+     * Default constructor
+     */
+    public BasicEvent() {
+
+    }
+
+    /**
+     * Constructor for creating an event with the same start and end date
+     * 
+     * @param caption
+     *            The caption for the event
+     * @param description
+     *            The description for the event
+     * @param date
+     *            The date the event occurred
+     */
+    public BasicEvent(String caption, String description, Date date) {
+        this.caption = caption;
+        this.description = description;
+        start = date;
+        end = date;
+    }
+
+    /**
+     * Constructor for creating an event with a start date and an end date.
+     * Start date should be before the end date
+     * 
+     * @param caption
+     *            The caption for the event
+     * @param description
+     *            The description for the event
+     * @param startDate
+     *            The start date of the event
+     * @param endDate
+     *            The end date of the event
+     */
+    public BasicEvent(String caption, String description, Date startDate,
+            Date endDate) {
+        this.caption = caption;
+        this.description = description;
+        start = startDate;
+        end = endDate;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getCaption()
+     */
+    public String getCaption() {
+        return caption;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getDescription()
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getEnd()
+     */
+    public Date getEnd() {
+        return end;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStart()
+     */
+    public Date getStart() {
+        return start;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#getStyleName()
+     */
+    public String getStyleName() {
+        return styleName;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.addon.calendar.event.CalendarEvent#isAllDay()
+     */
+    public boolean isAllDay() {
+        return isAllDay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setCaption(java.lang
+     * .String)
+     */
+    public void setCaption(String caption) {
+        this.caption = caption;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setDescription(java
+     * .lang.String)
+     */
+    public void setDescription(String description) {
+        this.description = description;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setEnd(java.util.
+     * Date)
+     */
+    public void setEnd(Date end) {
+        this.end = end;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setStart(java.util
+     * .Date)
+     */
+    public void setStart(Date start) {
+        this.start = start;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setStyleName(java
+     * .lang.String)
+     */
+    public void setStyleName(String styleName) {
+        this.styleName = styleName;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventEditor#setAllDay(boolean)
+     */
+    public void setAllDay(boolean isAllDay) {
+        this.isAllDay = isAllDay;
+        fireEventChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeListener
+     * )
+     */
+    public void addEventChangeListener(EventChangeListener listener) {
+        listeners.add(listener);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeNotifier
+     * #removeListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeListener
+     * )
+     */
+    public void removeEventChangeListener(EventChangeListener listener) {
+        listeners.remove(listener);
+    }
+
+    /**
+     * Fires an event change event to the listeners. Should be triggered when
+     * some property of the event changes.
+     */
+    protected void fireEventChange() {
+        EventChangeEvent event = new EventChangeEvent(this);
+
+        for (EventChangeListener listener : listeners) {
+            listener.eventChange(event);
+        }
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java b/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
new file mode 100644
index 0000000000..0314652245
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.event;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import com.vaadin.ui.components.calendar.event.CalendarEvent.EventChangeEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider.EventSetChangeNotifier;
+
+/**
+ * <p>
+ * Simple implementation of
+ * {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+ * CalendarEventProvider}. Use {@link #addEvent(CalendarEvent)} and
+ * {@link #removeEvent(CalendarEvent)} to add / remove events.
+ * </p>
+ * 
+ * <p>
+ * {@link com.vaadin.addon.calendar.event.CalendarEventProvider.EventSetChangeNotifier
+ * EventSetChangeNotifier} and
+ * {@link com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener
+ * EventChangeListener} are also implemented, so the Calendar is notified when
+ * an event is added, changed or removed.
+ * </p>
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicEventProvider implements CalendarEditableEventProvider,
+        EventSetChangeNotifier, CalendarEvent.EventChangeListener {
+
+    protected List<CalendarEvent> eventList = new ArrayList<CalendarEvent>();
+
+    private List<EventSetChangeListener> listeners = new ArrayList<EventSetChangeListener>();
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
+     * util.Date, java.util.Date)
+     */
+    public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
+        ArrayList<CalendarEvent> activeEvents = new ArrayList<CalendarEvent>();
+
+        for (CalendarEvent ev : eventList) {
+            long from = startDate.getTime();
+            long to = endDate.getTime();
+
+            if (ev.getStart() != null && ev.getEnd() != null) {
+                long f = ev.getStart().getTime();
+                long t = ev.getEnd().getTime();
+                // Select only events that overlaps with startDate and
+                // endDate.
+                if ((f <= to && f >= from) || (t >= from && t <= to)
+                        || (f <= from && t >= to)) {
+                    activeEvents.add(ev);
+                }
+            }
+        }
+
+        return activeEvents;
+    }
+
+    /**
+     * Does this event provider container this event
+     * 
+     * @param event
+     *            The event to check for
+     * @return If this provider has the event then true is returned, else false
+     */
+    public boolean containsEvent(BasicEvent event) {
+        return eventList.contains(event);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeNotifier
+     * #addListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener
+     * )
+     */
+    public void addEventSetChangeListener(EventSetChangeListener listener) {
+        listeners.add(listener);
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeNotifier
+     * #removeListener
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener
+     * )
+     */
+    public void removeEventSetChangeListener(EventSetChangeListener listener) {
+        listeners.remove(listener);
+    }
+
+    /**
+     * Fires a eventsetchange event. The event is fired when either an event is
+     * added or removed to the event provider
+     */
+    protected void fireEventSetChange() {
+        EventSetChangeEvent event = new EventSetChangeEvent(this);
+
+        for (EventSetChangeListener listener : listeners) {
+            listener.eventSetChange(event);
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeListener
+     * #eventChange
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChange)
+     */
+    public void eventChange(EventChangeEvent changeEvent) {
+        // naive implementation
+        fireEventSetChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void addEvent(CalendarEvent event) {
+        eventList.add(event);
+        if (event instanceof BasicEvent) {
+            ((BasicEvent) event).addEventChangeListener(this);
+        }
+        fireEventSetChange();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
+     * (com.vaadin.addon.calendar.event.CalendarEvent)
+     */
+    public void removeEvent(CalendarEvent event) {
+        eventList.remove(event);
+        if (event instanceof BasicEvent) {
+            ((BasicEvent) event).removeEventChangeListener(this);
+        }
+        fireEventSetChange();
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/CalendarEditableEventProvider.java b/server/src/com/vaadin/ui/components/calendar/event/CalendarEditableEventProvider.java
new file mode 100644
index 0000000000..145d2b4aa4
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/CalendarEditableEventProvider.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */package com.vaadin.ui.components.calendar.event;
+
+/**
+ * An event provider which allows adding and removing events
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+public interface CalendarEditableEventProvider extends CalendarEventProvider {
+
+    /**
+     * Adds an event to the event provider
+     * 
+     * @param event
+     *            The event to add
+     */
+    void addEvent(CalendarEvent event);
+
+    /**
+     * Removes an event from the event provider
+     * 
+     * @param event
+     *            The event
+     */
+    void removeEvent(CalendarEvent event);
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/CalendarEvent.java b/server/src/com/vaadin/ui/components/calendar/event/CalendarEvent.java
new file mode 100644
index 0000000000..531ee72c7f
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/CalendarEvent.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.event;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * <p>
+ * Event in the calendar. Customize your own event by implementing this
+ * interface.
+ * </p>
+ * 
+ * <li>Start and end fields are mandatory.</li>
+ * 
+ * <li>In "allDay" events longer than one day, starting and ending clock times
+ * are omitted in UI and only dates are shown.</li>
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ * 
+ */
+public interface CalendarEvent extends Serializable {
+
+    /**
+     * Gets start date of event.
+     * 
+     * @return Start date.
+     */
+    public Date getStart();
+
+    /**
+     * Get end date of event.
+     * 
+     * @return End date;
+     */
+    public Date getEnd();
+
+    /**
+     * Gets caption of event.
+     * 
+     * @return Caption text
+     */
+    public String getCaption();
+
+    /**
+     * Gets description of event. Shown as a tooltip over the event.
+     * 
+     * @return Description text.
+     */
+    public String getDescription();
+
+    /**
+     * <p>
+     * Gets style name of event. In the client, style name will be set to the
+     * event's element class name and can be styled by CSS
+     * </p>
+     * Styling example:</br> <code>Java code: </br>
+     * event.setStyleName("color1");
+     * </br></br>
+     * CSS:</br>
+     * .v-calendar-event-color1 {</br>
+     * &nbsp;&nbsp;&nbsp;background-color: #9effae;</br>}</code>
+     * 
+     * @return Style name.
+     */
+    public String getStyleName();
+
+    /**
+     * An all-day event typically does not occur at a specific time but targets
+     * a whole day or days. The rendering of all-day events differs from normal
+     * events.
+     * 
+     * @return true if this event is an all-day event, false otherwise
+     */
+    public boolean isAllDay();
+
+    /**
+     * Event to signal that an event has changed.
+     */
+    @SuppressWarnings("serial")
+    public class EventChangeEvent implements Serializable {
+
+        private CalendarEvent source;
+
+        public EventChangeEvent(CalendarEvent source) {
+            this.source = source;
+        }
+
+        /**
+         * @return the {@link com.vaadin.addon.calendar.event.CalendarEvent
+         *         CalendarEvent} that has changed
+         */
+        public CalendarEvent getCalendarEvent() {
+            return source;
+        }
+    }
+
+    /**
+     * Listener for EventSetChange events.
+     */
+    public interface EventChangeListener extends Serializable {
+
+        /**
+         * Called when an Event has changed.
+         */
+        public void eventChange(EventChangeEvent eventChangeEvent);
+    }
+
+    /**
+     * Notifier interface for EventChange events.
+     */
+    public interface EventChangeNotifier extends Serializable {
+
+        /**
+         * Add a listener to listen for EventChangeEvents. These events are
+         * fired when a events properties are changed.
+         * 
+         * @param listener
+         *            The listener to add
+         */
+        void addEventChangeListener(EventChangeListener listener);
+
+        /**
+         * Remove a listener from the event provider.
+         * 
+         * @param listener
+         *            The listener to remove
+         */
+        void removeEventChangeListener(EventChangeListener listener);
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/CalendarEventProvider.java b/server/src/com/vaadin/ui/components/calendar/event/CalendarEventProvider.java
new file mode 100644
index 0000000000..fefb2ca9b6
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/CalendarEventProvider.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.event;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Interface for querying events. The Vaadin Calendar always has a
+ * CalendarEventProvider set.
+ * 
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+public interface CalendarEventProvider extends Serializable {
+    /**
+     * <p>
+     * Gets all available events in the target date range between startDate and
+     * endDate. The Vaadin Calendar queries the events from the range that is
+     * shown, which is not guaranteed to be the same as the date range that is
+     * set.
+     * </p>
+     * 
+     * <p>
+     * For example, if you set the date range to be monday 22.2.2010 - wednesday
+     * 24.2.2000, the used Event Provider will be queried for events between
+     * monday 22.2.2010 00:00 and sunday 28.2.2010 23:59. Generally you can
+     * expect the date range to be expanded to whole days and whole weeks.
+     * </p>
+     * 
+     * @param startDate
+     *            Start date
+     * @param endDate
+     *            End date
+     * @return List of events
+     */
+    public List<CalendarEvent> getEvents(Date startDate, Date endDate);
+
+    /**
+     * Event to signal that the set of events has changed and the calendar
+     * should refresh its view from the
+     * {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+     * CalendarEventProvider} .
+     * 
+     */
+    @SuppressWarnings("serial")
+    public class EventSetChangeEvent implements Serializable {
+
+        private CalendarEventProvider source;
+
+        public EventSetChangeEvent(CalendarEventProvider source) {
+            this.source = source;
+        }
+
+        /**
+         * @return the
+         *         {@link com.vaadin.addon.calendar.event.CalendarEventProvider
+         *         CalendarEventProvider} that has changed
+         */
+        public CalendarEventProvider getProvider() {
+            return source;
+        }
+    }
+
+    /**
+     * Listener for EventSetChange events.
+     */
+    public interface EventSetChangeListener extends Serializable {
+
+        /**
+         * Called when the set of Events has changed.
+         */
+        public void eventSetChange(EventSetChangeEvent changeEvent);
+    }
+
+    /**
+     * Notifier interface for EventSetChange events.
+     */
+    public interface EventSetChangeNotifier extends Serializable {
+
+        /**
+         * Add a listener for listening to when new events are adding or removed
+         * from the event provider.
+         * 
+         * @param listener
+         *            The listener to add
+         */
+        void addEventSetChangeListener(EventSetChangeListener listener);
+
+        /**
+         * Remove a listener which listens to {@link EventSetChangeEvent}-events
+         * 
+         * @param listener
+         *            The listener to remove
+         */
+        void removeEventSetChangeListener(EventSetChangeListener listener);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/event/EditableCalendarEvent.java b/server/src/com/vaadin/ui/components/calendar/event/EditableCalendarEvent.java
new file mode 100644
index 0000000000..e8a27ad50f
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/event/EditableCalendarEvent.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.event;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * Extension to the basic {@link com.vaadin.addon.calendar.event.CalendarEvent
+ * CalendarEvent}. This interface provides setters (and thus editing
+ * capabilities) for all {@link com.vaadin.addon.calendar.event.CalendarEvent
+ * CalendarEvent} fields. For descriptions on the fields, refer to the extended
+ * interface.
+ * </p>
+ * 
+ * <p>
+ * This interface is used by some of the basic Calendar event handlers in the
+ * <code>com.vaadin.addon.calendar.ui.handler</code> package to determine
+ * whether an event can be edited.
+ * </p>
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public interface EditableCalendarEvent extends CalendarEvent {
+
+    /**
+     * Set the visible text in the calendar for the event.
+     * 
+     * @param caption
+     *            The text to show in the calendar
+     */
+    void setCaption(String caption);
+
+    /**
+     * Set the description of the event. This is shown in the calendar when
+     * hoovering over the event.
+     * 
+     * @param description
+     *            The text which describes the event
+     */
+    void setDescription(String description);
+
+    /**
+     * Set the end date of the event. Must be after the start date.
+     * 
+     * @param end
+     *            The end date to set
+     */
+    void setEnd(Date end);
+
+    /**
+     * Set the start date for the event. Must be before the end date
+     * 
+     * @param start
+     *            The start date of the event
+     */
+    void setStart(Date start);
+
+    /**
+     * Set the style name for the event used for styling the event cells
+     * 
+     * @param styleName
+     *            The stylename to use
+     * 
+     */
+    void setStyleName(String styleName);
+
+    /**
+     * Does the event span the whole day. If so then set this to true
+     * 
+     * @param isAllDay
+     *            True if the event spans the whole day. In this case the start
+     *            and end times are ignored.
+     */
+    void setAllDay(boolean isAllDay);
+
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
new file mode 100644
index 0000000000..fc2bfd6df4
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import com.vaadin.shared.ui.calendar.DateConstants;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardHandler;
+
+/**
+ * Implements basic functionality needed to enable backwards navigation.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicBackwardHandler implements BackwardHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.BackwardHandler#
+     * backward
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.BackwardEvent)
+     */
+    public void backward(BackwardEvent event) {
+        Date start = event.getComponent().getStartDate();
+        Date end = event.getComponent().getEndDate();
+
+        // calculate amount to move back
+        int durationInDays = (int) (((end.getTime()) - start.getTime()) / DateConstants.DAYINMILLIS);
+        durationInDays++;
+        durationInDays = -durationInDays;
+
+        // set new start and end times
+        Calendar javaCalendar = event.getComponent().getInternalCalendar();
+        javaCalendar.setTime(start);
+        javaCalendar.add(java.util.Calendar.DATE, durationInDays);
+        Date newStart = javaCalendar.getTime();
+
+        javaCalendar.setTime(end);
+        javaCalendar.add(java.util.Calendar.DATE, durationInDays);
+        Date newEnd = javaCalendar.getTime();
+
+        setDates(event, newStart, newEnd);
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(BackwardEvent event, Date start, Date end) {
+        event.getComponent().setStartDate(start);
+        event.getComponent().setEndDate(end);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
new file mode 100644
index 0000000000..c91a238b86
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickHandler;
+
+/**
+ * Implements basic functionality needed to switch to day view when a single day
+ * is clicked.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicDateClickHandler implements DateClickHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.DateClickHandler
+     * #dateClick
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.DateClickEvent)
+     */
+    public void dateClick(DateClickEvent event) {
+        Date clickedDate = event.getDate();
+
+        Calendar javaCalendar = event.getComponent().getInternalCalendar();
+        javaCalendar.setTime(clickedDate);
+
+        // as times are expanded, this is all that is needed to show one day
+        Date start = javaCalendar.getTime();
+        Date end = javaCalendar.getTime();
+
+        setDates(event, start, end);
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(DateClickEvent event, Date start, Date end) {
+        event.getComponent().setStartDate(start);
+        event.getComponent().setEndDate(end);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
new file mode 100644
index 0000000000..139837f339
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Date;
+
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventMoveHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.MoveEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.EditableCalendarEvent;
+
+/**
+ * Implements basic functionality needed to enable moving events.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicEventMoveHandler implements EventMoveHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventMoveHandler
+     * #eventMove
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.MoveEvent)
+     */
+    public void eventMove(MoveEvent event) {
+        CalendarEvent calendarEvent = event.getCalendarEvent();
+
+        if (calendarEvent instanceof EditableCalendarEvent) {
+
+            EditableCalendarEvent editableEvent = (EditableCalendarEvent) calendarEvent;
+
+            Date newFromTime = event.getNewStart();
+
+            // Update event dates
+            long length = editableEvent.getEnd().getTime()
+                    - editableEvent.getStart().getTime();
+            setDates(editableEvent, newFromTime, new Date(newFromTime.getTime()
+                    + length));
+        }
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(EditableCalendarEvent event, Date start, Date end) {
+        event.setStart(start);
+        event.setEnd(end);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
new file mode 100644
index 0000000000..c052d0d77b
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Date;
+
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResize;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResizeHandler;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.EditableCalendarEvent;
+
+/**
+ * Implements basic functionality needed to enable event resizing.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicEventResizeHandler implements EventResizeHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResizeHandler
+     * #eventResize
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResize)
+     */
+    public void eventResize(EventResize event) {
+        CalendarEvent calendarEvent = event.getCalendarEvent();
+
+        if (calendarEvent instanceof EditableCalendarEvent) {
+            Date newStartTime = event.getNewStart();
+            Date newEndTime = event.getNewEnd();
+
+            EditableCalendarEvent editableEvent = (EditableCalendarEvent) calendarEvent;
+
+            setDates(editableEvent, newStartTime, newEndTime);
+        }
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(EditableCalendarEvent event, Date start, Date end) {
+        event.setStart(start);
+        event.setEnd(end);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
new file mode 100644
index 0000000000..a5307ffd5c
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Calendar;
+import java.util.Date;
+
+import com.vaadin.shared.ui.calendar.DateConstants;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardHandler;
+
+/**
+ * Implements basic functionality needed to enable forward navigation.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicForwardHandler implements ForwardHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler#forward
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardEvent)
+     */
+    public void forward(ForwardEvent event) {
+        Date start = event.getComponent().getStartDate();
+        Date end = event.getComponent().getEndDate();
+
+        // calculate amount to move forward
+        int durationInDays = (int) (((end.getTime()) - start.getTime()) / DateConstants.DAYINMILLIS);
+        durationInDays++;
+
+        // set new start and end times
+        Calendar javaCalendar = Calendar.getInstance();
+        javaCalendar.setTime(start);
+        javaCalendar.add(java.util.Calendar.DATE, durationInDays);
+        Date newStart = javaCalendar.getTime();
+
+        javaCalendar.setTime(end);
+        javaCalendar.add(java.util.Calendar.DATE, durationInDays);
+        Date newEnd = javaCalendar.getTime();
+
+        setDates(event, newStart, newEnd);
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(ForwardEvent event, Date start, Date end) {
+        event.getComponent().setStartDate(start);
+        event.getComponent().setEndDate(end);
+    }
+}
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
new file mode 100644
index 0000000000..49efe49e48
--- /dev/null
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui.components.calendar.handler;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClickHandler;
+
+/**
+ * Implements basic functionality needed to change to week view when a week
+ * number is clicked.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+@SuppressWarnings("serial")
+public class BasicWeekClickHandler implements WeekClickHandler {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.addon.calendar.ui.CalendarComponentEvents.WeekClickHandler
+     * #weekClick
+     * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.WeekClick)
+     */
+    public void weekClick(WeekClick event) {
+        int week = event.getWeek();
+        int year = event.getYear();
+
+        // set correct year and month
+        Calendar javaCalendar = event.getComponent().getInternalCalendar();
+        javaCalendar.set(GregorianCalendar.YEAR, year);
+        javaCalendar.set(GregorianCalendar.WEEK_OF_YEAR, week);
+
+        // starting at the beginning of the week
+        javaCalendar.set(GregorianCalendar.DAY_OF_WEEK,
+                javaCalendar.getFirstDayOfWeek());
+        Date start = javaCalendar.getTime();
+
+        // ending at the end of the week
+        javaCalendar.add(GregorianCalendar.DATE, 6);
+        Date end = javaCalendar.getTime();
+
+        setDates(event, start, end);
+
+        // times are automatically expanded, no need to worry about them
+    }
+
+    /**
+     * Set the start and end dates for the event
+     * 
+     * @param event
+     *            The event that the start and end dates should be set
+     * @param start
+     *            The start date
+     * @param end
+     *            The end date
+     */
+    protected void setDates(WeekClick event, Date start, Date end) {
+        event.getComponent().setStartDate(start);
+        event.getComponent().setEndDate(end);
+    }
+
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java b/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java
new file mode 100644
index 0000000000..5926cfa1ca
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/calendar/CalendarBasics.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.server.component.calendar;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.junit.Test;
+
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.Calendar.TimeFormat;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventResize;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.MoveEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClick;
+import com.vaadin.ui.components.calendar.event.BasicEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+
+/**
+ * Basic API tests for the calendar
+ */
+public class CalendarBasics {
+
+    @Test
+    public void testEmptyConstructorInitialization() {
+
+        Calendar calendar = new Calendar();
+
+        // The calendar should have a basic event provider with no events
+        CalendarEventProvider provider = calendar.getEventProvider();
+        assertNotNull("Event provider should not be null", provider);
+
+        // Basic event handlers should be registered
+        assertNotNull(calendar.getHandler(BackwardEvent.EVENT_ID));
+        assertNotNull(calendar.getHandler(ForwardEvent.EVENT_ID));
+        assertNotNull(calendar.getHandler(WeekClick.EVENT_ID));
+        assertNotNull(calendar.getHandler(DateClickEvent.EVENT_ID));
+        assertNotNull(calendar.getHandler(MoveEvent.EVENT_ID));
+        assertNotNull(calendar.getHandler(EventResize.EVENT_ID));
+
+        // Calendar should have undefined size
+        assertTrue(calendar.getWidth() < 0);
+        assertTrue(calendar.getHeight() < 0);
+    }
+
+    @Test
+    public void testConstructorWithCaption() {
+        final String caption = "My Calendar Caption";
+        Calendar calendar = new Calendar(caption);
+        assertEquals(caption, calendar.getCaption());
+    }
+
+    @Test
+    public void testConstructorWithCustomEventProvider() {
+        BasicEventProvider myProvider = new BasicEventProvider();
+        Calendar calendar = new Calendar(myProvider);
+        assertEquals(myProvider, calendar.getEventProvider());
+    }
+
+    @Test
+    public void testConstructorWithCustomEventProviderAndCaption() {
+        BasicEventProvider myProvider = new BasicEventProvider();
+        final String caption = "My Calendar Caption";
+        Calendar calendar = new Calendar(caption, myProvider);
+        assertEquals(caption, calendar.getCaption());
+        assertEquals(myProvider, calendar.getEventProvider());
+    }
+
+    @Test
+    public void testDefaultStartAndEndDates() {
+        Calendar calendar = new Calendar();
+
+        // If no start and end date is set the calendar will display the current
+        // week
+        java.util.Calendar c = new GregorianCalendar();
+        java.util.Calendar c2 = new GregorianCalendar();
+
+        c2.setTime(calendar.getStartDate());
+        assertEquals(c.getFirstDayOfWeek(),
+                c2.get(java.util.Calendar.DAY_OF_WEEK));
+        c2.setTime(calendar.getEndDate());
+
+        c.set(java.util.Calendar.DAY_OF_WEEK, c.getFirstDayOfWeek() + 6);
+        assertEquals(c.get(java.util.Calendar.DAY_OF_WEEK),
+                c2.get(java.util.Calendar.DAY_OF_WEEK));
+    }
+
+    @Test
+    public void testCustomStartAndEndDates() {
+        Calendar calendar = new Calendar();
+        java.util.Calendar c = new GregorianCalendar();
+
+        Date start = c.getTime();
+        c.add(java.util.Calendar.DATE, 3);
+        Date end = c.getTime();
+
+        calendar.setStartDate(start);
+        calendar.setEndDate(end);
+
+        assertEquals(start.getTime(), calendar.getStartDate().getTime());
+        assertEquals(end.getTime(), calendar.getEndDate().getTime());
+    }
+
+    @Test
+    public void testCustomLocale() {
+        Calendar calendar = new Calendar();
+        calendar.setLocale(Locale.CANADA_FRENCH);
+
+        // Setting the locale should set the internal calendars locale
+        assertEquals(Locale.CANADA_FRENCH, calendar.getLocale());
+        java.util.Calendar c = new GregorianCalendar(Locale.CANADA_FRENCH);
+        assertEquals(c.getTimeZone().getRawOffset(), calendar
+                .getInternalCalendar().getTimeZone().getRawOffset());
+    }
+
+    @Test
+    public void testTimeFormat() {
+        Calendar calendar = new Calendar();
+
+        // The default timeformat depends on the current locale
+        calendar.setLocale(Locale.ENGLISH);
+        assertEquals(TimeFormat.Format12H, calendar.getTimeFormat());
+
+        calendar.setLocale(Locale.ITALIAN);
+        assertEquals(TimeFormat.Format24H, calendar.getTimeFormat());
+
+        // Setting a specific time format overrides the locale
+        calendar.setTimeFormat(TimeFormat.Format12H);
+        assertEquals(TimeFormat.Format12H, calendar.getTimeFormat());
+    }
+
+    @Test
+    public void testTimeZone() {
+        Calendar calendar = new Calendar();
+        calendar.setLocale(Locale.CANADA_FRENCH);
+
+        // By default the calendars timezone is returned
+        assertEquals(calendar.getInternalCalendar().getTimeZone(),
+                calendar.getTimeZone());
+
+        // One can override the default behaviour by specifying a timezone
+        TimeZone customTimeZone = TimeZone.getTimeZone("Europe/Helsinki");
+        calendar.setTimeZone(customTimeZone);
+        assertEquals(customTimeZone, calendar.getTimeZone());
+    }
+
+    @Test
+    public void testVisibleDaysOfWeek() {
+        Calendar calendar = new Calendar();
+
+        // The defaults are the whole week
+        assertEquals(1, calendar.getFirstVisibleDayOfWeek());
+        assertEquals(7, calendar.getLastVisibleDayOfWeek());
+
+        calendar.setFirstVisibleDayOfWeek(0); // Invalid input
+        assertEquals(1, calendar.getFirstVisibleDayOfWeek());
+
+        calendar.setLastVisibleDayOfWeek(0); // Invalid input
+        assertEquals(7, calendar.getLastVisibleDayOfWeek());
+
+        calendar.setFirstVisibleDayOfWeek(8); // Invalid input
+        assertEquals(1, calendar.getFirstVisibleDayOfWeek());
+
+        calendar.setLastVisibleDayOfWeek(8); // Invalid input
+        assertEquals(7, calendar.getLastVisibleDayOfWeek());
+
+        calendar.setFirstVisibleDayOfWeek(4);
+        assertEquals(4, calendar.getFirstVisibleDayOfWeek());
+
+        calendar.setLastVisibleDayOfWeek(6);
+        assertEquals(6, calendar.getLastVisibleDayOfWeek());
+
+        calendar.setFirstVisibleDayOfWeek(7); // Invalid since last day is 6
+        assertEquals(4, calendar.getFirstVisibleDayOfWeek());
+
+        calendar.setLastVisibleDayOfWeek(2); // Invalid since first day is 4
+        assertEquals(6, calendar.getLastVisibleDayOfWeek());
+    }
+
+    @Test
+    public void testVisibleHoursInDay() {
+        Calendar calendar = new Calendar();
+
+        // Defaults are the whole day
+        assertEquals(0, calendar.getFirstVisibleHourOfDay());
+        assertEquals(23, calendar.getLastVisibleHourOfDay());
+    }
+
+}
diff --git a/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java b/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java
new file mode 100644
index 0000000000..2bc95e371c
--- /dev/null
+++ b/server/tests/src/com/vaadin/tests/server/component/calendar/ContainerDataSource.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.server.component.calendar;
+
+import java.util.Date;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.junit.Test;
+
+import com.vaadin.data.Container.Indexed;
+import com.vaadin.data.Container.Sortable;
+import com.vaadin.data.Item;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.data.util.IndexedContainer;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.components.calendar.ContainerEventProvider;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+
+public class ContainerDataSource extends TestCase {
+
+    private Calendar calendar;
+
+    @Override
+    public void setUp() {
+        calendar = new Calendar();
+    }
+
+    /**
+     * Tests adding a bean item container to the Calendar
+     */
+    @Test
+    public void testWithBeanItemContainer() {
+
+        // Create a container to use as a datasource
+        Indexed container = createTestBeanItemContainer();
+
+        // Set datasource
+        calendar.setContainerDataSource(container);
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        cal.setTime(((CalendarEvent) container.getIdByIndex(0)).getStart());
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Test the all events are returned
+        List<CalendarEvent> events = calendar.getEventProvider().getEvents(
+                start, end);
+        assertEquals(container.size(), events.size());
+
+        // Test that a certain range is returned
+        cal.setTime(((CalendarEvent) container.getIdByIndex(6)).getStart());
+        end = cal.getTime();
+        events = calendar.getEventProvider().getEvents(start, end);
+        assertEquals(6, events.size());
+    }
+
+    /**
+     * This tests tests that if you give the Calendar an unsorted (== not sorted
+     * by starting date) container then the calendar should gracefully handle
+     * it. In this case the size of the container will be wrong. The test is
+     * exactly the same as {@link #testWithBeanItemContainer()} except that the
+     * beans has been intentionally sorted by caption instead of date.
+     */
+    @Test
+    public void testWithUnsortedBeanItemContainer() {
+        // Create a container to use as a datasource
+        Indexed container = createTestBeanItemContainer();
+
+        // Make the container sorted by caption
+        ((Sortable) container).sort(new Object[] { "caption" },
+                new boolean[] { true });
+
+        // Set data source
+        calendar.setContainerDataSource(container);
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        cal.setTime(((CalendarEvent) container.getIdByIndex(0)).getStart());
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Test the all events are returned
+        List<CalendarEvent> events = calendar.getEventProvider().getEvents(
+                start, end);
+        assertEquals(container.size(), events.size());
+
+        // Test that a certain range is returned
+        cal.setTime(((CalendarEvent) container.getIdByIndex(6)).getStart());
+        end = cal.getTime();
+        events = calendar.getEventProvider().getEvents(start, end);
+
+        // The events size is 1 since the getEvents returns the wrong range
+        assertEquals(1, events.size());
+    }
+
+    /**
+     * Tests adding a Indexed container to the Calendar
+     */
+    @Test
+    public void testWithIndexedContainer() {
+
+        // Create a container to use as a datasource
+        Indexed container = createTestIndexedContainer();
+
+        // Set datasource
+        calendar.setContainerDataSource(container, "testCaption",
+                "testDescription", "testStartDate", "testEndDate", null);
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        cal.setTime((Date) container.getItem(container.getIdByIndex(0))
+                .getItemProperty("testStartDate").getValue());
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Test the all events are returned
+        List<CalendarEvent> events = calendar.getEventProvider().getEvents(
+                start, end);
+        assertEquals(container.size(), events.size());
+
+        // Check that event values are present
+        CalendarEvent e = events.get(0);
+        assertEquals("Test 1", e.getCaption());
+        assertEquals("Description 1", e.getDescription());
+        assertTrue(e.getStart().compareTo(start) == 0);
+
+        // Test that a certain range is returned
+        cal.setTime((Date) container.getItem(container.getIdByIndex(6))
+                .getItemProperty("testStartDate").getValue());
+        end = cal.getTime();
+        events = calendar.getEventProvider().getEvents(start, end);
+        assertEquals(6, events.size());
+    }
+
+    @Test
+    public void testNullLimitsBeanItemContainer() {
+        // Create a container to use as a datasource
+        Indexed container = createTestBeanItemContainer();
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        cal.setTime(((CalendarEvent) container.getIdByIndex(0)).getStart());
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Set datasource
+        calendar.setContainerDataSource(container);
+
+        // Test null start time
+        List<CalendarEvent> events = calendar.getEventProvider().getEvents(
+                null, end);
+        assertEquals(container.size(), events.size());
+
+        // Test null end time
+        events = calendar.getEventProvider().getEvents(start, null);
+        assertEquals(container.size(), events.size());
+
+        // Test both null times
+        events = calendar.getEventProvider().getEvents(null, null);
+        assertEquals(container.size(), events.size());
+    }
+
+    @Test
+    public void testNullLimitsIndexedContainer() {
+        // Create a container to use as a datasource
+        Indexed container = createTestIndexedContainer();
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        cal.setTime((Date) container.getItem(container.getIdByIndex(0))
+                .getItemProperty("testStartDate").getValue());
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Set datasource
+        calendar.setContainerDataSource(container, "testCaption",
+                "testDescription", "testStartDate", "testEndDate", null);
+
+        // Test null start time
+        List<CalendarEvent> events = calendar.getEventProvider().getEvents(
+                null, end);
+        assertEquals(container.size(), events.size());
+
+        // Test null end time
+        events = calendar.getEventProvider().getEvents(start, null);
+        assertEquals(container.size(), events.size());
+
+        // Test both null times
+        events = calendar.getEventProvider().getEvents(null, null);
+        assertEquals(container.size(), events.size());
+    }
+
+    /**
+     * Tests the addEvent convenience method with the default event provider
+     */
+    @Test
+    public void testAddEventConvinienceMethod() {
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+
+        // Add an event
+        BasicEvent event = new BasicEvent("Test", "Test", start);
+        calendar.addEvent(event);
+
+        // Ensure event exists
+        List<CalendarEvent> events = calendar.getEvents(start, end);
+        assertEquals(1, events.size());
+        assertEquals(events.get(0).getCaption(), event.getCaption());
+        assertEquals(events.get(0).getDescription(), event.getDescription());
+        assertEquals(events.get(0).getStart(), event.getStart());
+    }
+
+    /**
+     * Test the removeEvent convenience method with the default event provider
+     */
+    @Test
+    public void testRemoveEventConvinienceMethod() {
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+
+        // Add an event
+        CalendarEvent event = new BasicEvent("Test", "Test", start);
+        calendar.addEvent(event);
+
+        // Ensure event exists
+        assertEquals(1, calendar.getEvents(start, end).size());
+
+        // Remove event
+        calendar.removeEvent(event);
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+    }
+
+    @Test
+    public void testAddEventConvinienceMethodWithCustomEventProvider() {
+
+        // Use a container data source
+        calendar.setEventProvider(new ContainerEventProvider(
+                new BeanItemContainer<BasicEvent>(BasicEvent.class)));
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+
+        // Add an event
+        BasicEvent event = new BasicEvent("Test", "Test", start);
+        calendar.addEvent(event);
+
+        // Ensure event exists
+        List<CalendarEvent> events = calendar.getEvents(start, end);
+        assertEquals(1, events.size());
+        assertEquals(events.get(0).getCaption(), event.getCaption());
+        assertEquals(events.get(0).getDescription(), event.getDescription());
+        assertEquals(events.get(0).getStart(), event.getStart());
+    }
+
+    @Test
+    public void testRemoveEventConvinienceMethodWithCustomEventProvider() {
+
+        // Use a container data source
+        calendar.setEventProvider(new ContainerEventProvider(
+                new BeanItemContainer<BasicEvent>(BasicEvent.class)));
+
+        // Start and end dates to query for
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        Date start = cal.getTime();
+        cal.add(java.util.Calendar.MONTH, 1);
+        Date end = cal.getTime();
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+
+        // Add an event
+        BasicEvent event = new BasicEvent("Test", "Test", start);
+        calendar.addEvent(event);
+
+        // Ensure event exists
+        List<CalendarEvent> events = calendar.getEvents(start, end);
+        assertEquals(1, events.size());
+
+        // Remove event
+        calendar.removeEvent(event);
+
+        // Ensure no events
+        assertEquals(0, calendar.getEvents(start, end).size());
+    }
+
+    private static Indexed createTestBeanItemContainer() {
+        BeanItemContainer<CalendarEvent> eventContainer = new BeanItemContainer<CalendarEvent>(
+                CalendarEvent.class);
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        for (int i = 1; i <= 10; i++) {
+            eventContainer.addBean(new BasicEvent("Test " + i, "Description "
+                    + i, cal.getTime()));
+            cal.add(java.util.Calendar.DAY_OF_MONTH, 2);
+        }
+        return eventContainer;
+    }
+
+    private static Indexed createTestIndexedContainer() {
+        IndexedContainer container = new IndexedContainer();
+        container.addContainerProperty("testCaption", String.class, "");
+        container.addContainerProperty("testDescription", String.class, "");
+        container.addContainerProperty("testStartDate", Date.class, null);
+        container.addContainerProperty("testEndDate", Date.class, null);
+
+        java.util.Calendar cal = java.util.Calendar.getInstance();
+        for (int i = 1; i <= 10; i++) {
+            Item item = container.getItem(container.addItem());
+            item.getItemProperty("testCaption").setValue("Test " + i);
+            item.getItemProperty("testDescription")
+                    .setValue("Description " + i);
+            item.getItemProperty("testStartDate").setValue(cal.getTime());
+            item.getItemProperty("testEndDate").setValue(cal.getTime());
+            cal.add(java.util.Calendar.DAY_OF_MONTH, 2);
+        }
+        return container;
+    }
+
+}
diff --git a/shared/src/com/vaadin/shared/ui/calendar/CalendarClientRpc.java b/shared/src/com/vaadin/shared/ui/calendar/CalendarClientRpc.java
new file mode 100644
index 0000000000..c1ff8bdda5
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/calendar/CalendarClientRpc.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.calendar;
+
+import com.vaadin.shared.communication.ClientRpc;
+
+/**
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ * 
+ */
+public interface CalendarClientRpc extends ClientRpc {
+    void scroll(int scrollPosition);
+}
diff --git a/shared/src/com/vaadin/shared/ui/calendar/CalendarEventId.java b/shared/src/com/vaadin/shared/ui/calendar/CalendarEventId.java
new file mode 100644
index 0000000000..6f52aabf43
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/calendar/CalendarEventId.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.calendar;
+
+/**
+ * CalendarEventId contains static String identifiers for all Calendar events.
+ * These are used both in the client and server side code.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public class CalendarEventId {
+
+    public static final String EVENTMOVE = "eventMove";
+    public static final String RANGESELECT = "rangeSelect";
+    public static final String FORWARD = "forward";
+    public static final String BACKWARD = "backward";
+    public static final String DATECLICK = "dateClick";
+    public static final String WEEKCLICK = "weekClick";
+    public static final String EVENTCLICK = "eventClick";
+    public static final String EVENTRESIZE = "eventResize";
+    public static final String ACTION = "action";
+}
diff --git a/shared/src/com/vaadin/shared/ui/calendar/CalendarServerRpc.java b/shared/src/com/vaadin/shared/ui/calendar/CalendarServerRpc.java
new file mode 100644
index 0000000000..5257310cbf
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/calendar/CalendarServerRpc.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.calendar;
+
+import com.vaadin.shared.annotations.Delayed;
+import com.vaadin.shared.communication.ServerRpc;
+
+/**
+ * @since 7.1
+ * @author Vaadin Ltd.
+ */
+public interface CalendarServerRpc extends ServerRpc {
+    void eventMove(int eventIndex, String newDate);
+
+    void rangeSelect(String range);
+
+    void forward();
+
+    void backward();
+
+    void dateClick(String date);
+
+    void weekClick(String event);
+
+    void eventClick(int eventIndex);
+
+    void eventResize(int eventIndex, String newStartDate, String newEndDate);
+
+    void actionOnEmptyCell(String actionKey, String startDate, String endDate);
+
+    void actionOnEvent(String actionKey, String startDate, String endDate,
+            int eventIndex);
+
+    @Delayed(lastOnly = true)
+    void scroll(int scrollPosition);
+}
diff --git a/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java b/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java
new file mode 100644
index 0000000000..fab5fd828e
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/calendar/CalendarState.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.calendar;
+
+import java.util.List;
+
+import com.vaadin.shared.AbstractComponentState;
+
+/**
+ * @since 7.1.0
+ * @author Vaadin Ltd.
+ */
+public class CalendarState extends AbstractComponentState {
+
+    public boolean format24H;
+    public String[] dayNames;
+    public String[] monthNames;
+    public int firstVisibleDayOfWeek = 1;
+    public int lastVisibleDayOfWeek = 7;
+    public int firstHourOfDay = 0;
+    public int lastHourOfDay = 23;
+    public int firstDayOfWeek;
+    public int scroll;
+    public String now;
+    public List<CalendarState.Day> days;
+    public List<CalendarState.Event> events;
+    public List<CalendarState.Action> actions;
+
+    public static class Day implements java.io.Serializable {
+        public String date;
+        public String localizedDateFormat;
+        public int dayOfWeek;
+        public int week;
+    }
+
+    public static class Action implements java.io.Serializable {
+
+        public String caption;
+        public String iconKey;
+        public String actionKey;
+        public String startDate;
+        public String endDate;
+    }
+
+    public static class Event implements java.io.Serializable {
+        public int index;
+        public String caption;
+        public String dateFrom;
+        public String dateTo;
+        public String timeFrom;
+        public String timeTo;
+        public String styleName;
+        public String description;
+        public boolean allDay;
+    }
+}
diff --git a/shared/src/com/vaadin/shared/ui/calendar/DateConstants.java b/shared/src/com/vaadin/shared/ui/calendar/DateConstants.java
new file mode 100644
index 0000000000..8a840274c2
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/calendar/DateConstants.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.calendar;
+
+/**
+ * 
+ * @since 7.1
+ * 
+ */
+public class DateConstants {
+
+    public static final String ACTION_DATE_FORMAT_PATTERN = "yyyy-MM-dd HH:mm:ss";
+    public static final String CLIENT_DATE_FORMAT = "yyyy-MM-dd";
+    public static final String CLIENT_TIME_FORMAT = "HH-mm";
+    public static final long MINUTEINMILLIS = 60 * 1000;
+    public static final long HOURINMILLIS = 60 * MINUTEINMILLIS;
+    public static final long DAYINMILLIS = 24 * HOURINMILLIS;
+    public static final long WEEKINMILLIS = 7 * DAYINMILLIS;
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
new file mode 100644
index 0000000000..4e0b963534
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
@@ -0,0 +1,181 @@
+/**
+ * Copyright 2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.util.Arrays;
+import java.util.Date;
+
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.data.util.BeanItemContainer;
+import com.vaadin.event.Action;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalSplitPanel;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.CloseEvent;
+import com.vaadin.ui.components.calendar.ContainerEventProvider;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+
+public class BeanItemContainerTestUI extends UI {
+
+    private Calendar calendar;
+
+    private Table table;
+
+    private BeanItemContainer<BasicEvent> events = new BeanItemContainer<BasicEvent>(
+            BasicEvent.class);
+
+    @SuppressWarnings("deprecation")
+    @Override
+    protected void init(VaadinRequest request) {
+        VerticalSplitPanel content = new VerticalSplitPanel();
+        content.setSizeFull();
+        setContent(content);
+
+        // Create Calendar
+        calendar = new Calendar();
+        calendar.setImmediate(true);
+        calendar.setSizeFull();
+        calendar.setContainerDataSource(events);
+        calendar.setStartDate(new Date(100, 1, 1));
+        calendar.setEndDate(new Date(100, 2, 1));
+
+        content.addComponent(calendar);
+
+        // Add event table connected to same data source
+        table = createTable();
+        table.setContainerDataSource(events);
+        table.setVisibleColumns(new Object[] { "caption", "description",
+                "start", "end" });
+        content.addComponent(table);
+    }
+
+    /**
+     * Creates a table with some actions
+     * 
+     * @return
+     */
+    private Table createTable() {
+        Table table = new Table();
+        table.setSizeFull();
+        table.addActionHandler(new Action.Handler() {
+
+            private final Action ADD = new Action("Add event");
+            private final Action EDIT = new Action("Edit event");
+            private final Action REMOVE = new Action("Remove event");
+
+            public void handleAction(Action action, Object sender, Object target) {
+                if (action == ADD) {
+                    BasicEvent event = new BasicEvent();
+                    event.setStart(new Date(100, 1, 1));
+                    event.setEnd(new Date(100, 1, 1));
+                    editEvent(event);
+                } else if (action == EDIT) {
+                    editEvent((BasicEvent) target);
+                } else if (action == REMOVE) {
+                    events.removeItem(target);
+                }
+            }
+
+            public Action[] getActions(Object target, Object sender) {
+                if (target == null) {
+                    return new Action[] { ADD };
+                } else {
+                    return new Action[] { EDIT, REMOVE };
+                }
+            }
+        });
+        return table;
+    }
+
+    /**
+     * Opens up a modal dialog window where an event can be modified
+     * 
+     * @param event
+     *            The event to modify
+     */
+    private void editEvent(final BasicEvent event) {
+        Window modal = new Window("Add event");
+        modal.setModal(true);
+        modal.setResizable(false);
+        modal.setDraggable(false);
+        modal.setWidth("300px");
+        final FieldGroup fieldGroup = new FieldGroup();
+
+        FormLayout formLayout = new FormLayout();
+        TextField captionField = new TextField("Caption");
+        captionField.setImmediate(true);
+        TextField descriptionField = new TextField("Description");
+        descriptionField.setImmediate(true);
+        DateField startField = new DateField("Start");
+        startField.setResolution(Resolution.MINUTE);
+        startField.setImmediate(true);
+        DateField endField = new DateField("End");
+        endField.setImmediate(true);
+        endField.setResolution(Resolution.MINUTE);
+
+        formLayout.addComponent(captionField);
+        formLayout.addComponent(descriptionField);
+        formLayout.addComponent(startField);
+        formLayout.addComponent(endField);
+
+        fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY);
+        fieldGroup.bind(descriptionField,
+                ContainerEventProvider.DESCRIPTION_PROPERTY);
+        fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY);
+        fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY);
+
+        fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event, Arrays
+                .asList(ContainerEventProvider.CAPTION_PROPERTY,
+                        ContainerEventProvider.DESCRIPTION_PROPERTY,
+                        ContainerEventProvider.STARTDATE_PROPERTY,
+                        ContainerEventProvider.ENDDATE_PROPERTY)));
+        modal.setContent(formLayout);
+        modal.addCloseListener(new Window.CloseListener() {
+            public void windowClose(CloseEvent e) {
+                // Commit changes to bean
+                try {
+                    fieldGroup.commit();
+                } catch (CommitException e1) {
+                    e1.printStackTrace();
+                }
+
+                if (events.containsId(event)) {
+                    /*
+                     * BeanItemContainer does not notify container listeners
+                     * when the bean changes so we need to trigger a
+                     * ItemSetChange event
+                     */
+                    BasicEvent dummy = new BasicEvent();
+                    events.addBean(dummy);
+                    events.removeItem(dummy);
+
+                } else {
+                    events.addBean(event);
+                }
+            }
+        });
+        getUI().addWindow(modal);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
new file mode 100644
index 0000000000..f5c2d9da7e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright 2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.util.Date;
+import java.util.Locale;
+
+import com.vaadin.event.Action;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.components.calendar.CalendarDateRange;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+
+public class CalendarActionsUI extends UI {
+
+    @SuppressWarnings("deprecation")
+    @Override
+    protected void init(VaadinRequest request) {
+        GridLayout content = new GridLayout(1, 2);
+        content.setSizeFull();
+        setContent(content);
+
+        final Calendar calendar = new Calendar();
+        calendar.setLocale(new Locale("fi", "FI"));
+
+        calendar.setSizeFull();
+        calendar.setStartDate(new Date(100, 1, 1));
+        calendar.setEndDate(new Date(100, 2, 1));
+
+        calendar.addActionHandler(new Action.Handler() {
+
+            public final Action NEW_EVENT = new Action("Add event");
+            public final Action EDIT_EVENT = new Action("Edit event");
+            public final Action REMOVE_EVENT = new Action("Remove event");
+
+            /*
+             * (non-Javadoc)
+             * 
+             * @see
+             * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event
+             * .Action, java.lang.Object, java.lang.Object)
+             */
+            public void handleAction(Action action, Object sender, Object target) {
+                Date date = (Date) target;
+                if (action == NEW_EVENT) {
+                    BasicEvent event = new BasicEvent("New event",
+                            "Hello world", date, date);
+                    calendar.addEvent(event);
+                }
+            }
+
+            /*
+             * (non-Javadoc)
+             * 
+             * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object,
+             * java.lang.Object)
+             */
+            public Action[] getActions(Object target, Object sender) {
+                CalendarDateRange date = (CalendarDateRange) target;
+
+                java.util.Calendar cal = java.util.Calendar.getInstance();
+                cal.set(2000, 1, 1, 12, 0, 0);
+
+                if (date.inRange(cal.getTime())) {
+                    return new Action[] { NEW_EVENT, };
+                }
+
+                cal.add(java.util.Calendar.DAY_OF_WEEK, 1);
+
+                if (date.inRange(cal.getTime())) {
+                    return new Action[] { REMOVE_EVENT };
+                }
+
+                return null;
+            }
+        });
+
+        content.addComponent(calendar);
+
+        content.addComponent(new Button("Set week view",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        calendar.setEndDate(new Date(100, 1, 7));
+                    }
+                }));
+
+        content.setRowExpandRatio(0, 1);
+
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
new file mode 100644
index 0000000000..530e47f1e0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
@@ -0,0 +1,1227 @@
+/**
+ * Copyright 2013 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.text.DateFormatSymbols;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.Map;
+import java.util.TimeZone;
+
+import com.vaadin.annotations.Theme;
+import com.vaadin.data.Item;
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.fieldgroup.FieldGroup;
+import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
+import com.vaadin.data.util.BeanItem;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.shared.ui.combobox.FilteringMode;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.ui.Alignment;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.Calendar.TimeFormat;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.FormLayout;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.TextField;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.EventClickHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.RangeSelectHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClick;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.WeekClickHandler;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.BasicEventProvider;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.handler.BasicDateClickHandler;
+import com.vaadin.ui.components.calendar.handler.BasicWeekClickHandler;
+
+/** Calendar component test application */
+@Theme("tests-calendar")
+public class CalendarTest extends UI {
+
+    private static final long serialVersionUID = -5436777475398410597L;
+
+    private static final String DEFAULT_ITEMID = "DEFAULT";
+
+    private enum Mode {
+        MONTH, WEEK, DAY;
+    }
+
+    /**
+     * This Gregorian calendar is used to control dates and time inside of this
+     * test application.
+     */
+    private GregorianCalendar calendar;
+
+    /** Target calendar component that this test application is made for. */
+    private Calendar calendarComponent;
+
+    private Date currentMonthsFirstDate;
+
+    private final Label captionLabel = new Label("");
+
+    private Button monthButton;
+
+    private Button weekButton;
+
+    private Button nextButton;
+
+    private Button prevButton;
+
+    private ComboBox timeZoneSelect;
+
+    private ComboBox formatSelect;
+
+    private ComboBox localeSelect;
+
+    private CheckBox hideWeekendsButton;
+
+    private CheckBox readOnlyButton;
+
+    private TextField captionField;
+
+    private Window scheduleEventPopup;
+
+    private final FormLayout scheduleEventFieldLayout = new FormLayout();
+    private FieldGroup scheduleEventFieldGroup = new FieldGroup();
+
+    private Button deleteEventButton;
+
+    private Button applyEventButton;
+
+    private Mode viewMode = Mode.MONTH;
+
+    private BasicEventProvider dataSource;
+
+    private Button addNewEvent;
+
+    /*
+     * When testBench is set to true, CalendarTest will have static content that
+     * is more suitable for Vaadin TestBench testing. Calendar will use a static
+     * date Mon 10 Jan 2000. Enable by starting the application with a
+     * "testBench" parameter in the URL.
+     */
+    private boolean testBench = false;
+
+    private String calendarHeight = null;
+
+    private String calendarWidth = null;
+
+    private CheckBox disabledButton;
+
+    private Integer firstHour;
+
+    private Integer lastHour;
+
+    private Integer firstDay;
+
+    private Integer lastDay;
+
+    private Locale defaultLocale = Locale.US;
+
+    private boolean showWeeklyView;
+
+    private boolean useSecondResolution;
+
+    private DateField startDateField;
+    private DateField endDateField;
+
+    @SuppressWarnings("serial")
+    @Override
+    public void init(VaadinRequest request) {
+        GridLayout layout = new GridLayout();
+        layout.setSizeFull();
+        layout.setMargin(true);
+        setContent(layout);
+
+        handleURLParams(request.getParameterMap());
+
+        initContent();
+    }
+
+    private void handleURLParams(Map<String, String[]> parameters) {
+        testBench = parameters.containsKey("testBench")
+                || parameters.containsKey("?testBench");
+
+        if (parameters.containsKey("width")) {
+            calendarWidth = parameters.get("width")[0];
+        }
+
+        if (parameters.containsKey("height")) {
+            calendarHeight = parameters.get("height")[0];
+        }
+
+        if (parameters.containsKey("firstDay")) {
+            firstDay = Integer.parseInt(parameters.get("firstDay")[0]);
+        }
+
+        if (parameters.containsKey("lastDay")) {
+            lastDay = Integer.parseInt(parameters.get("lastDay")[0]);
+        }
+
+        if (parameters.containsKey("firstHour")) {
+            firstHour = Integer.parseInt(parameters.get("firstHour")[0]);
+        }
+
+        if (parameters.containsKey("lastHour")) {
+            lastHour = Integer.parseInt(parameters.get("lastHour")[0]);
+        }
+
+        if (parameters.containsKey("locale")) {
+            String localeArray[] = parameters.get("locale")[0].split("_");
+            defaultLocale = new Locale(localeArray[0], localeArray[1]);
+            setLocale(defaultLocale);
+        }
+
+        if (parameters.containsKey(("secondsResolution"))) {
+            useSecondResolution = true;
+        }
+
+        showWeeklyView = parameters.containsKey("weekly");
+
+    }
+
+    public void initContent() {
+        // Set default Locale for this application
+        if (testBench) {
+            setLocale(defaultLocale);
+
+        } else {
+            setLocale(Locale.getDefault());
+        }
+
+        // Initialize locale, timezone and timeformat selects.
+        localeSelect = createLocaleSelect();
+        timeZoneSelect = createTimeZoneSelect();
+        formatSelect = createCalendarFormatSelect();
+
+        initCalendar();
+        initLayoutContent();
+        addInitialEvents();
+    }
+
+    private Date resolveFirstDateOfWeek(Date today,
+            java.util.Calendar currentCalendar) {
+        int firstDayOfWeek = currentCalendar.getFirstDayOfWeek();
+        currentCalendar.setTime(today);
+        while (firstDayOfWeek != currentCalendar
+                .get(java.util.Calendar.DAY_OF_WEEK)) {
+            currentCalendar.add(java.util.Calendar.DATE, -1);
+        }
+        return currentCalendar.getTime();
+    }
+
+    private Date resolveLastDateOfWeek(Date today,
+            java.util.Calendar currentCalendar) {
+        currentCalendar.setTime(today);
+        currentCalendar.add(java.util.Calendar.DATE, 1);
+        int firstDayOfWeek = currentCalendar.getFirstDayOfWeek();
+        // Roll to weeks last day using firstdayofweek. Roll until FDofW is
+        // found and then roll back one day.
+        while (firstDayOfWeek != currentCalendar
+                .get(java.util.Calendar.DAY_OF_WEEK)) {
+            currentCalendar.add(java.util.Calendar.DATE, 1);
+        }
+        currentCalendar.add(java.util.Calendar.DATE, -1);
+        return currentCalendar.getTime();
+    }
+
+    private void addInitialEvents() {
+        Date originalDate = calendar.getTime();
+        Date today = getToday();
+        
+        // Add a event that last a whole week
+        
+        Date start = resolveFirstDateOfWeek(today, calendar);
+        Date end = resolveLastDateOfWeek(today, calendar);
+        CalendarTestEvent event = getNewEvent("Whole week event", start, end);
+        event.setAllDay(true);
+        event.setStyleName("color4");
+        event.setDescription("Description for the whole week event.");
+        dataSource.addEvent(event);
+
+        // Add a allday event
+        calendar.setTime(start);
+        calendar.add(GregorianCalendar.DATE, 3);
+        start = calendar.getTime();
+        end = start;
+        event = getNewEvent("Allday event", start, end);
+        event.setAllDay(true);
+        event.setDescription("Some description.");
+        event.setStyleName("color3");
+        dataSource.addEvent(event);
+
+        // Add a second allday event
+        calendar.add(GregorianCalendar.DATE, 1);
+        start = calendar.getTime();
+        end = start;
+        event = getNewEvent("Second allday event", start, end);
+        event.setAllDay(true);
+        event.setDescription("Some description.");
+        event.setStyleName("color2");
+        dataSource.addEvent(event);
+
+        calendar.add(GregorianCalendar.DATE, -3);
+        calendar.set(GregorianCalendar.HOUR_OF_DAY, 9);
+        calendar.set(GregorianCalendar.MINUTE, 30);
+        start = calendar.getTime();
+        calendar.add(GregorianCalendar.HOUR_OF_DAY, 5);
+        calendar.set(GregorianCalendar.MINUTE, 0);
+        end = calendar.getTime();
+        event = getNewEvent("Appointment", start, end);
+        event.setWhere("Office");
+        event.setStyleName("color1");
+        event.setDescription("A longer description, which should display correctly.");
+        dataSource.addEvent(event);
+
+        calendar.add(GregorianCalendar.DATE, 1);
+        calendar.set(GregorianCalendar.HOUR_OF_DAY, 11);
+        calendar.set(GregorianCalendar.MINUTE, 0);
+        start = calendar.getTime();
+        calendar.add(GregorianCalendar.HOUR_OF_DAY, 8);
+        end = calendar.getTime();
+        event = getNewEvent("Training", start, end);
+        event.setStyleName("color2");
+        dataSource.addEvent(event);
+
+        calendar.add(GregorianCalendar.DATE, 4);
+        calendar.set(GregorianCalendar.HOUR_OF_DAY, 9);
+        calendar.set(GregorianCalendar.MINUTE, 0);
+        start = calendar.getTime();
+        calendar.add(GregorianCalendar.HOUR_OF_DAY, 9);
+        end = calendar.getTime();
+        event = getNewEvent("Free time", start, end);
+        dataSource.addEvent(event);
+
+        calendar.setTime(originalDate);
+    }
+
+    private void initLayoutContent() {
+        initNavigationButtons();
+        initHideWeekEndButton();
+        initReadOnlyButton();
+        initDisabledButton();
+        initAddNewEventButton();
+
+        HorizontalLayout hl = new HorizontalLayout();
+        hl.setWidth("100%");
+        hl.setSpacing(true);
+        hl.setMargin(new MarginInfo(false, false, true, false));
+        hl.addComponent(prevButton);
+        hl.addComponent(captionLabel);
+        hl.addComponent(monthButton);
+        hl.addComponent(weekButton);
+        hl.addComponent(nextButton);
+        hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
+        hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
+        hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
+        hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
+        hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);
+
+        monthButton.setVisible(viewMode == Mode.WEEK);
+        weekButton.setVisible(viewMode == Mode.DAY);
+
+        HorizontalLayout controlPanel = new HorizontalLayout();
+        controlPanel.setSpacing(true);
+        controlPanel.setMargin(new MarginInfo(false, false, true, false));
+        controlPanel.setWidth("100%");
+        controlPanel.addComponent(localeSelect);
+        controlPanel.addComponent(timeZoneSelect);
+        controlPanel.addComponent(formatSelect);
+        controlPanel.addComponent(hideWeekendsButton);
+        controlPanel.addComponent(readOnlyButton);
+        controlPanel.addComponent(disabledButton);
+        controlPanel.addComponent(addNewEvent);
+
+        controlPanel.setComponentAlignment(timeZoneSelect,
+                Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(formatSelect, Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(localeSelect, Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(hideWeekendsButton,
+                Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(readOnlyButton,
+                Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(disabledButton,
+                Alignment.MIDDLE_LEFT);
+        controlPanel.setComponentAlignment(addNewEvent, Alignment.MIDDLE_LEFT);
+
+        GridLayout layout = (GridLayout) getContent();
+        layout.addComponent(controlPanel);
+        layout.addComponent(hl);
+        layout.addComponent(calendarComponent);
+        layout.setRowExpandRatio(layout.getRows() - 1, 1.0f);
+    }
+
+    private void initNavigationButtons() {
+        monthButton = new Button("Month view", new ClickListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                switchToMonthView();
+            }
+        });
+
+        weekButton = new Button("Week view", new ClickListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                // simulate week click
+                WeekClickHandler handler = (WeekClickHandler) calendarComponent
+                        .getHandler(WeekClick.EVENT_ID);
+                handler.weekClick(new WeekClick(calendarComponent, calendar
+                        .get(GregorianCalendar.WEEK_OF_YEAR), calendar
+                        .get(GregorianCalendar.YEAR)));
+            }
+        });
+
+        nextButton = new Button("Next", new Button.ClickListener() {
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                handleNextButtonClick();
+            }
+        });
+
+        prevButton = new Button("Prev", new Button.ClickListener() {
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                handlePreviousButtonClick();
+            }
+        });
+    }
+
+    private void initHideWeekEndButton() {
+        hideWeekendsButton = new CheckBox("Hide weekends");
+        hideWeekendsButton.setImmediate(true);
+        hideWeekendsButton
+                .addValueChangeListener(new Property.ValueChangeListener() {
+
+                    private static final long serialVersionUID = 1L;
+
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        setWeekendsHidden(hideWeekendsButton.getValue());
+                    }
+                });
+    }
+
+    private void setWeekendsHidden(boolean weekendsHidden) {
+        if (weekendsHidden) {
+            int firstToShow = (GregorianCalendar.MONDAY - calendar
+                    .getFirstDayOfWeek()) % 7;
+            calendarComponent.setFirstVisibleDayOfWeek(firstToShow + 1);
+            calendarComponent.setLastVisibleDayOfWeek(firstToShow + 5);
+        } else {
+            calendarComponent.setFirstVisibleDayOfWeek(1);
+            calendarComponent.setLastVisibleDayOfWeek(7);
+        }
+
+    }
+
+    private void initReadOnlyButton() {
+        readOnlyButton = new CheckBox("Read-only mode");
+        readOnlyButton.setImmediate(true);
+        readOnlyButton
+                .addValueChangeListener(new Property.ValueChangeListener() {
+
+                    private static final long serialVersionUID = 1L;
+
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        calendarComponent.setReadOnly(readOnlyButton.getValue());
+                    }
+                });
+    }
+
+    private void initDisabledButton() {
+        disabledButton = new CheckBox("Disabled");
+        disabledButton.setImmediate(true);
+        disabledButton
+                .addValueChangeListener(new Property.ValueChangeListener() {
+
+                    private static final long serialVersionUID = 1L;
+
+                    @Override
+                    public void valueChange(ValueChangeEvent event) {
+                        calendarComponent.setEnabled(!disabledButton.getValue());
+                    }
+                });
+    }
+
+    public void initAddNewEventButton() {
+        addNewEvent = new Button("Add new event");
+        addNewEvent.addClickListener(new Button.ClickListener() {
+
+            private static final long serialVersionUID = -8307244759142541067L;
+
+            public void buttonClick(ClickEvent event) {
+                Date start = getToday();
+                start.setHours(0);
+                start.setMinutes(0);
+                start.setSeconds(0);
+
+                Date end = getEndOfDay(calendar, start);
+
+                showEventPopup(createNewEvent(start, end), true);
+            }
+        });
+    }
+
+    private void initFormFields(Layout formLayout,
+            Class<? extends CalendarEvent> eventClass) {
+
+        startDateField = createDateField("Start date");
+        endDateField = createDateField("End date");
+
+        final CheckBox allDayField = createCheckBox("All-day");
+        allDayField.addValueChangeListener(new Property.ValueChangeListener() {
+
+            private static final long serialVersionUID = -7104996493482558021L;
+
+            public void valueChange(ValueChangeEvent event) {
+                Object value = event.getProperty().getValue();
+                if (value instanceof Boolean && Boolean.TRUE.equals(value)) {
+                    setFormDateResolution(Resolution.DAY);
+
+                } else {
+                    setFormDateResolution(Resolution.MINUTE);
+                }
+            }
+
+        });
+
+        captionField = createTextField("Caption");
+        final TextField whereField = createTextField("Where");
+        final TextArea descriptionField = createTextArea("Description");
+        descriptionField.setRows(3);
+
+        final ComboBox styleNameField = createStyleNameComboBox();
+
+        formLayout.addComponent(startDateField);
+        formLayout.addComponent(endDateField);
+        formLayout.addComponent(allDayField);
+        formLayout.addComponent(captionField);
+        if (eventClass == CalendarTestEvent.class) {
+            formLayout.addComponent(whereField);
+        }
+        formLayout.addComponent(descriptionField);
+        formLayout.addComponent(styleNameField);
+
+        scheduleEventFieldGroup.bind(startDateField, "start");
+        scheduleEventFieldGroup.bind(endDateField, "end");
+        scheduleEventFieldGroup.bind(captionField, "caption");
+        scheduleEventFieldGroup.bind(descriptionField, "description");
+        if (eventClass == CalendarTestEvent.class) {
+            scheduleEventFieldGroup.bind(whereField, "where");
+        }
+        scheduleEventFieldGroup.bind(styleNameField, "styleName");
+        scheduleEventFieldGroup.bind(allDayField, "allDay");
+    }
+
+    private CheckBox createCheckBox(String caption) {
+        CheckBox cb = new CheckBox(caption);
+        cb.setImmediate(true);
+        return cb;
+    }
+
+    private TextField createTextField(String caption) {
+        TextField f = new TextField(caption);
+        f.setNullRepresentation("");
+        return f;
+    }
+
+    private TextArea createTextArea(String caption) {
+        TextArea f = new TextArea(caption);
+        f.setNullRepresentation("");
+        return f;
+    }
+
+    private DateField createDateField(String caption) {
+        DateField f = new DateField(caption);
+        if (useSecondResolution) {
+            f.setResolution(Resolution.SECOND);
+        } else {
+            f.setResolution(Resolution.MINUTE);
+        }
+        return f;
+    }
+
+    private ComboBox createStyleNameComboBox() {
+        ComboBox s = new ComboBox("Color");
+        s.addContainerProperty("c", String.class, "");
+        s.setItemCaptionPropertyId("c");
+        Item i = s.addItem("color1");
+        i.getItemProperty("c").setValue("Green");
+        i = s.addItem("color2");
+        i.getItemProperty("c").setValue("Blue");
+        i = s.addItem("color3");
+        i.getItemProperty("c").setValue("Red");
+        i = s.addItem("color4");
+        i.getItemProperty("c").setValue("Orange");
+        return s;
+    }
+
+    private void initCalendar() {
+        dataSource = new BasicEventProvider();
+
+        calendarComponent = new Calendar(dataSource);
+        calendarComponent.setLocale(getLocale());
+        calendarComponent.setImmediate(true);
+
+        if (calendarWidth != null || calendarHeight != null) {
+            if (calendarHeight != null) {
+                calendarComponent.setHeight(calendarHeight);
+            }
+            if (calendarWidth != null) {
+                calendarComponent.setWidth(calendarWidth);
+            }
+        } else {
+            calendarComponent.setSizeFull();
+        }
+
+        if (firstHour != null && lastHour != null) {
+            calendarComponent.setFirstVisibleHourOfDay(firstHour);
+            calendarComponent.setLastVisibleHourOfDay(lastHour);
+        }
+
+        if (firstDay != null && lastDay != null) {
+            calendarComponent.setFirstVisibleDayOfWeek(firstDay);
+            calendarComponent.setLastVisibleDayOfWeek(lastDay);
+        }
+
+        Date today = getToday();
+        calendar = new GregorianCalendar(getLocale());
+        calendar.setTime(today);
+
+        updateCaptionLabel();
+
+        if (!showWeeklyView) {
+            int rollAmount = calendar.get(GregorianCalendar.DAY_OF_MONTH) - 1;
+            calendar.add(GregorianCalendar.DAY_OF_MONTH, -rollAmount);
+            resetTime(false);
+            currentMonthsFirstDate = calendar.getTime();
+            calendarComponent.setStartDate(currentMonthsFirstDate);
+            calendar.add(GregorianCalendar.MONTH, 1);
+            calendar.add(GregorianCalendar.DATE, -1);
+            calendarComponent.setEndDate(calendar.getTime());
+        }
+
+        addCalendarEventListeners();
+    }
+
+    private Date getToday() {
+        if (testBench) {
+            GregorianCalendar testDate = new GregorianCalendar();
+            testDate.set(GregorianCalendar.YEAR, 2000);
+            testDate.set(GregorianCalendar.MONTH, 0);
+            testDate.set(GregorianCalendar.DATE, 10);
+            testDate.set(GregorianCalendar.HOUR_OF_DAY, 0);
+            testDate.set(GregorianCalendar.MINUTE, 0);
+            testDate.set(GregorianCalendar.SECOND, 0);
+            testDate.set(GregorianCalendar.MILLISECOND, 0);
+            return testDate.getTime();
+        }
+        return new Date();
+    }
+
+    @SuppressWarnings("serial")
+    private void addCalendarEventListeners() {
+        // Register week clicks by changing the schedules start and end dates.
+        calendarComponent.setHandler(new BasicWeekClickHandler() {
+
+            @Override
+            public void weekClick(WeekClick event) {
+                // let BasicWeekClickHandler handle calendar dates, and update
+                // only the other parts of UI here
+                super.weekClick(event);
+                updateCaptionLabel();
+                switchToWeekView();
+            }
+        });
+
+        calendarComponent.setHandler(new EventClickHandler() {
+
+            public void eventClick(EventClick event) {
+                showEventPopup(event.getCalendarEvent(), false);
+            }
+        });
+
+        calendarComponent.setHandler(new BasicDateClickHandler() {
+
+            @Override
+            public void dateClick(DateClickEvent event) {
+                // let BasicDateClickHandler handle calendar dates, and update
+                // only the other parts of UI here
+                super.dateClick(event);
+                switchToDayView();
+            }
+        });
+
+        calendarComponent.setHandler(new RangeSelectHandler() {
+
+            public void rangeSelect(RangeSelectEvent event) {
+                handleRangeSelect(event);
+            }
+        });
+    }
+
+    private ComboBox createTimeZoneSelect() {
+        ComboBox s = new ComboBox("Timezone");
+        s.addContainerProperty("caption", String.class, "");
+        s.setItemCaptionPropertyId("caption");
+        s.setFilteringMode(FilteringMode.CONTAINS);
+
+        Item i = s.addItem(DEFAULT_ITEMID);
+        i.getItemProperty("caption").setValue(
+                "Default (" + TimeZone.getDefault().getID() + ")");
+        for (String id : TimeZone.getAvailableIDs()) {
+            if (!s.containsId(id)) {
+                i = s.addItem(id);
+                i.getItemProperty("caption").setValue(id);
+            }
+        }
+
+        if (testBench) {
+            s.select("America/New_York");
+        } else {
+            s.select(DEFAULT_ITEMID);
+        }
+        s.setImmediate(true);
+        s.addValueChangeListener(new ValueChangeListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void valueChange(ValueChangeEvent event) {
+
+                updateCalendarTimeZone(event.getProperty().getValue());
+            }
+        });
+
+        return s;
+    }
+
+    private ComboBox createCalendarFormatSelect() {
+        ComboBox s = new ComboBox("Calendar format");
+        s.addContainerProperty("caption", String.class, "");
+        s.setItemCaptionPropertyId("caption");
+
+        Item i = s.addItem(DEFAULT_ITEMID);
+        i.getItemProperty("caption").setValue("Default by locale");
+        i = s.addItem(TimeFormat.Format12H);
+        i.getItemProperty("caption").setValue("12H");
+        i = s.addItem(TimeFormat.Format24H);
+        i.getItemProperty("caption").setValue("24H");
+
+        s.select(DEFAULT_ITEMID);
+        s.setImmediate(true);
+        s.addValueChangeListener(new ValueChangeListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void valueChange(ValueChangeEvent event) {
+                updateCalendarFormat(event.getProperty().getValue());
+            }
+        });
+
+        return s;
+    }
+
+    private ComboBox createLocaleSelect() {
+        ComboBox s = new ComboBox("Locale");
+        s.addContainerProperty("caption", String.class, "");
+        s.setItemCaptionPropertyId("caption");
+        s.setFilteringMode(FilteringMode.CONTAINS);
+
+        for (Locale l : Locale.getAvailableLocales()) {
+            if (!s.containsId(l)) {
+                Item i = s.addItem(l);
+                i.getItemProperty("caption").setValue(getLocaleItemCaption(l));
+            }
+        }
+
+        s.select(getLocale());
+        s.setImmediate(true);
+        s.addValueChangeListener(new ValueChangeListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void valueChange(ValueChangeEvent event) {
+                updateCalendarLocale((Locale) event.getProperty().getValue());
+            }
+        });
+
+        return s;
+    }
+
+    private void updateCalendarTimeZone(Object timezoneId) {
+        TimeZone tz = null;
+        if (!DEFAULT_ITEMID.equals(timezoneId)) {
+            tz = TimeZone.getTimeZone((String) timezoneId);
+        }
+
+        // remember the week that was showing, so we can re-set it later
+        Date startDate = calendarComponent.getStartDate();
+        calendar.setTime(startDate);
+        int weekNumber = calendar.get(java.util.Calendar.WEEK_OF_YEAR);
+        calendarComponent.setTimeZone(tz);
+        calendar.setTimeZone(calendarComponent.getTimeZone());
+
+        if (viewMode == Mode.WEEK) {
+            calendar.set(java.util.Calendar.WEEK_OF_YEAR, weekNumber);
+            calendar.set(java.util.Calendar.DAY_OF_WEEK,
+                    calendar.getFirstDayOfWeek());
+
+            calendarComponent.setStartDate(calendar.getTime());
+            calendar.add(java.util.Calendar.DATE, 6);
+            calendarComponent.setEndDate(calendar.getTime());
+        }
+    }
+
+    private void updateCalendarFormat(Object format) {
+        TimeFormat calFormat = null;
+        if (format instanceof TimeFormat) {
+            calFormat = (TimeFormat) format;
+        }
+
+        calendarComponent.setTimeFormat(calFormat);
+    }
+
+    private String getLocaleItemCaption(Locale l) {
+        String country = l.getDisplayCountry(getLocale());
+        String language = l.getDisplayLanguage(getLocale());
+        StringBuilder caption = new StringBuilder(country);
+        if (caption.length() != 0) {
+            caption.append(", ");
+        }
+        caption.append(language);
+        return caption.toString();
+    }
+
+    private void updateCalendarLocale(Locale l) {
+        int oldFirstDayOfWeek = calendar.getFirstDayOfWeek();
+        setLocale(l);
+        calendarComponent.setLocale(l);
+        calendar = new GregorianCalendar(l);
+        int newFirstDayOfWeek = calendar.getFirstDayOfWeek();
+
+        // we are showing 1 week, and the first day of the week has changed
+        // update start and end dates so that the same week is showing
+        if (viewMode == Mode.WEEK && oldFirstDayOfWeek != newFirstDayOfWeek) {
+            calendar.setTime(calendarComponent.getStartDate());
+            calendar.add(java.util.Calendar.DAY_OF_WEEK, 2);
+            // starting at the beginning of the week
+            calendar.set(GregorianCalendar.DAY_OF_WEEK, newFirstDayOfWeek);
+            Date start = calendar.getTime();
+
+            // ending at the end of the week
+            calendar.add(GregorianCalendar.DATE, 6);
+            Date end = calendar.getTime();
+
+            calendarComponent.setStartDate(start);
+            calendarComponent.setEndDate(end);
+
+            // Week days depend on locale so this must be refreshed
+            setWeekendsHidden(hideWeekendsButton.getValue());
+        }
+
+    }
+
+    private void handleNextButtonClick() {
+        switch (viewMode) {
+        case MONTH:
+            nextMonth();
+            break;
+        case WEEK:
+            nextWeek();
+            break;
+        case DAY:
+            nextDay();
+            break;
+        }
+    }
+
+    private void handlePreviousButtonClick() {
+        switch (viewMode) {
+        case MONTH:
+            previousMonth();
+            break;
+        case WEEK:
+            previousWeek();
+            break;
+        case DAY:
+            previousDay();
+            break;
+        }
+    }
+
+    private void handleRangeSelect(RangeSelectEvent event) {
+        Date start = event.getStart();
+        Date end = event.getEnd();
+
+        /*
+         * If a range of dates is selected in monthly mode, we want it to end at
+         * the end of the last day.
+         */
+        if (event.isMonthlyMode()) {
+            end = getEndOfDay(calendar, end);
+        }
+
+        showEventPopup(createNewEvent(start, end), true);
+    }
+
+    private void showEventPopup(CalendarEvent event, boolean newEvent) {
+        if (event == null) {
+            return;
+        }
+
+        updateCalendarEventPopup(newEvent);
+        updateCalendarEventForm(event);
+
+        if (!getWindows().contains(scheduleEventPopup)) {
+            addWindow(scheduleEventPopup);
+        }
+    }
+
+    /* Initializes a modal window to edit schedule event. */
+    private void createCalendarEventPopup() {
+        VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        layout.setSpacing(true);
+
+        scheduleEventPopup = new Window(null, layout);
+        scheduleEventPopup.setWidth("400px");
+        scheduleEventPopup.setModal(true);
+        scheduleEventPopup.center();
+
+        layout.addComponent(scheduleEventFieldLayout);
+
+        applyEventButton = new Button("Apply", new ClickListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                try {
+                    commitCalendarEvent();
+                } catch (CommitException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+        Button cancel = new Button("Cancel", new ClickListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                discardCalendarEvent();
+            }
+        });
+        deleteEventButton = new Button("Delete", new ClickListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void buttonClick(ClickEvent event) {
+                deleteCalendarEvent();
+            }
+        });
+        scheduleEventPopup.addCloseListener(new Window.CloseListener() {
+
+            private static final long serialVersionUID = 1L;
+
+            public void windowClose(Window.CloseEvent e) {
+                discardCalendarEvent();
+            }
+        });
+
+        HorizontalLayout buttons = new HorizontalLayout();
+        buttons.setSpacing(true);
+        buttons.addComponent(deleteEventButton);
+        buttons.addComponent(applyEventButton);
+        buttons.addComponent(cancel);
+        layout.addComponent(buttons);
+        layout.setComponentAlignment(buttons, Alignment.BOTTOM_RIGHT);
+    }
+
+    private void updateCalendarEventPopup(boolean newEvent) {
+        if (scheduleEventPopup == null) {
+            createCalendarEventPopup();
+        }
+
+        if (newEvent) {
+            scheduleEventPopup.setCaption("New event");
+        } else {
+            scheduleEventPopup.setCaption("Edit event");
+        }
+
+        deleteEventButton.setVisible(!newEvent);
+        deleteEventButton.setEnabled(!calendarComponent.isReadOnly());
+        applyEventButton.setEnabled(!calendarComponent.isReadOnly());
+    }
+
+    private void updateCalendarEventForm(CalendarEvent event) {
+        BeanItem<CalendarEvent> item = new BeanItem<CalendarEvent>(event);
+        scheduleEventFieldLayout.removeAllComponents();
+        scheduleEventFieldGroup = new FieldGroup();
+        initFormFields(scheduleEventFieldLayout, event.getClass());
+        scheduleEventFieldGroup.setBuffered(true);
+        scheduleEventFieldGroup.setItemDataSource(item);
+    }
+
+    private void setFormDateResolution(Resolution resolution) {
+        if (startDateField != null && endDateField != null) {
+            startDateField.setResolution(resolution);
+            endDateField.setResolution(resolution);
+        }
+    }
+
+    private CalendarEvent createNewEvent(Date startDate, Date endDate) {
+
+        BasicEvent event = new BasicEvent();
+        event.setCaption("");
+        event.setStart(startDate);
+        event.setEnd(endDate);
+        event.setStyleName("color1");
+        return event;
+    }
+
+    /* Removes the event from the data source and fires change event. */
+    private void deleteCalendarEvent() {
+        BasicEvent event = getFormCalendarEvent();
+        if (dataSource.containsEvent(event)) {
+            dataSource.removeEvent(event);
+        }
+        removeWindow(scheduleEventPopup);
+    }
+
+    /* Adds/updates the event in the data source and fires change event. */
+    private void commitCalendarEvent() throws CommitException {
+        scheduleEventFieldGroup.commit();
+        BasicEvent event = getFormCalendarEvent();
+        if (event.getEnd() == null) {
+            event.setEnd(event.getStart());
+        }
+        if (!dataSource.containsEvent(event)) {
+            dataSource.addEvent(event);
+        }
+
+        removeWindow(scheduleEventPopup);
+    }
+
+    private void discardCalendarEvent() {
+        scheduleEventFieldGroup.discard();
+        removeWindow(scheduleEventPopup);
+    }
+
+    @SuppressWarnings("unchecked")
+    private BasicEvent getFormCalendarEvent() {
+        BeanItem<CalendarEvent> item = (BeanItem<CalendarEvent>) scheduleEventFieldGroup
+                .getItemDataSource();
+        CalendarEvent event = item.getBean();
+        return (BasicEvent) event;
+    }
+
+    private void nextMonth() {
+        rollMonth(1);
+    }
+
+    private void previousMonth() {
+        rollMonth(-1);
+    }
+
+    private void nextWeek() {
+        rollWeek(1);
+    }
+
+    private void previousWeek() {
+        rollWeek(-1);
+    }
+
+    private void nextDay() {
+        rollDate(1);
+    }
+
+    private void previousDay() {
+        rollDate(-1);
+    }
+
+    private void rollMonth(int direction) {
+        calendar.setTime(currentMonthsFirstDate);
+        calendar.add(GregorianCalendar.MONTH, direction);
+        resetTime(false);
+        currentMonthsFirstDate = calendar.getTime();
+        calendarComponent.setStartDate(currentMonthsFirstDate);
+
+        updateCaptionLabel();
+
+        calendar.add(GregorianCalendar.MONTH, 1);
+        calendar.add(GregorianCalendar.DATE, -1);
+        resetCalendarTime(true);
+    }
+
+    private void rollWeek(int direction) {
+        calendar.add(GregorianCalendar.WEEK_OF_YEAR, direction);
+        calendar.set(GregorianCalendar.DAY_OF_WEEK,
+                calendar.getFirstDayOfWeek());
+        resetCalendarTime(false);
+        resetTime(true);
+        calendar.add(GregorianCalendar.DATE, 6);
+        calendarComponent.setEndDate(calendar.getTime());
+    }
+
+    private void rollDate(int direction) {
+        calendar.add(GregorianCalendar.DATE, direction);
+        resetCalendarTime(false);
+        resetCalendarTime(true);
+    }
+
+    private void updateCaptionLabel() {
+        DateFormatSymbols s = new DateFormatSymbols(getLocale());
+        String month = s.getShortMonths()[calendar.get(GregorianCalendar.MONTH)];
+        captionLabel.setValue(month + " "
+                + calendar.get(GregorianCalendar.YEAR));
+    }
+
+    private CalendarTestEvent getNewEvent(String caption, Date start, Date end) {
+        CalendarTestEvent event = new CalendarTestEvent();
+        event.setCaption(caption);
+        event.setStart(start);
+        event.setEnd(end);
+
+        return event;
+    }
+
+    /*
+     * Switch the view to week view.
+     */
+    public void switchToWeekView() {
+        viewMode = Mode.WEEK;
+        weekButton.setVisible(false);
+        monthButton.setVisible(true);
+    }
+
+    /*
+     * Switch the Calendar component's start and end date range to the target
+     * month only. (sample range: 01.01.2010 00:00.000 - 31.01.2010 23:59.999)
+     */
+    public void switchToMonthView() {
+        viewMode = Mode.MONTH;
+        monthButton.setVisible(false);
+        weekButton.setVisible(false);
+
+        calendar.setTime(currentMonthsFirstDate);
+        calendarComponent.setStartDate(currentMonthsFirstDate);
+
+        updateCaptionLabel();
+
+        calendar.add(GregorianCalendar.MONTH, 1);
+        calendar.add(GregorianCalendar.DATE, -1);
+        resetCalendarTime(true);
+    }
+
+    /*
+     * Switch to day view (week view with a single day visible).
+     */
+    public void switchToDayView() {
+        viewMode = Mode.DAY;
+        monthButton.setVisible(true);
+        weekButton.setVisible(true);
+    }
+
+    private void resetCalendarTime(boolean resetEndTime) {
+        resetTime(resetEndTime);
+        if (resetEndTime) {
+            calendarComponent.setEndDate(calendar.getTime());
+        } else {
+            calendarComponent.setStartDate(calendar.getTime());
+            updateCaptionLabel();
+        }
+    }
+
+    /*
+     * Resets the calendar time (hour, minute second and millisecond) either to
+     * zero or maximum value.
+     */
+    private void resetTime(boolean max) {
+        if (max) {
+            calendar.set(GregorianCalendar.HOUR_OF_DAY,
+                    calendar.getMaximum(GregorianCalendar.HOUR_OF_DAY));
+            calendar.set(GregorianCalendar.MINUTE,
+                    calendar.getMaximum(GregorianCalendar.MINUTE));
+            calendar.set(GregorianCalendar.SECOND,
+                    calendar.getMaximum(GregorianCalendar.SECOND));
+            calendar.set(GregorianCalendar.MILLISECOND,
+                    calendar.getMaximum(GregorianCalendar.MILLISECOND));
+        } else {
+            calendar.set(GregorianCalendar.HOUR_OF_DAY, 0);
+            calendar.set(GregorianCalendar.MINUTE, 0);
+            calendar.set(GregorianCalendar.SECOND, 0);
+            calendar.set(GregorianCalendar.MILLISECOND, 0);
+        }
+    }
+
+    private static Date getEndOfDay(java.util.Calendar calendar, Date date) {
+        java.util.Calendar calendarClone = (java.util.Calendar) calendar
+                .clone();
+
+        calendarClone.setTime(date);
+        calendarClone.set(java.util.Calendar.MILLISECOND,
+                calendarClone.getActualMaximum(java.util.Calendar.MILLISECOND));
+        calendarClone.set(java.util.Calendar.SECOND,
+                calendarClone.getActualMaximum(java.util.Calendar.SECOND));
+        calendarClone.set(java.util.Calendar.MINUTE,
+                calendarClone.getActualMaximum(java.util.Calendar.MINUTE));
+        calendarClone.set(java.util.Calendar.HOUR,
+                calendarClone.getActualMaximum(java.util.Calendar.HOUR));
+        calendarClone.set(java.util.Calendar.HOUR_OF_DAY,
+                calendarClone.getActualMaximum(java.util.Calendar.HOUR_OF_DAY));
+
+        return calendarClone.getTime();
+    }
+
+    private static Date getStartOfDay(java.util.Calendar calendar, Date date) {
+        java.util.Calendar calendarClone = (java.util.Calendar) calendar
+                .clone();
+
+        calendarClone.setTime(date);
+        calendarClone.set(java.util.Calendar.MILLISECOND, 0);
+        calendarClone.set(java.util.Calendar.SECOND, 0);
+        calendarClone.set(java.util.Calendar.MINUTE, 0);
+        calendarClone.set(java.util.Calendar.HOUR, 0);
+        calendarClone.set(java.util.Calendar.HOUR_OF_DAY, 0);
+
+        return calendarClone.getTime();
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java
new file mode 100644
index 0000000000..29b8f62403
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTestEvent.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+
+/**
+ * Test CalendarEvent implementation.
+ * 
+ * @see com.vaadin.addon.calendar.test.ui.Calendar.Event
+ */
+public class CalendarTestEvent extends BasicEvent {
+
+    private static final long serialVersionUID = 2820133201983036866L;
+    private String where;
+    private Object data;
+
+    public String getWhere() {
+        return where;
+    }
+
+    public void setWhere(String where) {
+        this.where = where;
+        fireEventChange();
+    }
+
+    public Object getData() {
+        return data;
+    }
+
+    public void setData(Object data) {
+        this.data = data;
+        fireEventChange();
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java
new file mode 100644
index 0000000000..8b789098e6
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/HiddenFwdBackButtons.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.util.Date;
+import java.util.Locale;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.BackwardHandler;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.ForwardHandler;
+
+public class HiddenFwdBackButtons extends UI {
+
+    @SuppressWarnings("deprecation")
+    @Override
+    protected void init(VaadinRequest request) {
+        GridLayout content = new GridLayout(1, 2);
+        content.setSizeFull();
+        setContent(content);
+
+        final Calendar calendar = new Calendar();
+        calendar.setLocale(new Locale("fi", "FI"));
+
+        calendar.setSizeFull();
+        calendar.setStartDate(new Date(100, 1, 1));
+        calendar.setEndDate(new Date(100, 1, 7));
+        content.addComponent(calendar);
+        Button button = new Button("Hide forward and back buttons");
+        button.addClickListener(new ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                // This should hide the forward and back navigation buttons
+                calendar.setHandler((BackwardHandler) null);
+                calendar.setHandler((ForwardHandler) null);
+            }
+        });
+        content.addComponent(button);
+
+        content.setRowExpandRatio(0, 1);
+
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
new file mode 100644
index 0000000000..0bd327da18
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickEvent;
+import com.vaadin.ui.components.calendar.CalendarComponentEvents.DateClickHandler;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEvent;
+import com.vaadin.ui.components.calendar.event.CalendarEventProvider;
+
+public class NotificationTestUI extends UI {
+
+    private DummyEventProvider provider;
+
+    private static class DummyEventProvider implements CalendarEventProvider {
+
+        private int index;
+        private List<CalendarEvent> events = new ArrayList<CalendarEvent>();
+
+        public void addEvent(Date date) {
+            BasicEvent e = new BasicEvent();
+            e.setAllDay(true);
+            e.setStart(date);
+            e.setEnd(date);
+            e.setCaption("Some event " + ++index);
+            events.add(e);
+        }
+
+        public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
+            return events;
+        }
+
+    }
+
+    @Override
+    protected void init(com.vaadin.server.VaadinRequest request) {
+        GridLayout content = new GridLayout(1, 2);
+        content.setSizeFull();
+        content.setRowExpandRatio(1, 1.0f);
+        setContent(content);
+        final Button btn = new Button("Show working notification",
+                new Button.ClickListener() {
+                    public void buttonClick(ClickEvent event) {
+                        Notification
+                                .show("This will disappear when you move your mouse!");
+                    }
+                });
+        content.addComponent(btn);
+
+        provider = new DummyEventProvider();
+        final Calendar cal = new Calendar(provider);
+        cal.setLocale(Locale.US);
+        cal.setSizeFull();
+        cal.setHandler(new DateClickHandler() {
+            public void dateClick(DateClickEvent event) {
+                provider.addEvent(event.getDate());
+                Notification
+                        .show("This should disappear, but if wont unless clicked.");
+
+                // this requestRepaint call interferes with the notification
+                cal.markAsDirty();
+            }
+        });
+        content.addComponent(cal);
+
+        java.util.Calendar javaCal = java.util.Calendar.getInstance();
+        javaCal.set(java.util.Calendar.YEAR, 2000);
+        javaCal.set(java.util.Calendar.MONTH, 0);
+        javaCal.set(java.util.Calendar.DAY_OF_MONTH, 1);
+        Date start = javaCal.getTime();
+        javaCal.set(java.util.Calendar.DAY_OF_MONTH, 31);
+        Date end = javaCal.getTime();
+
+        cal.setStartDate(start);
+        cal.setEndDate(end);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/calendar/actions.html b/uitest/src/com/vaadin/tests/components/calendar/actions.html
new file mode 100644
index 0000000000..bec3f2aded
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/actions.html
@@ -0,0 +1,51 @@
+<?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:8080/" />
+<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.calendar.CalendarActionsUI?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>contextMenuAt</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[7]</td>
+	<td>100,20</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>addEventContextMenu</td>
+</tr>
+<tr>
+	<td>contextMenuAt</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[8]</td>
+	<td>100,20</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>removeEventContextMenu</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[8]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>NoContextMenu</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html b/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
new file mode 100644
index 0000000000..cccb88bfb2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
@@ -0,0 +1,236 @@
+<?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="" />
+<title>basicNavigation</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">basicNavigation</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Feb 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Mar 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Feb 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>26</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[5]/domChild[6]/domChild[0]/domChild[0]</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,44</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/9/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/15/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>1 AM</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[23]</td>
+	<td>11 PM</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
+	<td>4,6</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
+	<td>4,5</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/23/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/29/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/9/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/15/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+	<td>77,5</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Tuesday 1/11/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>8,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Friday 12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/30/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 2/5/00</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>26</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html b/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
new file mode 100644
index 0000000000..dcf6c1ec53
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
@@ -0,0 +1,110 @@
+<?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="" />
+<title>eventSizingNoOverlap</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">eventSizingNoOverlap</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!-- Go to week view -->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>4,57</td>
+</tr>
+<!-- Open add-event popup, enter event between 12:45-13:15 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 12:45 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:15 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>12:45-13:15</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!-- Open add-event popup, enter event between 13:15-13:25 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 13:15 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:25 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>13:15-13:25</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!-- Open add-event popup, enter event between 13:25-13:55 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 13:25 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:55 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>13:25-13:55</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html b/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
new file mode 100644
index 0000000000..8991e1983d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
@@ -0,0 +1,116 @@
+<?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="" />
+<title>midnightEventsTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">midnightEventsTest</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;secondsResolution&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Add event from 0:00 to 0:00-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/3/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/4/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Midnight to midnight</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Add event from 00:00 to 00:00 on the same day-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td>84,10</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/7/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Zero-length midnight event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<!--Go to weekly view-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
+	<td>10,48</td>
+</tr>
+<!--Assert zero-length event exists-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>50,4</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Zero-length midnight event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert that the the all day event does not overflow to the next day by checking that the first time-cell is empty-->
+<tr>
+	<td>dragAndDrop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[5]</td>
+	<td>+0,+5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
new file mode 100644
index 0000000000..760beef6c0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
@@ -0,0 +1,170 @@
+<?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="" />
+<title>monthlyViewNewEvent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">monthlyViewNewEvent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Create new event with the button-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>10,5</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>52,8</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Open previously created event, assert values-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>91,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Open previously created event, assert values and shorten the event-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>41,8</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Click the calendar where the event previously was, assert new event creation-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td>
+	<td>107,8</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
new file mode 100644
index 0000000000..68690f81b4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
@@ -0,0 +1,410 @@
+<?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="" />
+<title>monthlyViewNewEvents</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">monthlyViewNewEvents</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging, make it all-day-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[0]/domChild[2]</td>
+	<td>98,83</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]</td>
+	<td>38,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>7,9</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging, make it blue-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[4]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[0]/domChild[3]</td>
+	<td>125,80</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>10,8</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+	<td>6,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td>
+	<td>49,10</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[4]</td>
+	<td>45,85</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>5,9</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Fourth test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Fourth event</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+	<td>13,18</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
+	<td>57,9</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Start asserting the previously entered events-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
+	<td>12,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
+	<td>72,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+	<td>44,10</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+	<td>79,5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
+	<td>47,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/30/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
+	<td>72,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/30/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[3]</td>
+	<td>37,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Fourth test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Fourth event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Red</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/notifications.html b/uitest/src/com/vaadin/tests/components/calendar/notifications.html
new file mode 100644
index 0000000000..15bf29a0fd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/notifications.html
@@ -0,0 +1,41 @@
+<?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:8080/" />
+<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.calendar.NotificationTestUI?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>83,11</td>
+</tr>
+<tr>
+	<td>mouseMove</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[3]/domChild[0]/domChild[3]</td>
+	<td>10,10</td>
+</tr>
+<tr>
+	<td>closeNotification</td>
+	<td>//div[@id='runcomvaadintestscomponentscalendarNotificationTestUI-1842310749-overlays']/div</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>no-notification</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
new file mode 100644
index 0000000000..66d2c2f126
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest1000x600px</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest1000x600px</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=1000px&amp;height=600px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>7,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
new file mode 100644
index 0000000000..7c963f547f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest100percentXundefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest100percentXundefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>10,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
new file mode 100644
index 0000000000..19f03db784
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest100x100percent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest100x100percent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25&amp;height=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>12,54</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
new file mode 100644
index 0000000000..70f6dbd75b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest300pxXundefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest300pxXundefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=300px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>11,52</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
new file mode 100644
index 0000000000..59d39226d9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestSizeFull</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestSizeFull</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,56</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
new file mode 100644
index 0000000000..d48917904c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedX100percent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedX100percent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
new file mode 100644
index 0000000000..2dfce00635
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedX300px</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedX300px</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=300px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,26</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
new file mode 100644
index 0000000000..3bfae6be35
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedXUndefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedXUndefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=&amp;height=</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>8,52</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html b/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
new file mode 100644
index 0000000000..a0c6798edb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
@@ -0,0 +1,46 @@
+<?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="" />
+<title>visibleHours24H</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">visibleHours24H</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
+	<td>9,55</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='gwt-uid-9']/div</td>
+	<td>7,14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td</td>
+	<td>120,15</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>9:00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td>
+	<td>16:00</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html
new file mode 100644
index 0000000000..b587288a24
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html
@@ -0,0 +1,657 @@
+<?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="" />
+<title>weeklyViewNewEvents</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">weeklyViewNewEvents</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Go to weekly view-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>3,49</td>
+</tr>
+<!--Assert the default event contents-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>26,5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/10/00 09:30 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/10/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>off</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Appointment</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td>
+	<td>Office</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>A longer description, which should display correctly.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>21,12</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>19,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/15/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/15/00 06:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Free time</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[6]/domChild[0]/domChild[0]</td>
+	<td>22,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/15/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Whole week event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description for the whole week event.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Orange</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert the all-day events-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[1]</td>
+	<td>78,3</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/12/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/12/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Allday event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Some description.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Red</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[1]</td>
+	<td>57,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second allday event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Some description.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Enter new event-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00 9:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00 2:00 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test event description</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td>
+	<td>3,15</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4</td>
+	<td>36,6</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>47,21</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test event description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Orange</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>8,9</td>
+</tr>
+<!--Edit previously created events and change properties-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>33,16</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#popupButton</td>
+	<td>10,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
+	<td>16,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#popupButton</td>
+	<td>14,14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
+	<td>14,10</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert the edited values-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]</td>
+	<td>34,21</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 8:00 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>7,73</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
+	<td>12,32</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>11,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[1]</td>
+	<td>4,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>14,71</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>16,111</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>14,209</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
+	<td>20,113</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>7,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>21,87</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>12,10</td>
+</tr>
+<!--Go to monthly view and assert inserted events-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[4]</td>
+	<td>36,10</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[3]</td>
+	<td>53,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[2]/domChild[0]</td>
+	<td>48,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[4]/domChild[0]/domChild[1]</td>
+	<td>50,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Whole week event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From ad290f8c65057bdef33ec73cb49a8c6d10b9e356 Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Wed, 3 Apr 2013 14:12:42 +0300
Subject: Fix for CheckBox and Layout (#11407)

Change in CheckBoxConnector led to wrong enabled behaviour and addition
to top coordinate to prevent scrollbars with VPopupCalendar

Change-Id: I381ab7c8a605535280ae58716181ef4c346997f7
---
 WebContent/VAADIN/themes/base/common/common.scss   |  1 +
 .../client/ui/checkbox/CheckBoxConnector.java      |  4 +++-
 .../tests/layouts/CaptionsInLayoutsWaiAria.java    | 22 ++++++++++++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/common/common.scss b/WebContent/VAADIN/themes/base/common/common.scss
index 27c6dc949c..926bdc7b74 100644
--- a/WebContent/VAADIN/themes/base/common/common.scss
+++ b/WebContent/VAADIN/themes/base/common/common.scss
@@ -240,6 +240,7 @@ input::-ms-clear {
 
 .v-assistive-device-only {
 	position: absolute;
+	top: -2000px;
 	left: -2000px;
 	width: 10px;
 	overflow: hidden;
diff --git a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
index ebfda2d715..7c2052e6f1 100644
--- a/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
+++ b/client/src/com/vaadin/client/ui/checkbox/CheckBoxConnector.java
@@ -92,7 +92,9 @@ public class CheckBoxConnector extends AbstractFieldConnector implements
         }
 
         getWidget().setRequired(isRequired());
-        getWidget().setEnabled(!isReadOnly());
+        if (isReadOnly()) {
+            getWidget().setEnabled(false);
+        }
 
         if (getIcon() != null) {
             if (getWidget().icon == null) {
diff --git a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
index 4ffe7f806e..ec323f2db2 100644
--- a/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
+++ b/uitest/src/com/vaadin/tests/layouts/CaptionsInLayoutsWaiAria.java
@@ -55,6 +55,7 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
         addComponent(toggleIcon());
         addComponent(toggleReadOnly());
         addComponent(toggleInvalid());
+        addComponent(toggleEnabled());
         addComponent(addCaptionText());
         // layoutParent.addComponent(new
         // NativeButton("Button right of layout"));
@@ -125,6 +126,21 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
         return readOnlyToggle;
     }
 
+    private Component toggleEnabled() {
+        CheckBox enabledToggle = new CheckBox();
+        enabledToggle.setImmediate(true);
+        enabledToggle.setValue(true);
+        enabledToggle.setCaption("Enabled");
+        enabledToggle.addValueChangeListener(new ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                setEnabled((Boolean) event.getProperty().getValue());
+            }
+        });
+
+        return enabledToggle;
+    }
+
     private Component toggleInvalid() {
         CheckBox invalid = new CheckBox("Invalid");
         invalid.setImmediate(true);
@@ -174,6 +190,12 @@ public class CaptionsInLayoutsWaiAria extends TestBase {
         }
     }
 
+    protected void setEnabled(boolean value) {
+        for (AbstractField<?> c : components) {
+            c.setEnabled(value);
+        }
+    }
+
     private Component toggleError() {
         CheckBox errorToggle = new CheckBox();
         errorToggle.setImmediate(true);
-- 
cgit v1.2.3


From b6928fde240d5b660a4a7be1076e7c58584b3303 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Wed, 3 Apr 2013 18:17:32 +0300
Subject: Reworked fix for ignoring /APP/ (#11192)

* Fixed potential NPE by using existing helper method
* Pass /APP/ urls also to session handlers as at least GlobalResourceHandler requires it
* Fixed test to test /APP/ instead of /APP

Change-Id: I8d913e6a5509c63f8e47813fce5751f5279ed4fc
---
 server/src/com/vaadin/server/BootstrapHandler.java                | 3 +--
 .../com/vaadin/server/communication/SessionRequestHandler.java    | 8 --------
 uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java   | 4 ++--
 3 files changed, 3 insertions(+), 12 deletions(-)

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/BootstrapHandler.java b/server/src/com/vaadin/server/BootstrapHandler.java
index 80cadb02c1..671279219e 100644
--- a/server/src/com/vaadin/server/BootstrapHandler.java
+++ b/server/src/com/vaadin/server/BootstrapHandler.java
@@ -115,8 +115,7 @@ public abstract class BootstrapHandler extends SynchronizedRequestHandler {
     @Override
     public boolean synchronizedHandleRequest(VaadinSession session,
             VaadinRequest request, VaadinResponse response) throws IOException {
-        String pathInfo = request.getPathInfo();
-        if (pathInfo.startsWith("/" + ApplicationConstants.APP_PATH + "/")) {
+        if (ServletPortletHelper.isAppRequest(request)) {
             // We do not want to handle /APP requests here, instead let it fall
             // through and produce a 404
             return false;
diff --git a/server/src/com/vaadin/server/communication/SessionRequestHandler.java b/server/src/com/vaadin/server/communication/SessionRequestHandler.java
index 14c940acf5..244cb0121d 100644
--- a/server/src/com/vaadin/server/communication/SessionRequestHandler.java
+++ b/server/src/com/vaadin/server/communication/SessionRequestHandler.java
@@ -22,7 +22,6 @@ import com.vaadin.server.RequestHandler;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinResponse;
 import com.vaadin.server.VaadinSession;
-import com.vaadin.shared.ApplicationConstants;
 
 /**
  * Handles a request by passing it to each registered {@link RequestHandler} in
@@ -51,13 +50,6 @@ public class SessionRequestHandler implements RequestHandler {
     @Override
     public boolean handleRequest(VaadinSession session, VaadinRequest request,
             VaadinResponse response) throws IOException {
-        String pathInfo = request.getPathInfo();
-        if (pathInfo.startsWith("/" + ApplicationConstants.APP_PATH + "/")) {
-            // /<APP_PATH>/ is reserved for Vaadin internal use and these
-            // requests should not be passed to session request handlers
-            return false;
-        }
-
         // Use a copy to avoid ConcurrentModificationException
         session.lock();
         ArrayList<RequestHandler> requestHandlers;
diff --git a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java
index dfd664c9cf..a6a5a5a084 100644
--- a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java
+++ b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.java
@@ -23,8 +23,8 @@ public class AppResource404 extends TestBase {
         addComponent(new Link("Existing resource", resource));
         addComponent(new Link("Non-existing resource", new ExternalResource(
                 baseUrl + "/APP/connector/0/4/asdfasdf")));
-        addComponent(new Link("/APP url that should give 404",
-                new ExternalResource(baseUrl + "/APP")));
+        addComponent(new Link("/APP/ url that should give 404",
+                new ExternalResource(baseUrl + "/APP/")));
         addComponent(new Link("/APPLE url that should go to UI providers",
                 new ExternalResource(baseUrl + "/APPLE")));
     }
-- 
cgit v1.2.3


From 008d51dba378c2feb57bd5d30550561567f3f91a Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 4 Apr 2013 12:24:43 +0300
Subject: Renamed Calendar tests to be more consistent with other tests
 (#11079)

Change-Id: I3c057c6c6ebf3cad982b5f8d2821b579f7aa57ea
---
 .../tests/components/calendar/CalendarActions.html |  51 ++
 .../calendar/CalendarBasicNavigation.html          | 236 ++++++++
 .../calendar/CalendarEventSizingNoOverlap.html     | 110 ++++
 .../calendar/CalendarMidnightEventsTest.html       | 116 ++++
 .../calendar/CalendarMonthlyViewNewEvent.html      | 170 ++++++
 .../calendar/CalendarMonthlyViewNewEvents.html     | 410 +++++++++++++
 .../components/calendar/CalendarNotifications.html |  41 ++
 .../calendar/CalendarSizeTest1000x600px.html       |  41 ++
 .../CalendarSizeTest100percentXundefined.html      |  41 ++
 .../calendar/CalendarSizeTest100x100percent.html   |  41 ++
 .../calendar/CalendarSizeTest300pxXundefined.html  |  41 ++
 .../calendar/CalendarSizeTestSizeFull.html         |  41 ++
 .../CalendarSizeTestUndefinedX100percent.html      |  41 ++
 .../calendar/CalendarSizeTestUndefinedX300px.html  |  41 ++
 .../CalendarSizeTestUndefinedXUndefined.html       |  41 ++
 .../calendar/CalendarVisibleHours24H.html          |  46 ++
 .../calendar/CalendarWeeklyViewNewEvents.html      | 657 +++++++++++++++++++++
 .../vaadin/tests/components/calendar/actions.html  |  51 --
 .../tests/components/calendar/basicNavigation.html | 236 --------
 .../components/calendar/eventSizingNoOverlap.html  | 110 ----
 .../components/calendar/midnightEventsTest.html    | 116 ----
 .../components/calendar/monthlyViewNewEvent.html   | 170 ------
 .../components/calendar/monthlyViewNewEvents.html  | 410 -------------
 .../tests/components/calendar/notifications.html   |  41 --
 .../components/calendar/sizeTest1000x600px.html    |  41 --
 .../calendar/sizeTest100percentXundefined.html     |  41 --
 .../calendar/sizeTest100x100percent.html           |  41 --
 .../calendar/sizeTest300pxXundefined.html          |  41 --
 .../components/calendar/sizeTestSizeFull.html      |  41 --
 .../calendar/sizeTestUndefinedX100percent.html     |  41 --
 .../calendar/sizeTestUndefinedX300px.html          |  41 --
 .../calendar/sizeTestUndefinedXUndefined.html      |  41 --
 .../tests/components/calendar/visibleHours24H.html |  46 --
 .../components/calendar/weeklyViewNewEvents.html   | 657 ---------------------
 34 files changed, 2165 insertions(+), 2165 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/actions.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/notifications.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html
new file mode 100644
index 0000000000..bec3f2aded
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActions.html
@@ -0,0 +1,51 @@
+<?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:8080/" />
+<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.calendar.CalendarActionsUI?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>contextMenuAt</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[7]</td>
+	<td>100,20</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>addEventContextMenu</td>
+</tr>
+<tr>
+	<td>contextMenuAt</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[8]</td>
+	<td>100,20</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>removeEventContextMenu</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[8]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>NoContextMenu</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html
new file mode 100644
index 0000000000..cccb88bfb2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarBasicNavigation.html
@@ -0,0 +1,236 @@
+<?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="" />
+<title>basicNavigation</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">basicNavigation</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Feb 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Mar 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Feb 2000</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>26</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[5]/domChild[6]/domChild[0]/domChild[0]</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,44</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/9/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/15/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>1 AM</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[23]</td>
+	<td>11 PM</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
+	<td>4,6</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
+	<td>4,5</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/23/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/29/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/9/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 1/15/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+	<td>77,5</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Tuesday 1/11/00</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>8,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>10,9</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Friday 12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>Sunday 1/30/00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
+	<td>Saturday 2/5/00</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>26</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html
new file mode 100644
index 0000000000..dcf6c1ec53
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarEventSizingNoOverlap.html
@@ -0,0 +1,110 @@
+<?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="" />
+<title>eventSizingNoOverlap</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">eventSizingNoOverlap</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!-- Go to week view -->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>4,57</td>
+</tr>
+<!-- Open add-event popup, enter event between 12:45-13:15 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 12:45 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:15 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>12:45-13:15</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!-- Open add-event popup, enter event between 13:15-13:25 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 13:15 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:25 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>13:15-13:25</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!-- Open add-event popup, enter event between 13:25-13:55 -->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00 13:25 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/9/00 13:55 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>13:25-13:55</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html
new file mode 100644
index 0000000000..8991e1983d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMidnightEventsTest.html
@@ -0,0 +1,116 @@
+<?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="" />
+<title>midnightEventsTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">midnightEventsTest</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;secondsResolution&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Add event from 0:00 to 0:00-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/3/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/4/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Midnight to midnight</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Add event from 00:00 to 00:00 on the same day-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td>84,10</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/7/00 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Zero-length midnight event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<!--Go to weekly view-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
+	<td>10,48</td>
+</tr>
+<!--Assert zero-length event exists-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>50,4</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Zero-length midnight event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert that the the all day event does not overflow to the next day by checking that the first time-cell is empty-->
+<tr>
+	<td>dragAndDrop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[5]</td>
+	<td>+0,+5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html
new file mode 100644
index 0000000000..760beef6c0
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvent.html
@@ -0,0 +1,170 @@
+<?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="" />
+<title>monthlyViewNewEvent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">monthlyViewNewEvent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Create new event with the button-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>10,5</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>52,8</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Open previously created event, assert values-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>91,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Open previously created event, assert values and shorten the event-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>41,8</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Click the calendar where the event previously was, assert new event creation-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td>
+	<td>107,8</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html
new file mode 100644
index 0000000000..68690f81b4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarMonthlyViewNewEvents.html
@@ -0,0 +1,410 @@
+<?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="" />
+<title>monthlyViewNewEvents</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">monthlyViewNewEvents</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging, make it all-day-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[0]/domChild[2]</td>
+	<td>98,83</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]</td>
+	<td>38,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>7,9</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event by dragging, make it blue-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[4]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[0]/domChild[3]</td>
+	<td>125,80</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>10,8</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+	<td>6,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td>
+	<td>49,10</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[4]</td>
+	<td>45,85</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>5,9</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Fourth test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Fourth event</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
+	<td>13,18</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
+	<td>57,9</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Start asserting the previously entered events-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
+	<td>12,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
+	<td>72,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/27/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/31/99</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+	<td>44,10</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
+	<td>79,5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/26/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Desc</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
+	<td>47,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/30/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
+	<td>72,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/30/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/1/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Third test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Testing</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[3]</td>
+	<td>37,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>12/29/99</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Fourth test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Fourth event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Red</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html
new file mode 100644
index 0000000000..15bf29a0fd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarNotifications.html
@@ -0,0 +1,41 @@
+<?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:8080/" />
+<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.calendar.NotificationTestUI?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>83,11</td>
+</tr>
+<tr>
+	<td>mouseMove</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[3]/domChild[0]/domChild[3]</td>
+	<td>10,10</td>
+</tr>
+<tr>
+	<td>closeNotification</td>
+	<td>//div[@id='runcomvaadintestscomponentscalendarNotificationTestUI-1842310749-overlays']/div</td>
+	<td>0,0</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>no-notification</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
new file mode 100644
index 0000000000..66d2c2f126
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest1000x600px</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest1000x600px</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=1000px&amp;height=600px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>7,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
new file mode 100644
index 0000000000..7c963f547f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest100percentXundefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest100percentXundefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>10,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
new file mode 100644
index 0000000000..19f03db784
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest100x100percent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest100x100percent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25&amp;height=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>12,54</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
new file mode 100644
index 0000000000..70f6dbd75b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTest300pxXundefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTest300pxXundefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=300px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>11,52</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html
new file mode 100644
index 0000000000..59d39226d9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestSizeFull</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestSizeFull</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,56</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
new file mode 100644
index 0000000000..d48917904c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedX100percent</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedX100percent</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=100%25</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,53</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
new file mode 100644
index 0000000000..2dfce00635
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedX300px</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedX300px</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=300px</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>9,26</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
new file mode 100644
index 0000000000..3bfae6be35
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
@@ -0,0 +1,41 @@
+<?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="" />
+<title>sizeTestUndefinedXUndefined</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">sizeTestUndefinedXUndefined</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=&amp;height=</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
+	<td>Jan 2000</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>8,52</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
new file mode 100644
index 0000000000..a0c6798edb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
@@ -0,0 +1,46 @@
+<?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="" />
+<title>visibleHours24H</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">visibleHours24H</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
+	<td>9,55</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='gwt-uid-9']/div</td>
+	<td>7,14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td</td>
+	<td>120,15</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>9:00</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td>
+	<td>16:00</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
new file mode 100644
index 0000000000..b587288a24
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
@@ -0,0 +1,657 @@
+<?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="" />
+<title>weeklyViewNewEvents</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">weeklyViewNewEvents</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
+	<td></td>
+</tr>
+<!--Go to weekly view-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>3,49</td>
+</tr>
+<!--Assert the default event contents-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>26,5</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/10/00 09:30 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/10/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>off</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Appointment</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td>
+	<td>Office</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>A longer description, which should display correctly.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Green</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>21,12</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
+	<td>19,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/15/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/15/00 06:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Free time</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[6]/domChild[0]/domChild[0]</td>
+	<td>22,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/9/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/15/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Whole week event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Description for the whole week event.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Orange</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert the all-day events-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[1]</td>
+	<td>78,3</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/12/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/12/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Allday event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Some description.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Red</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[1]</td>
+	<td>57,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Second allday event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Some description.</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Blue</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Enter new event-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00 9:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00 2:00 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test event description</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td>
+	<td>3,15</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4</td>
+	<td>36,6</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>47,21</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/13/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/13/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Test event description</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
+	<td>Orange</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>8,9</td>
+</tr>
+<!--Edit previously created events and change properties-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>33,16</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#popupButton</td>
+	<td>10,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
+	<td>16,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#popupButton</td>
+	<td>14,14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
+	<td>14,10</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert the edited values-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]</td>
+	<td>34,21</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Create new event-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 8:00 PM</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>enterCharacter</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
+	<td>Second test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>7,73</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
+	<td>12,32</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>11,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[1]</td>
+	<td>4,9</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>14,71</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>16,111</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>14,209</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 10:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 08:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
+	<td>20,113</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 11:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 07:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>7,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
+	<td>21,87</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
+	<td>1/11/00 09:00 AM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
+	<td>1/11/00 02:00 PM</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>12,10</td>
+</tr>
+<!--Go to monthly view and assert inserted events-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[4]</td>
+	<td>36,10</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[3]</td>
+	<td>53,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Training</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[2]/domChild[0]</td>
+	<td>48,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Test event 2</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[4]/domChild[0]/domChild[1]</td>
+	<td>50,6</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
+	<td>Whole week event</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/actions.html b/uitest/src/com/vaadin/tests/components/calendar/actions.html
deleted file mode 100644
index bec3f2aded..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/actions.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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:8080/" />
-<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.calendar.CalendarActionsUI?restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>contextMenuAt</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[7]</td>
-	<td>100,20</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td>addEventContextMenu</td>
-</tr>
-<tr>
-	<td>contextMenuAt</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[8]</td>
-	<td>100,20</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td>removeEventContextMenu</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarActionsUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[8]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td>NoContextMenu</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html b/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
deleted file mode 100644
index cccb88bfb2..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/basicNavigation.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<?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="" />
-<title>basicNavigation</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">basicNavigation</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Feb 2000</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Mar 2000</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Feb 2000</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>26</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[5]/domChild[6]/domChild[0]/domChild[0]</td>
-	<td>5</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>9,44</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Sunday 1/9/00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
-	<td>Saturday 1/15/00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>1 AM</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[23]</td>
-	<td>11 PM</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
-	<td>4,6</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]/domChild[0]</td>
-	<td>4,5</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Sunday 1/23/00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
-	<td>Saturday 1/29/00</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>9,7</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>9,7</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Sunday 1/9/00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
-	<td>Saturday 1/15/00</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
-	<td>77,5</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Tuesday 1/11/00</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>8,8</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>10,9</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Friday 12/31/99</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
-	<td>Sunday 1/30/00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]</td>
-	<td>Saturday 2/5/00</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
-	<td>26</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html b/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
deleted file mode 100644
index dcf6c1ec53..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/eventSizingNoOverlap.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<?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="" />
-<title>eventSizingNoOverlap</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">eventSizingNoOverlap</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
-	<td></td>
-</tr>
-<!-- Go to week view -->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>4,57</td>
-</tr>
-<!-- Open add-event popup, enter event between 12:45-13:15 -->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/9/00 12:45 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/9/00 13:15 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>12:45-13:15</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!-- Open add-event popup, enter event between 13:15-13:25 -->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/9/00 13:15 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/9/00 13:25 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>13:15-13:25</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!-- Open add-event popup, enter event between 13:25-13:55 -->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/9/00 13:25 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/9/00 13:55 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>13:25-13:55</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html b/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
deleted file mode 100644
index 8991e1983d..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/midnightEventsTest.html
+++ /dev/null
@@ -1,116 +0,0 @@
-<?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="" />
-<title>midnightEventsTest</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">midnightEventsTest</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;secondsResolution&amp;restartApplication</td>
-	<td></td>
-</tr>
-<!--Add event from 0:00 to 0:00-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/3/00 12:00:00 AM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/4/00 12:00:00 AM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Midnight to midnight</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Add event from 00:00 to 00:00 on the same day-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[2]</td>
-	<td>84,10</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/7/00 12:00:00 AM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Zero-length midnight event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<!--Go to weekly view-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
-	<td>10,48</td>
-</tr>
-<!--Assert zero-length event exists-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td>
-	<td>50,4</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Zero-length midnight event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert that the the all day event does not overflow to the next day by checking that the first time-cell is empty-->
-<tr>
-	<td>dragAndDrop</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]/domChild[0]/domChild[5]</td>
-	<td>+0,+5</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
deleted file mode 100644
index 760beef6c0..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvent.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<?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="" />
-<title>monthlyViewNewEvent</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">monthlyViewNewEvent</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
-	<td></td>
-</tr>
-<!--Create new event with the button-->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>10,5</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>52,8</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/26/99</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/1/00</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Test description</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Open previously created event, assert values-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>91,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/26/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/1/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>on</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Test description</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Open previously created event, assert values and shorten the event-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>41,8</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/26/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/1/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>on</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Test description</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/27/99</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/31/99</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Click the calendar where the event previously was, assert new event creation-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]</td>
-	<td>107,8</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
deleted file mode 100644
index 68690f81b4..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/monthlyViewNewEvents.html
+++ /dev/null
@@ -1,410 +0,0 @@
-<?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="" />
-<title>monthlyViewNewEvents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">monthlyViewNewEvents</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
-	<td></td>
-</tr>
-<!--Create new event by dragging, make it all-day-->
-<tr>
-	<td>drag</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>drop</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[5]/domChild[0]/domChild[2]</td>
-	<td>98,83</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/27/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/31/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>on</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Description</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Create new event by dragging-->
-<tr>
-	<td>drag</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>drop</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]</td>
-	<td>38,8</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>7,9</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Second test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Desc</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Create new event by dragging, make it blue-->
-<tr>
-	<td>drag</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[4]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>drop</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[0]/domChild[3]</td>
-	<td>125,80</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>10,8</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Third test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Testing</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
-	<td>6,9</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item2</td>
-	<td>49,10</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[4]</td>
-	<td>45,85</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>5,9</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Fourth test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Fourth event</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]#button</td>
-	<td>13,18</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item3</td>
-	<td>57,9</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Start asserting the previously entered events-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
-	<td>12,7</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/27/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/31/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>on</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Description</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
-	<td>72,6</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/27/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/31/99</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
-	<td>44,10</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/26/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/29/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Second test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Desc</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[2]</td>
-	<td>79,5</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/26/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/29/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Second test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Desc</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
-	<td>47,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/30/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/1/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Third test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Testing</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Blue</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[4]/domChild[0]/domChild[2]</td>
-	<td>72,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/30/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/1/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Third test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Testing</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Blue</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[0]/domChild[3]</td>
-	<td>37,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>12/29/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>12/29/99</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Fourth test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Fourth event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Red</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/notifications.html b/uitest/src/com/vaadin/tests/components/calendar/notifications.html
deleted file mode 100644
index 15bf29a0fd..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/notifications.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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:8080/" />
-<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.calendar.NotificationTestUI?restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>83,11</td>
-</tr>
-<tr>
-	<td>mouseMove</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarNotificationTestUI::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[3]/domChild[0]/domChild[3]</td>
-	<td>10,10</td>
-</tr>
-<tr>
-	<td>closeNotification</td>
-	<td>//div[@id='runcomvaadintestscomponentscalendarNotificationTestUI-1842310749-overlays']/div</td>
-	<td>0,0</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td>no-notification</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
deleted file mode 100644
index 66d2c2f126..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTest1000x600px.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTest1000x600px</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTest1000x600px</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=1000px&amp;height=600px</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>7,53</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
deleted file mode 100644
index 7c963f547f..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100percentXundefined.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTest100percentXundefined</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTest100percentXundefined</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>10,53</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
deleted file mode 100644
index 19f03db784..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTest100x100percent.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTest100x100percent</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTest100x100percent</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=100%25&amp;height=100%25</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>12,54</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
deleted file mode 100644
index 70f6dbd75b..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTest300pxXundefined.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTest300pxXundefined</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTest300pxXundefined</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=300px</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>11,52</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
deleted file mode 100644
index 59d39226d9..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTestSizeFull.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTestSizeFull</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestSizeFull</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>9,56</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
deleted file mode 100644
index d48917904c..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX100percent.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTestUndefinedX100percent</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestUndefinedX100percent</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=100%25</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>9,53</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
deleted file mode 100644
index 2dfce00635..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedX300px.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTestUndefinedX300px</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestUndefinedX300px</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;height=300px</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>9,26</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html b/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
deleted file mode 100644
index 3bfae6be35..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/sizeTestUndefinedXUndefined.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTestUndefinedXUndefined</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestUndefinedXUndefined</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication&amp;width=&amp;height=</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>8,52</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html b/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
deleted file mode 100644
index a0c6798edb..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/visibleHours24H.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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="" />
-<title>visibleHours24H</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">visibleHours24H</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;firstDay=1&amp;lastDay=5&amp;firstHour=8&amp;lastHour=16&amp;restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
-	<td>9,55</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>//div[@id='gwt-uid-9']/div</td>
-	<td>7,14</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[4]/td</td>
-	<td>120,15</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>9:00</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[8]</td>
-	<td>16:00</td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html
deleted file mode 100644
index b587288a24..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/weeklyViewNewEvents.html
+++ /dev/null
@@ -1,657 +0,0 @@
-<?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="" />
-<title>weeklyViewNewEvents</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">weeklyViewNewEvents</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;width=1000px&amp;height=600px&amp;restartApplication</td>
-	<td></td>
-</tr>
-<!--Go to weekly view-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>3,49</td>
-</tr>
-<!--Assert the default event contents-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
-	<td>26,5</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/10/00 09:30 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/10/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>off</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Appointment</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[1]</td>
-	<td>Office</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>A longer description, which should display correctly.</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Green</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
-	<td>21,12</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 11:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 07:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Training</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Blue</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[7]/domChild[0]/domChild[48]/domChild[0]/domChild[0]</td>
-	<td>19,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/15/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/15/00 06:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Free time</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[6]/domChild[0]/domChild[0]</td>
-	<td>22,6</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/9/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/15/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VCheckBox[0]/domChild[0]</td>
-	<td>on</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Whole week event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Description for the whole week event.</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Orange</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert the all-day events-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[1]</td>
-	<td>78,3</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/12/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/12/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Allday event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Some description.</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Red</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]/domChild[1]</td>
-	<td>57,7</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/13/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/13/00</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Second allday event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Some description.</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Blue</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Enter new event-->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/13/00 9:00 AM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/13/00 2:00 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Test event description</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[1]</td>
-	<td>3,15</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VFilterSelect$SuggestionPopup[0]/VFilterSelect$SuggestionMenu[0]#item4</td>
-	<td>36,6</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert previously created event-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
-	<td>47,21</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/13/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/13/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Test event description</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VFilterSelect[0]/domChild[0]</td>
-	<td>Orange</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>8,9</td>
-</tr>
-<!--Edit previously created events and change properties-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[5]/domChild[0]/domChild[48]/domChild[0]</td>
-	<td>33,16</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#popupButton</td>
-	<td>10,11</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
-	<td>16,11</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#popupButton</td>
-	<td>14,14</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::Root/VOverlay[0]/VCalendarPanel[0]#day11</td>
-	<td>14,10</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[1]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert the edited values-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]</td>
-	<td>34,21</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Create new event-->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 10:00 AM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 8:00 PM</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event 2</td>
-</tr>
-<tr>
-	<td>enterCharacter</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextArea[0]</td>
-	<td>Second test event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[0]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
-	<td>7,73</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<!--Assert previously created event still exists in the right place (as multiple events occupy the same time)-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
-	<td>12,32</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 11:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 07:00 PM</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>11,8</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[1]</td>
-	<td>4,9</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 10:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 08:00 PM</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
-	<td>14,71</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
-	<td>16,111</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 10:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 08:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event 2</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[48]/domChild[0]</td>
-	<td>14,209</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 10:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 08:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event 2</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[49]/domChild[0]/domChild[0]</td>
-	<td>20,113</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 11:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 07:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Training</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>7,8</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]/domChild[50]/domChild[0]</td>
-	<td>21,87</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[0]#field</td>
-	<td>1/11/00 09:00 AM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VPopupCalendar[1]#field</td>
-	<td>1/11/00 02:00 PM</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
-	<td>12,10</td>
-</tr>
-<!--Go to monthly view and assert inserted events-->
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[4]</td>
-	<td>36,10</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[3]</td>
-	<td>53,6</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Training</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[2]/domChild[0]/domChild[2]/domChild[0]</td>
-	<td>48,7</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Test event 2</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[4]/domChild[0]/domChild[1]</td>
-	<td>50,6</td>
-</tr>
-<tr>
-	<td>assertValue</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VFormLayout[0]/VFormLayout$VFormLayoutTable[0]/VTextField[0]</td>
-	<td>Whole week event</td>
-</tr>
-<tr>
-	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VHorizontalLayout[0]/ChildComponentContainer[2]/VButton[0]/domChild[0]/domChild[0]</td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
-- 
cgit v1.2.3


From d937722318c47831775d2f0e6c67b0f0f1d57688 Mon Sep 17 00:00:00 2001
From: Pekka Hyvönen <pekka@vaadin.com>
Date: Thu, 21 Feb 2013 17:04:48 +0200
Subject: Maximize Restore for Window #3400

Change-Id: I164ae83bd6cf98f7a3d7e76d8e717a56e8cb5183
---
 WebContent/VAADIN/themes/base/window/window.scss   |  27 +-
 .../VAADIN/themes/reindeer/window/img/maximize.png | Bin 0 -> 270 bytes
 .../VAADIN/themes/reindeer/window/img/restore.png  | Bin 0 -> 328 bytes
 .../VAADIN/themes/reindeer/window/window.scss      |  20 +-
 WebContent/VAADIN/themes/runo/window/window.scss   |  23 +-
 .../client/ui/AbstractComponentConnector.java      |  12 +-
 client/src/com/vaadin/client/ui/VWindow.java       |  94 ++++---
 .../vaadin/client/ui/window/WindowConnector.java   | 287 +++++++++++++--------
 server/src/com/vaadin/ui/Window.java               | 147 ++++++++++-
 .../vaadin/shared/ui/window/WindowServerRpc.java   |   6 +
 .../com/vaadin/shared/ui/window/WindowState.java   |   6 +
 .../window/WindowMaximizeRestoreTest.html          | 228 ++++++++++++++++
 .../window/WindowMaximizeRestoreTest.java          | 165 ++++++++++++
 13 files changed, 857 insertions(+), 158 deletions(-)
 create mode 100644 WebContent/VAADIN/themes/reindeer/window/img/maximize.png
 create mode 100644 WebContent/VAADIN/themes/reindeer/window/img/restore.png
 create mode 100644 uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
 create mode 100644 uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/window/window.scss b/WebContent/VAADIN/themes/base/window/window.scss
index b9e7b54139..05f3b115ad 100644
--- a/WebContent/VAADIN/themes/base/window/window.scss
+++ b/WebContent/VAADIN/themes/base/window/window.scss
@@ -38,6 +38,10 @@
 }
 .#{$primaryStyleName}-header {
 	font-weight: bold;
+	-khtml-user-select: none;
+	-moz-user-select: none;
+	-ie-user-select: none;
+	user-select: none;
 }
 /* A more specific selector to make sure padding isn't so easily overridden */
 div.#{$primaryStyleName}-header {
@@ -77,20 +81,37 @@ div.#{$primaryStyleName}-header {
 .#{$primaryStyleName} div.#{$primaryStyleName}-footer-noresize {
 	height: 0;
 }
-.#{$primaryStyleName}-resizebox-disabled {
+.#{$primaryStyleName}-resizebox-disabled,
+.#{$primaryStyleName}-restorebox-disabled,
+.#{$primaryStyleName}-maximizebox-disabled {
 	cursor: default;
 	display: none;
 }
-.#{$primaryStyleName}-closebox {
+.#{$primaryStyleName}-closebox,
+.#{$primaryStyleName}-restorebox,
+.#{$primaryStyleName}-maximizebox {
 	position: absolute;
 	top: 0;
 	right: 0;
 	width: 1em;
 	height: 1em;
-	background: red;
 	cursor: pointer;
 	overflow: hidden;
 }
+.#{$primaryStyleName}-maximizebox,
+.#{$primaryStyleName}-restorebox {
+	right: 1.1em;
+}
+
+.#{$primaryStyleName}-closebox {
+	background: red;
+}
+.#{$primaryStyleName}-maximizebox {
+	background: blue;
+}
+.#{$primaryStyleName}-restorebox {
+	background: yellow;
+}
 .#{$primaryStyleName}-modalitycurtain {
 	top: 0;
 	left: 0;
diff --git a/WebContent/VAADIN/themes/reindeer/window/img/maximize.png b/WebContent/VAADIN/themes/reindeer/window/img/maximize.png
new file mode 100644
index 0000000000..86ffff9760
Binary files /dev/null and b/WebContent/VAADIN/themes/reindeer/window/img/maximize.png differ
diff --git a/WebContent/VAADIN/themes/reindeer/window/img/restore.png b/WebContent/VAADIN/themes/reindeer/window/img/restore.png
new file mode 100644
index 0000000000..119ea04259
Binary files /dev/null and b/WebContent/VAADIN/themes/reindeer/window/img/restore.png differ
diff --git a/WebContent/VAADIN/themes/reindeer/window/window.scss b/WebContent/VAADIN/themes/reindeer/window/window.scss
index e6a73ee2c0..7a05e52aec 100644
--- a/WebContent/VAADIN/themes/reindeer/window/window.scss
+++ b/WebContent/VAADIN/themes/reindeer/window/window.scss
@@ -14,7 +14,7 @@
 	border-color: rgba(0,0,0,.2);
 }
 .#{$primaryStyleName}-outerheader {
-	padding: 12px 32px 0 14px;
+	padding: 12px 52px 0 14px;
 	height: 37px;
 	background: black repeat-x;
 	background-image: url(img/header-bg.png); /** sprite-ref: verticals; sprite-alignment: repeat */
@@ -61,6 +61,24 @@
 .#{$primaryStyleName}-closebox:active {
 	background-image: url(img/close-pressed.png); /** sprite-ref: verticals */
 }
+.#{$primaryStyleName}-maximizebox,
+.#{$primaryStyleName}-restorebox {
+	top: 12px;
+	right: 28px;
+	width: 15px;
+	height: 16px;
+	background: transparent;
+}
+.#{$primaryStyleName}-maximizebox {
+	&, &:hover,&:active {
+		background-image: url(img/maximize.png); /** sprite-ref: verticals */
+	}
+}
+.#{$primaryStyleName}-restorebox {
+	&, &:hover,&:active {
+		background-image: url(img/restore.png); /** sprite-ref: verticals */
+	}
+}
 .#{$primaryStyleName}-contents {
 	background: #fff;
 }
diff --git a/WebContent/VAADIN/themes/runo/window/window.scss b/WebContent/VAADIN/themes/runo/window/window.scss
index 994238f2ad..db153243e9 100644
--- a/WebContent/VAADIN/themes/runo/window/window.scss
+++ b/WebContent/VAADIN/themes/runo/window/window.scss
@@ -51,14 +51,33 @@
 	background: transparent;
 	display: block;
 }
-.#{$primaryStyleName}-closebox {
+.#{$primaryStyleName}-closebox,
+.#{$primaryStyleName}-maximizebox,
+.#{$primaryStyleName}-restorebox {
 	position: absolute;
 	top: 21px;
-	right: 24px;
 	width: 12px;
 	height: 12px;
 	background: transparent url(img/close.png);
 }
+.#{$primaryStyleName}-closebox {
+	right: 24px;
+	background: transparent url(img/close.png);
+}
+
+.#{$primaryStyleName}-maximizebox,
+.#{$primaryStyleName}-restorebox {
+	right: 42px;
+}
+
+.#{$primaryStyleName}-maximizebox {
+	background: transparent url(img/maximize.png);
+}
+
+.#{$primaryStyleName}-restorebox {
+	background: transparent url(img/restore.png);
+}
+
 .#{$primaryStyleName}-closebox:hover {
 	background-position: 0 -12px;
 }
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index ecd6abae08..e7f7379994 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -36,6 +36,8 @@ import com.vaadin.client.metadata.NoDataException;
 import com.vaadin.client.metadata.Type;
 import com.vaadin.client.metadata.TypeData;
 import com.vaadin.client.metadata.TypeDataStore;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.ManagedLayout;
 import com.vaadin.client.ui.datefield.PopupDateFieldConnector;
 import com.vaadin.client.ui.ui.UIConnector;
 import com.vaadin.shared.AbstractComponentState;
@@ -205,12 +207,12 @@ public abstract class AbstractComponentConnector extends AbstractConnector
         }
     }
 
-    private void updateComponentSize() {
-        Profiler.enter("AbstractComponentConnector.updateComponentSize");
-
-        String newWidth = getState().width == null ? "" : getState().width;
-        String newHeight = getState().height == null ? "" : getState().height;
+    protected void updateComponentSize() {
+        updateComponentSize(getState().width == null ? "" : getState().width,
+                getState().height == null ? "" : getState().height);
+    }
 
+    protected void updateComponentSize(String newWidth, String newHeight) {
         // Parent should be updated if either dimension changed between relative
         // and non-relative
         if (newWidth.endsWith("%") != lastKnownWidth.endsWith("%")) {
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index fd2a701334..bd9a0ed07c 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -49,6 +49,7 @@ import com.vaadin.client.LayoutManager;
 import com.vaadin.client.Util;
 import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
 import com.vaadin.shared.EventId;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
 
 /**
  * "Sub window" component.
@@ -58,18 +59,6 @@ import com.vaadin.shared.EventId;
 public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         ScrollHandler, KeyDownHandler, FocusHandler, BlurHandler, Focusable {
 
-    /**
-     * Minimum allowed height of a window. This refers to the content area, not
-     * the outer borders.
-     */
-    private static final int MIN_CONTENT_AREA_HEIGHT = 100;
-
-    /**
-     * Minimum allowed width of a window. This refers to the content area, not
-     * the outer borders.
-     */
-    private static final int MIN_CONTENT_AREA_WIDTH = 150;
-
     private static ArrayList<VWindow> windowOrder = new ArrayList<VWindow>();
 
     private static boolean orderingDefered;
@@ -113,6 +102,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
     /** For internal use only. May be removed or replaced in the future. */
     public Element closeBox;
 
+    /** For internal use only. May be removed or replaced in the future. */
+    public Element maximizeRestoreBox;
+
     /** For internal use only. May be removed or replaced in the future. */
     public ApplicationConnection client;
 
@@ -262,6 +254,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         resizeBox = DOM.createDiv();
         DOM.setElementProperty(resizeBox, "className", CLASSNAME + "-resizebox");
         closeBox = DOM.createDiv();
+        maximizeRestoreBox = DOM.createDiv();
+        DOM.setElementProperty(maximizeRestoreBox, "className", CLASSNAME
+                + "-maximizebox");
         DOM.setElementProperty(closeBox, "className", CLASSNAME + "-closebox");
         DOM.appendChild(footer, resizeBox);
 
@@ -269,14 +264,15 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         DOM.setElementProperty(wrapper, "className", CLASSNAME + "-wrap");
 
         DOM.appendChild(wrapper, header);
+        DOM.appendChild(wrapper, maximizeRestoreBox);
         DOM.appendChild(wrapper, closeBox);
         DOM.appendChild(header, headerText);
         DOM.appendChild(wrapper, contents);
         DOM.appendChild(wrapper, footer);
         DOM.appendChild(super.getContainerElement(), wrapper);
 
-        sinkEvents(Event.MOUSEEVENTS | Event.TOUCHEVENTS | Event.ONCLICK
-                | Event.ONLOSECAPTURE);
+        sinkEvents(Event.ONDBLCLICK | Event.MOUSEEVENTS | Event.TOUCHEVENTS
+                | Event.ONCLICK | Event.ONLOSECAPTURE);
 
         setWidget(contentPanel);
 
@@ -575,6 +571,31 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         }
     }
 
+    public void updateMaximizeRestoreClassName(boolean visible,
+            DisplayState state) {
+        String className;
+        if (state == DisplayState.MAXIMIZED) {
+            className = CLASSNAME + "-restorebox";
+        } else {
+            className = CLASSNAME + "-maximizebox";
+        }
+        if (!visible) {
+            className = className + " " + className + "-disabled";
+        }
+        maximizeRestoreBox.setClassName(className);
+    }
+
+    // TODO this will eventually be removed, currently used to avoid updating to
+    // server side.
+    public void setPopupPositionNoUpdate(int left, int top) {
+        if (top < 0) {
+            // ensure window is not moved out of browser window from top of the
+            // screen
+            top = 0;
+        }
+        super.setPopupPosition(left, top);
+    }
+
     @Override
     public void setPopupPosition(int left, int top) {
         if (top < 0) {
@@ -616,6 +637,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         return contents;
     }
 
+    private Event headerDragPending;
+
     @Override
     public void onBrowserEvent(final Event event) {
         boolean bubble = true;
@@ -632,6 +655,28 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
                 onCloseClick();
             }
             bubble = false;
+        } else if (target == maximizeRestoreBox) {
+            // handled in connector
+            if (type != Event.ONCLICK) {
+                bubble = false;
+            }
+        } else if (header.isOrHasChild(target) && !dragging) {
+            // dblclick handled in connector
+            if (type != Event.ONDBLCLICK && draggable) {
+                if (type == Event.ONMOUSEDOWN) {
+                    headerDragPending = event;
+                } else if (type == Event.ONMOUSEMOVE
+                        && headerDragPending != null) {
+                    // ie won't work unless this is set here
+                    dragging = true;
+                    onDragEvent(headerDragPending);
+                    onDragEvent(event);
+                    headerDragPending = null;
+                } else {
+                    headerDragPending = null;
+                }
+                bubble = false;
+            }
         } else if (dragging || !contents.isOrHasChild(target)) {
             onDragEvent(event);
             bubble = false;
@@ -648,7 +693,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
          */
         if (type == Event.ONMOUSEDOWN
                 && !contentPanel.getElement().isOrHasChild(target)
-                && target != closeBox) {
+                && target != closeBox && target != maximizeRestoreBox) {
             contentPanel.focus();
         }
 
@@ -746,16 +791,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         }
 
         int w = Util.getTouchOrMouseClientX(event) - startX + origW;
-        int minWidth = getMinWidth();
-        if (w < minWidth) {
-            w = minWidth;
-        }
-
         int h = Util.getTouchOrMouseClientY(event) - startY + origH;
-        int minHeight = getMinHeight();
-        if (h < minHeight) {
-            h = minHeight;
-        }
 
         setWidth(w + "px");
         setHeight(h + "px");
@@ -775,7 +811,7 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         }
     }
 
-    private void updateContentsSize() {
+    public void updateContentsSize() {
         LayoutManager layoutManager = getLayoutManager();
         layoutManager.setNeedsMeasure(ConnectorMap.get(client).getConnector(
                 this));
@@ -959,10 +995,6 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         contentPanel.focus();
     }
 
-    public int getMinHeight() {
-        return MIN_CONTENT_AREA_HEIGHT + getDecorationHeight();
-    }
-
     private int getDecorationHeight() {
         LayoutManager lm = getLayoutManager();
         int headerHeight = lm.getOuterHeight(header);
@@ -974,10 +1006,6 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         return LayoutManager.get(client);
     }
 
-    public int getMinWidth() {
-        return MIN_CONTENT_AREA_WIDTH + getDecorationWidth();
-    }
-
     private int getDecorationWidth() {
         LayoutManager layoutManager = getLayoutManager();
         return layoutManager.getOuterWidth(getElement())
diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java
index 8cfc25a9dc..66907fbfa4 100644
--- a/client/src/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java
@@ -20,7 +20,10 @@ import com.google.gwt.dom.client.NativeEvent;
 import com.google.gwt.dom.client.Style;
 import com.google.gwt.dom.client.Style.Position;
 import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.DOM;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.DoubleClickEvent;
+import com.google.gwt.event.dom.client.DoubleClickHandler;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.Window;
 import com.vaadin.client.ApplicationConnection;
@@ -31,6 +34,7 @@ import com.vaadin.client.LayoutManager;
 import com.vaadin.client.Paintable;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.Util;
+import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.ui.AbstractSingleComponentContainerConnector;
 import com.vaadin.client.ui.ClickEventHandler;
 import com.vaadin.client.ui.PostLayoutListener;
@@ -43,6 +47,7 @@ import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.window.WindowServerRpc;
 import com.vaadin.shared.ui.window.WindowState;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
 
 @Connect(value = com.vaadin.ui.Window.class)
 public class WindowConnector extends AbstractSingleComponentContainerConnector
@@ -57,7 +62,32 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
         }
     };
 
-    boolean minWidthChecked = false;
+    abstract class WindowEventHandler implements ClickHandler,
+            DoubleClickHandler {
+    }
+
+    private WindowEventHandler maximizeRestoreClickHandler = new WindowEventHandler() {
+
+        @Override
+        public void onClick(ClickEvent event) {
+            final Element target = event.getNativeEvent().getEventTarget()
+                    .cast();
+            if (target == getWidget().maximizeRestoreBox) {
+                // Click on maximize/restore box
+                onMaximizeRestore();
+            }
+        }
+
+        @Override
+        public void onDoubleClick(DoubleClickEvent event) {
+            final Element target = event.getNativeEvent().getEventTarget()
+                    .cast();
+            if (getWidget().header.isOrHasChild(target)) {
+                // Double click on header
+                onMaximizeRestore();
+            }
+        }
+    };
 
     @Override
     public boolean delegateCaptionHandling() {
@@ -68,12 +98,18 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
     protected void init() {
         super.init();
 
+        VWindow window = getWidget();
+
         getLayoutManager().registerDependency(this,
-                getWidget().contentPanel.getElement());
-        getLayoutManager().registerDependency(this, getWidget().header);
-        getLayoutManager().registerDependency(this, getWidget().footer);
+                window.contentPanel.getElement());
+        getLayoutManager().registerDependency(this, window.header);
+        getLayoutManager().registerDependency(this, window.footer);
 
-        getWidget().setOwner(getConnection().getUIConnector().getWidget());
+        window.addHandler(maximizeRestoreClickHandler, ClickEvent.getType());
+        window.addHandler(maximizeRestoreClickHandler,
+                DoubleClickEvent.getType());
+
+        window.setOwner(getConnection().getUIConnector().getWidget());
     }
 
     @Override
@@ -87,109 +123,46 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
 
     @Override
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-        getWidget().id = getConnectorId();
-        getWidget().client = client;
-
-        // Workaround needed for Testing Tools (GWT generates window DOM
-        // slightly different in different browsers).
-        DOM.setElementProperty(getWidget().closeBox, "id", getConnectorId()
-                + "_window_close");
 
-        if (isRealUpdate(uidl)) {
-            if (getState().modal != getWidget().vaadinModality) {
-                getWidget().setVaadinModality(!getWidget().vaadinModality);
-            }
-            if (!getWidget().isAttached()) {
-                getWidget().setVisible(false); // hide until
-                // possible centering
-                getWidget().show();
-            }
-            if (getState().resizable != getWidget().resizable) {
-                getWidget().setResizable(getState().resizable);
-            }
-            getWidget().resizeLazy = getState().resizeLazy;
+        VWindow window = getWidget();
+        String connectorId = getConnectorId();
 
-            getWidget().setDraggable(getState().draggable);
+        window.id = getConnectorId();
+        window.client = client;
 
-            // Caption must be set before required header size is measured. If
-            // the caption attribute is missing the caption should be cleared.
-            String iconURL = null;
-            if (getIcon() != null) {
-                iconURL = getIcon();
-            }
-            getWidget().setCaption(getState().caption, iconURL);
-        }
+        // Workaround needed for Testing Tools (GWT generates window DOM
+        // slightly different in different browsers).
+        window.closeBox.setId(connectorId + "_window_close");
+        window.maximizeRestoreBox
+                .setId(connectorId + "_window_maximizerestore");
 
-        getWidget().visibilityChangesDisabled = true;
+        window.visibilityChangesDisabled = true;
         if (!isRealUpdate(uidl)) {
             return;
         }
-        getWidget().visibilityChangesDisabled = false;
-
-        clickEventHandler.handleEventHandlerRegistration();
-
-        getWidget().immediate = getState().immediate;
-
-        getWidget().setClosable(!isReadOnly());
-
-        // Initialize the position form UIDL
-        int positionx = getState().positionX;
-        int positiony = getState().positionY;
-        if (positionx >= 0 || positiony >= 0) {
-            if (positionx < 0) {
-                positionx = 0;
-            }
-            if (positiony < 0) {
-                positiony = 0;
-            }
-            getWidget().setPopupPosition(positionx, positiony);
-        }
-
-        int childIndex = 0;
+        window.visibilityChangesDisabled = false;
 
         // we may have actions
         for (int i = 0; i < uidl.getChildCount(); i++) {
             UIDL childUidl = uidl.getChildUIDL(i);
             if (childUidl.getTag().equals("actions")) {
-                if (getWidget().shortcutHandler == null) {
-                    getWidget().shortcutHandler = new ShortcutActionHandler(
-                            getConnectorId(), client);
+                if (window.shortcutHandler == null) {
+                    window.shortcutHandler = new ShortcutActionHandler(
+                            connectorId, client);
                 }
-                getWidget().shortcutHandler.updateActionMap(childUidl);
+                window.shortcutHandler.updateActionMap(childUidl);
             }
 
         }
 
-        // setting scrollposition must happen after children is rendered
-        getWidget().contentPanel.setScrollPosition(getState().scrollTop);
-        getWidget().contentPanel
-                .setHorizontalScrollPosition(getState().scrollLeft);
-
-        // Center this window on screen if requested
-        // This had to be here because we might not know the content size before
-        // everything is painted into the window
-
-        // centered is this is unset on move/resize
-        getWidget().centered = getState().centered;
-        getWidget().setVisible(true);
-
-        // ensure window is not larger than browser window
-        if (getWidget().getOffsetWidth() > Window.getClientWidth()) {
-            getWidget().setWidth(Window.getClientWidth() + "px");
-        }
-        if (getWidget().getOffsetHeight() > Window.getClientHeight()) {
-            getWidget().setHeight(Window.getClientHeight() + "px");
-        }
-
         if (uidl.hasAttribute("bringToFront")) {
             /*
              * Focus as a side-effect. Will be overridden by
              * ApplicationConnection if another component was focused by the
              * server side.
              */
-            getWidget().contentPanel.focus();
-            getWidget().bringToFrontSequence = uidl
-                    .getIntAttribute("bringToFront");
+            window.contentPanel.focus();
+            window.bringToFrontSequence = uidl.getIntAttribute("bringToFront");
             VWindow.deferOrdering();
         }
     }
@@ -224,26 +197,6 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
         boolean hasContent = (content != null);
         Element contentElement = window.contentPanel.getElement();
 
-        if (!minWidthChecked) {
-            boolean needsMinWidth = !isUndefinedWidth() || !hasContent
-                    || content.isRelativeWidth();
-            int minWidth = window.getMinWidth();
-            if (needsMinWidth && lm.getInnerWidth(contentElement) < minWidth) {
-                minWidthChecked = true;
-                // Use minimum width if less than a certain size
-                window.setWidth(minWidth + "px");
-            }
-            minWidthChecked = true;
-        }
-
-        boolean needsMinHeight = !isUndefinedHeight() || !hasContent
-                || content.isRelativeHeight();
-        int minHeight = window.getMinHeight();
-        if (needsMinHeight && lm.getInnerHeight(contentElement) < minHeight) {
-            // Use minimum height if less than a certain size
-            window.setHeight(minHeight + "px");
-        }
-
         Style contentStyle = window.contents.getStyle();
 
         int headerHeight = lm.getOuterHeight(window.header);
@@ -291,9 +244,9 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
 
     @Override
     public void postLayout() {
-        minWidthChecked = false;
         VWindow window = getWidget();
-        if (window.centered) {
+        if (window.centered
+                && getState().displayState != DisplayState.MAXIMIZED) {
             window.center();
         }
         window.positionOrSizeUpdated();
@@ -304,6 +257,124 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
         return (WindowState) super.getState();
     }
 
+    @Override
+    public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        super.onStateChanged(stateChangeEvent);
+
+        VWindow window = getWidget();
+        WindowState state = getState();
+
+        if (state.modal != window.vaadinModality) {
+            window.setVaadinModality(!window.vaadinModality);
+        }
+        if (!window.isAttached()) {
+            window.setVisible(false); // hide until possible centering
+            window.show();
+        }
+        boolean resizeable = state.resizable
+                && state.displayState == DisplayState.NORMAL;
+        window.setResizable(resizeable);
+
+        window.resizeLazy = state.resizeLazy;
+
+        window.setDraggable(state.draggable
+                && state.displayState == DisplayState.NORMAL);
+
+        window.updateMaximizeRestoreClassName(state.resizable,
+                state.displayState);
+
+        // Caption must be set before required header size is measured. If
+        // the caption attribute is missing the caption should be cleared.
+        String iconURL = null;
+        if (getIcon() != null) {
+            iconURL = getIcon();
+        }
+        window.setCaption(state.caption, iconURL);
+
+        clickEventHandler.handleEventHandlerRegistration();
+
+        window.immediate = state.immediate;
+
+        window.setClosable(!isReadOnly());
+        // initialize position from state
+        updateWindowPosition();
+
+        // setting scrollposition must happen after children is rendered
+        window.contentPanel.setScrollPosition(state.scrollTop);
+        window.contentPanel.setHorizontalScrollPosition(state.scrollLeft);
+
+        // Center this window on screen if requested
+        // This had to be here because we might not know the content size before
+        // everything is painted into the window
+
+        // centered is this is unset on move/resize
+        window.centered = state.centered;
+        window.setVisible(true);
+
+        // ensure window is not larger than browser window
+        if (window.getOffsetWidth() > Window.getClientWidth()) {
+            window.setWidth(Window.getClientWidth() + "px");
+        }
+        if (window.getOffsetHeight() > Window.getClientHeight()) {
+            window.setHeight(Window.getClientHeight() + "px");
+        }
+    }
+
+    // Need to override default because of DisplayState
+    @Override
+    protected void updateComponentSize() {
+        if (getState().displayState == DisplayState.NORMAL) {
+            super.updateComponentSize();
+        } else if (getState().displayState == DisplayState.MAXIMIZED) {
+            super.updateComponentSize("100%", "100%");
+        }
+    }
+
+    protected void updateWindowPosition() {
+        VWindow window = getWidget();
+        WindowState state = getState();
+        if (state.displayState == DisplayState.NORMAL) {
+            // if centered, position handled in postLayout()
+            if (!state.centered) {
+                window.setPopupPosition(state.positionX, state.positionY);
+            }
+        } else if (state.displayState == DisplayState.MAXIMIZED) {
+            window.setPopupPositionNoUpdate(0, 0);
+            window.bringToFront();
+        }
+    }
+
+    protected void updateDisplayState() {
+        VWindow window = getWidget();
+        WindowState state = getState();
+
+        // update draggable on widget
+        window.setDraggable(state.draggable
+                && state.displayState == DisplayState.NORMAL);
+        // update resizable on widget
+        window.setResizable(state.resizable
+                && state.displayState == DisplayState.NORMAL);
+        updateComponentSize();
+        updateWindowPosition();
+        window.updateMaximizeRestoreClassName(state.resizable,
+                state.displayState);
+        window.updateContentsSize();
+    }
+
+    protected void onMaximizeRestore() {
+        WindowState state = getState();
+        if (state.resizable) {
+            if (state.displayState == DisplayState.MAXIMIZED) {
+                state.displayState = DisplayState.NORMAL;
+            } else {
+                state.displayState = DisplayState.MAXIMIZED;
+            }
+            updateDisplayState();
+            getRpcProxy(WindowServerRpc.class).windowDisplayStateChanged(
+                    state.displayState);
+        }
+    }
+
     /**
      * Gives the WindowConnector an order number. As a side effect, moves the
      * window according to its order number so the windows are stacked. This
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index d8b33e6b25..0c1509663a 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -37,6 +37,8 @@ import com.vaadin.server.PaintTarget;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.window.WindowServerRpc;
 import com.vaadin.shared.ui.window.WindowState;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
+import com.vaadin.util.ReflectTools;
 
 /**
  * A component that represents a floating popup window that can be added to a
@@ -71,6 +73,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         public void click(MouseEventDetails mouseDetails) {
             fireEvent(new ClickEvent(Window.this, mouseDetails));
         }
+
+        @Override
+        public void windowDisplayStateChanged(DisplayState newState) {
+            setDisplayState(newState);
+        }
     };
 
     /**
@@ -234,10 +241,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Gets the distance of Window left border in pixels from left border of the
-     * containing (main window).
+     * containing (main window) when the window is in
+     * {@link DisplayState#NORMAL}.
      * 
      * @return the Distance of Window left border in pixels from left border of
-     *         the containing (main window). or -1 if unspecified.
+     *         the containing (main window).or -1 if unspecified
      * @since 4.0.0
      */
     public int getPositionX() {
@@ -246,7 +254,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Sets the distance of Window left border in pixels from left border of the
-     * containing (main window).
+     * containing (main window). Has effect only if in
+     * {@link DisplayState#NORMAL} mode.
      * 
      * @param positionX
      *            the Distance of Window left border in pixels from left border
@@ -260,10 +269,11 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Gets the distance of Window top border in pixels from top border of the
-     * containing (main window).
+     * containing (main window) when the window is in
+     * {@link DisplayState#NORMAL} state, or when next set to that state.
      * 
      * @return Distance of Window top border in pixels from top border of the
-     *         containing (main window). or -1 if unspecified .
+     *         containing (main window). or -1 if unspecified
      * 
      * @since 4.0.0
      */
@@ -273,7 +283,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Sets the distance of Window top border in pixels from top border of the
-     * containing (main window).
+     * containing (main window). Has effect only if in
+     * {@link DisplayState#NORMAL} mode.
      * 
      * @param positionY
      *            the Distance of Window top border in pixels from top border of
@@ -401,6 +412,104 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         fireEvent(new Window.CloseEvent(this));
     }
 
+    /**
+     * Event which is fired when the display state of the Window changes.
+     * 
+     * @author Vaadin Ltd
+     * @since 7.1
+     * 
+     */
+    public static class DisplayStateChangeEvent extends Component.Event {
+
+        private final DisplayState displayState;
+
+        /**
+         * 
+         * @param source
+         */
+        public DisplayStateChangeEvent(Component source,
+                DisplayState displayState) {
+            super(source);
+            this.displayState = displayState;
+        }
+
+        /**
+         * Gets the Window.
+         * 
+         * @return the window
+         */
+        public Window getWindow() {
+            return (Window) getSource();
+        }
+
+        /**
+         * Gets the new DisplayState.
+         * 
+         * @return the displayState
+         */
+        public DisplayState getDisplayState() {
+            return displayState;
+        }
+    }
+
+    /**
+     * An interface used for listening to Window maximize / restore events. Add
+     * the DisplayStateChangeListener to a window and
+     * {@link DisplayStateChangeListener#displayStateChanged(DisplayStateChangeEvent)}
+     * will be called whenever the window is maximized (
+     * {@link DisplayState#MAXIMIZED}) or restored ({@link DisplayState#NORMAL}
+     * ).
+     */
+    public interface DisplayStateChangeListener extends Serializable {
+
+        public static final Method displayStateChangeMethod = ReflectTools
+                .findMethod(DisplayStateChangeListener.class,
+                        "displayStateChanged", DisplayStateChangeEvent.class);
+
+        /**
+         * Called when the user maximizes / restores a window. Use
+         * {@link DisplayStateChangeEvent#getWindow()} to get a reference to the
+         * {@link Window} that was maximized / restored. Use
+         * {@link DisplayStateChangeEvent#getDisplayState()} to get a reference
+         * to the new state.
+         * 
+         * @param event
+         */
+        public void displayStateChanged(DisplayStateChangeEvent event);
+    }
+
+    /**
+     * Adds a DisplayStateChangeListener to the window.
+     * 
+     * The DisplayStateChangeEvent is fired when the user changed the display
+     * state by clicking the maximize/restore button or by double clicking on
+     * the window header. The event is also fired if the state is changed using
+     * {@link #setDisplayState(DisplayState)}.
+     * 
+     * @param listener
+     *            the DisplayStateChangeListener to add.
+     */
+    public void addDisplayStateChangeListener(DisplayStateChangeListener listener) {
+        addListener(DisplayStateChangeEvent.class, listener,
+                DisplayStateChangeListener.displayStateChangeMethod);
+    }
+
+    /**
+     * Removes the DisplayStateChangeListener from the window.
+     * 
+     * @param listener
+     *            the DisplayStateChangeListener to remove.
+     */
+    public void removeDisplayStateChangeListener(DisplayStateChangeListener listener) {
+        removeListener(DisplayStateChangeEvent.class, listener,
+                DisplayStateChangeListener.displayStateChangeMethod);
+    }
+
+    protected void fireWindowDisplayStateChange() {
+        fireEvent(new Window.DisplayStateChangeEvent(this,
+                getState().displayState));
+    }
+
     /**
      * Method for the resize event.
      */
@@ -670,6 +779,27 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         getState().draggable = draggable;
     }
 
+    /**
+     * Gets the current DisplayState of the window.
+     * 
+     * @return displayState the current DisplayState.
+     */
+    public DisplayState getDisplayState() {
+        return getState(false).displayState;
+    }
+
+    /**
+     * Sets the DisplayState for the window.
+     * 
+     * @param displayState
+     */
+    public void setDisplayState(DisplayState displayState) {
+        if (displayState != getDisplayState()) {
+            getState().displayState = displayState;
+            fireWindowDisplayStateChange();
+        }
+    }
+
     /*
      * Actions
      */
@@ -873,4 +1003,9 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
     protected WindowState getState() {
         return (WindowState) super.getState();
     }
+
+    @Override
+    protected WindowState getState(boolean markAsDirty) {
+        return (WindowState) super.getState(markAsDirty);
+    }
 }
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
index c42f91c006..0128adca40 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
@@ -15,8 +15,14 @@
  */
 package com.vaadin.shared.ui.window;
 
+import com.vaadin.shared.annotations.Delayed;
 import com.vaadin.shared.communication.ServerRpc;
 import com.vaadin.shared.ui.ClickRpc;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
 
 public interface WindowServerRpc extends ClickRpc, ServerRpc {
+
+    @Delayed(lastOnly = true)
+    public void windowDisplayStateChanged(DisplayState newState);
+
 }
\ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java
index 4afc20f2b1..eb6f1c758a 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowState.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java
@@ -21,6 +21,11 @@ public class WindowState extends PanelState {
     {
         primaryStyleName = "v-window";
     }
+
+    public enum DisplayState {
+        NORMAL, MAXIMIZED;
+    }
+
     public boolean modal = false;
     public boolean resizable = true;
     public boolean resizeLazy = false;
@@ -28,4 +33,5 @@ public class WindowState extends PanelState {
     public boolean centered = false;;
     public int positionX = -1;
     public int positionY = -1;
+    public DisplayState displayState = DisplayState.NORMAL;
 }
\ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
new file mode 100644
index 0000000000..090579d81d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -0,0 +1,228 @@
+<?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/run/" />
+<title>WindowMaximizeRestoreTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">WindowMaximizeRestoreTest</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.window.WindowMaximizeRestoreTest?restartApplication</td>
+	<td></td>
+</tr>
+<!--Test maximize-restore button-->
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>Window 1</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>7,8</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-restorebox</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<!--test double click on header-->
+<tr>
+	<td>doubleClickAt</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-restorebox</td>
+</tr>
+<tr>
+	<td>doubleClickAt</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<!--Resizable = false should hide max-restore button-->
+<tr>
+	<td>assertVisible</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>8,3</td>
+</tr>
+<tr>
+	<td>assertNotVisible</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td></td>
+</tr>
+<!--Test server side max-restore-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+	<td>34,6</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-restorebox</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+	<td>34,6</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<!--test double click on header doesn't work-->
+<tr>
+	<td>doubleClickAt</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<tr>
+	<td>doubleClickAt</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>v-window-maximizebox</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>8,3</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[4]/VNativeButton[0]</td>
+	<td>26,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--test two windows with screen shot-->
+<tr>
+	<td>screenCapture</td>
+	<td>window-2-original-pos-window-1-centered</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>10,8</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-1-maximized-on-top-of-window-2</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+	<td>43,12</td>
+</tr>
+<!--maximize window 2 content-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[3]/VNativeButton[0]</td>
+	<td>100,9</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-2-original-pos-window-1-centered</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>6,11</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-2-maximized-on-top-of-window-1</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[2]</td>
+	<td>7,5</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-2-closed-window-1-centered</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VFilterSelect[0]/domChild[1]</td>
+	<td>1,17</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='VAADIN_COMBOBOX_OPTIONLIST']/div/div[2]/table/tbody/tr[2]/td</td>
+	<td>122,6</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-2-added-maximized-on-top-of-window-1</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[1]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>6,11</td>
+</tr>
+<tr>
+	<td>doubleClickAt</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>113,10</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td>window-1-maximized-with-doubleclick</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
new file mode 100644
index 0000000000..fe45b036a1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
@@ -0,0 +1,165 @@
+package com.vaadin.tests.components.window;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.window.WindowState.DisplayState;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.ComboBox;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.NativeButton;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+import com.vaadin.ui.Window.CloseEvent;
+import com.vaadin.ui.Window.CloseListener;
+import com.vaadin.ui.Window.DisplayStateChangeEvent;
+import com.vaadin.ui.Window.DisplayStateChangeListener;
+
+public class WindowMaximizeRestoreTest extends AbstractTestUI {
+    Button.ClickListener addListener = new Button.ClickListener() {
+
+        @Override
+        public void buttonClick(ClickEvent event) {
+            addWindow(createNewWindow());
+        }
+    };
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        Button addButton = new Button("Add new Window");
+        addButton.addListener(addListener);
+        addComponent(addButton);
+
+        addWindowAgain = new ComboBox("Add Window Again");
+        addWindowAgain.setBuffered(false);
+        addWindowAgain.setImmediate(true);
+        addWindowAgain.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                Object value = event.getProperty().getValue();
+                if (value != null && value instanceof Window) {
+                    UI.getCurrent().addWindow((Window) value);
+                    addWindowAgain.removeItem(value);
+                }
+            }
+        });
+        addComponent(addWindowAgain);
+
+        addWindow(createNewWindow());
+    }
+
+    private int windowCount = 0;
+    private ComboBox addWindowAgain;
+
+    private Window createNewWindow() {
+        final Window w = new Window("Window " + (++windowCount));
+        final VerticalLayout content = new VerticalLayout();
+        w.setContent(content);
+        w.setData(windowCount);
+        w.setWidth("200px");
+        w.setHeight("300px");
+        w.setPositionX(200);
+        w.setPositionY(200);
+        final NativeButton maximize = new NativeButton("Maximize");
+        Button.ClickListener listener = new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                if (w.getDisplayState() == DisplayState.MAXIMIZED) {
+                    w.setDisplayState(DisplayState.NORMAL);
+                    maximize.setCaption("Maximize");
+                } else {
+                    w.setDisplayState(DisplayState.MAXIMIZED);
+                    maximize.setCaption("Restore");
+                }
+            }
+
+        };
+        maximize.addClickListener(listener);
+        ((ComponentContainer) w.getContent()).addComponent(maximize);
+
+        w.addDisplayStateChangeListener(new DisplayStateChangeListener() {
+
+            @Override
+            public void displayStateChanged(DisplayStateChangeEvent event) {
+                DisplayState state = (event.getWindow().getDisplayState());
+                if (state == DisplayState.NORMAL) {
+                    w.setCaption("Window " + w.getData() + " Normal");
+                    maximize.setCaption("Maximize");
+                } else if (state == DisplayState.MAXIMIZED) {
+                    w.setCaption("Window " + w.getData() + " Maximized");
+                    maximize.setCaption("Restore");
+                }
+            }
+        });
+        final CheckBox resizeable = new CheckBox("Resizeable");
+        resizeable.setValue(w.isResizable());
+        resizeable.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                w.setResizable(resizeable.getValue());
+            }
+        });
+        ((ComponentContainer) w.getContent()).addComponent(resizeable);
+        final CheckBox closeable = new CheckBox("Closeable");
+        closeable.setValue(w.isClosable());
+        closeable.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                w.setClosable(closeable.getValue());
+            }
+        });
+        ((ComponentContainer) w.getContent()).addComponent(closeable);
+        NativeButton contentFull = new NativeButton("Set Content Size Full",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        w.getContent().setSizeFull();
+                    }
+                });
+        contentFull.setWidth("100%");
+        ((ComponentContainer) w.getContent()).addComponent(contentFull);
+
+        NativeButton center = new NativeButton("Center");
+        center.addClickListener(new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                w.center();
+            }
+        });
+        ((ComponentContainer) w.getContent()).addComponent(center);
+
+        w.addCloseListener(new CloseListener() {
+
+            @Override
+            public void windowClose(CloseEvent e) {
+                Item item = addWindowAgain.addItem(w);
+                addWindowAgain.setItemCaption(w, "Window "
+                        + w.getData().toString());
+            }
+        });
+
+        return w;
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 3400;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests the default maximize & restore funtionality. Max. makes window 100%*100% and pos(0, 0), and restore returns it to the values that are set in windows state.";
+    }
+}
-- 
cgit v1.2.3


From f980667fdfef13bcb3bfcd7e86910bed39f39bb2 Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Thu, 21 Mar 2013 10:40:45 +0200
Subject: WAI-ARIA functions for Tree (#11389)

All to navigate the tree with an assisitve device

Change-Id: I531cefc95d7a720caf69aca579549e5a497ad586
---
 client/src/com/vaadin/client/ui/VContextMenu.java  |   2 +
 client/src/com/vaadin/client/ui/VTree.java         |  63 ++++++++++-
 .../com/vaadin/client/ui/tree/TreeConnector.java   |   7 +-
 server/src/com/vaadin/ui/Tree.java                 |  51 +++++++++
 .../com/vaadin/shared/ui/tree/TreeConstants.java   |   2 +
 .../vaadin/tests/components/tree/SimpleTree.java   | 122 +++++++++++++++++++++
 6 files changed, 242 insertions(+), 5 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/tree/SimpleTree.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VContextMenu.java b/client/src/com/vaadin/client/ui/VContextMenu.java
index 80751652df..e601c8027a 100644
--- a/client/src/com/vaadin/client/ui/VContextMenu.java
+++ b/client/src/com/vaadin/client/ui/VContextMenu.java
@@ -37,6 +37,7 @@ import com.google.gwt.event.dom.client.LoadEvent;
 import com.google.gwt.event.dom.client.LoadHandler;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.MenuBar;
@@ -75,6 +76,7 @@ public class VContextMenu extends VOverlay implements SubPartAware {
         super(true, false, true);
         setWidget(menu);
         setStyleName("v-contextmenu");
+        getElement().setId(DOM.createUniqueId());
     }
 
     protected void imagesLoaded() {
diff --git a/client/src/com/vaadin/client/ui/VTree.java b/client/src/com/vaadin/client/ui/VTree.java
index 624dce4f13..20b3050a5d 100644
--- a/client/src/com/vaadin/client/ui/VTree.java
+++ b/client/src/com/vaadin/client/ui/VTree.java
@@ -24,6 +24,10 @@ import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
+import com.google.gwt.aria.client.ExpandedValue;
+import com.google.gwt.aria.client.Id;
+import com.google.gwt.aria.client.Roles;
+import com.google.gwt.aria.client.SelectedValue;
 import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.Scheduler;
 import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -75,7 +79,8 @@ import com.vaadin.shared.ui.tree.TreeConstants;
  */
 public class VTree extends FocusElementPanel implements VHasDropHandler,
         FocusHandler, BlurHandler, KeyPressHandler, KeyDownHandler,
-        SubPartAware, ActionOwner {
+        SubPartAware, ActionOwner, HandlesAriaCaption {
+    private String lastNodeKey = "";
 
     public static final String CLASSNAME = "v-tree";
 
@@ -168,6 +173,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
     public VTree() {
         super();
         setStyleName(CLASSNAME);
+
+        Roles.getTreeRole().set(body.getElement());
         add(body);
 
         addFocusHandler(this);
@@ -865,12 +872,22 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
         }
 
         protected void constructDom() {
+            String labelId = DOM.createUniqueId();
+
             addStyleName(CLASSNAME);
+            getElement().setId(DOM.createUniqueId());
+            Roles.getTreeitemRole().set(getElement());
+            Roles.getTreeitemRole().setAriaSelectedState(getElement(),
+                    SelectedValue.FALSE);
+            Roles.getTreeitemRole().setAriaLabelledbyProperty(getElement(),
+                    Id.of(labelId));
 
             nodeCaptionDiv = DOM.createDiv();
             DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME
                     + "-caption");
             Element wrapper = DOM.createDiv();
+            wrapper.setId(labelId);
+
             nodeCaptionSpan = DOM.createSpan();
             DOM.appendChild(getElement(), nodeCaptionDiv);
             DOM.appendChild(nodeCaptionDiv, wrapper);
@@ -886,6 +903,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
 
             childNodeContainer = new FlowPanel();
             childNodeContainer.setStyleName(CLASSNAME + "-children");
+            Roles.getGroupRole().set(childNodeContainer.getElement());
             setWidget(childNodeContainer);
         }
 
@@ -914,10 +932,13 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
                             new String[] { key }, true);
                 }
                 addStyleName(CLASSNAME + "-expanded");
+                Roles.getTreeitemRole().setAriaExpandedState(getElement(),
+                        ExpandedValue.TRUE);
                 childNodeContainer.setVisible(true);
-
             } else {
                 removeStyleName(CLASSNAME + "-expanded");
+                Roles.getTreeitemRole().setAriaExpandedState(getElement(),
+                        ExpandedValue.FALSE);
                 childNodeContainer.setVisible(false);
                 if (notifyServer) {
                     client.updateVariable(paintableId, "collapse",
@@ -1094,15 +1115,17 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
             Util.scrollIntoViewVertically(nodeCaptionDiv);
         }
 
-        public void setIcon(String iconUrl) {
+        public void setIcon(String iconUrl, String altText) {
             if (iconUrl != null) {
                 // Add icon if not present
                 if (icon == null) {
                     icon = new Icon(client);
+                    Roles.getImgRole().set(icon.getElement());
                     DOM.insertBefore(DOM.getFirstChild(nodeCaptionDiv),
                             icon.getElement(), nodeCaptionSpan);
                 }
                 icon.setUri(iconUrl);
+                icon.getElement().setAttribute("alt", altText);
             } else {
                 // Remove icon if present
                 if (icon != null) {
@@ -1517,10 +1540,34 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
         // Unfocus previously focused node
         if (focusedNode != null) {
             focusedNode.setFocused(false);
+
+            Roles.getTreeRole().removeAriaActivedescendantProperty(
+                    focusedNode.getElement());
         }
 
         if (node != null) {
             node.setFocused(true);
+            Roles.getTreeitemRole().setAriaSelectedState(node.getElement(),
+                    SelectedValue.TRUE);
+
+            /*
+             * FIXME: This code needs to be changed when the keyboard navigation
+             * doesn't immediately trigger a selection change anymore.
+             * 
+             * Right now this function is called before and after the Tree is
+             * rebuilt when up/down arrow keys are pressed. This leads to the
+             * problem, that the newly selected item is announced too often with
+             * a screen reader.
+             * 
+             * Behaviour is different when using the Tree with and without
+             * screen reader.
+             */
+            if (node.key.equals(lastNodeKey)) {
+                Roles.getTreeRole().setAriaActivedescendantProperty(
+                        getFocusElement(), Id.of(node.getElement()));
+            } else {
+                lastNodeKey = node.key;
+            }
         }
 
         focusedNode = node;
@@ -2161,4 +2208,14 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
         keyToNode.clear();
     }
 
+    @Override
+    public void bindAriaCaption(Element captionElement) {
+        AriaHelper.bindCaption(body, captionElement);
+    }
+
+    @Override
+    public void clearAriaCaption() {
+        AriaHelper.clearCaption(body);
+    }
+
 }
diff --git a/client/src/com/vaadin/client/ui/tree/TreeConnector.java b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
index 6e3fffb47c..d8ad7d6634 100644
--- a/client/src/com/vaadin/client/ui/tree/TreeConnector.java
+++ b/client/src/com/vaadin/client/ui/tree/TreeConnector.java
@@ -262,8 +262,11 @@ public class TreeConnector extends AbstractComponentConnector implements
             getWidget().selectedIds.add(nodeKey);
         }
 
-        treeNode.setIcon(uidl
-                .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_ICON));
+        String iconUrl = uidl
+                .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_ICON);
+        String iconAltText = uidl
+                .getStringAttribute(TreeConstants.ATTRIBUTE_NODE_ICON_ALT);
+        treeNode.setIcon(iconUrl, iconAltText);
     }
 
     void renderChildNodes(TreeNode containerNode, Iterator<UIDL> i, int level) {
diff --git a/server/src/com/vaadin/ui/Tree.java b/server/src/com/vaadin/ui/Tree.java
index 34cfbaf61b..700195cd4b 100644
--- a/server/src/com/vaadin/ui/Tree.java
+++ b/server/src/com/vaadin/ui/Tree.java
@@ -72,6 +72,11 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
 
     /* Private members */
 
+    /**
+     * Item icons alt texts.
+     */
+    private final HashMap<Object, String> itemIconAlts = new HashMap<Object, String>();
+
     /**
      * Set of expanded nodes.
      */
@@ -163,6 +168,50 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
         super(caption, dataSource);
     }
 
+    @Override
+    public void setItemIcon(Object itemId, Resource icon) {
+        setItemIcon(itemId, icon, "");
+    }
+
+    /**
+     * Sets the icon for an item.
+     * 
+     * @param itemId
+     *            the id of the item to be assigned an icon.
+     * @param icon
+     *            the icon to use or null.
+     * 
+     * @param altText
+     *            String with the alternative text for the icon
+     */
+    public void setItemIcon(Object itemId, Resource icon, String altText) {
+        if (itemId != null) {
+            super.setItemIcon(itemId, icon);
+
+            if (icon == null) {
+                itemIconAlts.remove(itemId);
+            } else if (altText == null) {
+                throw new IllegalArgumentException(
+                        "Parameter 'altText' needs to be non null");
+            } else {
+                itemIconAlts.put(itemId, altText);
+            }
+            markAsDirty();
+        }
+    }
+
+    /**
+     * Return the alternate text of an icon in a tree item.
+     * 
+     * @param itemId
+     *            Object with the ID of the item
+     * @return String with the alternate text of the icon, or null when no icon
+     *         was set
+     */
+    public String getItemIconAlternateText(Object itemId) {
+        return itemIconAlts.get(itemId);
+    }
+
     /* Expanding and collapsing */
 
     /**
@@ -638,6 +687,8 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
                 if (icon != null) {
                     target.addAttribute(TreeConstants.ATTRIBUTE_NODE_ICON,
                             getItemIcon(itemId));
+                    target.addAttribute(TreeConstants.ATTRIBUTE_NODE_ICON_ALT,
+                            getItemIconAlternateText(itemId));
                 }
                 final String key = itemIdMapper.key(itemId);
                 target.addAttribute("key", key);
diff --git a/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java b/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java
index 7adc69511d..a57ca31246 100644
--- a/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java
+++ b/shared/src/com/vaadin/shared/ui/tree/TreeConstants.java
@@ -26,6 +26,8 @@ public class TreeConstants implements Serializable {
     public static final String ATTRIBUTE_NODE_CAPTION = "caption";
     @Deprecated
     public static final String ATTRIBUTE_NODE_ICON = "icon";
+    @Deprecated
+    public static final String ATTRIBUTE_NODE_ICON_ALT = "iconalt";
 
     @Deprecated
     public static final String ATTRIBUTE_ACTION_CAPTION = "caption";
diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java
new file mode 100644
index 0000000000..2fd3f05dbb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.java
@@ -0,0 +1,122 @@
+package com.vaadin.tests.components.tree;
+
+import java.util.Date;
+
+import com.vaadin.data.Item;
+import com.vaadin.data.util.HierarchicalContainer;
+import com.vaadin.event.Action;
+import com.vaadin.server.ThemeResource;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.AbstractSelect;
+import com.vaadin.ui.Tree;
+
+public class SimpleTree extends TestBase implements Action.Handler {
+    private static final String[][] hardware = { //
+            { "Desktops", "Dell OptiPlex GX240", "Dell OptiPlex GX260",
+                    "Dell OptiPlex GX280" },
+            { "Monitors", "Benq T190HD", "Benq T220HD", "Benq T240HD" },
+            { "Laptops", "IBM ThinkPad T40", "IBM ThinkPad T43",
+                    "IBM ThinkPad T60" } };
+
+    ThemeResource notCachedFolderIconLargeOther = new ThemeResource(
+            "../runo/icons/16/ok.png?" + new Date().getTime());
+    ThemeResource notCachedFolderIconLarge = new ThemeResource(
+            "../runo/icons/16/folder.png?" + new Date().getTime());
+
+    // Actions for the context menu
+    private static final Action ACTION_ADD = new Action("Add child item");
+    private static final Action ACTION_DELETE = new Action("Delete");
+    private static final Action[] ACTIONS = new Action[] { ACTION_ADD,
+            ACTION_DELETE };
+
+    private Tree tree;
+
+    @Override
+    public void setup() {
+        // Create the Tree,a dd to layout
+        tree = new Tree("Hardware Inventory");
+        addComponent(tree);
+
+        // Contents from a (prefilled example) hierarchical container:
+        tree.setContainerDataSource(getHardwareContainer());
+
+        // Add actions (context menu)
+        tree.addActionHandler(this);
+
+        // Cause valueChange immediately when the user selects
+        tree.setImmediate(true);
+
+        // Set tree to show the 'name' property as caption for items
+        tree.setItemCaptionPropertyId("name");
+        tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
+
+        tree.setItemIcon(9, notCachedFolderIconLargeOther, "First Choice");
+        tree.setItemIcon(11, notCachedFolderIconLarge);
+
+        // Expand whole tree
+        for (Object id : tree.rootItemIds()) {
+            tree.expandItemsRecursively(id);
+        }
+    }
+
+    public static HierarchicalContainer getHardwareContainer() {
+        Item item = null;
+        int itemId = 0; // Increasing numbering for itemId:s
+
+        // Create new container
+        HierarchicalContainer hwContainer = new HierarchicalContainer();
+        // Create containerproperty for name
+        hwContainer.addContainerProperty("name", String.class, null);
+        // Create containerproperty for icon
+        hwContainer.addContainerProperty("icon", ThemeResource.class,
+                new ThemeResource("../runo/icons/16/document.png"));
+        for (int i = 0; i < hardware.length; i++) {
+            // Add new item
+            item = hwContainer.addItem(itemId);
+            // Add name property for item
+            item.getItemProperty("name").setValue(hardware[i][0]);
+            // Allow children
+            hwContainer.setChildrenAllowed(itemId, true);
+            itemId++;
+            for (int j = 1; j < hardware[i].length; j++) {
+                if (j == 1) {
+                    item.getItemProperty("icon").setValue(
+                            new ThemeResource("../runo/icons/16/folder.png"));
+                }
+
+                // Add child items
+                item = hwContainer.addItem(itemId);
+                item.getItemProperty("name").setValue(hardware[i][j]);
+                hwContainer.setParent(itemId, itemId - j);
+
+                hwContainer.setChildrenAllowed(itemId, false);
+                if (j == 2) {
+                    hwContainer.setChildrenAllowed(itemId, true);
+                }
+
+                itemId++;
+            }
+        }
+        return hwContainer;
+    }
+
+    @Override
+    protected String getDescription() {
+        return "Sample Tree for testing WAI-ARIA functionality";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 0;
+    }
+
+    @Override
+    public Action[] getActions(Object target, Object sender) {
+        return ACTIONS;
+    }
+
+    @Override
+    public void handleAction(Action action, Object sender, Object target) {
+        System.out.println("Action: " + action.getCaption());
+    }
+}
\ No newline at end of file
-- 
cgit v1.2.3


From c926a09f54cd08856c8cd7a15fd00cf0b62b63b5 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Fri, 5 Apr 2013 16:53:19 +0300
Subject: Global code reformat

Change-Id: I4b3c74ede518aa2712038d1451974a93cdecabc2
---
 .../themeutils/SASSAddonImportFileCreator.java     |   7 +-
 .../server/widgetsetutils/ClassPathExplorer.java   |   7 +-
 client/src/com/vaadin/client/ComponentLocator.java |   6 +-
 .../client/ConnectorHierarchyChangeEvent.java      |  10 +-
 .../com/vaadin/client/HasComponentsConnector.java  |   1 +
 client/src/com/vaadin/client/Util.java             |   1 -
 .../client/debug/internal/HierarchySection.java    |   1 +
 .../client/debug/internal/NetworkSection.java      |   1 +
 .../JavaScriptManagerConnector.java                |   2 +-
 .../client/ui/AbstractComponentConnector.java      |   2 -
 .../com/vaadin/client/ui/AbstractConnector.java    |   1 +
 .../client/ui/AbstractHasComponentsConnector.java  |   2 +-
 .../src/com/vaadin/client/ui/VAbsoluteLayout.java  |   8 +-
 client/src/com/vaadin/client/ui/VCalendar.java     |   2 +
 .../src/com/vaadin/client/ui/VColorPickerArea.java |   1 +
 .../src/com/vaadin/client/ui/VOptionGroupBase.java |   2 +
 client/src/com/vaadin/client/ui/VScrollTable.java  |   8 +-
 .../ui/absolutelayout/AbsoluteLayoutConnector.java |   3 +-
 .../client/ui/calendar/CalendarConnector.java      |  18 +++-
 .../client/ui/calendar/schedule/DateCell.java      |  46 ++++----
 .../ui/calendar/schedule/DateCellContainer.java    |   9 +-
 .../ui/calendar/schedule/DateCellDayEvent.java     | 116 +++++++++------------
 .../client/ui/calendar/schedule/DateCellGroup.java |   1 -
 .../client/ui/calendar/schedule/DayToolbar.java    |   2 +
 .../calendar/schedule/FocusableComplexPanel.java   |   5 +
 .../client/ui/calendar/schedule/FocusableGrid.java |   5 +
 .../client/ui/calendar/schedule/FocusableHTML.java |   5 +
 .../client/ui/calendar/schedule/MonthGrid.java     |   1 +
 .../client/ui/calendar/schedule/SimpleDayCell.java |   5 +
 .../ui/calendar/schedule/SimpleWeekToolbar.java    |   1 +
 .../client/ui/calendar/schedule/WeekGrid.java      |   1 +
 .../calendar/schedule/WeekGridMinuteTimeRange.java |  11 +-
 .../ui/calendar/schedule/WeeklyLongEvents.java     |   3 +-
 .../calendar/schedule/dd/CalendarDropHandler.java  |   1 +
 .../schedule/dd/CalendarMonthDropHandler.java      |   1 +
 .../schedule/dd/CalendarWeekDropHandler.java       |   1 +
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |   4 +-
 .../src/com/vaadin/data/fieldgroup/FieldGroup.java |   3 +-
 .../src/com/vaadin/server/BrowserWindowOpener.java |   3 +-
 .../communication/AbstractStreamingEvent.java      |   1 -
 .../communication/ConnectorHierarchyWriter.java    |   2 +-
 .../communication/PortletListenerNotifier.java     |   2 +-
 .../server/communication/ResourceWriter.java       |   2 +-
 .../communication/StreamingEndEventImpl.java       |   1 -
 .../communication/StreamingErrorEventImpl.java     |   1 -
 .../communication/StreamingProgressEventImpl.java  |   1 -
 .../communication/StreamingStartEventImpl.java     |   1 -
 server/src/com/vaadin/ui/AbstractColorPicker.java  |   1 +
 .../src/com/vaadin/ui/AbstractOrderedLayout.java   |   1 +
 server/src/com/vaadin/ui/Calendar.java             |  27 ++++-
 server/src/com/vaadin/ui/GridLayout.java           |   1 +
 server/src/com/vaadin/ui/Window.java               |   6 +-
 .../calendar/ContainerEventProvider.java           |  11 ++
 .../ui/components/calendar/event/BasicEvent.java   |  14 +++
 .../calendar/event/BasicEventProvider.java         |   6 ++
 .../calendar/handler/BasicBackwardHandler.java     |   1 +
 .../calendar/handler/BasicDateClickHandler.java    |   1 +
 .../calendar/handler/BasicEventMoveHandler.java    |   1 +
 .../calendar/handler/BasicEventResizeHandler.java  |   1 +
 .../calendar/handler/BasicForwardHandler.java      |   1 +
 .../calendar/handler/BasicWeekClickHandler.java    |   1 +
 .../ui/components/colorpicker/ColorPickerGrid.java |   2 +
 .../components/colorpicker/ColorPickerHistory.java |   2 +
 .../components/colorpicker/ColorPickerPopup.java   |   8 ++
 .../vaadin/data/util/AbstractContainerTest.java    |   1 -
 .../data/util/ReflectToolsGetSuperField.java       |  11 +-
 .../data/validator/TestStringLengthValidator.java  |   2 +-
 .../abstractfield/RemoveListenersOnDetach.java     |   3 +-
 .../fieldgroup/CaseInsensitiveBinding.java         |   3 +-
 .../tests/server/component/tree/TreeTest.java      |   3 +-
 .../util/ReflectToolsGetFieldValueByType.java      |   4 +-
 .../util/ReflectToolsGetPrimitiveFieldValue.java   |   4 +-
 .../src/com/vaadin/sass/SassCompiler.java          |   5 +-
 .../scss/AbstractDirectoryScanningSassTests.java   |   2 +-
 .../vaadin/launcher/DevelopmentServerLauncher.java |   3 +-
 .../button/ButtonWithShortcutNotRendered.java      |   2 +
 .../calendar/BeanItemContainerTestUI.java          |   3 +
 .../components/calendar/CalendarActionsUI.java     |   3 +
 .../tests/components/calendar/CalendarTest.java    |  19 +++-
 .../components/calendar/NotificationTestUI.java    |   3 +
 .../checkbox/CheckBoxRevertValueChange.java        |   2 +
 .../combobox/ComboBoxDuplicateCaption.java         |   1 +
 .../ComboBoxSQLContainerFilteredValueChange.java   |   5 +-
 .../VerticalRelativeSizeWithoutExpand.java         |   1 +
 .../richtextarea/RichTextAreaEmptyString.java      |   1 +
 .../RichTextAreaPreventsTextFieldAccess.java       |   4 +
 .../components/select/OptionGroupBaseSelects.java  |   2 +
 .../components/table/EmptyRowsWhenScrolling.java   |   3 +
 .../components/table/LargeSelectionCausesNPE.java  |   3 +
 .../table/TableColumnWidthsAndExpandRatios.java    |   9 +-
 .../table/TableInSubWindowMemoryLeak.java          |   4 +
 .../components/table/TableRowScrolledBottom.java   |   1 -
 .../TableWithBrokenGeneratorAndContainer.java      |   3 +
 .../table/ValueAfterClearingContainer.java         |   9 ++
 .../components/table/ViewPortCalculation.java      |   2 +
 .../tabsheet/ExtraScrollbarsInTabSheet.java        |   1 +
 .../tabsheet/HiddenTabSheetBrowserResize.java      |   1 +
 .../tests/components/textarea/ScrollCursor.java    |   5 +
 .../TextFieldMaxLengthRemovedFromDOM.java          |   1 +
 .../treetable/TreeTableCacheOnPartialUpdates.java  |   2 +
 .../treetable/TreeTableExtraScrollbar.java         |   3 +
 .../TreeTableExtraScrollbarWithChildren.java       |   3 +
 .../treetable/TreeTableInternalError.java          |   3 +
 .../tests/components/uitest/BackButtonTest.java    |   3 +
 .../components/upload/TestFileUploadSize.java      |   4 +
 .../components/window/LegacyWindowOpenTest.java    |   6 ++
 .../tests/components/window/PageOpenTest.java      |   6 ++
 .../TableQueryWithNonUniqueFirstPrimaryKey.java    |   1 +
 .../tests/minitutorials/v70/SimpleLoginUI.java     |  10 +-
 .../tests/minitutorials/v70/SimpleLoginView.java   |   8 +-
 .../v71beta/CSSInjectWithColorpicker.java          |  54 +++++-----
 .../minitutorials/v7a1/AutoGeneratingForm.java     |   2 +-
 .../tests/minitutorials/v7b6/OpeningUIInPopup.java |   7 +-
 .../vaadin/tests/minitutorials/v7b9/CountView.java |   1 +
 .../vaadin/tests/minitutorials/v7b9/LoginView.java |   1 +
 .../vaadin/tests/minitutorials/v7b9/MainView.java  |   1 +
 .../minitutorials/v7b9/MainViewEarlierExample.java |   1 +
 .../tests/minitutorials/v7b9/SettingsView.java     |   5 +
 118 files changed, 436 insertions(+), 217 deletions(-)

(limited to 'uitest/src')

diff --git a/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java b/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
index 1fa259c06b..98ce639d16 100644
--- a/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
+++ b/client-compiler/src/com/vaadin/server/themeutils/SASSAddonImportFileCreator.java
@@ -43,7 +43,6 @@ public class SASSAddonImportFileCreator {
 
     private static final String ADDON_IMPORTS_FILE_TEXT = "This file is managed by the Eclipse plug-in and "
             + "will be overwritten from time to time. Do not manually edit this file.";
-    
 
     /**
      * 
@@ -78,7 +77,8 @@ public class SASSAddonImportFileCreator {
             addonImports.createNewFile();
         }
 
-        LocationInfo info = ClassPathExplorer.getAvailableWidgetSetsAndStylesheets();
+        LocationInfo info = ClassPathExplorer
+                .getAvailableWidgetSetsAndStylesheets();
 
         try {
             PrintStream printStream = new PrintStream(new FileOutputStream(
@@ -113,8 +113,7 @@ public class SASSAddonImportFileCreator {
             // Convention is to name the mixing after the stylesheet. Strip
             // .scss from filename
             String mixin = file.substring(file.lastIndexOf("/") + 1,
-                    file.length()
-                    - ".scss".length());
+                    file.length() - ".scss".length());
 
             stream.print("@include " + mixin + ";");
         }
diff --git a/client-compiler/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java b/client-compiler/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
index 018e19049b..5bc5c0d0ab 100644
--- a/client-compiler/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
+++ b/client-compiler/src/com/vaadin/server/widgetsetutils/ClassPathExplorer.java
@@ -84,7 +84,7 @@ public class ClassPathExplorer {
 
         public LocationInfo(Map<String, URL> widgetsets, Map<String, URL> themes) {
             this.widgetsets = widgetsets;
-            this.addonStyles = themes;
+            addonStyles = themes;
         }
 
         public Map<String, URL> getWidgetsets() {
@@ -186,8 +186,9 @@ public class ClassPathExplorer {
      *            separators) to a URL (see {@link #classpathLocations}) - new
      *            entries are added to this map
      */
-    private static void searchForWidgetSetsAndAddonStyles(String locationString,
-            Map<String, URL> widgetsets, Map<String, URL> addonStyles) {
+    private static void searchForWidgetSetsAndAddonStyles(
+            String locationString, Map<String, URL> widgetsets,
+            Map<String, URL> addonStyles) {
 
         URL location = classpathLocations.get(locationString);
         File directory = new File(location.getFile());
diff --git a/client/src/com/vaadin/client/ComponentLocator.java b/client/src/com/vaadin/client/ComponentLocator.java
index 543877448a..551f7bafcb 100644
--- a/client/src/com/vaadin/client/ComponentLocator.java
+++ b/client/src/com/vaadin/client/ComponentLocator.java
@@ -566,8 +566,7 @@ public class ComponentLocator {
                 // ChildComponentContainer and VOrderedLayout$Slot have been
                 // replaced with Slot
                 if (w instanceof VAbstractOrderedLayout
-                        && ("ChildComponentContainer"
-                                .equals(widgetClassName) || "VOrderedLayout$Slot"
+                        && ("ChildComponentContainer".equals(widgetClassName) || "VOrderedLayout$Slot"
                                 .equals(widgetClassName))) {
                     widgetClassName = "Slot";
                 }
@@ -592,8 +591,7 @@ public class ComponentLocator {
                  * ChildComponentContainer)
                  */
                 if ((w instanceof VGridLayout)
-                        && "ChildComponentContainer"
-                                .equals(widgetClassName)
+                        && "ChildComponentContainer".equals(widgetClassName)
                         && i + 1 < parts.length) {
 
                     HasWidgets layout = (HasWidgets) w;
diff --git a/client/src/com/vaadin/client/ConnectorHierarchyChangeEvent.java b/client/src/com/vaadin/client/ConnectorHierarchyChangeEvent.java
index 56ae7c44ac..2896386933 100644
--- a/client/src/com/vaadin/client/ConnectorHierarchyChangeEvent.java
+++ b/client/src/com/vaadin/client/ConnectorHierarchyChangeEvent.java
@@ -67,19 +67,17 @@ public class ConnectorHierarchyChangeEvent extends
     }
 
     /**
-     * Returns the {@link HasComponentsConnector} for which this event
-     * occurred.
+     * Returns the {@link HasComponentsConnector} for which this event occurred.
      * 
-     * @return The {@link HasComponentsConnector} whose child collection
-     *         has changed. Never returns null.
+     * @return The {@link HasComponentsConnector} whose child collection has
+     *         changed. Never returns null.
      */
     public HasComponentsConnector getParent() {
         return parent;
     }
 
     /**
-     * Sets the {@link HasComponentsConnector} for which this event
-     * occurred.
+     * Sets the {@link HasComponentsConnector} for which this event occurred.
      * 
      * @param The
      *            {@link HasComponentsConnector} whose child collection has
diff --git a/client/src/com/vaadin/client/HasComponentsConnector.java b/client/src/com/vaadin/client/HasComponentsConnector.java
index 0a1a7be97b..ebc6dbcd2a 100644
--- a/client/src/com/vaadin/client/HasComponentsConnector.java
+++ b/client/src/com/vaadin/client/HasComponentsConnector.java
@@ -21,6 +21,7 @@ import java.util.List;
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.user.client.ui.HasWidgets;
 import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler;
+import com.vaadin.ui.HasComponents;
 
 /**
  * An interface used by client-side connectors whose widget is a component
diff --git a/client/src/com/vaadin/client/Util.java b/client/src/com/vaadin/client/Util.java
index 049a689cb6..9810156bcc 100644
--- a/client/src/com/vaadin/client/Util.java
+++ b/client/src/com/vaadin/client/Util.java
@@ -1347,5 +1347,4 @@ public class Util {
         }
     }
 
-
 }
diff --git a/client/src/com/vaadin/client/debug/internal/HierarchySection.java b/client/src/com/vaadin/client/debug/internal/HierarchySection.java
index 3c2b7251f3..776ba9326d 100644
--- a/client/src/com/vaadin/client/debug/internal/HierarchySection.java
+++ b/client/src/com/vaadin/client/debug/internal/HierarchySection.java
@@ -246,6 +246,7 @@ class HierarchySection implements Section {
         }
     }
 
+    @Override
     public void meta(ApplicationConnection ac, ValueMap meta) {
         content.clear();
         JsArray<ValueMap> valueMapArray = meta
diff --git a/client/src/com/vaadin/client/debug/internal/NetworkSection.java b/client/src/com/vaadin/client/debug/internal/NetworkSection.java
index ff6466651b..ebdeff810f 100644
--- a/client/src/com/vaadin/client/debug/internal/NetworkSection.java
+++ b/client/src/com/vaadin/client/debug/internal/NetworkSection.java
@@ -77,6 +77,7 @@ public class NetworkSection implements Section {
         // NOP
     }
 
+    @Override
     public void uidl(ApplicationConnection ac, ValueMap uidl) {
         int sinceStart = VDebugWindow.getMillisSinceStart();
         int sinceReset = VDebugWindow.getMillisSinceReset();
diff --git a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
index ce79b4c64c..8e6ad25407 100644
--- a/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
+++ b/client/src/com/vaadin/client/extensions/javascriptmanager/JavaScriptManagerConnector.java
@@ -23,8 +23,8 @@ import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.core.client.JsArray;
 import com.google.gwt.json.client.JSONArray;
 import com.vaadin.client.ServerConnector;
-import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.communication.JavaScriptMethodInvocation;
+import com.vaadin.client.communication.StateChangeEvent;
 import com.vaadin.client.extensions.AbstractExtensionConnector;
 import com.vaadin.shared.extension.javascriptmanager.ExecuteJavaScriptRpc;
 import com.vaadin.shared.extension.javascriptmanager.JavaScriptManagerState;
diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
index dcb159985c..5475c128c1 100644
--- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java
@@ -36,8 +36,6 @@ import com.vaadin.client.metadata.NoDataException;
 import com.vaadin.client.metadata.Type;
 import com.vaadin.client.metadata.TypeData;
 import com.vaadin.client.metadata.TypeDataStore;
-import com.vaadin.client.ui.AbstractFieldConnector;
-import com.vaadin.client.ui.ManagedLayout;
 import com.vaadin.client.ui.datefield.PopupDateFieldConnector;
 import com.vaadin.client.ui.ui.UIConnector;
 import com.vaadin.shared.AbstractComponentState;
diff --git a/client/src/com/vaadin/client/ui/AbstractConnector.java b/client/src/com/vaadin/client/ui/AbstractConnector.java
index 2c76aa93fe..6855c5cd2d 100644
--- a/client/src/com/vaadin/client/ui/AbstractConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractConnector.java
@@ -439,6 +439,7 @@ public abstract class AbstractConnector implements ServerConnector,
      * 
      * @see com.vaadin.client.ServerConnector#hasEventListener(java.lang.String)
      */
+    @Override
     public boolean hasEventListener(String eventIdentifier) {
         Set<String> reg = getState().registeredEventListeners;
         return (reg != null && reg.contains(eventIdentifier));
diff --git a/client/src/com/vaadin/client/ui/AbstractHasComponentsConnector.java b/client/src/com/vaadin/client/ui/AbstractHasComponentsConnector.java
index 4a6aefd082..d833f076e4 100644
--- a/client/src/com/vaadin/client/ui/AbstractHasComponentsConnector.java
+++ b/client/src/com/vaadin/client/ui/AbstractHasComponentsConnector.java
@@ -20,9 +20,9 @@ import java.util.List;
 
 import com.google.gwt.event.shared.HandlerRegistration;
 import com.vaadin.client.ComponentConnector;
-import com.vaadin.client.HasComponentsConnector;
 import com.vaadin.client.ConnectorHierarchyChangeEvent;
 import com.vaadin.client.ConnectorHierarchyChangeEvent.ConnectorHierarchyChangeHandler;
+import com.vaadin.client.HasComponentsConnector;
 
 public abstract class AbstractHasComponentsConnector extends
         AbstractComponentConnector implements HasComponentsConnector,
diff --git a/client/src/com/vaadin/client/ui/VAbsoluteLayout.java b/client/src/com/vaadin/client/ui/VAbsoluteLayout.java
index ee5d1f039a..dc080bcf7d 100644
--- a/client/src/com/vaadin/client/ui/VAbsoluteLayout.java
+++ b/client/src/com/vaadin/client/ui/VAbsoluteLayout.java
@@ -322,7 +322,7 @@ public class VAbsoluteLayout extends ComplexPanel {
             }
         }
     }
-    
+
     /**
      * Cleanup old wrappers which have been left empty by other inner layouts
      * moving the widget from the wrapper into their own hierarchy. This usually
@@ -330,7 +330,7 @@ public class VAbsoluteLayout extends ComplexPanel {
      * automatically detaches the widget from the parent, in this case the
      * wrapper, and re-attaches it somewhere else. This has to be done in the
      * layout phase since the order of the hierarchy events are not defined.
-     */           
+     */
     public void cleanupWrappers() {
         for (Widget widget : getChildren()) {
             if (widget instanceof AbsoluteWrapper) {
@@ -339,9 +339,9 @@ public class VAbsoluteLayout extends ComplexPanel {
                     wrapper.destroy();
                     super.remove(wrapper);
                     continue;
-                }             
+                }
             }
-        }        
+        }
     }
 
     /**
diff --git a/client/src/com/vaadin/client/ui/VCalendar.java b/client/src/com/vaadin/client/ui/VCalendar.java
index e66a2d7552..c5c12f2d72 100644
--- a/client/src/com/vaadin/client/ui/VCalendar.java
+++ b/client/src/com/vaadin/client/ui/VCalendar.java
@@ -590,6 +590,7 @@ public class VCalendar extends Composite {
             cell.setMonthGrid(monthGrid);
             cell.setDate(d);
             cell.addDomHandler(new ContextMenuHandler() {
+                @Override
                 public void onContextMenu(ContextMenuEvent event) {
                     if (mouseEventListener != null) {
                         event.preventDefault();
@@ -827,6 +828,7 @@ public class VCalendar extends Composite {
     public static Comparator<CalendarEvent> getEventComparator() {
         return new Comparator<CalendarEvent>() {
 
+            @Override
             public int compare(CalendarEvent o1, CalendarEvent o2) {
                 if (o1.isAllDay() != o2.isAllDay()) {
                     if (o2.isAllDay()) {
diff --git a/client/src/com/vaadin/client/ui/VColorPickerArea.java b/client/src/com/vaadin/client/ui/VColorPickerArea.java
index bdae65438f..81f2c8fcc7 100644
--- a/client/src/com/vaadin/client/ui/VColorPickerArea.java
+++ b/client/src/com/vaadin/client/ui/VColorPickerArea.java
@@ -67,6 +67,7 @@ public class VColorPickerArea extends Widget implements ClickHandler, HasHTML,
      * @param handler
      * @return HandlerRegistration used to remove the handler
      */
+    @Override
     public HandlerRegistration addClickHandler(ClickHandler handler) {
         return addDomHandler(handler, ClickEvent.getType());
     }
diff --git a/client/src/com/vaadin/client/ui/VOptionGroupBase.java b/client/src/com/vaadin/client/ui/VOptionGroupBase.java
index 4d60b2eba8..cc691130ad 100644
--- a/client/src/com/vaadin/client/ui/VOptionGroupBase.java
+++ b/client/src/com/vaadin/client/ui/VOptionGroupBase.java
@@ -118,6 +118,7 @@ public abstract class VOptionGroupBase extends Composite implements Field,
         return multiselect;
     }
 
+    @Override
     public boolean isEnabled() {
         return enabled;
     }
@@ -190,6 +191,7 @@ public abstract class VOptionGroupBase extends Composite implements Field,
         }
     }
 
+    @Override
     public void setEnabled(boolean enabled) {
         if (this.enabled != enabled) {
             this.enabled = enabled;
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index 4d61fba429..d9dd542b15 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -1113,10 +1113,10 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
         if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
             // received 'surprising' firstvisible from server: scroll there
             firstRowInViewPort = firstvisible;
-          
+
             /*
-             * Schedule the scrolling to be executed last so no updates to the rows
-             * affect scrolling measurements.
+             * Schedule the scrolling to be executed last so no updates to the
+             * rows affect scrolling measurements.
              */
             Scheduler.get().scheduleFinally(lazyScroller);
         }
@@ -3056,7 +3056,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
                                 .hasNext(); columnIndex++) {
                             if (it.next() == this) {
                                 break;
-                            }                          
+                            }
                         }
                     }
                     final int cw = scrollBody.getColWidth(columnIndex);
diff --git a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
index cba9cc2fa1..da79639dcd 100644
--- a/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
+++ b/client/src/com/vaadin/client/ui/absolutelayout/AbsoluteLayoutConnector.java
@@ -100,8 +100,7 @@ public class AbsoluteLayoutConnector extends
     /*
      * (non-Javadoc)
      * 
-     * @see
-     * com.vaadin.client.HasComponentsConnector#updateCaption(com.vaadin
+     * @see com.vaadin.client.HasComponentsConnector#updateCaption(com.vaadin
      * .client.ComponentConnector)
      */
     @Override
diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
index 120a65d842..c36521b3ac 100644
--- a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
+++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
@@ -54,8 +54,8 @@ import com.vaadin.client.ui.calendar.schedule.CalendarDay;
 import com.vaadin.client.ui.calendar.schedule.CalendarEvent;
 import com.vaadin.client.ui.calendar.schedule.DateCell;
 import com.vaadin.client.ui.calendar.schedule.DateCell.DateCellSlot;
-import com.vaadin.client.ui.calendar.schedule.DateUtil;
 import com.vaadin.client.ui.calendar.schedule.DateCellDayEvent;
+import com.vaadin.client.ui.calendar.schedule.DateUtil;
 import com.vaadin.client.ui.calendar.schedule.HasTooltipKey;
 import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
 import com.vaadin.client.ui.calendar.schedule.dd.CalendarDropHandler;
@@ -131,6 +131,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
      */
     protected void registerListeners() {
         getWidget().setListener(new DateClickListener() {
+            @Override
             public void dateClick(String date) {
                 if (!getWidget().isDisabledOrReadOnly()
                         && hasEventListener(CalendarEventId.DATECLICK)) {
@@ -139,6 +140,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new ForwardListener() {
+            @Override
             public void forward() {
                 if (hasEventListener(CalendarEventId.FORWARD)) {
                     rpc.forward();
@@ -146,6 +148,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new BackwardListener() {
+            @Override
             public void backward() {
                 if (hasEventListener(CalendarEventId.BACKWARD)) {
                     rpc.backward();
@@ -153,6 +156,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new RangeSelectListener() {
+            @Override
             public void rangeSelected(String value) {
                 if (hasEventListener(CalendarEventId.RANGESELECT)) {
                     rpc.rangeSelect(value);
@@ -160,6 +164,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new WeekClickListener() {
+            @Override
             public void weekClick(String event) {
                 if (!getWidget().isDisabledOrReadOnly()
                         && hasEventListener(CalendarEventId.WEEKCLICK)) {
@@ -168,6 +173,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new EventMovedListener() {
+            @Override
             public void eventMoved(CalendarEvent event) {
                 if (hasEventListener(CalendarEventId.EVENTMOVE)) {
                     StringBuilder sb = new StringBuilder();
@@ -180,6 +186,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new EventResizeListener() {
+            @Override
             public void eventResized(CalendarEvent event) {
                 if (hasEventListener(CalendarEventId.EVENTRESIZE)) {
                     StringBuilder buffer = new StringBuilder();
@@ -205,12 +212,14 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new VCalendar.ScrollListener() {
+            @Override
             public void scroll(int scrollPosition) {
                 // This call is @Delayed (== non-immediate)
                 rpc.scroll(scrollPosition);
             }
         });
         getWidget().setListener(new EventClickListener() {
+            @Override
             public void eventClick(CalendarEvent event) {
                 if (hasEventListener(CalendarEventId.EVENTCLICK)) {
                     rpc.eventClick(event.getIndex());
@@ -218,6 +227,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
             }
         });
         getWidget().setListener(new MouseEventListener() {
+            @Override
             public void contextMenu(ContextMenuEvent event, final Widget widget) {
                 final NativeEvent ne = event.getNativeEvent();
                 int left = ne.getClientX();
@@ -225,14 +235,17 @@ public class CalendarConnector extends AbstractComponentConnector implements
                 top += Window.getScrollTop();
                 left += Window.getScrollLeft();
                 getClient().getContextMenu().showAt(new ActionOwner() {
+                    @Override
                     public String getPaintableId() {
                         return CalendarConnector.this.getPaintableId();
                     }
 
+                    @Override
                     public ApplicationConnection getClient() {
                         return CalendarConnector.this.getClient();
                     }
 
+                    @Override
                     @SuppressWarnings("deprecation")
                     public Action[] getActions() {
                         if (widget instanceof SimpleDayCell) {
@@ -423,6 +436,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
      * @see
      * com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler#getDropHandler()
      */
+    @Override
     public CalendarDropHandler getDropHandler() {
         return dropHandler;
     }
@@ -548,6 +562,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
      * Returns ALL currently registered events. Use {@link #getActions(Date)} to
      * get the actions for a specific date
      */
+    @Override
     public Action[] getActions() {
         List<Action> actions = new ArrayList<Action>();
         for (int i = 0; i < actionKeys.size(); i++) {
@@ -573,6 +588,7 @@ public class CalendarConnector extends AbstractComponentConnector implements
      * 
      * @see com.vaadin.terminal.gwt.client.ui.ActionOwner#getPaintableId()
      */
+    @Override
     public String getPaintableId() {
         return getConnectorId();
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
index 05e2a808fe..516447153e 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCell.java
@@ -122,8 +122,8 @@ public class DateCell extends FocusableComplexPanel implements
         long start = getDate().getTime() + firstHour * 3600000;
         long end = start + slotTime;
         for (int i = 0; i < numberOfSlots; i++) {
-            DateCellSlot slot = new DateCellSlot(this, new Date(
-                    start), new Date(end));
+            DateCellSlot slot = new DateCellSlot(this, new Date(start),
+                    new Date(end));
             if (i % 2 == 0) {
                 slot.setStyleName("v-datecellslot-even");
             } else {
@@ -177,8 +177,7 @@ public class DateCell extends FocusableComplexPanel implements
             }
         }
 
-        throw new IllegalArgumentException(
-                "Element not found in this DateCell");
+        throw new IllegalArgumentException("Element not found in this DateCell");
     }
 
     public DateCellSlot getSlot(int index) {
@@ -271,8 +270,7 @@ public class DateCell extends FocusableComplexPanel implements
     private void recalculateEventPositions() {
         for (int i = 0; i < getWidgetCount(); i++) {
             DateCellDayEvent dayEvent = (DateCellDayEvent) getWidget(i);
-            updatePositionFor(dayEvent, getDate(),
-                    dayEvent.getCalendarEvent());
+            updatePositionFor(dayEvent, getDate(), dayEvent.getCalendarEvent());
         }
     }
 
@@ -325,8 +323,8 @@ public class DateCell extends FocusableComplexPanel implements
         startingSlotHeight = height / numberOfSlots;
 
         for (int i = 0; i < slotElements.length; i++) {
-            slotElements[i].getStyle().setHeight(slotElementHeights[i],
-                    Unit.PX);
+            slotElements[i].getStyle()
+                    .setHeight(slotElementHeights[i], Unit.PX);
         }
 
         Iterator<Widget> it = iterator();
@@ -412,8 +410,8 @@ public class DateCell extends FocusableComplexPanel implements
 
             DateCellDayEvent d = (DateCellDayEvent) getWidget(eventIndex);
             WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d
-                    .getCalendarEvent().getStartTime(), d
-                    .getCalendarEvent().getEndTime());
+                    .getCalendarEvent().getStartTime(), d.getCalendarEvent()
+                    .getEndTime());
 
             if (WeekGridMinuteTimeRange.doesOverlap(dateRange, nextRange)) {
                 skipIndex = col;
@@ -459,9 +457,9 @@ public class DateCell extends FocusableComplexPanel implements
 
         int count = getWidgetCount();
         DateCellDayEvent target = (DateCellDayEvent) getWidget(targetIndex);
-        WeekGridMinuteTimeRange targetRange = new WeekGridMinuteTimeRange(target
-                .getCalendarEvent().getStartTime(), target
-                .getCalendarEvent().getEndTime());
+        WeekGridMinuteTimeRange targetRange = new WeekGridMinuteTimeRange(
+                target.getCalendarEvent().getStartTime(), target
+                        .getCalendarEvent().getEndTime());
         Date groupStart = targetRange.getStart();
         Date groupEnd = targetRange.getEnd();
 
@@ -472,8 +470,8 @@ public class DateCell extends FocusableComplexPanel implements
 
             DateCellDayEvent d = (DateCellDayEvent) getWidget(i);
             WeekGridMinuteTimeRange nextRange = new WeekGridMinuteTimeRange(d
-                    .getCalendarEvent().getStartTime(), d
-                    .getCalendarEvent().getEndTime());
+                    .getCalendarEvent().getStartTime(), d.getCalendarEvent()
+                    .getEndTime());
             if (WeekGridMinuteTimeRange.doesOverlap(targetRange, nextRange)) {
                 g.add(i);
 
@@ -497,7 +495,8 @@ public class DateCell extends FocusableComplexPanel implements
 
     public void addEvent(Date targetDay, CalendarEvent calendarEvent) {
         Element main = getElement();
-        DateCellDayEvent dayEvent = new DateCellDayEvent(this, weekgrid, calendarEvent);
+        DateCellDayEvent dayEvent = new DateCellDayEvent(this, weekgrid,
+                calendarEvent);
         dayEvent.setSlotHeightInPX(getSlotHeight());
         dayEvent.setDisabled(isDisabled());
 
@@ -562,8 +561,8 @@ public class DateCell extends FocusableComplexPanel implements
             }
             index++;
         }
-        this.insert(dayEvent, (com.google.gwt.user.client.Element) main,
-                index, true);
+        this.insert(dayEvent, (com.google.gwt.user.client.Element) main, index,
+                true);
     }
 
     public void removeEvent(DateCellDayEvent dayEvent) {
@@ -584,10 +583,10 @@ public class DateCell extends FocusableComplexPanel implements
         int eventStartHours = eventStart.getHours();
         int eventEndHours = eventEnd.getHours();
 
-        return (eventStartHours <= lastHour)
-                && (eventEndHours >= firstHour);
+        return (eventStartHours <= lastHour) && (eventEndHours >= firstHour);
     }
 
+    @Override
     public void onKeyDown(KeyDownEvent event) {
         int keycode = event.getNativeEvent().getKeyCode();
         if (keycode == KeyCodes.KEY_ESCAPE && eventRangeStart > -1) {
@@ -595,6 +594,7 @@ public class DateCell extends FocusableComplexPanel implements
         }
     }
 
+    @Override
     public void onMouseDown(MouseDownEvent event) {
         if (event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
             Element e = Element.as(event.getNativeEvent().getEventTarget());
@@ -610,6 +610,7 @@ public class DateCell extends FocusableComplexPanel implements
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void onMouseUp(MouseUpEvent event) {
         if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
@@ -676,6 +677,7 @@ public class DateCell extends FocusableComplexPanel implements
         }
     }
 
+    @Override
     public void onMouseMove(MouseMoveEvent event) {
         if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
             return;
@@ -782,8 +784,7 @@ public class DateCell extends FocusableComplexPanel implements
         return today != null;
     }
 
-    public void addEmphasisStyle(
-            com.google.gwt.user.client.Element elementOver) {
+    public void addEmphasisStyle(com.google.gwt.user.client.Element elementOver) {
         String originalStylename = getStyleName(elementOver);
         setStyleName(elementOver, originalStylename + DRAGEMPHASISSTYLE);
     }
@@ -797,6 +798,7 @@ public class DateCell extends FocusableComplexPanel implements
                         - DRAGEMPHASISSTYLE.length()));
     }
 
+    @Override
     public void onContextMenu(ContextMenuEvent event) {
         if (weekgrid.getCalendar().getMouseEventListener() != null) {
             event.preventDefault();
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
index f1b45c83c5..04e6bb7df6 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellContainer.java
@@ -31,8 +31,8 @@ import com.vaadin.client.ui.VCalendar;
  * 
  * since 7.1
  */
-public class DateCellContainer extends FlowPanel implements
-        MouseDownHandler, MouseUpHandler {
+public class DateCellContainer extends FlowPanel implements MouseDownHandler,
+        MouseUpHandler {
 
     private Date date;
 
@@ -67,7 +67,8 @@ public class DateCellContainer extends FlowPanel implements
 
     public boolean hasEvent(int slotIndex) {
         return hasDateCell(slotIndex)
-                && ((WeeklyLongEventsDateCell) getChildren().get(slotIndex)).getEvent() != null;
+                && ((WeeklyLongEventsDateCell) getChildren().get(slotIndex))
+                        .getEvent() != null;
     }
 
     public boolean hasDateCell(int slotIndex) {
@@ -94,12 +95,14 @@ public class DateCellContainer extends FlowPanel implements
         add(dateCell);
     }
 
+    @Override
     public void onMouseDown(MouseDownEvent event) {
         clickTargetWidget = (Widget) event.getSource();
 
         event.stopPropagation();
     }
 
+    @Override
     public void onMouseUp(MouseUpEvent event) {
         if (event.getSource() == clickTargetWidget
                 && clickTargetWidget instanceof WeeklyLongEventsDateCell
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
index 039a00e25a..c56566bf25 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellDayEvent.java
@@ -51,8 +51,8 @@ import com.vaadin.shared.ui.calendar.DateConstants;
  * @since 7.1
  */
 public class DateCellDayEvent extends FocusableHTML implements
-        MouseDownHandler, MouseUpHandler, MouseMoveHandler,
-        KeyDownHandler, ContextMenuHandler, HasTooltipKey {
+        MouseDownHandler, MouseUpHandler, MouseMoveHandler, KeyDownHandler,
+        ContextMenuHandler, HasTooltipKey {
 
     private final DateCell dateCell;
     private Element caption = null;
@@ -79,7 +79,8 @@ public class DateCellDayEvent extends FocusableHTML implements
     private final List<HandlerRegistration> handlers;
     private boolean mouseMoveCanceled;
 
-    public DateCellDayEvent(DateCell dateCell, WeekGrid parent, CalendarEvent event) {
+    public DateCellDayEvent(DateCell dateCell, WeekGrid parent,
+            CalendarEvent event) {
         super();
         this.dateCell = dateCell;
 
@@ -110,8 +111,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             bottomResizeBar = DOM.createDiv();
 
             topResizeBar.addClassName("v-calendar-event-resizetop");
-            bottomResizeBar
-                    .addClassName("v-calendar-event-resizebottom");
+            bottomResizeBar.addClassName("v-calendar-event-resizebottom");
 
             getElement().appendChild(topResizeBar);
             getElement().appendChild(bottomResizeBar);
@@ -142,8 +142,7 @@ public class DateCellDayEvent extends FocusableHTML implements
         this.slotHeight = slotHeight;
     }
 
-    public void updatePosition(long startFromMinutes,
-            long durationInMinutes) {
+    public void updatePosition(long startFromMinutes, long durationInMinutes) {
         if (startFromMinutes < 0) {
             startFromMinutes = 0;
         }
@@ -183,8 +182,7 @@ public class DateCellDayEvent extends FocusableHTML implements
 
     /**
      * @param bigMode
-     *            If false, event is so small that caption must be in
-     *            time-row
+     *            If false, event is so small that caption must be in time-row
      */
     private void updateCaptions(boolean bigMode) {
         String separator = bigMode ? "<br />" : ": ";
@@ -194,6 +192,7 @@ public class DateCellDayEvent extends FocusableHTML implements
         eventContent.setInnerHTML("");
     }
 
+    @Override
     public void onKeyDown(KeyDownEvent event) {
         int keycode = event.getNativeEvent().getKeyCode();
         if (keycode == KeyCodes.KEY_ESCAPE && mouseMoveStarted) {
@@ -201,38 +200,31 @@ public class DateCellDayEvent extends FocusableHTML implements
         }
     }
 
+    @Override
     public void onMouseDown(MouseDownEvent event) {
         startX = event.getClientX();
         startY = event.getClientY();
-        if (isDisabled()
-                || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
+        if (isDisabled() || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
             return;
         }
 
-        clickTarget = Element.as(event.getNativeEvent()
-                .getEventTarget());
+        clickTarget = Element.as(event.getNativeEvent().getEventTarget());
         mouseMoveCanceled = false;
 
-        if (weekGrid.getCalendar().isEventMoveAllowed()
-                || clickTargetsResize()) {
+        if (weekGrid.getCalendar().isEventMoveAllowed() || clickTargetsResize()) {
             moveRegistration = addMouseMoveHandler(this);
             setFocus(true);
             try {
-                startYrelative = (int) ((double) event
-                        .getRelativeY(caption) % slotHeight);
-                startXrelative = (event.getRelativeX(weekGrid
-                        .getElement()) - weekGrid.timebar
-                        .getOffsetWidth())
-                        % getDateCellWidth();
+                startYrelative = (int) ((double) event.getRelativeY(caption) % slotHeight);
+                startXrelative = (event.getRelativeX(weekGrid.getElement()) - weekGrid.timebar
+                        .getOffsetWidth()) % getDateCellWidth();
             } catch (Exception e) {
-                GWT.log("Exception calculating relative start position",
-                        e);
+                GWT.log("Exception calculating relative start position", e);
             }
             mouseMoveStarted = false;
             Style s = getElement().getStyle();
             s.setZIndex(1000);
-            startDatetimeFrom = (Date) calendarEvent.getStartTime()
-                    .clone();
+            startDatetimeFrom = (Date) calendarEvent.getStartTime().clone();
             startDatetimeTo = (Date) calendarEvent.getEndTime().clone();
             Event.setCapture(getElement());
         }
@@ -243,13 +235,14 @@ public class DateCellDayEvent extends FocusableHTML implements
         }
 
         /*
-         * We need to stop the event propagation or else the WeekGrid
-         * range select will kick in
+         * We need to stop the event propagation or else the WeekGrid range
+         * select will kick in
          */
         event.stopPropagation();
         event.preventDefault();
     }
 
+    @Override
     public void onMouseUp(MouseUpEvent event) {
         if (mouseMoveCanceled) {
             return;
@@ -274,8 +267,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             // check if mouse has moved over threshold of 3 pixels
             boolean mouseMoved = (xDiff < -3 || xDiff > 3 || yDiff < -3 || yDiff > 3);
 
-            if (!weekGrid.getCalendar().isDisabledOrReadOnly()
-                    && mouseMoved) {
+            if (!weekGrid.getCalendar().isDisabledOrReadOnly() && mouseMoved) {
                 // Event Move:
                 // - calendar must be enabled
                 // - calendar must not be in read-only mode
@@ -283,8 +275,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             } else if (!weekGrid.getCalendar().isDisabled()) {
                 // Event Click:
                 // - calendar must be enabled (read-only is allowed)
-                EventTarget et = event.getNativeEvent()
-                        .getEventTarget();
+                EventTarget et = event.getNativeEvent().getEventTarget();
                 Element e = Element.as(et);
                 if (e == caption || e == eventContent
                         || e.getParentElement() == caption) {
@@ -304,6 +295,7 @@ public class DateCellDayEvent extends FocusableHTML implements
         }
     }
 
+    @Override
     @SuppressWarnings("deprecation")
     public void onMouseMove(MouseMoveEvent event) {
         if (startY < 0 && startX < 0) {
@@ -330,8 +322,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             mouseMoveStarted = true;
         }
 
-        HorizontalPanel parent = (HorizontalPanel) getParent()
-                .getParent();
+        HorizontalPanel parent = (HorizontalPanel) getParent().getParent();
         int relativeX = event.getRelativeX(parent.getElement())
                 - weekGrid.timebar.getOffsetWidth();
         int halfHourDiff = 0;
@@ -362,10 +353,9 @@ public class DateCellDayEvent extends FocusableHTML implements
         int dayOffsetPx = calculateDateCellOffsetPx(dayOffset)
                 + weekGrid.timebar.getOffsetWidth();
 
-        GWT.log("DateCellWidth: " + dateCellWidth + " dayDiff: "
-                + dayDiff + " dayOffset: " + dayOffset
-                + " dayOffsetPx: " + dayOffsetPx + " startXrelative: "
-                + startXrelative + " moveX: " + moveX);
+        GWT.log("DateCellWidth: " + dateCellWidth + " dayDiff: " + dayDiff
+                + " dayOffset: " + dayOffset + " dayOffsetPx: " + dayOffsetPx
+                + " startXrelative: " + startXrelative + " moveX: " + moveX);
 
         if (relativeX < 0 || relativeX >= getDatesWidth()) {
             return;
@@ -391,11 +381,10 @@ public class DateCellDayEvent extends FocusableHTML implements
             calendarEvent.setEnd(new Date(to.getTime()));
 
             // Set new position for the event
-            long startFromMinutes = (from.getHours() * 60)
-                    + from.getMinutes();
+            long startFromMinutes = (from.getHours() * 60) + from.getMinutes();
             long range = calendarEvent.getRangeInMinutes();
-            startFromMinutes = calculateStartFromMinute(
-                    startFromMinutes, from, to, dayOffsetPx);
+            startFromMinutes = calculateStartFromMinute(startFromMinutes, from,
+                    to, dayOffsetPx);
             if (startFromMinutes < 0) {
                 range += startFromMinutes;
             }
@@ -404,8 +393,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             s.setLeft(dayOffsetPx, Unit.PX);
 
             if (weekGrid.getDateCellWidths() != null) {
-                s.setWidth(weekGrid.getDateCellWidths()[dayOffset],
-                        Unit.PX);
+                s.setWidth(weekGrid.getDateCellWidths()[dayOffset], Unit.PX);
             } else {
                 setWidth(moveWidth);
             }
@@ -415,10 +403,8 @@ public class DateCellDayEvent extends FocusableHTML implements
             long newStartTime = oldStartTime
                     + ((long) halfHourInMilliSeconds * halfHourDiff);
 
-            if (!isTimeRangeTooSmall(newStartTime,
-                    startDatetimeTo.getTime())) {
-                newStartTime = startDatetimeTo.getTime()
-                        - getMinTimeRange();
+            if (!isTimeRangeTooSmall(newStartTime, startDatetimeTo.getTime())) {
+                newStartTime = startDatetimeTo.getTime() - getMinTimeRange();
             }
 
             from.setTime(newStartTime);
@@ -427,8 +413,7 @@ public class DateCellDayEvent extends FocusableHTML implements
             calendarEvent.setStart(new Date(from.getTime()));
 
             // Set new position for the event
-            long startFromMinutes = (from.getHours() * 60)
-                    + from.getMinutes();
+            long startFromMinutes = (from.getHours() * 60) + from.getMinutes();
             long range = calendarEvent.getRangeInMinutes();
 
             updatePosition(startFromMinutes, range);
@@ -438,10 +423,8 @@ public class DateCellDayEvent extends FocusableHTML implements
             long newEndTime = oldEndTime
                     + ((long) halfHourInMilliSeconds * halfHourDiff);
 
-            if (!isTimeRangeTooSmall(startDatetimeFrom.getTime(),
-                    newEndTime)) {
-                newEndTime = startDatetimeFrom.getTime()
-                        + getMinTimeRange();
+            if (!isTimeRangeTooSmall(startDatetimeFrom.getTime(), newEndTime)) {
+                newEndTime = startDatetimeFrom.getTime() + getMinTimeRange();
             }
 
             to.setTime(newEndTime);
@@ -453,8 +436,8 @@ public class DateCellDayEvent extends FocusableHTML implements
             long startFromMinutes = (startDatetimeFrom.getHours() * 60)
                     + startDatetimeFrom.getMinutes();
             long range = calendarEvent.getRangeInMinutes();
-            startFromMinutes = calculateStartFromMinute(
-                    startFromMinutes, from, to, dayOffsetPx);
+            startFromMinutes = calculateStartFromMinute(startFromMinutes, from,
+                    to, dayOffsetPx);
             if (startFromMinutes < 0) {
                 range += startFromMinutes;
             }
@@ -509,14 +492,12 @@ public class DateCellDayEvent extends FocusableHTML implements
 
     // date methods are not deprecated in GWT
     @SuppressWarnings("deprecation")
-    private long calculateStartFromMinute(long startFromMinutes,
-            Date from, Date to, int dayOffset) {
-        boolean eventStartAtDifferentDay = from.getDate() != to
-                .getDate();
+    private long calculateStartFromMinute(long startFromMinutes, Date from,
+            Date to, int dayOffset) {
+        boolean eventStartAtDifferentDay = from.getDate() != to.getDate();
         if (eventStartAtDifferentDay) {
-            long minutesOnPrevDay = (getTargetDateByCurrentPosition(
-                    dayOffset).getTime() - from.getTime())
-                    / DateConstants.MINUTEINMILLIS;
+            long minutesOnPrevDay = (getTargetDateByCurrentPosition(dayOffset)
+                    .getTime() - from.getTime()) / DateConstants.MINUTEINMILLIS;
             startFromMinutes = -1 * minutesOnPrevDay;
         }
 
@@ -554,8 +535,7 @@ public class DateCellDayEvent extends FocusableHTML implements
     }
 
     /**
-     * @return the minimum amount of ms that an event must last when
-     *         resized
+     * @return the minimum amount of ms that an event must last when resized
      */
     private long getMinTimeRange() {
         return DateConstants.MINUTEINMILLIS * 30;
@@ -573,8 +553,7 @@ public class DateCellDayEvent extends FocusableHTML implements
         buffer.append(",");
         buffer.append(DateUtil.formatClientSideDate(event.getStart()));
         buffer.append("-");
-        buffer.append(DateUtil.formatClientSideTime(event
-                .getStartTime()));
+        buffer.append(DateUtil.formatClientSideTime(event.getStartTime()));
         buffer.append(",");
         buffer.append(DateUtil.formatClientSideDate(event.getEnd()));
         buffer.append("-");
@@ -643,11 +622,12 @@ public class DateCellDayEvent extends FocusableHTML implements
         return disabled;
     }
 
+    @Override
     public void onContextMenu(ContextMenuEvent event) {
-        if (this.dateCell.weekgrid.getCalendar().getMouseEventListener() != null) {
+        if (dateCell.weekgrid.getCalendar().getMouseEventListener() != null) {
             event.preventDefault();
             event.stopPropagation();
-            this.dateCell.weekgrid.getCalendar().getMouseEventListener()
+            dateCell.weekgrid.getCalendar().getMouseEventListener()
                     .contextMenu(event, this);
         }
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
index d2add53389..79276eab7b 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DateCellGroup.java
@@ -19,7 +19,6 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
-
 /**
  * Internally used by the calendar
  * 
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
index bb0155d892..6233e8111e 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java
@@ -109,6 +109,7 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler {
         }
 
         l.addClickHandler(new ClickHandler() {
+            @Override
             public void onClick(ClickEvent event) {
                 if (calendar.getDateClickListener() != null) {
                     calendar.getDateClickListener().dateClick(date);
@@ -133,6 +134,7 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler {
         add(nextLabel);
     }
 
+    @Override
     public void onClick(ClickEvent event) {
         if (!calendar.isDisabledOrReadOnly()) {
             if (event.getSource() == nextLabel) {
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
index 62332385d2..6b42caec10 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableComplexPanel.java
@@ -56,6 +56,7 @@ public class FocusableComplexPanel extends ComplexPanel implements
      * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
      * google.gwt.event.dom.client.FocusHandler)
      */
+    @Override
     public HandlerRegistration addFocusHandler(FocusHandler handler) {
         return addDomHandler(handler, FocusEvent.getType());
     }
@@ -67,6 +68,7 @@ public class FocusableComplexPanel extends ComplexPanel implements
      * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
      * .gwt.event.dom.client.BlurHandler)
      */
+    @Override
     public HandlerRegistration addBlurHandler(BlurHandler handler) {
         return addDomHandler(handler, BlurEvent.getType());
     }
@@ -78,6 +80,7 @@ public class FocusableComplexPanel extends ComplexPanel implements
      * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
      * com.google.gwt.event.dom.client.KeyDownHandler)
      */
+    @Override
     public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
         return addDomHandler(handler, KeyDownEvent.getType());
     }
@@ -89,6 +92,7 @@ public class FocusableComplexPanel extends ComplexPanel implements
      * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
      * (com.google.gwt.event.dom.client.KeyPressHandler)
      */
+    @Override
     public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
         return addDomHandler(handler, KeyPressEvent.getType());
     }
@@ -111,6 +115,7 @@ public class FocusableComplexPanel extends ComplexPanel implements
     /**
      * Focus the panel
      */
+    @Override
     public void focus() {
         setFocus(true);
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
index d3177362bf..b40f1c3652 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableGrid.java
@@ -68,6 +68,7 @@ public class FocusableGrid extends Grid implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
      * google.gwt.event.dom.client.FocusHandler)
      */
+    @Override
     public HandlerRegistration addFocusHandler(FocusHandler handler) {
         return addDomHandler(handler, FocusEvent.getType());
     }
@@ -79,6 +80,7 @@ public class FocusableGrid extends Grid implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
      * .gwt.event.dom.client.BlurHandler)
      */
+    @Override
     public HandlerRegistration addBlurHandler(BlurHandler handler) {
         return addDomHandler(handler, BlurEvent.getType());
     }
@@ -90,6 +92,7 @@ public class FocusableGrid extends Grid implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
      * com.google.gwt.event.dom.client.KeyDownHandler)
      */
+    @Override
     public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
         return addDomHandler(handler, KeyDownEvent.getType());
     }
@@ -101,6 +104,7 @@ public class FocusableGrid extends Grid implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
      * (com.google.gwt.event.dom.client.KeyPressHandler)
      */
+    @Override
     public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
         return addDomHandler(handler, KeyPressEvent.getType());
     }
@@ -123,6 +127,7 @@ public class FocusableGrid extends Grid implements HasFocusHandlers,
     /**
      * Focus the panel
      */
+    @Override
     public void focus() {
         setFocus(true);
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
index c3fe1958f0..31d810608a 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/FocusableHTML.java
@@ -58,6 +58,7 @@ public class FocusableHTML extends HTML implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasFocusHandlers#addFocusHandler(com.
      * google.gwt.event.dom.client.FocusHandler)
      */
+    @Override
     public HandlerRegistration addFocusHandler(FocusHandler handler) {
         return addDomHandler(handler, FocusEvent.getType());
     }
@@ -69,6 +70,7 @@ public class FocusableHTML extends HTML implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasBlurHandlers#addBlurHandler(com.google
      * .gwt.event.dom.client.BlurHandler)
      */
+    @Override
     public HandlerRegistration addBlurHandler(BlurHandler handler) {
         return addDomHandler(handler, BlurEvent.getType());
     }
@@ -80,6 +82,7 @@ public class FocusableHTML extends HTML implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasKeyDownHandlers#addKeyDownHandler(
      * com.google.gwt.event.dom.client.KeyDownHandler)
      */
+    @Override
     public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
         return addDomHandler(handler, KeyDownEvent.getType());
     }
@@ -91,6 +94,7 @@ public class FocusableHTML extends HTML implements HasFocusHandlers,
      * com.google.gwt.event.dom.client.HasKeyPressHandlers#addKeyPressHandler
      * (com.google.gwt.event.dom.client.KeyPressHandler)
      */
+    @Override
     public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
         return addDomHandler(handler, KeyPressEvent.getType());
     }
@@ -113,6 +117,7 @@ public class FocusableHTML extends HTML implements HasFocusHandlers,
     /**
      * Focus the panel
      */
+    @Override
     public void focus() {
         setFocus(true);
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
index f5afd12e42..df9bc42d2a 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/MonthGrid.java
@@ -191,6 +191,7 @@ public class MonthGrid extends FocusableGrid implements KeyDownHandler {
         return enabled;
     }
 
+    @Override
     public void onKeyDown(KeyDownEvent event) {
         int keycode = event.getNativeKeyCode();
         if (KeyCodes.KEY_ESCAPE == keycode && selectionStart != null) {
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
index 8d1ca0fcda..a2bd008d01 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java
@@ -361,6 +361,7 @@ public class SimpleDayCell extends FocusableFlowPanel implements
         super.onDetach();
     }
 
+    @Override
     public void onMouseUp(MouseUpEvent event) {
         if (event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
             return;
@@ -415,6 +416,7 @@ public class SimpleDayCell extends FocusableFlowPanel implements
         clickedWidget = null;
     }
 
+    @Override
     public void onMouseDown(MouseDownEvent event) {
         if (calendar.isDisabled()
                 || event.getNativeButton() != NativeEvent.BUTTON_LEFT) {
@@ -456,11 +458,13 @@ public class SimpleDayCell extends FocusableFlowPanel implements
         event.preventDefault();
     }
 
+    @Override
     public void onMouseOver(MouseOverEvent event) {
         event.preventDefault();
         getMonthGrid().setSelectionEnd(this);
     }
 
+    @Override
     public void onMouseMove(MouseMoveEvent event) {
         if (clickedWidget instanceof MonthEventLabel && !monthEventMouseDown
                 || (startY < 0 && startX < 0)) {
@@ -566,6 +570,7 @@ public class SimpleDayCell extends FocusableFlowPanel implements
         Event.setCapture(getElement());
         keyDownHandler = addKeyDownHandler(new KeyDownHandler() {
 
+            @Override
             public void onKeyDown(KeyDownEvent event) {
                 if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
                     cancelEventDrag(w);
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
index f86ba03053..59902811cd 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleWeekToolbar.java
@@ -98,6 +98,7 @@ public class SimpleWeekToolbar extends FlexTable implements ClickHandler {
         }
     }
 
+    @Override
     public void onClick(ClickEvent event) {
         WeekLabel wl = (WeekLabel) event.getSource();
         if (calendar.getWeekClickListener() != null) {
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
index c5646f97ae..450ea29549 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGrid.java
@@ -83,6 +83,7 @@ public class WeekGrid extends SimplePanel {
             scrollPanel.setWidget(content);
 
             scrollPanel.addScrollHandler(new ScrollHandler() {
+                @Override
                 public void onScroll(ScrollEvent event) {
                     if (calendar.getScrollListener() != null) {
                         calendar.getScrollListener().scroll(
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
index 27ace91c4e..e634735be7 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeekGridMinuteTimeRange.java
@@ -27,16 +27,16 @@ public class WeekGridMinuteTimeRange {
     private final Date end;
 
     /**
-     * Creates a Date time range between start and end date. Drops seconds
-     * from the range.
+     * Creates a Date time range between start and end date. Drops seconds from
+     * the range.
      * 
      * @param start
      *            Start time of the range
      * @param end
      *            End time of the range
      * @param clearSeconds
-     *            Boolean Indicates, if seconds should be dropped from the
-     *            range start and end
+     *            Boolean Indicates, if seconds should be dropped from the range
+     *            start and end
      */
     public WeekGridMinuteTimeRange(Date start, Date end) {
         this.start = new Date(start.getTime());
@@ -53,7 +53,8 @@ public class WeekGridMinuteTimeRange {
         return end;
     }
 
-    public static boolean doesOverlap(WeekGridMinuteTimeRange a, WeekGridMinuteTimeRange b) {
+    public static boolean doesOverlap(WeekGridMinuteTimeRange a,
+            WeekGridMinuteTimeRange b) {
         boolean overlaps = a.getStart().compareTo(b.getEnd()) < 0
                 && a.getEnd().compareTo(b.getStart()) > 0;
         return overlaps;
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
index e3b7d5d7fe..f7c5c0dac4 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/WeeklyLongEvents.java
@@ -78,7 +78,8 @@ public class WeeklyLongEvents extends HorizontalPanel implements HasTooltipKey {
             Date dcDate = dc.getDate();
             int comp = dcDate.compareTo(from);
             int comp2 = dcDate.compareTo(to);
-            WeeklyLongEventsDateCell eventLabel = dc.getDateCell(calendarEvent.getSlotIndex());
+            WeeklyLongEventsDateCell eventLabel = dc.getDateCell(calendarEvent
+                    .getSlotIndex());
             eventLabel.setStylePrimaryName("v-calendar-event");
             if (comp >= 0 && comp2 <= 0) {
                 eventLabel.setEvent(calendarEvent);
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
index 03db4d091e..aab9ca9c38 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
@@ -57,6 +57,7 @@ public abstract class CalendarDropHandler extends VAbstractDropHandler {
      * com.vaadin.terminal.gwt.client.ui.dd.VDropHandler#getApplicationConnection
      * ()
      */
+    @Override
     public ApplicationConnection getApplicationConnection() {
         return calendarConnector.getClient();
     }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
index 6e57fb6fef..913477ee14 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
@@ -81,6 +81,7 @@ public class CalendarMonthDropHandler extends CalendarDropHandler {
     public void dragOver(final VDragEvent drag) {
         if (isLocationValid(drag.getElementOver())) {
             validate(new VAcceptCallback() {
+                @Override
                 public void accepted(VDragEvent event) {
                     dragAccepted(drag);
                 }
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
index fa7aaa428b..0ea683dc3c 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
@@ -80,6 +80,7 @@ public class CalendarWeekDropHandler extends CalendarDropHandler {
     public void dragOver(final VDragEvent drag) {
         if (isLocationValid(drag.getElementOver())) {
             validate(new VAcceptCallback() {
+                @Override
                 public void accepted(VDragEvent event) {
                     dragAccepted(drag);
                 }
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 69296b537c..0843b3069d 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -338,8 +338,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
     }
 
     /**
-     * Reads CSS strings and resources injected by {@link Styles#inject}
-     * from the UIDL stream.
+     * Reads CSS strings and resources injected by {@link Styles#inject} from
+     * the UIDL stream.
      * 
      * @param uidl
      *            The uidl which contains "css-resource" and "css-string" tags
diff --git a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
index 6c515dbdee..981aea387d 100644
--- a/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
+++ b/server/src/com/vaadin/data/fieldgroup/FieldGroup.java
@@ -919,7 +919,8 @@ public class FieldGroup implements Serializable {
             for (Object itemPropertyId : dataSource.getItemPropertyIds()) {
                 if (itemPropertyId instanceof String) {
                     String itemPropertyName = (String) itemPropertyId;
-                    if (minifiedFieldName.equals(minifyFieldName(itemPropertyName))) {
+                    if (minifiedFieldName
+                            .equals(minifyFieldName(itemPropertyName))) {
                         return itemPropertyName;
                     }
                 }
diff --git a/server/src/com/vaadin/server/BrowserWindowOpener.java b/server/src/com/vaadin/server/BrowserWindowOpener.java
index 8e049ca454..a6e420f89c 100644
--- a/server/src/com/vaadin/server/BrowserWindowOpener.java
+++ b/server/src/com/vaadin/server/BrowserWindowOpener.java
@@ -38,7 +38,8 @@ public class BrowserWindowOpener extends AbstractExtension {
         private final String path;
         private final Class<? extends UI> uiClass;
 
-        public BrowserWindowOpenerUIProvider(Class<? extends UI> uiClass, String path) {
+        public BrowserWindowOpenerUIProvider(Class<? extends UI> uiClass,
+                String path) {
             this.path = ensureInitialSlash(path);
             this.uiClass = uiClass;
         }
diff --git a/server/src/com/vaadin/server/communication/AbstractStreamingEvent.java b/server/src/com/vaadin/server/communication/AbstractStreamingEvent.java
index 054bc14f2d..b97a60fd56 100644
--- a/server/src/com/vaadin/server/communication/AbstractStreamingEvent.java
+++ b/server/src/com/vaadin/server/communication/AbstractStreamingEvent.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.server.communication;
 
-import com.vaadin.server.StreamVariable;
 import com.vaadin.server.StreamVariable.StreamingEvent;
 
 /**
diff --git a/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java b/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
index 963886edbb..467bddbdce 100644
--- a/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
+++ b/server/src/com/vaadin/server/communication/ConnectorHierarchyWriter.java
@@ -26,8 +26,8 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import com.vaadin.server.AbstractClientConnector;
-import com.vaadin.server.LegacyCommunicationManager;
 import com.vaadin.server.ClientConnector;
+import com.vaadin.server.LegacyCommunicationManager;
 import com.vaadin.server.PaintException;
 import com.vaadin.ui.UI;
 
diff --git a/server/src/com/vaadin/server/communication/PortletListenerNotifier.java b/server/src/com/vaadin/server/communication/PortletListenerNotifier.java
index c64819ca44..5c03a6f4dc 100644
--- a/server/src/com/vaadin/server/communication/PortletListenerNotifier.java
+++ b/server/src/com/vaadin/server/communication/PortletListenerNotifier.java
@@ -29,8 +29,8 @@ import javax.portlet.RenderResponse;
 import javax.portlet.ResourceRequest;
 import javax.portlet.ResourceResponse;
 
-import com.vaadin.server.SynchronizedRequestHandler;
 import com.vaadin.server.ServletPortletHelper;
+import com.vaadin.server.SynchronizedRequestHandler;
 import com.vaadin.server.VaadinPortletRequest;
 import com.vaadin.server.VaadinPortletResponse;
 import com.vaadin.server.VaadinPortletSession;
diff --git a/server/src/com/vaadin/server/communication/ResourceWriter.java b/server/src/com/vaadin/server/communication/ResourceWriter.java
index 86f8dd3b36..080027943f 100644
--- a/server/src/com/vaadin/server/communication/ResourceWriter.java
+++ b/server/src/com/vaadin/server/communication/ResourceWriter.java
@@ -25,8 +25,8 @@ import java.util.Iterator;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import com.vaadin.server.LegacyCommunicationManager;
 import com.vaadin.server.JsonPaintTarget;
+import com.vaadin.server.LegacyCommunicationManager;
 import com.vaadin.ui.CustomLayout;
 import com.vaadin.ui.UI;
 
diff --git a/server/src/com/vaadin/server/communication/StreamingEndEventImpl.java b/server/src/com/vaadin/server/communication/StreamingEndEventImpl.java
index e241bbbfaf..f8cfb160be 100644
--- a/server/src/com/vaadin/server/communication/StreamingEndEventImpl.java
+++ b/server/src/com/vaadin/server/communication/StreamingEndEventImpl.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.server.communication;
 
-import com.vaadin.server.StreamVariable;
 import com.vaadin.server.StreamVariable.StreamingEndEvent;
 
 @SuppressWarnings("serial")
diff --git a/server/src/com/vaadin/server/communication/StreamingErrorEventImpl.java b/server/src/com/vaadin/server/communication/StreamingErrorEventImpl.java
index 1ee74c68b6..9d9a19e4fe 100644
--- a/server/src/com/vaadin/server/communication/StreamingErrorEventImpl.java
+++ b/server/src/com/vaadin/server/communication/StreamingErrorEventImpl.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.server.communication;
 
-import com.vaadin.server.StreamVariable;
 import com.vaadin.server.StreamVariable.StreamingErrorEvent;
 
 @SuppressWarnings("serial")
diff --git a/server/src/com/vaadin/server/communication/StreamingProgressEventImpl.java b/server/src/com/vaadin/server/communication/StreamingProgressEventImpl.java
index c07e37e196..69f3bfb29c 100644
--- a/server/src/com/vaadin/server/communication/StreamingProgressEventImpl.java
+++ b/server/src/com/vaadin/server/communication/StreamingProgressEventImpl.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.server.communication;
 
-import com.vaadin.server.StreamVariable;
 import com.vaadin.server.StreamVariable.StreamingProgressEvent;
 
 @SuppressWarnings("serial")
diff --git a/server/src/com/vaadin/server/communication/StreamingStartEventImpl.java b/server/src/com/vaadin/server/communication/StreamingStartEventImpl.java
index a7f13be499..bd16f08801 100644
--- a/server/src/com/vaadin/server/communication/StreamingStartEventImpl.java
+++ b/server/src/com/vaadin/server/communication/StreamingStartEventImpl.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.server.communication;
 
-import com.vaadin.server.StreamVariable;
 import com.vaadin.server.StreamVariable.StreamingStartEvent;
 
 @SuppressWarnings("serial")
diff --git a/server/src/com/vaadin/ui/AbstractColorPicker.java b/server/src/com/vaadin/ui/AbstractColorPicker.java
index d7037e366d..c3bdd49155 100644
--- a/server/src/com/vaadin/ui/AbstractColorPicker.java
+++ b/server/src/com/vaadin/ui/AbstractColorPicker.java
@@ -405,6 +405,7 @@ public abstract class AbstractColorPicker extends AbstractComponent implements
                 window.setImmediate(true);
                 window.addCloseListener(this);
                 window.addColorChangeListener(new ColorChangeListener() {
+                    @Override
                     public void colorChanged(ColorChangeEvent event) {
                         AbstractColorPicker.this.colorChanged(event);
                     }
diff --git a/server/src/com/vaadin/ui/AbstractOrderedLayout.java b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
index b06b2e0871..c9eb756daa 100644
--- a/server/src/com/vaadin/ui/AbstractOrderedLayout.java
+++ b/server/src/com/vaadin/ui/AbstractOrderedLayout.java
@@ -439,6 +439,7 @@ public abstract class AbstractOrderedLayout extends AbstractLayout implements
      * com.vaadin.ui.Layout.AlignmentHandler#setDefaultComponentAlignment(com
      * .vaadin.ui.Alignment)
      */
+    @Override
     public void setDefaultComponentAlignment(Alignment defaultAlignment) {
         defaultComponentAlignment = defaultAlignment;
     }
diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java
index 4bf2885a8c..38fa355dd8 100644
--- a/server/src/com/vaadin/ui/Calendar.java
+++ b/server/src/com/vaadin/ui/Calendar.java
@@ -1206,14 +1206,16 @@ public class Calendar extends AbstractComponent implements
 
         // remove old listener
         if (getEventProvider() instanceof EventSetChangeNotifier) {
-            ((EventSetChangeNotifier) getEventProvider()).removeEventSetChangeListener(this);
+            ((EventSetChangeNotifier) getEventProvider())
+                    .removeEventSetChangeListener(this);
         }
 
         this.calendarEventProvider = calendarEventProvider;
 
         // add new listener
         if (calendarEventProvider instanceof EventSetChangeNotifier) {
-            ((EventSetChangeNotifier) calendarEventProvider).addEventSetChangeListener(this);
+            ((EventSetChangeNotifier) calendarEventProvider)
+                    .addEventSetChangeListener(this);
         }
     }
 
@@ -1232,6 +1234,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.addon.calendar.ui.CalendarEvents.EventChangeListener#eventChange
      * (com.vaadin.addon.calendar.ui.CalendarEvents.EventChange)
      */
+    @Override
     public void eventSetChange(EventSetChangeEvent changeEvent) {
         // sanity check
         if (calendarEventProvider == changeEvent.getProvider()) {
@@ -1276,6 +1279,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler)
      */
+    @Override
     public void setHandler(ForwardHandler listener) {
         setHandler(ForwardEvent.EVENT_ID, ForwardEvent.class, listener,
                 ForwardHandler.forwardMethod);
@@ -1289,6 +1293,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.BackwardHandler)
      */
+    @Override
     public void setHandler(BackwardHandler listener) {
         setHandler(BackwardEvent.EVENT_ID, BackwardEvent.class, listener,
                 BackwardHandler.backwardMethod);
@@ -1302,6 +1307,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.DateClickHandler)
      */
+    @Override
     public void setHandler(DateClickHandler listener) {
         setHandler(DateClickEvent.EVENT_ID, DateClickEvent.class, listener,
                 DateClickHandler.dateClickMethod);
@@ -1315,6 +1321,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventClickHandler)
      */
+    @Override
     public void setHandler(EventClickHandler listener) {
         setHandler(EventClick.EVENT_ID, EventClick.class, listener,
                 EventClickHandler.eventClickMethod);
@@ -1328,6 +1335,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.WeekClickHandler)
      */
+    @Override
     public void setHandler(WeekClickHandler listener) {
         setHandler(WeekClick.EVENT_ID, WeekClick.class, listener,
                 WeekClickHandler.weekClickMethod);
@@ -1342,6 +1350,7 @@ public class Calendar extends AbstractComponent implements
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResizeHandler
      * )
      */
+    @Override
     public void setHandler(EventResizeHandler listener) {
         setHandler(EventResize.EVENT_ID, EventResize.class, listener,
                 EventResizeHandler.eventResizeMethod);
@@ -1356,6 +1365,7 @@ public class Calendar extends AbstractComponent implements
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.RangeSelectHandler
      * )
      */
+    @Override
     public void setHandler(RangeSelectHandler listener) {
         setHandler(RangeSelectEvent.EVENT_ID, RangeSelectEvent.class, listener,
                 RangeSelectHandler.rangeSelectMethod);
@@ -1370,6 +1380,7 @@ public class Calendar extends AbstractComponent implements
      * #addListener
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventMoveHandler)
      */
+    @Override
     public void setHandler(EventMoveHandler listener) {
         setHandler(MoveEvent.EVENT_ID, MoveEvent.class, listener,
                 EventMoveHandler.eventMoveMethod);
@@ -1382,6 +1393,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.addon.calendar.ui.CalendarComponentEvents.CalendarEventNotifier
      * #getHandler(java.lang.String)
      */
+    @Override
     public EventListener getHandler(String eventId) {
         return handlers.get(eventId);
     }
@@ -1389,6 +1401,7 @@ public class Calendar extends AbstractComponent implements
     /**
      * Get the currently active drop handler
      */
+    @Override
     public DropHandler getDropHandler() {
         return dropHandler;
     }
@@ -1410,6 +1423,7 @@ public class Calendar extends AbstractComponent implements
      * @see
      * com.vaadin.event.dd.DropTarget#translateDropTargetDetails(java.util.Map)
      */
+    @Override
     public TargetDetails translateDropTargetDetails(
             Map<String, Object> clientVariables) {
         Map<String, Object> serverVariables = new HashMap<String, Object>(1);
@@ -1458,12 +1472,14 @@ public class Calendar extends AbstractComponent implements
     public void setContainerDataSource(Container.Indexed container) {
         ContainerEventProvider provider = new ContainerEventProvider(container);
         provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() {
+            @Override
             public void eventSetChange(EventSetChangeEvent changeEvent) {
                 // Repaint if events change
                 markAsDirty();
             }
         });
         provider.addEventChangeListener(new EventChangeListener() {
+            @Override
             public void eventChange(EventChangeEvent changeEvent) {
                 // Repaint if event changes
                 markAsDirty();
@@ -1506,12 +1522,14 @@ public class Calendar extends AbstractComponent implements
         provider.setEndDateProperty(endDateProperty);
         provider.setStyleNameProperty(styleNameProperty);
         provider.addEventSetChangeListener(new CalendarEventProvider.EventSetChangeListener() {
+            @Override
             public void eventSetChange(EventSetChangeEvent changeEvent) {
                 // Repaint if events change
                 markAsDirty();
             }
         });
         provider.addEventChangeListener(new EventChangeListener() {
+            @Override
             public void eventChange(EventChangeEvent changeEvent) {
                 // Repaint if event changes
                 markAsDirty();
@@ -1527,6 +1545,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
      * util.Date, java.util.Date)
      */
+    @Override
     public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
         return getEventProvider().getEvents(startDate, endDate);
     }
@@ -1538,6 +1557,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void addEvent(CalendarEvent event) {
         if (getEventProvider() instanceof CalendarEditableEventProvider) {
             CalendarEditableEventProvider provider = (CalendarEditableEventProvider) getEventProvider();
@@ -1556,6 +1576,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void removeEvent(CalendarEvent event) {
         if (getEventProvider() instanceof CalendarEditableEventProvider) {
             CalendarEditableEventProvider provider = (CalendarEditableEventProvider) getEventProvider();
@@ -1599,6 +1620,7 @@ public class Calendar extends AbstractComponent implements
      * </ul>
      * </p>
      */
+    @Override
     public void addActionHandler(Handler actionHandler) {
         if (actionHandler != null) {
             if (actionHandlers == null) {
@@ -1635,6 +1657,7 @@ public class Calendar extends AbstractComponent implements
      * com.vaadin.event.Action.Container#removeActionHandler(com.vaadin.event
      * .Action.Handler)
      */
+    @Override
     public void removeActionHandler(Handler actionHandler) {
         if (actionHandlers != null && actionHandlers.contains(actionHandler)) {
             actionHandlers.remove(actionHandler);
diff --git a/server/src/com/vaadin/ui/GridLayout.java b/server/src/com/vaadin/ui/GridLayout.java
index 60664c8937..53a25c1c83 100644
--- a/server/src/com/vaadin/ui/GridLayout.java
+++ b/server/src/com/vaadin/ui/GridLayout.java
@@ -1245,6 +1245,7 @@ public class GridLayout extends AbstractLayout implements
      * com.vaadin.ui.Layout.AlignmentHandler#setDefaultComponentAlignment(com
      * .vaadin.ui.Alignment)
      */
+    @Override
     public void setDefaultComponentAlignment(Alignment defaultAlignment) {
         defaultComponentAlignment = defaultAlignment;
     }
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index 0c1509663a..479992d084 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -489,7 +489,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
      * @param listener
      *            the DisplayStateChangeListener to add.
      */
-    public void addDisplayStateChangeListener(DisplayStateChangeListener listener) {
+    public void addDisplayStateChangeListener(
+            DisplayStateChangeListener listener) {
         addListener(DisplayStateChangeEvent.class, listener,
                 DisplayStateChangeListener.displayStateChangeMethod);
     }
@@ -500,7 +501,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
      * @param listener
      *            the DisplayStateChangeListener to remove.
      */
-    public void removeDisplayStateChangeListener(DisplayStateChangeListener listener) {
+    public void removeDisplayStateChangeListener(
+            DisplayStateChangeListener listener) {
         removeListener(DisplayStateChangeEvent.class, listener,
                 DisplayStateChangeListener.displayStateChangeMethod);
     }
diff --git a/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java b/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
index b01140eb88..37ea255d27 100644
--- a/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
+++ b/server/src/com/vaadin/ui/components/calendar/ContainerEventProvider.java
@@ -239,6 +239,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
      * util.Date, java.util.Date)
      */
+    @Override
     public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
         eventCache.clear();
 
@@ -315,6 +316,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * #addListener(com.vaadin.addon.calendar.event.CalendarEventProvider.
      * EventSetChangeListener)
      */
+    @Override
     public void addEventSetChangeListener(EventSetChangeListener listener) {
         if (!eventSetChangeListeners.contains(listener)) {
             eventSetChangeListeners.add(listener);
@@ -329,6 +331,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * #removeListener(com.vaadin.addon.calendar.event.CalendarEventProvider.
      * EventSetChangeListener)
      */
+    @Override
     public void removeEventSetChangeListener(EventSetChangeListener listener) {
         eventSetChangeListeners.remove(listener);
     }
@@ -340,6 +343,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEvent.EventChangeNotifier#addListener
      * (com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener)
      */
+    @Override
     public void addEventChangeListener(EventChangeListener listener) {
         if (eventChangeListeners.contains(listener)) {
             eventChangeListeners.add(listener);
@@ -353,6 +357,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * removeListener
      * (com.vaadin.addon.calendar.event.CalendarEvent.EventChangeListener)
      */
+    @Override
     public void removeEventChangeListener(EventChangeListener listener) {
         eventChangeListeners.remove(listener);
     }
@@ -434,6 +439,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.data.Container.ItemSetChangeListener#containerItemSetChange
      * (com.vaadin.data.Container.ItemSetChangeEvent)
      */
+    @Override
     public void containerItemSetChange(ItemSetChangeEvent event) {
         if (event.getContainer() == container) {
             // Trigger an eventset change event when the itemset changes
@@ -450,6 +456,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.data.Property.ValueChangeListener#valueChange(com.vaadin.data
      * .Property.ValueChangeEvent)
      */
+    @Override
     public void valueChange(ValueChangeEvent event) {
         /*
          * TODO Need to figure out how to get the item which triggered the the
@@ -466,6 +473,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * #eventMove
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.MoveEvent)
      */
+    @Override
     public void eventMove(MoveEvent event) {
         CalendarEvent ce = event.getCalendarEvent();
         if (eventCache.contains(ce)) {
@@ -496,6 +504,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * #eventResize
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResize)
      */
+    @Override
     public void eventResize(EventResize event) {
         CalendarEvent ce = event.getCalendarEvent();
         if (eventCache.contains(ce)) {
@@ -531,6 +540,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void addEvent(CalendarEvent event) {
         Item item;
         try {
@@ -560,6 +570,7 @@ public class ContainerEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void removeEvent(CalendarEvent event) {
         container.removeItem(event);
     }
diff --git a/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java b/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
index ab342dfabf..3f14145f0c 100644
--- a/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
+++ b/server/src/com/vaadin/ui/components/calendar/event/BasicEvent.java
@@ -91,6 +91,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#getCaption()
      */
+    @Override
     public String getCaption() {
         return caption;
     }
@@ -100,6 +101,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#getDescription()
      */
+    @Override
     public String getDescription() {
         return description;
     }
@@ -109,6 +111,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#getEnd()
      */
+    @Override
     public Date getEnd() {
         return end;
     }
@@ -118,6 +121,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#getStart()
      */
+    @Override
     public Date getStart() {
         return start;
     }
@@ -127,6 +131,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#getStyleName()
      */
+    @Override
     public String getStyleName() {
         return styleName;
     }
@@ -136,6 +141,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * 
      * @see com.vaadin.addon.calendar.event.CalendarEvent#isAllDay()
      */
+    @Override
     public boolean isAllDay() {
         return isAllDay;
     }
@@ -147,6 +153,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setCaption(java.lang
      * .String)
      */
+    @Override
     public void setCaption(String caption) {
         this.caption = caption;
         fireEventChange();
@@ -159,6 +166,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setDescription(java
      * .lang.String)
      */
+    @Override
     public void setDescription(String description) {
         this.description = description;
         fireEventChange();
@@ -171,6 +179,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setEnd(java.util.
      * Date)
      */
+    @Override
     public void setEnd(Date end) {
         this.end = end;
         fireEventChange();
@@ -183,6 +192,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setStart(java.util
      * .Date)
      */
+    @Override
     public void setStart(Date start) {
         this.start = start;
         fireEventChange();
@@ -195,6 +205,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setStyleName(java
      * .lang.String)
      */
+    @Override
     public void setStyleName(String styleName) {
         this.styleName = styleName;
         fireEventChange();
@@ -206,6 +217,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * @see
      * com.vaadin.addon.calendar.event.CalendarEventEditor#setAllDay(boolean)
      */
+    @Override
     public void setAllDay(boolean isAllDay) {
         this.isAllDay = isAllDay;
         fireEventChange();
@@ -220,6 +232,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeListener
      * )
      */
+    @Override
     public void addEventChangeListener(EventChangeListener listener) {
         listeners.add(listener);
     }
@@ -233,6 +246,7 @@ public class BasicEvent implements EditableCalendarEvent, EventChangeNotifier {
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventChangeListener
      * )
      */
+    @Override
     public void removeEventChangeListener(EventChangeListener listener) {
         listeners.remove(listener);
     }
diff --git a/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java b/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
index 0314652245..b2b74a5e52 100644
--- a/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
+++ b/server/src/com/vaadin/ui/components/calendar/event/BasicEventProvider.java
@@ -56,6 +56,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEventProvider#getEvents(java.
      * util.Date, java.util.Date)
      */
+    @Override
     public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
         ArrayList<CalendarEvent> activeEvents = new ArrayList<CalendarEvent>();
 
@@ -98,6 +99,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener
      * )
      */
+    @Override
     public void addEventSetChangeListener(EventSetChangeListener listener) {
         listeners.add(listener);
 
@@ -112,6 +114,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChangeListener
      * )
      */
+    @Override
     public void removeEventSetChangeListener(EventSetChangeListener listener) {
         listeners.remove(listener);
     }
@@ -136,6 +139,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * #eventChange
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventSetChange)
      */
+    @Override
     public void eventChange(EventChangeEvent changeEvent) {
         // naive implementation
         fireEventSetChange();
@@ -148,6 +152,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#addEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void addEvent(CalendarEvent event) {
         eventList.add(event);
         if (event instanceof BasicEvent) {
@@ -163,6 +168,7 @@ public class BasicEventProvider implements CalendarEditableEventProvider,
      * com.vaadin.addon.calendar.event.CalendarEditableEventProvider#removeEvent
      * (com.vaadin.addon.calendar.event.CalendarEvent)
      */
+    @Override
     public void removeEvent(CalendarEvent event) {
         eventList.remove(event);
         if (event instanceof BasicEvent) {
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
index fc2bfd6df4..65e9c94dec 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicBackwardHandler.java
@@ -39,6 +39,7 @@ public class BasicBackwardHandler implements BackwardHandler {
      * backward
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.BackwardEvent)
      */
+    @Override
     public void backward(BackwardEvent event) {
         Date start = event.getComponent().getStartDate();
         Date end = event.getComponent().getEndDate();
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
index c91a238b86..ac2470e008 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicDateClickHandler.java
@@ -39,6 +39,7 @@ public class BasicDateClickHandler implements DateClickHandler {
      * #dateClick
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.DateClickEvent)
      */
+    @Override
     public void dateClick(DateClickEvent event) {
         Date clickedDate = event.getDate();
 
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
index 139837f339..ae4c5fcc12 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventMoveHandler.java
@@ -39,6 +39,7 @@ public class BasicEventMoveHandler implements EventMoveHandler {
      * #eventMove
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.MoveEvent)
      */
+    @Override
     public void eventMove(MoveEvent event) {
         CalendarEvent calendarEvent = event.getCalendarEvent();
 
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
index c052d0d77b..ee7fc27360 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicEventResizeHandler.java
@@ -39,6 +39,7 @@ public class BasicEventResizeHandler implements EventResizeHandler {
      * #eventResize
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.EventResize)
      */
+    @Override
     public void eventResize(EventResize event) {
         CalendarEvent calendarEvent = event.getCalendarEvent();
 
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
index a5307ffd5c..e36c9e5756 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicForwardHandler.java
@@ -38,6 +38,7 @@ public class BasicForwardHandler implements ForwardHandler {
      * com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardHandler#forward
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.ForwardEvent)
      */
+    @Override
     public void forward(ForwardEvent event) {
         Date start = event.getComponent().getStartDate();
         Date end = event.getComponent().getEndDate();
diff --git a/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java b/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
index 49efe49e48..846fd7dd53 100644
--- a/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
+++ b/server/src/com/vaadin/ui/components/calendar/handler/BasicWeekClickHandler.java
@@ -40,6 +40,7 @@ public class BasicWeekClickHandler implements WeekClickHandler {
      * #weekClick
      * (com.vaadin.addon.calendar.ui.CalendarComponentEvents.WeekClick)
      */
+    @Override
     public void weekClick(WeekClick event) {
         int week = event.getWeek();
         int year = event.getYear();
diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java
index 9e9855afdd..9123245033 100644
--- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java
+++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerGrid.java
@@ -187,6 +187,7 @@ public class ColorPickerGrid extends AbstractComponent implements ColorSelector
      * @param listener
      *            The color change listener
      */
+    @Override
     public void addColorChangeListener(ColorChangeListener listener) {
         addListener(ColorChangeEvent.class, listener, COLOR_CHANGE_METHOD);
     }
@@ -202,6 +203,7 @@ public class ColorPickerGrid extends AbstractComponent implements ColorSelector
      * @param listener
      *            The listener
      */
+    @Override
     public void removeColorChangeListener(ColorChangeListener listener) {
         removeListener(ColorChangeEvent.class, listener);
     }
diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java
index e6edbcf40e..2902585f56 100644
--- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java
+++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerHistory.java
@@ -194,6 +194,7 @@ public class ColorPickerHistory extends CustomComponent implements
      * @param listener
      *            The listener
      */
+    @Override
     public void addColorChangeListener(ColorChangeListener listener) {
         addListener(ColorChangeEvent.class, listener, COLOR_CHANGE_METHOD);
     }
@@ -204,6 +205,7 @@ public class ColorPickerHistory extends CustomComponent implements
      * @param listener
      *            The listener
      */
+    @Override
     public void removeColorChangeListener(ColorChangeListener listener) {
         removeListener(ColorChangeEvent.class, listener);
     }
diff --git a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
index c06ae9f6ff..fee52d1a24 100644
--- a/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
+++ b/server/src/com/vaadin/ui/components/colorpicker/ColorPickerPopup.java
@@ -283,6 +283,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         }
 
         redSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 double red = (Double) event.getProperty().getValue();
                 if (!updatingColors) {
@@ -303,6 +304,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         }
 
         greenSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 double green = (Double) event.getProperty().getValue();
                 if (!updatingColors) {
@@ -322,6 +324,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         }
 
         blueSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 double blue = (Double) event.getProperty().getValue();
                 if (!updatingColors) {
@@ -380,6 +383,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         hueSlider.setWidth("220px");
         hueSlider.setImmediate(true);
         hueSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 if (!updatingColors) {
                     float hue = (Float.parseFloat(event.getProperty()
@@ -417,6 +421,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         saturationSlider.setWidth("220px");
         saturationSlider.setImmediate(true);
         saturationSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 if (!updatingColors) {
                     float hue = (Float.parseFloat(hueSlider.getValue()
@@ -444,6 +449,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
         valueSlider.setWidth("220px");
         valueSlider.setImmediate(true);
         valueSlider.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 if (!updatingColors) {
                     float hue = (Float.parseFloat(hueSlider.getValue()
@@ -754,6 +760,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
 
     /** HSV color converter */
     Coordinates2Color HSVConverter = new Coordinates2Color() {
+        @Override
         public int[] calculate(Color color) {
 
             float[] hsv = color.getHSV();
@@ -769,6 +776,7 @@ public class ColorPickerPopup extends Window implements ClickListener,
             return new int[] { x, y };
         }
 
+        @Override
         public Color calculate(int x, int y) {
             float saturation = 1f - (y / 220.0f);
             float value = (x / 220.0f);
diff --git a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
index 3d9909c42c..64db805623 100644
--- a/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
+++ b/server/tests/src/com/vaadin/data/util/AbstractContainerTest.java
@@ -324,7 +324,6 @@ public abstract class AbstractContainerTest extends TestCase {
                 "com.vaadin.terminal.gwt.client.Focusable",
                 "com.vaadin.data.Buffered", isFilteredOutItemNull(), 20);
 
-
         // Filter by "contains da" (reversed as ad here)
         container.removeAllContainerFilters();
 
diff --git a/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java b/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java
index efba6085ac..dc828689a8 100644
--- a/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java
+++ b/server/tests/src/com/vaadin/data/util/ReflectToolsGetSuperField.java
@@ -19,15 +19,16 @@ public class ReflectToolsGetSuperField {
         class MySubClass extends MyClass {
             // no fields here
         }
-        
+
         PropertysetItem item = new PropertysetItem();
-        item.addItemProperty("testProperty", new ObjectProperty<String>("Value of testProperty"));
-        
+        item.addItemProperty("testProperty", new ObjectProperty<String>(
+                "Value of testProperty"));
+
         MySubClass form = new MySubClass();
-        
+
         FieldGroup binder = new FieldGroup(item);
         binder.bindMemberFields(form);
-        
+
         assertTrue("Value of testProperty".equals(form.test.getValue()));
     }
 
diff --git a/server/tests/src/com/vaadin/tests/data/validator/TestStringLengthValidator.java b/server/tests/src/com/vaadin/tests/data/validator/TestStringLengthValidator.java
index 032b8b6d14..6b4b2b0d51 100644
--- a/server/tests/src/com/vaadin/tests/data/validator/TestStringLengthValidator.java
+++ b/server/tests/src/com/vaadin/tests/data/validator/TestStringLengthValidator.java
@@ -45,7 +45,7 @@ public class TestStringLengthValidator extends TestCase {
                 validatorMinValue
                         .isValid("This is a really long string to test that no upper bound exists"));
     }
-    
+
     public void testNoLowerBound() {
         assertTrue("Didn't accept short string", validatorMaxValue.isValid(""));
         assertTrue("Didn't accept short string", validatorMaxValue.isValid("1"));
diff --git a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
index 6dfd50c44c..731387d203 100644
--- a/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
+++ b/server/tests/src/com/vaadin/tests/server/component/abstractfield/RemoveListenersOnDetach.java
@@ -19,7 +19,8 @@ public class RemoveListenersOnDetach {
     int numReadOnlyChanges = 0;
 
     AbstractField field = new AbstractField() {
-        final private VaadinSession application = new AlwaysLockedVaadinSession(null);
+        final private VaadinSession application = new AlwaysLockedVaadinSession(
+                null);
         private UI uI = new UI() {
 
             @Override
diff --git a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java
index 3f4368c295..e571576990 100644
--- a/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java
+++ b/server/tests/src/com/vaadin/tests/server/component/fieldgroup/CaseInsensitiveBinding.java
@@ -68,7 +68,8 @@ public class CaseInsensitiveBinding {
             TextField firstName = new TextField("First name");
 
             public MyForm() {
-                // should bind to the firstName property, not first_name property
+                // should bind to the firstName property, not first_name
+                // property
                 addComponent(firstName);
             }
         }
diff --git a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
index a0d57c4d59..3c9fc4c0cd 100644
--- a/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
+++ b/server/tests/src/com/vaadin/tests/server/component/tree/TreeTest.java
@@ -88,8 +88,7 @@ public class TreeTest {
         tree.expandItem("parent");
         tree.expandItem("child");
 
-        Field expandedField = tree.getClass()
-                .getDeclaredField("expanded");
+        Field expandedField = tree.getClass().getDeclaredField("expanded");
         Field expandedItemIdField = tree.getClass().getDeclaredField(
                 "expandedItemId");
 
diff --git a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
index 718a76804f..540ffb852d 100644
--- a/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
+++ b/server/tests/src/com/vaadin/util/ReflectToolsGetFieldValueByType.java
@@ -54,8 +54,8 @@ public class ReflectToolsGetFieldValueByType {
             memberField = myInstance.getClass().getField("field");
             // Should throw an IllegalArgument exception as the mySubClass class
             // doesn't have an Integer field.
-            ReflectTools.getJavaFieldValue(myInstance,
-                    memberField, Integer.class);
+            ReflectTools.getJavaFieldValue(myInstance, memberField,
+                    Integer.class);
             fail("Previous method call should have thrown an exception");
         } catch (Exception e) {
         }
diff --git a/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java b/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java
index df192c51f2..1e1fafe31c 100644
--- a/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java
+++ b/server/tests/src/com/vaadin/util/ReflectToolsGetPrimitiveFieldValue.java
@@ -17,8 +17,8 @@ public class ReflectToolsGetPrimitiveFieldValue {
         Object fieldValue = new Boolean(false);
         try {
             memberField = myInstance.getClass().getField("field");
-            fieldValue = ReflectTools.getJavaFieldValue(myInstance,
-                    memberField);
+            fieldValue = ReflectTools
+                    .getJavaFieldValue(myInstance, memberField);
         } catch (Exception e) {
         }
         assertFalse(fieldValue instanceof Boolean);
diff --git a/theme-compiler/src/com/vaadin/sass/SassCompiler.java b/theme-compiler/src/com/vaadin/sass/SassCompiler.java
index 48b2d24c46..6a83425ca1 100644
--- a/theme-compiler/src/com/vaadin/sass/SassCompiler.java
+++ b/theme-compiler/src/com/vaadin/sass/SassCompiler.java
@@ -17,7 +17,6 @@
 package com.vaadin.sass;
 
 import java.io.File;
-import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
 
@@ -49,12 +48,12 @@ public class SassCompiler {
         // ScssStylesheet.setStylesheetResolvers(new VaadinResolver());
 
         ScssStylesheet scss = ScssStylesheet.get(input);
-        if(scss == null){
+        if (scss == null) {
             System.err.println("The scss file " + input
                     + " could not be found.");
             return;
         }
-        
+
         scss.compile();
         if (output == null) {
             System.out.println(scss.toString());
diff --git a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
index 47657f805c..d60756a2c9 100644
--- a/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
+++ b/theme-compiler/tests/src/com/vaadin/sass/testcases/scss/AbstractDirectoryScanningSassTests.java
@@ -33,7 +33,7 @@ import org.junit.Assert;
 import com.vaadin.sass.internal.ScssStylesheet;
 import com.vaadin.sass.testcases.scss.SassTestRunner.FactoryTest;
 
-public abstract class AbstractDirectoryScanningSassTests  {
+public abstract class AbstractDirectoryScanningSassTests {
 
     public static Collection<String> getScssResourceNames(URL directoryUrl)
             throws URISyntaxException {
diff --git a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
index 444a70348c..ad372bd5bc 100644
--- a/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
+++ b/uitest/src/com/vaadin/launcher/DevelopmentServerLauncher.java
@@ -58,8 +58,9 @@ public class DevelopmentServerLauncher {
 
         // Pass-through of arguments for Jetty
         final Map<String, String> serverArgs = parseArguments(args);
-        if (!serverArgs.containsKey("shutdownPort"))
+        if (!serverArgs.containsKey("shutdownPort")) {
             serverArgs.put("shutdownPort", "8889");
+        }
 
         int port = Integer.parseInt(serverArgs.get("shutdownPort"));
         if (port > 0) {
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java b/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java
index b01e0a85d0..f866928054 100644
--- a/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonWithShortcutNotRendered.java
@@ -83,6 +83,7 @@ public class ButtonWithShortcutNotRendered extends AbstractTestUI {
 
             addValueChangeListener(new Property.ValueChangeListener() {
 
+                @Override
                 public void valueChange(
                         com.vaadin.data.Property.ValueChangeEvent event) {
                     final Item item = getItem(getValue());
@@ -162,6 +163,7 @@ public class ButtonWithShortcutNotRendered extends AbstractTestUI {
             }
         }
 
+        @Override
         public void buttonClick(ClickEvent event) {
             // NOP
         }
diff --git a/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
index 4e0b963534..83fc4a03cb 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/BeanItemContainerTestUI.java
@@ -85,6 +85,7 @@ public class BeanItemContainerTestUI extends UI {
             private final Action EDIT = new Action("Edit event");
             private final Action REMOVE = new Action("Remove event");
 
+            @Override
             public void handleAction(Action action, Object sender, Object target) {
                 if (action == ADD) {
                     BasicEvent event = new BasicEvent();
@@ -98,6 +99,7 @@ public class BeanItemContainerTestUI extends UI {
                 }
             }
 
+            @Override
             public Action[] getActions(Object target, Object sender) {
                 if (target == null) {
                     return new Action[] { ADD };
@@ -153,6 +155,7 @@ public class BeanItemContainerTestUI extends UI {
                         ContainerEventProvider.ENDDATE_PROPERTY)));
         modal.setContent(formLayout);
         modal.addCloseListener(new Window.CloseListener() {
+            @Override
             public void windowClose(CloseEvent e) {
                 // Commit changes to bean
                 try {
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
index f5c2d9da7e..ee898e0790 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarActionsUI.java
@@ -57,6 +57,7 @@ public class CalendarActionsUI extends UI {
              * com.vaadin.event.Action.Handler#handleAction(com.vaadin.event
              * .Action, java.lang.Object, java.lang.Object)
              */
+            @Override
             public void handleAction(Action action, Object sender, Object target) {
                 Date date = (Date) target;
                 if (action == NEW_EVENT) {
@@ -72,6 +73,7 @@ public class CalendarActionsUI extends UI {
              * @see com.vaadin.event.Action.Handler#getActions(java.lang.Object,
              * java.lang.Object)
              */
+            @Override
             public Action[] getActions(Object target, Object sender) {
                 CalendarDateRange date = (CalendarDateRange) target;
 
@@ -96,6 +98,7 @@ public class CalendarActionsUI extends UI {
 
         content.addComponent(new Button("Set week view",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         calendar.setEndDate(new Date(100, 1, 7));
                     }
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
index 530e47f1e0..a1bcca2e4e 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarTest.java
@@ -260,9 +260,9 @@ public class CalendarTest extends UI {
     private void addInitialEvents() {
         Date originalDate = calendar.getTime();
         Date today = getToday();
-        
+
         // Add a event that last a whole week
-        
+
         Date start = resolveFirstDateOfWeek(today, calendar);
         Date end = resolveLastDateOfWeek(today, calendar);
         CalendarTestEvent event = getNewEvent("Whole week event", start, end);
@@ -388,6 +388,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 switchToMonthView();
             }
@@ -397,6 +398,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 // simulate week click
                 WeekClickHandler handler = (WeekClickHandler) calendarComponent
@@ -410,6 +412,7 @@ public class CalendarTest extends UI {
         nextButton = new Button("Next", new Button.ClickListener() {
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 handleNextButtonClick();
             }
@@ -418,6 +421,7 @@ public class CalendarTest extends UI {
         prevButton = new Button("Prev", new Button.ClickListener() {
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 handlePreviousButtonClick();
             }
@@ -488,6 +492,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = -8307244759142541067L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 Date start = getToday();
                 start.setHours(0);
@@ -512,6 +517,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = -7104996493482558021L;
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 Object value = event.getProperty().getValue();
                 if (value instanceof Boolean && Boolean.TRUE.equals(value)) {
@@ -675,6 +681,7 @@ public class CalendarTest extends UI {
 
         calendarComponent.setHandler(new EventClickHandler() {
 
+            @Override
             public void eventClick(EventClick event) {
                 showEventPopup(event.getCalendarEvent(), false);
             }
@@ -693,6 +700,7 @@ public class CalendarTest extends UI {
 
         calendarComponent.setHandler(new RangeSelectHandler() {
 
+            @Override
             public void rangeSelect(RangeSelectEvent event) {
                 handleRangeSelect(event);
             }
@@ -725,6 +733,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
 
                 updateCalendarTimeZone(event.getProperty().getValue());
@@ -752,6 +761,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 updateCalendarFormat(event.getProperty().getValue());
             }
@@ -779,6 +789,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 updateCalendarLocale((Locale) event.getProperty().getValue());
             }
@@ -933,6 +944,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 try {
                     commitCalendarEvent();
@@ -945,6 +957,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 discardCalendarEvent();
             }
@@ -953,6 +966,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 deleteCalendarEvent();
             }
@@ -961,6 +975,7 @@ public class CalendarTest extends UI {
 
             private static final long serialVersionUID = 1L;
 
+            @Override
             public void windowClose(Window.CloseEvent e) {
                 discardCalendarEvent();
             }
diff --git a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
index 0bd327da18..6e5718a652 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
+++ b/uitest/src/com/vaadin/tests/components/calendar/NotificationTestUI.java
@@ -50,6 +50,7 @@ public class NotificationTestUI extends UI {
             events.add(e);
         }
 
+        @Override
         public List<CalendarEvent> getEvents(Date startDate, Date endDate) {
             return events;
         }
@@ -64,6 +65,7 @@ public class NotificationTestUI extends UI {
         setContent(content);
         final Button btn = new Button("Show working notification",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         Notification
                                 .show("This will disappear when you move your mouse!");
@@ -76,6 +78,7 @@ public class NotificationTestUI extends UI {
         cal.setLocale(Locale.US);
         cal.setSizeFull();
         cal.setHandler(new DateClickHandler() {
+            @Override
             public void dateClick(DateClickEvent event) {
                 provider.addEvent(event.getDate());
                 Notification
diff --git a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
index 5b086fb935..cc26cf8845 100644
--- a/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
+++ b/uitest/src/com/vaadin/tests/components/checkbox/CheckBoxRevertValueChange.java
@@ -29,6 +29,7 @@ public class CheckBoxRevertValueChange extends AbstractTestUIWithLog {
         final CheckBox alwaysUnchecked = new CheckBox("You may not check me");
         alwaysUnchecked
                 .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
                     public void valueChange(Property.ValueChangeEvent event) {
                         if (alwaysUnchecked.getValue()) {
                             log("I said no checking!");
@@ -40,6 +41,7 @@ public class CheckBoxRevertValueChange extends AbstractTestUIWithLog {
         alwaysChecked.setValue(true);
         alwaysChecked
                 .addValueChangeListener(new Property.ValueChangeListener() {
+                    @Override
                     public void valueChange(Property.ValueChangeEvent event) {
                         if (!alwaysChecked.getValue()) {
                             log("I said no unchecking!");
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java
index 3c1e8a27d6..bd71850a89 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxDuplicateCaption.java
@@ -38,6 +38,7 @@ public class ComboBoxDuplicateCaption extends TestBase {
         box.setImmediate(true);
         box.addValueChangeListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(
                     com.vaadin.data.Property.ValueChangeEvent event) {
                 Person p = (Person) event.getProperty().getValue();
diff --git a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java
index 23a75ae56e..75010f0ea9 100644
--- a/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java
+++ b/uitest/src/com/vaadin/tests/components/combobox/ComboBoxSQLContainerFilteredValueChange.java
@@ -53,6 +53,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase {
         myCombo.setWidth("100.0%");
         myCombo.setHeight("-1px");
         myCombo.addListener(new Property.ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 selectedLabel.setValue("Selected: "
                         + event.getProperty().getValue());
@@ -72,6 +73,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase {
 
     /**
      * (Re)creates the test table
+     * 
      * @param connectionPool
      */
     private void createTestTable(JDBCConnectionPool connectionPool) {
@@ -97,6 +99,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase {
 
     /**
      * Adds test data to the test table
+     * 
      * @param connectionPool
      * @throws SQLException
      */
@@ -111,7 +114,7 @@ public class ComboBoxSQLContainerFilteredValueChange extends TestBase {
             statement.executeUpdate("INSERT INTO mytable VALUES(2, 'A1')");
             statement.executeUpdate("INSERT INTO mytable VALUES(3, 'B0')");
             statement.executeUpdate("INSERT INTO mytable VALUES(4, 'B1')");
-            
+
             statement.close();
             conn.commit();
         } catch (SQLException e) {
diff --git a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java
index 86525da3ef..0ac9a008d2 100755
--- a/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java
+++ b/uitest/src/com/vaadin/tests/components/orderedlayout/VerticalRelativeSizeWithoutExpand.java
@@ -1,4 +1,5 @@
 package com.vaadin.tests.components.orderedlayout;
+
 import com.vaadin.data.util.BeanItemContainer;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.ui.Panel;
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java
index 5eddf9dc6d..01dc10220f 100644
--- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaEmptyString.java
@@ -29,6 +29,7 @@ public class RichTextAreaEmptyString extends TestBase {
 
         final Button b = new Button("get area value", new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 l.setValue(area.getValue());
             }
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
index f4ad149dd1..c3433c3054 100644
--- a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaPreventsTextFieldAccess.java
@@ -50,6 +50,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase {
         Button addWindowButton = new Button("Open RichTextArea-Dialog");
         addWindowButton.addClickListener(new Button.ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 getMainWindow().addWindow(subWindow);
 
@@ -60,6 +61,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase {
         Button removeWindowButton = new Button("removeWindowButton");
         removeWindowButton.addClickListener(new Button.ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 getMainWindow().removeWindow(subWindow);
 
@@ -70,6 +72,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase {
         Button focusButton = new Button("Set focus on TextField");
         focusButton.addClickListener(new Button.ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 testField.focus();
 
@@ -80,6 +83,7 @@ public class RichTextAreaPreventsTextFieldAccess extends TestBase {
         Button removeRTA = new Button("Remove RTA");
         removeRTA.addClickListener(new Button.ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 wLayout.removeComponent(rText);
 
diff --git a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
index f2dee69cbf..0df82688d1 100644
--- a/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
+++ b/uitest/src/com/vaadin/tests/components/select/OptionGroupBaseSelects.java
@@ -29,6 +29,7 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout>
         CheckBox cb = new CheckBox("Switch Selects ReadOnly", false);
         cb.addListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 for (Iterator<Component> it = layout.getComponentIterator(); it
                         .hasNext();) {
@@ -42,6 +43,7 @@ public class OptionGroupBaseSelects extends ComponentTestCase<HorizontalLayout>
         CheckBox cb2 = new CheckBox("Switch Selects Enabled", true);
         cb2.addListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 for (Iterator<Component> it = layout.getComponentIterator(); it
                         .hasNext();) {
diff --git a/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java b/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java
index c1ae9b4118..3bc0d3dd1f 100644
--- a/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java
+++ b/uitest/src/com/vaadin/tests/components/table/EmptyRowsWhenScrolling.java
@@ -93,6 +93,7 @@ public class EmptyRowsWhenScrolling extends UI {
             table.setVisibleColumns(new String[] { "image", "id", "col1",
                     "col2", "col3", "col4" });
             table.addGeneratedColumn("image", new ColumnGenerator() {
+                @Override
                 public Object generateCell(Table source, Object itemId,
                         Object columnId) {
                     int imgNum = new Random().nextInt(5) + 1;
@@ -112,6 +113,7 @@ public class EmptyRowsWhenScrolling extends UI {
                     image.setWidth("50px");
                     image.setHeight("50px");
                     image.addClickListener(new com.vaadin.event.MouseEvents.ClickListener() {
+                        @Override
                         public void click(
                                 com.vaadin.event.MouseEvents.ClickEvent event) {
                             Notification.show("Image clicked!");
@@ -123,6 +125,7 @@ public class EmptyRowsWhenScrolling extends UI {
 
             // Refresh table button
             getBtnRefreshTable().addClickListener(new ClickListener() {
+                @Override
                 public void buttonClick(ClickEvent event) {
                     table.refreshRowCache();
                 }
diff --git a/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java b/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java
index fb782b8ded..b6ee62ea59 100644
--- a/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java
+++ b/uitest/src/com/vaadin/tests/components/table/LargeSelectionCausesNPE.java
@@ -105,6 +105,7 @@ public class LargeSelectionCausesNPE extends TestBase {
         }
 
         Table.ValueChangeListener valueChangeListener = new Table.ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 // in multiselect mode, a Set of itemIds is returned,
                 // in singleselect mode the itemId is returned directly
@@ -119,6 +120,7 @@ public class LargeSelectionCausesNPE extends TestBase {
 
         Button.ClickListener clickListener = new Button.ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 Property nameProperty = table.getContainerProperty(0, NAME);
                 if (("0").equals(nameLabel.getValue())) {
@@ -148,6 +150,7 @@ public class LargeSelectionCausesNPE extends TestBase {
 
         ColumnGenerator columnGenerator = new ColumnGenerator() {
 
+            @Override
             public Object generateCell(Table source, Object itemId,
                     Object columnId) {
                 Label label = new Label();
diff --git a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java
index 747c99468f..b1ecb3fc10 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableColumnWidthsAndExpandRatios.java
@@ -38,10 +38,11 @@ public class TableColumnWidthsAndExpandRatios extends TestBase {
         return new NativeButton("Reset " + property + " width",
                 new Button.ClickListener() {
 
-            public void buttonClick(ClickEvent event) {
-                table.setColumnWidth(property, -1);
-            }
-        });
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        table.setColumnWidth(property, -1);
+                    }
+                });
     }
 
     @Override
diff --git a/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java
index dcaabf98d6..c0c8876fca 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableInSubWindowMemoryLeak.java
@@ -20,6 +20,7 @@ public class TableInSubWindowMemoryLeak extends TestBase {
         final Button openButton = new Button("open me");
         openButton.addClickListener(new ClickListener() {
 
+            @Override
             public void buttonClick(final ClickEvent event) {
                 final Window window = new Window("Simple Window");
                 window.setModal(true);
@@ -29,6 +30,7 @@ public class TableInSubWindowMemoryLeak extends TestBase {
                 window.setContent(table);
                 UI.getCurrent().addWindow(window);
                 window.addCloseListener(new CloseListener() {
+                    @Override
                     public void windowClose(final CloseEvent e) {
                         window.setContent(new Label());
                         UI.getCurrent().removeWindow(window);
@@ -40,6 +42,7 @@ public class TableInSubWindowMemoryLeak extends TestBase {
 
         final Button openButton2 = new Button("open me without Table");
         openButton2.addClickListener(new ClickListener() {
+            @Override
             public void buttonClick(final ClickEvent event) {
                 final Window window = new Window("Simple Window");
                 window.setModal(true);
@@ -47,6 +50,7 @@ public class TableInSubWindowMemoryLeak extends TestBase {
                 window.setWidth("200px");
                 UI.getCurrent().addWindow(window);
                 window.addCloseListener(new CloseListener() {
+                    @Override
                     public void windowClose(final CloseEvent e) {
                         UI.getCurrent().removeWindow(window);
                     }
diff --git a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
index 9823fc1859..7d48dfa11e 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableRowScrolledBottom.java
@@ -5,7 +5,6 @@ import com.vaadin.tests.components.TestBase;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Label;
 import com.vaadin.ui.Table;
-import com.vaadin.ui.VerticalLayout;
 
 public class TableRowScrolledBottom extends TestBase {
 
diff --git a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
index 9c5ce9dc0c..efa1b1bdab 100644
--- a/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
+++ b/uitest/src/com/vaadin/tests/components/table/TableWithBrokenGeneratorAndContainer.java
@@ -78,6 +78,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase {
             this.brokenInterval = brokenInterval;
         }
 
+        @Override
         public Object generateCell(Table source, Object itemId, Object columnId) {
             if (counter++ % brokenInterval == 0
                     && Boolean.TRUE.equals(brokenGenerator.getValue())) {
@@ -97,6 +98,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase {
         clearTableOnError.setImmediate(true);
         clearTableOnError.addValueChangeListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 Boolean value = clearTableOnError.getValue();
                 setErrorHandler(value != null ? value : false);
@@ -110,6 +112,7 @@ public class TableWithBrokenGeneratorAndContainer extends TestBase {
         Button refreshTableCache = new Button("Refresh table cache",
                 new Button.ClickListener() {
 
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         table.markAsDirty();
                         table.refreshRowCache();
diff --git a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
index f378c146ea..b0622e748c 100644
--- a/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
+++ b/uitest/src/com/vaadin/tests/components/table/ValueAfterClearingContainer.java
@@ -26,6 +26,7 @@ public class ValueAfterClearingContainer extends TestBase {
         table.setImmediate(true);
         table.addValueChangeListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 log.log("Value changed to " + event.getProperty().getValue());
             }
@@ -38,6 +39,7 @@ public class ValueAfterClearingContainer extends TestBase {
         multiselect.setId("multiselect");
         multiselect.addValueChangeListener(new ValueChangeListener() {
 
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 Boolean value = multiselect.getValue();
                 table.setMultiSelect(value == null ? false : value);
@@ -46,6 +48,7 @@ public class ValueAfterClearingContainer extends TestBase {
         addComponent(multiselect);
         Button addItemsButton = new Button("Add table items",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         if (!table.getItemIds().isEmpty()) {
                             Notification
@@ -65,6 +68,7 @@ public class ValueAfterClearingContainer extends TestBase {
 
         Button showValueButton = new Button("Show value",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         log.log("Table selection: " + table.getValue());
                     }
@@ -74,6 +78,7 @@ public class ValueAfterClearingContainer extends TestBase {
 
         Button removeItemsFromTableButton = new Button(
                 "Remove items from table", new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         table.removeAllItems();
                     }
@@ -83,6 +88,7 @@ public class ValueAfterClearingContainer extends TestBase {
 
         Button removeItemsFromContainerButton = new Button(
                 "Remove items from container", new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         table.getContainerDataSource().removeAllItems();
                     }
@@ -92,6 +98,7 @@ public class ValueAfterClearingContainer extends TestBase {
         Button removeItemsFromContainerAndSanitizeButton = new Button(
                 "Remove items from container and sanitize",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         table.getContainerDataSource().removeAllItems();
                         table.sanitizeSelection();
@@ -102,6 +109,7 @@ public class ValueAfterClearingContainer extends TestBase {
         addComponent(removeItemsFromContainerAndSanitizeButton);
         Button removeSelectedFromTableButton = new Button(
                 "Remove selected item from table", new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         Object selection = table.getValue();
                         if (selection == null) {
@@ -117,6 +125,7 @@ public class ValueAfterClearingContainer extends TestBase {
         Button removeSelectedFromContainer = new Button(
                 "Remove selected item from container",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         Object selection = table.getValue();
                         if (selection == null) {
diff --git a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java
index 878dd0d3c4..de32ea1fc0 100644
--- a/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java
+++ b/uitest/src/com/vaadin/tests/components/table/ViewPortCalculation.java
@@ -43,6 +43,7 @@ public class ViewPortCalculation extends TestBase {
         }
 
         table.setCellStyleGenerator(new CellStyleGenerator() {
+            @Override
             public String getStyle(Table source, Object itemId,
                     Object propertyId) {
                 if (itemId.equals(lastDoubleClickedItemId)) {
@@ -53,6 +54,7 @@ public class ViewPortCalculation extends TestBase {
         });
 
         table.addItemClickListener(new ItemClickListener() {
+            @Override
             public void itemClick(ItemClickEvent event) {
                 if (event.isDoubleClick()) {
                     lastDoubleClickedItemId = event.getItemId();
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java
index 2917eccbfb..fffc766e7c 100755
--- a/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/ExtraScrollbarsInTabSheet.java
@@ -1,4 +1,5 @@
 package com.vaadin.tests.components.tabsheet;
+
 import com.vaadin.annotations.Theme;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.ui.HorizontalSplitPanel;
diff --git a/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java b/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java
index 0fdb579997..eac786d9b3 100644
--- a/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java
+++ b/uitest/src/com/vaadin/tests/components/tabsheet/HiddenTabSheetBrowserResize.java
@@ -17,6 +17,7 @@ public class HiddenTabSheetBrowserResize extends TestBase {
 
         Button toggleButton = new Button("Toggle TabSheet",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         tabSheet.setVisible(!tabSheet.isVisible());
                     }
diff --git a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java
index c95731d94f..154a30a64b 100644
--- a/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java
+++ b/uitest/src/com/vaadin/tests/components/textarea/ScrollCursor.java
@@ -27,6 +27,7 @@ public class ScrollCursor extends TestBase {
         Button button = new Button("Scroll");
         button.addListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 textArea.setCursorPosition(getPosition());
             }
@@ -34,6 +35,7 @@ public class ScrollCursor extends TestBase {
         Button wrap = new Button("Set wrap");
         wrap.addListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 textArea.setWordwrap(false);
             }
@@ -42,6 +44,7 @@ public class ScrollCursor extends TestBase {
         Button toBegin = new Button("To begin");
         toBegin.addListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 position = 3;
             }
@@ -50,6 +53,7 @@ public class ScrollCursor extends TestBase {
         Button toMiddle = new Button("To middle");
         toMiddle.addListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 position = 130;
             }
@@ -58,6 +62,7 @@ public class ScrollCursor extends TestBase {
         Button toEnd = new Button("To end");
         toEnd.addListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 position = textArea.getValue().toString().length();
             }
diff --git a/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java b/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java
index 28ff20c174..049b08d4e8 100644
--- a/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java
+++ b/uitest/src/com/vaadin/tests/components/textfield/TextFieldMaxLengthRemovedFromDOM.java
@@ -17,6 +17,7 @@ public class TextFieldMaxLengthRemovedFromDOM extends TestBase {
 
         tf.addFocusListener(new FieldEvents.FocusListener() {
 
+            @Override
             public void focus(FocusEvent event) {
                 // Resetting Max length should not remove maxlength attribute
                 tf.setMaxLength(11);
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java
index f792a32f8f..85a69702a4 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableCacheOnPartialUpdates.java
@@ -90,6 +90,7 @@ public class TreeTableCacheOnPartialUpdates extends TestBase {
     }
 
     public class Col4ColumnGenerator implements ColumnGenerator {
+        @Override
         public Component generateCell(final com.vaadin.ui.Table source,
                 final Object itemId, Object columnId) {
             TestBean tb = (TestBean) itemId;
@@ -98,6 +99,7 @@ public class TreeTableCacheOnPartialUpdates extends TestBase {
             btnCol4.setId("cacheTestButtonToggle-" + tb.getCol1() + "-"
                     + tb.getCol2());
             btnCol4.addClickListener(new Button.ClickListener() {
+                @Override
                 public void buttonClick(ClickEvent event) {
                     treeTable.setCollapsed(itemId,
                             !treeTable.isCollapsed(itemId));
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java
index 4af0da158d..79c967914f 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbar.java
@@ -49,6 +49,7 @@ public class TreeTableExtraScrollbar extends TestBase {
         button.setId("button");
         button.addClickListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 table.addItem(new TestObject("name 6-1", "value 6-1"));
                 table.addItem(new TestObject("name 6-2", "value 6-2"));
@@ -68,12 +69,14 @@ public class TreeTableExtraScrollbar extends TestBase {
     }
 
     private class EmptyColumnGenerator implements Table.ColumnGenerator {
+        @Override
         public Object generateCell(Table table, Object itemId, Object columnId) {
             return null;
         }
     }
 
     private class TypeColumnGenerator implements Table.ColumnGenerator {
+        @Override
         public Object generateCell(Table table, Object itemId, Object columnId) {
             if (itemId instanceof TestObject) {
                 return new Label(((TestObject) itemId).getValue());
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java
index cad33e242f..0dc98b2c2e 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableExtraScrollbarWithChildren.java
@@ -62,6 +62,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase {
         button.setId("button");
         button.addClickListener(new ClickListener() {
 
+            @Override
             public void buttonClick(ClickEvent event) {
                 table.setCollapsed(parent, !table.isCollapsed(parent));
                 Notification.show("collapsed: " + table.isCollapsed(parent));
@@ -73,6 +74,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase {
     }
 
     private class HierarchyColumnGenerator implements Table.ColumnGenerator {
+        @Override
         public Object generateCell(Table table, Object itemId, Object columnId) {
             Label label = new Label("this should be mostly hidden");
             label.setSizeUndefined();
@@ -81,6 +83,7 @@ public class TreeTableExtraScrollbarWithChildren extends TestBase {
     }
 
     private class TypeColumnGenerator implements Table.ColumnGenerator {
+        @Override
         public Object generateCell(Table table, Object itemId, Object columnId) {
             if (itemId instanceof TestObject) {
                 return new Label(((TestObject) itemId).getValue());
diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java
index f6d7f11eb7..1b510f1ac5 100644
--- a/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java
+++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableInternalError.java
@@ -30,6 +30,7 @@ public class TreeTableInternalError extends TestBase {
         Button button = new Button("Resize") {
             {
                 addClickListener(new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         t.setHeight("300px");
                     }
@@ -64,12 +65,14 @@ public class TreeTableInternalError extends TestBase {
     }
 
     public class ButtonColumnGenerator implements ColumnGenerator {
+        @Override
         public Component generateCell(final com.vaadin.ui.Table source,
                 final Object itemId, Object columnId) {
             String identifier = "Expand/Collapse";
             Button btnCol = new NativeButton(identifier);
             btnCol.setId("cacheTestButtonToggle-" + itemId);
             btnCol.addClickListener(new Button.ClickListener() {
+                @Override
                 public void buttonClick(ClickEvent event) {
                     t.setCollapsed(itemId, !t.isCollapsed(itemId));
                 }
diff --git a/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java b/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java
index d5bac0d509..7e7a084eed 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java
+++ b/uitest/src/com/vaadin/tests/components/uitest/BackButtonTest.java
@@ -57,6 +57,7 @@ public class BackButtonTest extends AbstractTestUI {
             addComponent(l);
 
             Button b = new Button("Go to Page 2", new Button.ClickListener() {
+                @Override
                 public void buttonClick(ClickEvent event) {
                     l.setCaption("Data from Page 1 : " + value);
                     getPage().setUriFragment("page2");
@@ -85,6 +86,7 @@ public class BackButtonTest extends AbstractTestUI {
 
             addComponent(f);
             f.addValueChangeListener(new ValueChangeListener() {
+                @Override
                 public void valueChange(ValueChangeEvent event) {
                     value = f.getValue();
                     p1.l.setCaption("Data from Page 2 : " + value);
@@ -92,6 +94,7 @@ public class BackButtonTest extends AbstractTestUI {
             });
 
             Button b = new Button("Go Back", new Button.ClickListener() {
+                @Override
                 public void buttonClick(ClickEvent event) {
                     getPage().setUriFragment("page1");
                 }
diff --git a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java
index 32f5c93bfd..178f8f9393 100644
--- a/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java
+++ b/uitest/src/com/vaadin/tests/components/upload/TestFileUploadSize.java
@@ -28,6 +28,7 @@ public class TestFileUploadSize extends TestBase implements Receiver {
 
         Upload u = new Upload("Upload", new Upload.Receiver() {
 
+            @Override
             public OutputStream receiveUpload(String filename, String mimeType) {
                 return baos;
             }
@@ -35,12 +36,14 @@ public class TestFileUploadSize extends TestBase implements Receiver {
         u.setId("UPL");
         u.addStartedListener(new Upload.StartedListener() {
 
+            @Override
             public void uploadStarted(StartedEvent event) {
                 expectedSize.setValue(String.valueOf(event.getContentLength()));
             }
         });
         u.addFinishedListener(new Upload.FinishedListener() {
 
+            @Override
             public void uploadFinished(FinishedEvent event) {
                 label.setValue("Upload finished. Name: " + event.getFilename());
                 receivedSize.setValue(String.valueOf(baos.size()));
@@ -62,6 +65,7 @@ public class TestFileUploadSize extends TestBase implements Receiver {
         addComponent(u);
     }
 
+    @Override
     public OutputStream receiveUpload(String filename, String MIMEType) {
         Notification.show("Receiving upload");
         return new ByteArrayOutputStream();
diff --git a/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java
index 175c3f6d8a..ad36e04d88 100644
--- a/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/LegacyWindowOpenTest.java
@@ -19,6 +19,7 @@ public class LegacyWindowOpenTest extends TestBase {
 
         addComponent(new Button("Window.open _blank always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.open(r, "_blank", true);
                     }
@@ -26,6 +27,7 @@ public class LegacyWindowOpenTest extends TestBase {
 
         addComponent(new Button("Window.open _blank NOT always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.open(r, "_blank", false);
                     }
@@ -33,6 +35,7 @@ public class LegacyWindowOpenTest extends TestBase {
 
         addComponent(new Button("Window.open _new always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.open(r, "_new", true);
                     }
@@ -40,6 +43,7 @@ public class LegacyWindowOpenTest extends TestBase {
 
         addComponent(new Button("Window.open _new NOT always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.open(r, "_new", false);
                     }
@@ -47,6 +51,7 @@ public class LegacyWindowOpenTest extends TestBase {
         addComponent(new Button(
                 "Window execute Javascript window.open(www.google.com, _blank)",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\");");
                     }
@@ -54,6 +59,7 @@ public class LegacyWindowOpenTest extends TestBase {
         addComponent(new Button(
                 "Window execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         win.executeJavaScript("window.open(\"http://www.google.com\", \"_blank\", \"resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes\");");
                     }
diff --git a/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java
index 2dbc24cb66..a566b09cdc 100644
--- a/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/PageOpenTest.java
@@ -20,6 +20,7 @@ public class PageOpenTest extends AbstractTestUI {
 
         addComponent(new Button("Page.open _blank always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         page.open(url, "_blank", true);
                     }
@@ -27,6 +28,7 @@ public class PageOpenTest extends AbstractTestUI {
 
         addComponent(new Button("Page.open _blank NOT always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         page.open(url, "_blank", false);
                     }
@@ -34,6 +36,7 @@ public class PageOpenTest extends AbstractTestUI {
 
         addComponent(new Button("Page.open _new always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         page.open(url, "_new", true);
                     }
@@ -41,6 +44,7 @@ public class PageOpenTest extends AbstractTestUI {
 
         addComponent(new Button("Page.open _new NOT always as popup",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         page.open(url, "_new", false);
                     }
@@ -48,6 +52,7 @@ public class PageOpenTest extends AbstractTestUI {
         addComponent(new Button(
                 "Execute Javascript window.open(www.google.com, _blank)",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         JavaScript
                                 .getCurrent()
@@ -58,6 +63,7 @@ public class PageOpenTest extends AbstractTestUI {
         addComponent(new Button(
                 "Execute Javascript window.open(www.google.com, _blank, resizable=yes,menubar=yes,toolbar=yes,directories=yes,location=yes,scrollbars=yes,status=yes)",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         JavaScript
                                 .getCurrent()
diff --git a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java
index fa84c7cbb8..da3476610b 100644
--- a/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java
+++ b/uitest/src/com/vaadin/tests/containers/sqlcontainer/TableQueryWithNonUniqueFirstPrimaryKey.java
@@ -53,6 +53,7 @@ public class TableQueryWithNonUniqueFirstPrimaryKey extends LegacyApplication {
             myCombo.setWidth("100.0%");
             myCombo.setHeight("-1px");
             myCombo.addValueChangeListener(new Property.ValueChangeListener() {
+                @Override
                 public void valueChange(ValueChangeEvent event) {
                     if (myCombo.getValue() != null) {
                         Item item = myCombo.getItem(event.getProperty()
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
index 2fbbff10a8..1f94d43abe 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginUI.java
@@ -26,16 +26,16 @@ public class SimpleLoginUI extends UI {
          */
         getNavigator().addView(SimpleLoginMainView.NAME,
                 SimpleLoginMainView.class);
-                       
+
         /*
          * We use a view change handler to ensure the user is always redirected
          * to the login view if the user is not logged in.
          */
         getNavigator().addViewChangeListener(new ViewChangeListener() {
-            
+
             @Override
             public boolean beforeViewChange(ViewChangeEvent event) {
-                
+
                 // Check if a user has logged in
                 boolean isLoggedIn = getSession().getAttribute("user") != null;
                 boolean isLoginView = event.getNewView() instanceof SimpleLoginView;
@@ -54,10 +54,10 @@ public class SimpleLoginUI extends UI {
 
                 return true;
             }
-            
+
             @Override
             public void afterViewChange(ViewChangeEvent event) {
-                
+
             }
         });
     }
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java
index 88a2a8f678..3ff1c2df40 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v70/SimpleLoginView.java
@@ -33,7 +33,8 @@ public class SimpleLoginView extends CustomComponent implements View,
         user.setWidth("300px");
         user.setRequired(true);
         user.setInputPrompt("Your username (eg. joe@email.com)");
-        user.addValidator(new EmailValidator("Username must be an email address"));
+        user.addValidator(new EmailValidator(
+                "Username must be an email address"));
         user.setInvalidAllowed(false);
 
         // Create the password input field
@@ -61,7 +62,7 @@ public class SimpleLoginView extends CustomComponent implements View,
         viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
         setCompositionRoot(viewLayout);
     }
-    
+
     @Override
     public void enter(ViewChangeEvent event) {
         // focus the username field when user arrives to the login view
@@ -119,7 +120,7 @@ public class SimpleLoginView extends CustomComponent implements View,
         boolean isValid = username.equals("test@test.com")
                 && password.equals("passw0rd");
 
-        if(isValid){
+        if (isValid) {
             // Store the current user in the service session
             getSession().setAttribute("user", username);
 
@@ -134,4 +135,3 @@ public class SimpleLoginView extends CustomComponent implements View,
         }
     }
 }
-
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
index e3b8f997e0..63e43b29f1 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v71beta/CSSInjectWithColorpicker.java
@@ -30,27 +30,26 @@ public class CSSInjectWithColorpicker extends UI {
 
         // Create a text editor
         Component editor = createEditor("Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        +"Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
-                        + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
-                        + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
-                        + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
-                        + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
-                        + "quam, ac urna eros est cras id cras, eleifend eu mattis nec.");
-
-        
+                + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                + "quam, ac urna eros est cras id cras, eleifend eu mattis nec."
+                + "Lorem ipsum dolor sit amet, lacus pharetra sed, sit a "
+                + "tortor. Id aliquam lorem pede, orci ut enim metus, diam nulla mi "
+                + "suspendisse tempor tortor. Eleifend lorem proin, morbi vel diam ut. "
+                + "Tempor est tellus vitae, pretium condimentum facilisis sit. Sagittis "
+                + "quam, ac urna eros est cras id cras, eleifend eu mattis nec.");
+
         VerticalLayout content = new VerticalLayout(editor);
         content.setMargin(true);
         setContent(content);
@@ -100,10 +99,11 @@ public class CSSInjectWithColorpicker extends UI {
         TextArea textLabel = new TextArea(null, text);
         textLabel.setWidth("100%");
         textLabel.setHeight("200px");
-        
-        // IMPORTANT: We are here setting the style name of the label, we are going to use this in our injected styles to target the label
+
+        // IMPORTANT: We are here setting the style name of the label, we are
+        // going to use this in our injected styles to target the label
         textLabel.setStyleName("text-label");
-        
+
         panelContent.addComponent(textLabel);
 
         return editor;
@@ -203,8 +203,8 @@ public class CSSInjectWithColorpicker extends UI {
      */
     private Component createFontSizeSelect() {
 
-        final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10,
-                12, 14, 16, 20, 25, 30, 40, 50));
+        final ComboBox select = new ComboBox(null, Arrays.asList(8, 9, 10, 12,
+                14, 16, 20, 25, 30, 40, 50));
         select.setWidth("100px");
         select.setValue(12);
         select.setInputPrompt("Font size");
@@ -213,7 +213,7 @@ public class CSSInjectWithColorpicker extends UI {
         select.setNullSelectionAllowed(false);
         select.setNewItemsAllowed(false);
         select.addValueChangeListener(new ValueChangeListener() {
-            
+
             @Override
             public void valueChange(ValueChangeEvent event) {
                 // Get the new font size
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java b/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java
index 5547c1077e..a2723beab3 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7a1/AutoGeneratingForm.java
@@ -46,7 +46,7 @@ public class AutoGeneratingForm extends UI {
         fieldGroup.setItemDataSource(new BeanItem<Person>(new Person("John",
                 "Doe", 34)));
 
-        // Loop through the properties, build fields for them and add the fields 
+        // Loop through the properties, build fields for them and add the fields
         // to this root
         for (Object propertyId : fieldGroup.getUnboundPropertyIds()) {
             layout.addComponent(fieldGroup.buildAndBind(propertyId));
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java b/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java
index 2152e05f14..da9c73dd94 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b6/OpeningUIInPopup.java
@@ -27,16 +27,17 @@ public class OpeningUIInPopup extends UI {
     protected void init(VaadinRequest request) {
         Button popupButton = new Button("Open popup with MyPopupUI");
 
-        BrowserWindowOpener popupOpener = new BrowserWindowOpener(MyPopupUI.class);
+        BrowserWindowOpener popupOpener = new BrowserWindowOpener(
+                MyPopupUI.class);
         popupOpener.setFeatures("height=300,width=300");
         popupOpener.extend(popupButton);
-        
+
         // Add a parameter
         popupOpener.setParameter("foo", "bar");
 
         // Set a fragment
         popupOpener.setUriFragment("myfragment");
-        
+
         setContent(popupButton);
     }
 
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
index 7aaf810355..59708f2bc7 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/CountView.java
@@ -14,6 +14,7 @@ public class CountView extends Panel implements View {
         setContent(new Label("Created: " + count++));
     }
 
+    @Override
     public void enter(ViewChangeEvent event) {
 
     }
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
index 3aa3e42a58..28f8443440 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/LoginView.java
@@ -28,6 +28,7 @@ public class LoginView extends Panel implements View {
         layout.addComponent(password);
 
         final Button login = new Button("Login", new Button.ClickListener() {
+            @Override
             public void buttonClick(ClickEvent event) {
                 Notification.show("Ok, let's pretend you're " + email);
 
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
index 3a1a685bbe..d37a39345f 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainView.java
@@ -42,6 +42,7 @@ public class MainView extends Panel implements View {
         layout.addComponent(lnk);
 
         logOut = new Button("Logout", new Button.ClickListener() {
+            @Override
             public void buttonClick(ClickEvent event) {
 
                 ((NavigationtestUI) UI.getCurrent()).setLoggedInUser(null);
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
index 0eac6a042e..861fd9f8a4 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/MainViewEarlierExample.java
@@ -41,6 +41,7 @@ public class MainViewEarlierExample extends Panel implements View {
         // login/logout toggle so we can test this
         Button logInOut = new Button("Toggle login",
                 new Button.ClickListener() {
+                    @Override
                     public void buttonClick(ClickEvent event) {
                         Object user = ((NavigationtestUI) UI.getCurrent())
                                 .getLoggedInUser();
diff --git a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
index 61492adc39..74c4e68b93 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/v7b9/SettingsView.java
@@ -43,6 +43,7 @@ public class SettingsView extends Panel implements View {
         date.setBuffered(true);
         // show buttons when date is changed
         date.addValueChangeListener(new ValueChangeListener() {
+            @Override
             public void valueChange(ValueChangeEvent event) {
                 hideOrShowButtons();
                 pendingViewAndParameters = null;
@@ -51,6 +52,7 @@ public class SettingsView extends Panel implements View {
 
         // commit the TextField changes when "Save" is clicked
         apply = new Button("Apply", new Button.ClickListener() {
+            @Override
             public void buttonClick(ClickEvent event) {
                 date.commit();
                 hideOrShowButtons();
@@ -61,6 +63,7 @@ public class SettingsView extends Panel implements View {
 
         // Discard the TextField changes when "Cancel" is clicked
         cancel = new Button("Cancel", new Button.ClickListener() {
+            @Override
             public void buttonClick(ClickEvent event) {
                 date.discard();
                 hideOrShowButtons();
@@ -72,6 +75,7 @@ public class SettingsView extends Panel implements View {
 
         // attach a listener so that we'll get asked isViewChangeAllowed?
         navigator.addViewChangeListener(new ViewChangeListener() {
+            @Override
             public boolean beforeViewChange(ViewChangeEvent event) {
                 if (event.getOldView() == SettingsView.this
                         && date.isModified()) {
@@ -93,6 +97,7 @@ public class SettingsView extends Panel implements View {
                 }
             }
 
+            @Override
             public void afterViewChange(ViewChangeEvent event) {
                 pendingViewAndParameters = null;
             }
-- 
cgit v1.2.3


From 309e3de9152ae9958e6e723ed348712b4b39452e Mon Sep 17 00:00:00 2001
From: johan <johan@vaadin.com>
Date: Mon, 8 Apr 2013 11:55:44 +0300
Subject: Implement range for date field (#6241)

Change-Id: I34458f676fede39e1992316cbed8d62193ce8509
---
 .../VAADIN/themes/base/datefield/datefield.scss    |  13 +-
 .../src/com/vaadin/client/ui/VCalendarPanel.java   | 416 +++++++++++++++++++--
 .../src/com/vaadin/client/ui/VPopupCalendar.java   |  24 ++
 .../ui/datefield/InlineDateFieldConnector.java     |   2 +
 .../ui/datefield/PopupDateFieldConnector.java      |   2 +
 server/src/com/vaadin/ui/DateField.java            | 175 +++++++++
 .../shared/ui/datefield/InlineDateFieldState.java  |   3 +-
 .../shared/ui/datefield/TextualDateFieldState.java |  14 +
 .../components/datefield/DateFieldRanges.java      | 270 +++++++++++++
 ...eCausesOutOfRangeExceptionIfImmediateField.html | 251 +++++++++++++
 ...dRangeEarlierThanStartRangeCausesException.html |  91 +++++
 .../DateFieldRanges_InitialDatesOutsideRange.html  | 121 ++++++
 ..._MonthChangeMeansFocusDayRolledInsideRange.html | 100 +++++
 ...rClickableIfRangeAcceptsFractionOfNextYear.html | 191 ++++++++++
 ...rClickableIfRangeAcceptsFractionOfPrevYear.html | 146 ++++++++
 ...es_SettingValueOutsideRangeCausesException.html | 136 +++++++
 16 files changed, 1915 insertions(+), 40 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/datefield/datefield.scss b/WebContent/VAADIN/themes/base/datefield/datefield.scss
index 1d3d408ed2..cbba9b46f3 100644
--- a/WebContent/VAADIN/themes/base/datefield/datefield.scss
+++ b/WebContent/VAADIN/themes/base/datefield/datefield.scss
@@ -59,10 +59,21 @@
 .v-disabled .#{$primaryStyleName}-calendarpanel-day-today {
 	cursor: default;
 }
-.#{$primaryStyleName}-calendarpanel-day-disabled {
+.#{$primaryStyleName}-calendarpanel-day-disabled,
+.#{$primaryStyleName}-calendarpanel-day-outside-range {
 	cursor: default;
 	opacity: .5;
 }
+
+.#{$primaryStyleName}-calendarpanel-prevyear,
+.#{$primaryStyleName}-calendarpanel-nextyear,
+.#{$primaryStyleName}-calendarpanel-prevmonth,
+.#{$primaryStyleName}-calendarpanel-nextmonth {
+	button.outside-range{
+		opacity: .5;
+ 	}
+}
+
 .#{$primaryStyleName}-calendarpanel-day-selected {
 	cursor: default;
 	background: #333;
diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java
index 3e81ec734b..311932b819 100644
--- a/client/src/com/vaadin/client/ui/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java
@@ -121,6 +121,8 @@ public class VCalendarPanel extends FocusableFlexTable implements
 
     private static final String CN_OFFMONTH = "offmonth";
 
+    private static final String CN_OUTSIDE_RANGE = "outside-range";
+
     /**
      * Represents a click handler for when a user selects a value by using the
      * mouse
@@ -136,6 +138,9 @@ public class VCalendarPanel extends FocusableFlexTable implements
         @Override
         public void onClick(ClickEvent event) {
             Date newDate = ((Day) event.getSource()).getDate();
+            if (!isDateInsideRange(newDate, Resolution.DAY)) {
+                return;
+            }
             if (newDate.getMonth() != displayedMonth.getMonth()
                     || newDate.getYear() != displayedMonth.getYear()) {
                 // If an off-month date was clicked, we must change the
@@ -298,7 +303,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
      * Updates year, month, day from focusedDate to value
      */
     private void selectFocused() {
-        if (focusedDate != null) {
+        if (focusedDate != null && isDateInsideRange(focusedDate, resolution)) {
             if (value == null) {
                 // No previously selected value (set to null on server side).
                 // Create a new date using current date and time
@@ -405,10 +410,13 @@ public class VCalendarPanel extends FocusableFlexTable implements
             prevMonth = new VEventButton();
             prevMonth.setHTML("&lsaquo;");
             prevMonth.setStyleName("v-button-prevmonth");
+
             prevMonth.setTabIndex(-1);
+
             nextMonth = new VEventButton();
             nextMonth.setHTML("&rsaquo;");
             nextMonth.setStyleName("v-button-nextmonth");
+
             nextMonth.setTabIndex(-1);
 
             setWidget(0, 3, nextMonth);
@@ -422,18 +430,23 @@ public class VCalendarPanel extends FocusableFlexTable implements
         }
 
         if (prevYear == null) {
+
             prevYear = new VEventButton();
             prevYear.setHTML("&laquo;");
             prevYear.setStyleName("v-button-prevyear");
+
             prevYear.setTabIndex(-1);
             nextYear = new VEventButton();
             nextYear.setHTML("&raquo;");
             nextYear.setStyleName("v-button-nextyear");
+
             nextYear.setTabIndex(-1);
             setWidget(0, 0, prevYear);
             setWidget(0, 4, nextYear);
         }
 
+        updateControlButtonRangeStyles(needsMonth);
+
         final String monthName = needsMonth ? getDateTimeService().getMonth(
                 displayedMonth.getMonth()) : "";
         final int year = displayedMonth.getYear() + 1900;
@@ -454,6 +467,48 @@ public class VCalendarPanel extends FocusableFlexTable implements
                 + "</span>");
     }
 
+    private void updateControlButtonRangeStyles(boolean needsMonth) {
+
+        if (focusedDate == null) {
+            return;
+        }
+
+        if (needsMonth) {
+            Date prevMonthDate = (Date) focusedDate.clone();
+            removeOneMonth(prevMonthDate);
+
+            if (!isDateInsideRange(prevMonthDate, Resolution.MONTH)) {
+                prevMonth.addStyleName(CN_OUTSIDE_RANGE);
+            } else {
+                prevMonth.removeStyleName(CN_OUTSIDE_RANGE);
+            }
+            Date nextMonthDate = (Date) focusedDate.clone();
+            addOneMonth(nextMonthDate);
+            if (!isDateInsideRange(nextMonthDate, Resolution.MONTH)) {
+                nextMonth.addStyleName(CN_OUTSIDE_RANGE);
+            } else {
+                nextMonth.removeStyleName(CN_OUTSIDE_RANGE);
+            }
+        }
+
+        Date prevYearDate = (Date) focusedDate.clone();
+        prevYearDate.setYear(prevYearDate.getYear() - 1);
+        if (!isDateInsideRange(prevYearDate, Resolution.YEAR)) {
+            prevYear.addStyleName(CN_OUTSIDE_RANGE);
+        } else {
+            prevYear.removeStyleName(CN_OUTSIDE_RANGE);
+        }
+
+        Date nextYearDate = (Date) focusedDate.clone();
+        nextYearDate.setYear(nextYearDate.getYear() + 1);
+        if (!isDateInsideRange(nextYearDate, Resolution.YEAR)) {
+            nextYear.addStyleName(CN_OUTSIDE_RANGE);
+        } else {
+            nextYear.removeStyleName(CN_OUTSIDE_RANGE);
+        }
+
+    }
+
     private DateTimeService getDateTimeService() {
         return dateTimeService;
     }
@@ -477,6 +532,107 @@ public class VCalendarPanel extends FocusableFlexTable implements
         this.showISOWeekNumbers = showISOWeekNumbers;
     }
 
+    /**
+     * Checks inclusively whether a date is inside a range of dates or not.
+     * 
+     * @param date
+     * @return
+     */
+    private boolean isDateInsideRange(Date date, Resolution minResolution) {
+        assert (date != null);
+
+        return isAcceptedByRangeEnd(date, minResolution)
+                && isAcceptedByRangeStart(date, minResolution);
+    }
+
+    /**
+     * Accepts dates greater than or equal to rangeStart, depending on the
+     * resolution. If the resolution is set to DAY, the range will compare on a
+     * day-basis. If the resolution is set to YEAR, only years are compared. So
+     * even if the range is set to one millisecond in next year, also next year
+     * will be included.
+     * 
+     * @param date
+     * @param minResolution
+     * @return
+     */
+    private boolean isAcceptedByRangeStart(Date date, Resolution minResolution) {
+        assert (date != null);
+
+        // rangeStart == null means that we accept all values below rangeEnd
+        if (rangeStart == null) {
+            return true;
+        }
+
+        Date valueDuplicate = (Date) date.clone();
+        Date rangeStartDuplicate = (Date) rangeStart.clone();
+
+        if (minResolution == Resolution.YEAR) {
+            return valueDuplicate.getYear() >= rangeStartDuplicate.getYear();
+        }
+        if (minResolution == Resolution.MONTH) {
+            valueDuplicate = clearDateBelowMonth(valueDuplicate);
+            rangeStartDuplicate = clearDateBelowMonth(rangeStartDuplicate);
+        } else {
+            valueDuplicate = clearDateBelowDay(valueDuplicate);
+            rangeStartDuplicate = clearDateBelowDay(rangeStartDuplicate);
+        }
+
+        return !rangeStartDuplicate.after(valueDuplicate);
+    }
+
+    /**
+     * Accepts dates earlier than or equal to rangeStart, depending on the
+     * resolution. If the resolution is set to DAY, the range will compare on a
+     * day-basis. If the resolution is set to YEAR, only years are compared. So
+     * even if the range is set to one millisecond in next year, also next year
+     * will be included.
+     * 
+     * @param date
+     * @param minResolution
+     * @return
+     */
+    private boolean isAcceptedByRangeEnd(Date date, Resolution minResolution) {
+        assert (date != null);
+
+        // rangeEnd == null means that we accept all values above rangeStart
+        if (rangeEnd == null) {
+            return true;
+        }
+
+        Date valueDuplicate = (Date) date.clone();
+        Date rangeEndDuplicate = (Date) rangeEnd.clone();
+
+        if (minResolution == Resolution.YEAR) {
+            return valueDuplicate.getYear() <= rangeEndDuplicate.getYear();
+        }
+        if (minResolution == Resolution.MONTH) {
+            valueDuplicate = clearDateBelowMonth(valueDuplicate);
+            rangeEndDuplicate = clearDateBelowMonth(rangeEndDuplicate);
+        } else {
+            valueDuplicate = clearDateBelowDay(valueDuplicate);
+            rangeEndDuplicate = clearDateBelowDay(rangeEndDuplicate);
+        }
+
+        return !rangeEndDuplicate.before(valueDuplicate);
+
+    }
+
+    private static Date clearDateBelowMonth(Date date) {
+        date.setDate(1);
+        return clearDateBelowDay(date);
+    }
+
+    private static Date clearDateBelowDay(Date date) {
+        date.setHours(0);
+        date.setMinutes(0);
+        date.setSeconds(0);
+        // Clearing milliseconds
+        long time = date.getTime() / 1000;
+        date = new Date(time * 1000);
+        return date;
+    }
+
     /**
      * Builds the day and time selectors of the calendar.
      */
@@ -563,10 +719,16 @@ public class VCalendarPanel extends FocusableFlexTable implements
             for (int dayOfWeek = 0; dayOfWeek < 7; dayOfWeek++) {
 
                 // Actually write the day of month
-                Day day = new Day((Date) curr.clone());
+                Date dayDate = (Date) curr.clone();
+                Day day = new Day(dayDate);
+
                 day.setStyleName(parent.getStylePrimaryName()
                         + "-calendarpanel-day");
 
+                if (!isDateInsideRange(dayDate, Resolution.DAY)) {
+                    day.addStyleDependentName(CN_OUTSIDE_RANGE);
+                }
+
                 if (curr.equals(selectedDate)) {
                     day.addStyleDependentName(CN_SELECTED);
                     Roles.getGridcellRole().setAriaSelectedState(
@@ -672,6 +834,17 @@ public class VCalendarPanel extends FocusableFlexTable implements
      * Moves the focus forward the given number of days.
      */
     private void focusNextDay(int days) {
+        if (focusedDate == null) {
+            return;
+        }
+
+        Date focusCopy = ((Date) focusedDate.clone());
+        focusCopy.setDate(focusedDate.getDate() + days);
+        if (!isDateInsideRange(focusCopy, resolution)) {
+            // If not inside allowed range, then do not move anything
+            return;
+        }
+
         int oldMonth = focusedDate.getMonth();
         int oldYear = focusedDate.getYear();
         focusedDate.setDate(focusedDate.getDate() + days);
@@ -681,6 +854,7 @@ public class VCalendarPanel extends FocusableFlexTable implements
             // Month did not change, only move the selection
             focusDay(focusedDate);
         } else {
+
             // If the month changed we need to re-render the calendar
             displayedMonth.setMonth(focusedDate.getMonth());
             displayedMonth.setYear(focusedDate.getYear());
@@ -700,38 +874,83 @@ public class VCalendarPanel extends FocusableFlexTable implements
      */
     private void focusNextMonth() {
 
-        int currentMonth = focusedDate.getMonth();
-        focusedDate.setMonth(currentMonth + 1);
+        if (focusedDate == null) {
+            return;
+        }
+        // Trying to request next month
+        Date requestedNextMonthDate = (Date) focusedDate.clone();
+        addOneMonth(requestedNextMonthDate);
+
+        if (!isDateInsideRange(requestedNextMonthDate, Resolution.MONTH)) {
+            return;
+        }
+
+        // Now also checking whether the day is inside the range or not. If not
+        // inside,
+        // correct it
+        if (!isDateInsideRange(requestedNextMonthDate, Resolution.DAY)) {
+            requestedNextMonthDate = adjustDateToFitInsideRange(requestedNextMonthDate);
+        }
+        focusedDate.setYear(requestedNextMonthDate.getYear());
+        focusedDate.setMonth(requestedNextMonthDate.getMonth());
+        focusedDate.setDate(requestedNextMonthDate.getDate());
+        displayedMonth.setMonth(displayedMonth.getMonth() + 1);
+
+        renderCalendar();
+    }
+
+    private static void addOneMonth(Date date) {
+        int currentMonth = date.getMonth();
         int requestedMonth = (currentMonth + 1) % 12;
 
+        date.setMonth(date.getMonth() + 1);
+
         /*
          * If the selected value was e.g. 31.3 the new value would be 31.4 but
          * this value is invalid so the new value will be 1.5. This is taken
          * care of by decreasing the value until we have the correct month.
          */
-        while (focusedDate.getMonth() != requestedMonth) {
-            focusedDate.setDate(focusedDate.getDate() - 1);
+        while (date.getMonth() != requestedMonth) {
+            date.setDate(date.getDate() - 1);
         }
-        displayedMonth.setMonth(displayedMonth.getMonth() + 1);
-
-        renderCalendar();
     }
 
-    /**
-     * Selects the previous month
-     */
-    private void focusPreviousMonth() {
-        int currentMonth = focusedDate.getMonth();
-        focusedDate.setMonth(currentMonth - 1);
+    private static void removeOneMonth(Date date) {
+        int currentMonth = date.getMonth();
+
+        date.setMonth(date.getMonth() - 1);
 
         /*
          * If the selected value was e.g. 31.12 the new value would be 31.11 but
          * this value is invalid so the new value will be 1.12. This is taken
          * care of by decreasing the value until we have the correct month.
          */
-        while (focusedDate.getMonth() == currentMonth) {
-            focusedDate.setDate(focusedDate.getDate() - 1);
+        while (date.getMonth() == currentMonth) {
+            date.setDate(date.getDate() - 1);
         }
+    }
+
+    /**
+     * Selects the previous month
+     */
+    private void focusPreviousMonth() {
+
+        if (focusedDate == null) {
+            return;
+        }
+        Date requestedPreviousMonthDate = (Date) focusedDate.clone();
+        removeOneMonth(requestedPreviousMonthDate);
+
+        if (!isDateInsideRange(requestedPreviousMonthDate, Resolution.MONTH)) {
+            return;
+        }
+
+        if (!isDateInsideRange(requestedPreviousMonthDate, Resolution.DAY)) {
+            requestedPreviousMonthDate = adjustDateToFitInsideRange(requestedPreviousMonthDate);
+        }
+        focusedDate.setYear(requestedPreviousMonthDate.getYear());
+        focusedDate.setMonth(requestedPreviousMonthDate.getMonth());
+        focusedDate.setDate(requestedPreviousMonthDate.getDate());
         displayedMonth.setMonth(displayedMonth.getMonth() - 1);
 
         renderCalendar();
@@ -741,16 +960,41 @@ public class VCalendarPanel extends FocusableFlexTable implements
      * Selects the previous year
      */
     private void focusPreviousYear(int years) {
-        int currentMonth = focusedDate.getMonth();
-        focusedDate.setYear(focusedDate.getYear() - years);
-        displayedMonth.setYear(displayedMonth.getYear() - years);
-        /*
-         * If the focused date was a leap day (Feb 29), the new date becomes Mar
-         * 1 if the new year is not also a leap year. Set it to Feb 28 instead.
-         */
-        if (focusedDate.getMonth() != currentMonth) {
-            focusedDate.setDate(0);
+
+        if (focusedDate == null) {
+            return;
         }
+        Date previousYearDate = (Date) focusedDate.clone();
+        previousYearDate.setYear(previousYearDate.getYear() - years);
+        // Do not focus if not inside range
+        if (!isDateInsideRange(previousYearDate, Resolution.YEAR)) {
+            return;
+        }
+        // If we remove one year, but have to roll back a bit, fit it
+        // into the calendar. Also the months have to be changed
+        if (!isDateInsideRange(previousYearDate, Resolution.DAY)) {
+            previousYearDate = adjustDateToFitInsideRange(previousYearDate);
+
+            focusedDate.setYear(previousYearDate.getYear());
+            focusedDate.setMonth(previousYearDate.getMonth());
+            focusedDate.setDate(previousYearDate.getDate());
+            displayedMonth.setYear(previousYearDate.getYear());
+            displayedMonth.setMonth(previousYearDate.getMonth());
+        } else {
+
+            int currentMonth = focusedDate.getMonth();
+            focusedDate.setYear(focusedDate.getYear() - years);
+            displayedMonth.setYear(displayedMonth.getYear() - years);
+            /*
+             * If the focused date was a leap day (Feb 29), the new date becomes
+             * Mar 1 if the new year is not also a leap year. Set it to Feb 28
+             * instead.
+             */
+            if (focusedDate.getMonth() != currentMonth) {
+                focusedDate.setDate(0);
+            }
+        }
+
         renderCalendar();
     }
 
@@ -758,16 +1002,41 @@ public class VCalendarPanel extends FocusableFlexTable implements
      * Selects the next year
      */
     private void focusNextYear(int years) {
-        int currentMonth = focusedDate.getMonth();
-        focusedDate.setYear(focusedDate.getYear() + years);
-        displayedMonth.setYear(displayedMonth.getYear() + years);
-        /*
-         * If the focused date was a leap day (Feb 29), the new date becomes Mar
-         * 1 if the new year is not also a leap year. Set it to Feb 28 instead.
-         */
-        if (focusedDate.getMonth() != currentMonth) {
-            focusedDate.setDate(0);
+
+        if (focusedDate == null) {
+            return;
+        }
+        Date nextYearDate = (Date) focusedDate.clone();
+        nextYearDate.setYear(nextYearDate.getYear() + years);
+        // Do not focus if not inside range
+        if (!isDateInsideRange(nextYearDate, Resolution.YEAR)) {
+            return;
         }
+        // If we add one year, but have to roll back a bit, fit it
+        // into the calendar. Also the months have to be changed
+        if (!isDateInsideRange(nextYearDate, Resolution.DAY)) {
+            nextYearDate = adjustDateToFitInsideRange(nextYearDate);
+
+            focusedDate.setYear(nextYearDate.getYear());
+            focusedDate.setMonth(nextYearDate.getMonth());
+            focusedDate.setDate(nextYearDate.getDate());
+            displayedMonth.setYear(nextYearDate.getYear());
+            displayedMonth.setMonth(nextYearDate.getMonth());
+        } else {
+
+            int currentMonth = focusedDate.getMonth();
+            focusedDate.setYear(focusedDate.getYear() + years);
+            displayedMonth.setYear(displayedMonth.getYear() + years);
+            /*
+             * If the focused date was a leap day (Feb 29), the new date becomes
+             * Mar 1 if the new year is not also a leap year. Set it to Feb 28
+             * instead.
+             */
+            if (focusedDate.getMonth() != currentMonth) {
+                focusedDate.setDate(0);
+            }
+        }
+
         renderCalendar();
     }
 
@@ -1265,6 +1534,20 @@ public class VCalendarPanel extends FocusableFlexTable implements
         }
     }
 
+    /**
+     * Adjusts a date to fit inside the range, only if outside
+     * 
+     * @param date
+     */
+    private Date adjustDateToFitInsideRange(Date date) {
+        if (rangeStart != null && rangeStart.after(date)) {
+            date = (Date) rangeStart.clone();
+        } else if (rangeEnd != null && rangeEnd.before(date)) {
+            date = (Date) rangeEnd.clone();
+        }
+        return date;
+    }
+
     /**
      * Sets the data of the Panel.
      * 
@@ -1277,12 +1560,42 @@ public class VCalendarPanel extends FocusableFlexTable implements
         if (currentDate == value && currentDate != null) {
             return;
         }
+        boolean currentDateWasAdjusted = false;
+        // Check that selected date is inside the allowed range
+        if (currentDate != null && !isDateInsideRange(currentDate, resolution)) {
+            currentDate = adjustDateToFitInsideRange(currentDate);
+            currentDateWasAdjusted = true;
+        }
 
         Date oldDisplayedMonth = displayedMonth;
         value = currentDate;
 
-        if (value == null) {
-            focusedDate = displayedMonth = null;
+        // If current date was adjusted, we will not select any date,
+        // since that will look like a date is selected. Instead we
+        // only focus on the adjusted value
+        if (value == null || currentDateWasAdjusted) {
+            // If ranges enabled, we may need to focus on a different view to
+            // potentially not get stuck
+            if (rangeStart != null || rangeEnd != null) {
+                Date dateThatFitsInsideRange = adjustDateToFitInsideRange(new Date());
+                focusedDate = new FocusedDate(
+                        dateThatFitsInsideRange.getYear(),
+                        dateThatFitsInsideRange.getMonth(),
+                        dateThatFitsInsideRange.getDate());
+                displayedMonth = new FocusedDate(
+                        dateThatFitsInsideRange.getYear(),
+                        dateThatFitsInsideRange.getMonth(), 1);
+                // value was adjusted. Set selected to null to not cause
+                // confusion, but this is only needed (and allowed) when we have
+                // a day
+                // resolution
+                if (getResolution().getCalendarField() >= Resolution.DAY
+                        .getCalendarField()) {
+                    value = null;
+                }
+            } else {
+                focusedDate = displayedMonth = null;
+            }
         } else {
             focusedDate = new FocusedDate(value.getYear(), value.getMonth(),
                     value.getDate());
@@ -1725,6 +2038,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
     private static final String SUBPART_DAY = "day";
     private static final String SUBPART_MONTH_YEAR_HEADER = "header";
 
+    private Date rangeStart;
+
+    private Date rangeEnd;
+
     @Override
     public String getSubPartName(Element subElement) {
         if (contains(nextMonth, subElement)) {
@@ -1888,4 +2205,29 @@ public class VCalendarPanel extends FocusableFlexTable implements
             }
         }
     }
+
+    /**
+     * Sets the start range for this component. The start range is inclusive,
+     * and it depends on the current resolution, what is considered inside the
+     * range.
+     * 
+     * @param startDate
+     *            - the allowed range's start date
+     */
+    public void setRangeStart(Date rangeStart) {
+        this.rangeStart = rangeStart;
+
+    }
+
+    /**
+     * Sets the end range for this component. The end range is inclusive, and it
+     * depends on the current resolution, what is considered inside the range.
+     * 
+     * @param endDate
+     *            - the allowed range's end date
+     */
+    public void setRangeEnd(Date rangeEnd) {
+        this.rangeEnd = rangeEnd;
+
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/VPopupCalendar.java b/client/src/com/vaadin/client/ui/VPopupCalendar.java
index aa34a1b4e3..87dd4061a7 100644
--- a/client/src/com/vaadin/client/ui/VPopupCalendar.java
+++ b/client/src/com/vaadin/client/ui/VPopupCalendar.java
@@ -581,4 +581,28 @@ public class VPopupCalendar extends VTextualDate implements Field,
     public String getDescriptionForAssistiveDevices() {
         return descriptionForAssisitveDevicesElement.getInnerText();
     }
+
+    /**
+     * Sets the start range for this component. The start range is inclusive,
+     * and it depends on the current resolution, what is considered inside the
+     * range.
+     * 
+     * @param startDate
+     *            - the allowed range's start date
+     */
+    public void setRangeStart(Date rangeStart) {
+        calendar.setRangeStart(rangeStart);
+    }
+
+    /**
+     * Sets the end range for this component. The end range is inclusive, and it
+     * depends on the current resolution, what is considered inside the range.
+     * 
+     * @param endDate
+     *            - the allowed range's end date
+     */
+    public void setRangeEnd(Date rangeEnd) {
+        calendar.setRangeEnd(rangeEnd);
+    }
+
 }
diff --git a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
index beff3eaa72..2fb40b3cdb 100644
--- a/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/InlineDateFieldConnector.java
@@ -114,6 +114,8 @@ public class InlineDateFieldConnector extends AbstractDateFieldConnector {
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
         getWidget().setTabIndex(getState().tabIndex);
+        getWidget().calendarPanel.setRangeStart(getState().rangeStart);
+        getWidget().calendarPanel.setRangeEnd(getState().rangeEnd);
     }
 
     @Override
diff --git a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
index f59ac713e8..b3bb481658 100644
--- a/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
+++ b/client/src/com/vaadin/client/ui/datefield/PopupDateFieldConnector.java
@@ -138,6 +138,8 @@ public class PopupDateFieldConnector extends TextualDateConnector {
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
         getWidget().setTextFieldEnabled(getState().textFieldEnabled);
+        getWidget().setRangeStart(getState().rangeStart);
+        getWidget().setRangeEnd(getState().rangeEnd);
     }
 
     @Override
diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java
index 78c86ceb00..c1c3ffe0bf 100644
--- a/server/src/com/vaadin/ui/DateField.java
+++ b/server/src/com/vaadin/ui/DateField.java
@@ -29,6 +29,7 @@ import com.vaadin.data.Property;
 import com.vaadin.data.Validator;
 import com.vaadin.data.Validator.InvalidValueException;
 import com.vaadin.data.util.converter.Converter;
+import com.vaadin.data.validator.DateRangeValidator;
 import com.vaadin.event.FieldEvents;
 import com.vaadin.event.FieldEvents.BlurEvent;
 import com.vaadin.event.FieldEvents.BlurListener;
@@ -38,6 +39,7 @@ import com.vaadin.server.PaintException;
 import com.vaadin.server.PaintTarget;
 import com.vaadin.shared.ui.datefield.DateFieldConstants;
 import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.shared.ui.datefield.TextualDateFieldState;
 
 /**
  * <p>
@@ -146,6 +148,10 @@ public class DateField extends AbstractField<Date> implements
     private TimeZone timeZone = null;
 
     private static Map<Resolution, String> variableNameForResolution = new HashMap<Resolution, String>();
+
+    private String dateOutOfRangeMessage = "Date is out of allowed range";
+
+    private DateRangeValidator currentRangeValidator;
     {
         variableNameForResolution.put(Resolution.SECOND, "sec");
         variableNameForResolution.put(Resolution.MINUTE, "min");
@@ -277,6 +283,174 @@ public class DateField extends AbstractField<Date> implements
         return super.shouldHideErrors() && uiHasValidDateString;
     }
 
+    @Override
+    protected TextualDateFieldState getState() {
+        return (TextualDateFieldState) super.getState();
+    }
+
+    @Override
+    protected TextualDateFieldState getState(boolean markAsDirty) {
+        return (TextualDateFieldState) super.getState(markAsDirty);
+    }
+
+    /**
+     * Sets the start range for this component. If the value is set before this
+     * date (taking the resolution into account), the component will not
+     * validate. If <code>startDate</code> is set to <code>null</code>, any
+     * value before <code>endDate</code> will be accepted by the range
+     * 
+     * @param startDate
+     *            - the allowed range's start date
+     */
+    public void setRangeStart(Date startDate) {
+        if (startDate != null && getState().rangeEnd != null
+                && startDate.after(getState().rangeEnd)) {
+            throw new IllegalStateException(
+                    "startDate cannot be later than endDate");
+        }
+        getState().rangeStart = startDate;
+        // rangeStart = startDate;
+        // This has to be done to correct for the resolution
+        // updateRangeState();
+        updateRangeValidator();
+    }
+
+    /**
+     * Sets the current error message if the range validation fails.
+     * 
+     * @param dateOutOfRangeMessage
+     *            - Localizable message which is shown when value (the date) is
+     *            set outside allowed range
+     */
+    public void setDateOutOfRangeMessage(String dateOutOfRangeMessage) {
+        this.dateOutOfRangeMessage = dateOutOfRangeMessage;
+        updateRangeValidator();
+    }
+
+    /**
+     * Gets the end range for a certain resolution. The range is inclusive, so
+     * if rangeEnd is set to zero milliseconds past year n and resolution is set
+     * to YEAR, any date in year n will be accepted. Resolutions lower than DAY
+     * will be interpreted on a DAY level. That is, everything below DATE is
+     * cleared
+     * 
+     * @param forResolution
+     *            - the range conforms to the resolution
+     * @return
+     */
+    private Date getRangeEnd(Resolution forResolution) {
+        // We need to set the correct resolution for the dates,
+        // otherwise the range validator will complain
+
+        Date rangeEnd = getState(false).rangeEnd;
+        if (rangeEnd == null) {
+            return null;
+        }
+
+        Calendar endCal = Calendar.getInstance();
+        endCal.setTime(rangeEnd);
+
+        if (forResolution == Resolution.YEAR) {
+            // Adding one year (minresolution) and clearing the rest.
+            endCal.set(endCal.get(Calendar.YEAR) + 1, 0, 1, 0, 0, 0);
+        } else if (forResolution == Resolution.MONTH) {
+            // Adding one month (minresolution) and clearing the rest.
+            endCal.set(endCal.get(Calendar.YEAR),
+                    endCal.get(Calendar.MONTH) + 1, 1, 0, 0, 0);
+        } else {
+            endCal.set(endCal.get(Calendar.YEAR), endCal.get(Calendar.MONTH),
+                    endCal.get(Calendar.DATE) + 1, 0, 0, 0);
+        }
+        // removing one millisecond will now get the endDate to return to
+        // current resolution's set time span (year or month)
+        endCal.set(Calendar.MILLISECOND, -1);
+        return endCal.getTime();
+    }
+
+    /**
+     * Gets the start range for a certain resolution. The range is inclusive, so
+     * if <code>rangeStart</code> is set to one millisecond before year n and
+     * resolution is set to YEAR, any date in year n - 1 will be accepted.
+     * Lowest supported resolution is DAY.
+     * 
+     * @param forResolution
+     *            - the range conforms to the resolution
+     * @return
+     */
+    private Date getRangeStart(Resolution forResolution) {
+        if (getState(false).rangeStart == null) {
+            return null;
+        }
+        Calendar startCal = Calendar.getInstance();
+        startCal.setTime(getState(false).rangeStart);
+
+        if (forResolution == Resolution.YEAR) {
+            startCal.set(startCal.get(Calendar.YEAR), 0, 1, 0, 0, 0);
+        } else if (forResolution == Resolution.MONTH) {
+            startCal.set(startCal.get(Calendar.YEAR),
+                    startCal.get(Calendar.MONTH), 1, 0, 0, 0);
+        } else {
+            startCal.set(startCal.get(Calendar.YEAR),
+                    startCal.get(Calendar.MONTH), startCal.get(Calendar.DATE),
+                    0, 0, 0);
+        }
+
+        startCal.set(Calendar.MILLISECOND, 0);
+        return startCal.getTime();
+    }
+
+    private void updateRangeValidator() {
+        if (currentRangeValidator != null) {
+            removeValidator(currentRangeValidator);
+        }
+
+        currentRangeValidator = new DateRangeValidator(dateOutOfRangeMessage,
+                getRangeStart(resolution), getRangeEnd(resolution), null);
+
+        addValidator(currentRangeValidator);
+
+    }
+
+    /**
+     * Sets the end range for this component. If the value is set after this
+     * date (taking the resolution into account), the component will not
+     * validate. If <code>endDate</code> is set to <code>null</code>, any value
+     * after <code>startDate</code> will be accepted by the range.
+     * 
+     * @param endDate
+     *            - the allowed range's end date (inclusive, based on the
+     *            current resolution)
+     */
+    public void setRangeEnd(Date endDate) {
+        if (endDate != null && getState().rangeStart != null
+                && getState().rangeStart.after(endDate)) {
+            throw new IllegalStateException(
+                    "endDate cannot be earlier than startDate");
+        }
+        // rangeEnd = endDate;
+        getState().rangeEnd = endDate;
+        updateRangeValidator();
+    }
+
+    /**
+     * Returns the precise rangeStart used.
+     * 
+     * @param startDate
+     * 
+     */
+    public Date getRangeStart() {
+        return getState(false).rangeStart;
+    }
+
+    /**
+     * Returns the precise rangeEnd used.
+     * 
+     * @param startDate
+     */
+    public Date getRangeEnd() {
+        return getState(false).rangeEnd;
+    }
+
     /*
      * Invoked when a variable of the component changes. Don't add a JavaDoc
      * comment here, we use the default documentation from implemented
@@ -572,6 +746,7 @@ public class DateField extends AbstractField<Date> implements
      */
     public void setResolution(Resolution resolution) {
         this.resolution = resolution;
+        updateRangeValidator();
         markAsDirty();
     }
 
diff --git a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
index 405f89d538..d15d8de100 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
@@ -15,9 +15,8 @@
  */
 package com.vaadin.shared.ui.datefield;
 
-import com.vaadin.shared.AbstractFieldState;
 
-public class InlineDateFieldState extends AbstractFieldState {
+public class InlineDateFieldState extends TextualDateFieldState {
     {
         primaryStyleName = "v-inline-datefield";
     }
diff --git a/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
index c34f3d8eda..11ad4cdb59 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/TextualDateFieldState.java
@@ -15,10 +15,24 @@
  */
 package com.vaadin.shared.ui.datefield;
 
+import java.util.Date;
+
 import com.vaadin.shared.AbstractFieldState;
 
 public class TextualDateFieldState extends AbstractFieldState {
     {
         primaryStyleName = "v-datefield";
     }
+
+    /*
+     * Start range that has been cleared, depending on the resolution of the
+     * date field
+     */
+    public Date rangeStart = null;
+
+    /*
+     * End range that has been cleared, depending on the resolution of the date
+     * field
+     */
+    public Date rangeEnd = null;
 }
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java
new file mode 100644
index 0000000000..2daa3e3f96
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges.java
@@ -0,0 +1,270 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Calendar;
+import java.util.Date;
+import java.util.Locale;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.MarginInfo;
+import com.vaadin.shared.ui.datefield.Resolution;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.GridLayout;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.NativeSelect;
+import com.vaadin.ui.VerticalLayout;
+
+public class DateFieldRanges extends AbstractTestUI {
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 6241;
+    }
+
+    private Label label = new Label();
+    private NativeSelect resoSelect = new NativeSelect("Resolution");
+    private DateField fromRange = new DateField("Range start");
+    private DateField toRange = new DateField("Range end");
+    private DateField valueDF = new DateField("Value");
+    private CheckBox immediateCB = new CheckBox("Immediate");
+    private Button recreate = new Button("Recreate static datefields");
+    private Button clearRangeButton = new Button("Clear range");
+
+    private GridLayout currentStaticContainer;
+
+    private DateField inlineDynamicDateField;
+    private DateField dynamicDateField;
+
+    private Calendar createCalendar() {
+        Calendar c = Calendar.getInstance();
+        c.set(2013, 3, 26, 6, 1, 12);
+        return c;
+    }
+
+    private Date newDate() {
+        return createCalendar().getTime();
+    }
+
+    private void initializeControlFields() {
+        resoSelect.addItem(Resolution.MINUTE);
+        resoSelect.addItem(Resolution.SECOND);
+        resoSelect.addItem(Resolution.HOUR);
+        resoSelect.addItem(Resolution.DAY);
+        resoSelect.addItem(Resolution.MONTH);
+        resoSelect.addItem(Resolution.YEAR);
+        resoSelect.setImmediate(true);
+        resoSelect.setValue(Resolution.DAY);
+        resoSelect.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                Resolution r = (Resolution) resoSelect.getValue();
+                inlineDynamicDateField.setResolution(r);
+                dynamicDateField.setResolution(r);
+
+            }
+        });
+
+        fromRange.setValue(null);
+        fromRange.setImmediate(true);
+        fromRange.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                inlineDynamicDateField.setRangeStart(fromRange.getValue());
+                dynamicDateField.setRangeStart(fromRange.getValue());
+
+            }
+        });
+
+        toRange.setValue(null);
+        toRange.setImmediate(true);
+        toRange.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                inlineDynamicDateField.setRangeEnd(toRange.getValue());
+                dynamicDateField.setRangeEnd(toRange.getValue());
+
+            }
+        });
+
+        valueDF.setValue(null);
+        valueDF.setImmediate(true);
+        valueDF.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                inlineDynamicDateField.setValue(valueDF.getValue());
+                dynamicDateField.setValue(valueDF.getValue());
+
+            }
+        });
+
+        immediateCB.setValue(true);
+        immediateCB.setImmediate(true);
+        immediateCB.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+
+                inlineDynamicDateField.setImmediate(immediateCB.getValue());
+                dynamicDateField.setImmediate(immediateCB.getValue());
+
+            }
+        });
+
+        recreate.addClickListener(new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                GridLayout newContainer = createStaticFields();
+                replaceComponent(currentStaticContainer, newContainer);
+                currentStaticContainer = newContainer;
+            }
+        });
+
+        clearRangeButton.addClickListener(new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                fromRange.setValue(null);
+                toRange.setValue(null);
+            }
+        });
+
+        Calendar startCal = createCalendar();
+        Calendar endCal = createCalendar();
+        endCal.add(Calendar.DATE, 30);
+
+        dynamicDateField = createDateField(startCal.getTime(),
+                endCal.getTime(), null, Resolution.DAY, false);
+        inlineDynamicDateField = createDateField(startCal.getTime(),
+                endCal.getTime(), null, Resolution.DAY, true);
+
+        resoSelect.setId("resoSelect");
+        fromRange.setId("fromRange");
+        toRange.setId("toRange");
+        valueDF.setId("valueDF");
+        immediateCB.setId("immediateCB");
+        recreate.setId("recreate");
+        clearRangeButton.setId("clearRangeButton");
+        dynamicDateField.setId("dynamicDateField");
+        inlineDynamicDateField.setId("inlineDynamicDateField");
+
+    }
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        setLocale(new Locale("en", "US"));
+        getLayout().setWidth(100, Unit.PERCENTAGE);
+        getLayout().setHeight(null);
+        getLayout().setMargin(new MarginInfo(true, false, false, false));
+        getLayout().setSpacing(true);
+
+        initializeControlFields();
+
+        GridLayout gl = new GridLayout(2, 2);
+        gl.setSpacing(true);
+
+        gl.addComponent(dynamicDateField);
+        gl.addComponent(inlineDynamicDateField);
+
+        HorizontalLayout hl = new HorizontalLayout();
+        hl.setSpacing(true);
+        hl.addComponent(resoSelect);
+        hl.addComponent(fromRange);
+        hl.addComponent(toRange);
+        hl.addComponent(valueDF);
+        hl.addComponent(immediateCB);
+        hl.addComponent(recreate);
+        hl.addComponent(clearRangeButton);
+        addComponent(hl);
+        addComponent(new Label("Dynamic DateFields"));
+        addComponent(gl);
+        currentStaticContainer = createStaticFields();
+        addComponent(new Label("Static DateFields"));
+        addComponent(currentStaticContainer);
+
+        addComponent(label);
+
+    }
+
+    private GridLayout createStaticFields() {
+        Calendar startCal = createCalendar();
+        Calendar endCal = createCalendar();
+        endCal.add(Calendar.DATE, 30);
+        GridLayout gl = new GridLayout(2, 2);
+        gl.setSpacing(true);
+        DateField df = createDateField(startCal.getTime(), endCal.getTime(),
+                null, Resolution.DAY, false);
+        gl.addComponent(df);
+        DateField inline = createDateField(startCal.getTime(),
+                endCal.getTime(), null, Resolution.DAY, true);
+        gl.addComponent(inline);
+        inline.setId("staticInline");
+        VerticalLayout vl = new VerticalLayout();
+
+        return gl;
+    }
+
+    private DateField createDateField(Date rangeStart, Date rangeEnd,
+            Date value, Resolution resolution, boolean inline) {
+
+        DateField df = null;
+
+        if (inline) {
+            df = new InlineDateField();
+        } else {
+            df = new DateField();
+        }
+
+        final DateField gg = df;
+        updateValuesForDateField(df);
+
+        df.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                label.setValue((gg.getValue() == null ? "Nothing" : gg
+                        .getValue().toString())
+                        + " selected. isValid: "
+                        + gg.isValid());
+            }
+        });
+        return df;
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Not defined yet";
+
+    }
+
+    private void updateValuesForDateField(DateField df) {
+        Date fromVal = fromRange.getValue();
+        Date toVal = toRange.getValue();
+        Date value = valueDF.getValue();
+        Resolution r = (Resolution) resoSelect.getValue();
+        boolean immediate = immediateCB.getValue();
+
+        df.setValue(value);
+        df.setResolution(r);
+        df.setRangeStart(fromVal);
+        df.setRangeEnd(toVal);
+        df.setImmediate(immediate);
+
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
new file mode 100644
index 0000000000..e6b498c6f7
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
@@ -0,0 +1,251 @@
+<?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="" />
+<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.DateFieldRanges?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>59,10</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4/4/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>36,13</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>2</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>2</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>2/2/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>48,13</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5/5/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>50,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[8]</td>
+	<td>12,14</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>April 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#popupButton</td>
+	<td>14,15</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[15]</td>
+	<td>14,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[15]</td>
+	<td>14,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[4]/span</td>
+	<td>18,12</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>March 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>April 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextNotPresent</td>
+	<td>April 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[7]</td>
+	<td>15,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[7]</td>
+	<td>15,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>14,14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[12]</td>
+	<td>18,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[12]</td>
+	<td>12,10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[11]</td>
+	<td>17,14</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>February 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='staticInline']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td>
+	<td>14,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='inlineDynamicDateField']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td>
+	<td>15,6</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='staticInline']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[8]/span</td>
+	<td>14,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//div[@id='inlineDynamicDateField']/table/tbody/tr[2]/td/table/tbody/tr[2]/td[8]/span</td>
+	<td>19,4</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
new file mode 100644
index 0000000000..e0c5721c27
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
@@ -0,0 +1,91 @@
+<?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="" />
+<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.DateFieldRanges?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>44,6</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>4/4/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>41,14</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>3</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>3</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>3/3/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>33,9</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//div[@id='gwt-uid-16']/span[2]</td>
+	<td>v-errorindicator</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html
new file mode 100644
index 0000000000..eeeda5270b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_InitialDatesOutsideRange.html
@@ -0,0 +1,121 @@
+<?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="" />
+<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.DateFieldRanges</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>39,14</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1/1/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>31,13</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>2</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1/2/11</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>111</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1/1/10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>52,12</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[5]/VButton[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VGridLayout[0]/domChild[2]/domChild[0]/domChild[0]</td>
+	<td>v-errorindicator</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
new file mode 100644
index 0000000000..6e1ca024cb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_MonthChangeMeansFocusDayRolledInsideRange.html
@@ -0,0 +1,100 @@
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.datefield.DateFieldRanges</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>27,11</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>1/1/10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>47,10</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>2</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>2</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>2/2/10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>15,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VGridLayout[0]/VPopupCalendar[0]#popupButton</td>
+	<td>9,14</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>id=PID_VAADIN_POPUPCAL</td>
+	<td>left</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>id=PID_VAADIN_POPUPCAL</td>
+	<td>left</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[3]/span</td>
+	<td>January 2010</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>id=PID_VAADIN_POPUPCAL</td>
+	<td>right</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr/td[3]/span</td>
+	<td>February 2010</td>
+</tr>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html
new file mode 100644
index 0000000000..f5d7ee97ca
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_NextYearClickableIfRangeAcceptsFractionOfNextYear.html
@@ -0,0 +1,191 @@
+<?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="" />
+<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.DateFieldRanges</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>37,13</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>1/1/15</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>35,7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>12</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>12</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>12/12/14</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>40,10</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2014</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[8]</td>
+	<td>11,8</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>January 2015</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[7]</td>
+	<td>13,10</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>January 2015</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[8]</td>
+	<td>6,7</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>January 2015</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>15,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[5]</td>
+	<td>8,8</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>select</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td>
+	<td>label=MONTH</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[8]</td>
+	<td>13,11</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>January 2015</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>12,13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[5]</td>
+	<td>12,13</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2013</td>
+	<td></td>
+</tr>
+<tr>
+	<td>select</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SresoSelect/domChild[0]</td>
+	<td>label=YEAR</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>8,12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>8,12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>8,12</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>2015</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html
new file mode 100644
index 0000000000..4c671b266d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_PrevYearClickableIfRangeAcceptsFractionOfPrevYear.html
@@ -0,0 +1,146 @@
+<?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="" />
+<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.DateFieldRanges</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>33,10</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>12</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>12</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>12/12/10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>32,9</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>11</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>enter</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>1/1/11</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>January 2011</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[5]</td>
+	<td>13,12</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2010</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[6]</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2010</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[5]</td>
+	<td>5,0</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>December 2010</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[7]</td>
+	<td>16,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[7]</td>
+	<td>16,9</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[8]</td>
+	<td>19,8</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>February 2012</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html
new file mode 100644
index 0000000000..c3f7e021a8
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_SettingValueOutsideRangeCausesException.html
@@ -0,0 +1,136 @@
+<?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="" />
+<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.DateFieldRanges</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>36,8</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
+	<td>4/4/12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>40,11</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>3</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>3</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
+	<td>3/3/12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>40,5</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5</td>
+</tr>
+<tr>
+	<td>pressSpecialKey</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>shift 7</td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
+	<td>5/5/12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]</td>
+	<td>393,89</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#popupButton</td>
+	<td>10,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=(//button[@type='button'])[17]</td>
+	<td>12,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[5]/span</td>
+	<td>13,9</td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>May 2012</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From 8a2e8ff43e477f6269dc21469efee044d65e12b8 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 5 Apr 2013 18:41:52 +0300
Subject: Fixed broken tests

* Added missing screenshot identifiers
* Removed redundant test
* DebugConsole -> DebugWindow
* Updated test to show why serialization fails
* Fixed problems caused by added maximize button

Change-Id: I5cf76fec7170747120b7243f9693851cd52c12af
---
 .../calendar/CalendarSizeTest1000x600px.html       |  4 +-
 .../CalendarSizeTest100percentXundefined.html      |  4 +-
 .../calendar/CalendarSizeTest100x100percent.html   |  4 +-
 .../calendar/CalendarSizeTest300pxXundefined.html  |  4 +-
 .../calendar/CalendarSizeTestSizeFull.html         | 41 ----------------
 .../CalendarSizeTestUndefinedX100percent.html      |  4 +-
 .../calendar/CalendarSizeTestUndefinedX300px.html  |  4 +-
 .../CalendarSizeTestUndefinedXUndefined.html       |  4 +-
 .../tests/components/ui/UIInitException.html       |  4 +-
 .../tests/components/ui/UISerialization.java       | 56 ++++++++++++----------
 .../tests/components/window/CloseSubWindow.html    |  7 +--
 .../tests/components/window/CloseSubWindow.java    |  2 +-
 .../tests/components/window/SubWindowOrder.html    |  6 +--
 .../window/WindowMaximizeRestoreTest.html          |  2 +-
 .../window/WindowWithInvalidCloseListener.html     |  2 +-
 .../com/vaadin/tests/debug/DebugWindowPresent.html | 16 +++----
 .../tests/requesthandlers/AppResource404.html      |  7 ++-
 17 files changed, 69 insertions(+), 102 deletions(-)
 delete mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
index 66d2c2f126..bd4c671361 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest1000x600px.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
index 7c963f547f..64b5444d34 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100percentXundefined.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
index 19f03db784..0905034b13 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest100x100percent.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
index 70f6dbd75b..99327a01df 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTest300pxXundefined.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html
deleted file mode 100644
index 59d39226d9..0000000000
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestSizeFull.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<?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="" />
-<title>sizeTestSizeFull</title>
-</head>
-<body>
-<table cellpadding="1" cellspacing="1" border="1">
-<thead>
-<tr><td rowspan="1" colspan="3">sizeTestSizeFull</td></tr>
-</thead><tbody>
-<tr>
-	<td>open</td>
-	<td>/run/com.vaadin.tests.components.calendar.CalendarTest?testBench&amp;restartApplication</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[1]/Slot[1]/VLabel[0]</td>
-	<td>Jan 2000</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[2]/domChild[0]/domChild[0]</td>
-	<td>9,56</td>
-</tr>
-<tr>
-	<td>screenCapture</td>
-	<td></td>
-	<td></td>
-</tr>
-</tbody></table>
-</body>
-</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
index d48917904c..2e4c811ff1 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX100percent.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
index 2dfce00635..cca66c7145 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedX300px.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
index 3bfae6be35..e4a8da691b 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarSizeTestUndefinedXUndefined.html
@@ -24,7 +24,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>month</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -34,7 +34,7 @@
 <tr>
 	<td>screenCapture</td>
 	<td></td>
-	<td></td>
+	<td>week</td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
index c2b1b33059..68b11e7942 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
+++ b/uitest/src/com/vaadin/tests/components/ui/UIInitException.html
@@ -17,9 +17,9 @@
 	<td></td>
 </tr>
 <tr>
-	<td>assertText</td>
-	<td>//html/body/div/pre</td>
+	<td>assertTextPresent</td>
 	<td>Catch me if you can</td>
+	<td></td>
 </tr>
 </tbody></table>
 </body>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
index 5f3d8d97de..90021a0bf4 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UISerialization.java
@@ -20,15 +20,19 @@ import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
+import java.io.PrintWriter;
 import java.io.Serializable;
+import java.io.StringWriter;
 import java.util.Date;
 
 import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.tests.util.Log;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.Label;
 
 public class UISerialization extends AbstractTestUI {
 
@@ -42,21 +46,29 @@ public class UISerialization extends AbstractTestUI {
             @Override
             public void buttonClick(ClickEvent event) {
                 Date d = new Date();
-                byte[] result = serialize(UISerialization.this);
-                long elapsed = new Date().getTime() - d.getTime();
-                log.log("Serialized UI in " + elapsed + "ms into "
-                        + result.length + " bytes");
-                Object diffStateBefore = getConnectorTracker().getDiffState(
-                        UISerialization.this);
-                UISerialization app = (UISerialization) deserialize(result);
-                log.log("Deserialized UI in " + elapsed + "ms");
-                Object diffStateAfter = getConnectorTracker().getDiffState(
-                        UISerialization.this);
-                if (diffStateBefore.equals(diffStateAfter)) {
-                    log.log("Diff states match, size: "
-                            + diffStateBefore.toString().length());
-                } else {
-                    log.log("Diff states do not match");
+                try {
+                    byte[] result = serialize(UISerialization.this);
+                    long elapsed = new Date().getTime() - d.getTime();
+                    log.log("Serialized UI in " + elapsed + "ms into "
+                            + result.length + " bytes");
+                    Object diffStateBefore = getConnectorTracker()
+                            .getDiffState(UISerialization.this);
+                    UISerialization app = (UISerialization) deserialize(result);
+                    log.log("Deserialized UI in " + elapsed + "ms");
+                    Object diffStateAfter = getConnectorTracker().getDiffState(
+                            UISerialization.this);
+                    if (diffStateBefore.equals(diffStateAfter)) {
+                        log.log("Diff states match, size: "
+                                + diffStateBefore.toString().length());
+                    } else {
+                        log.log("Diff states do not match");
+                    }
+                } catch (Exception e) {
+                    log.log("Exception caught: " + e.getMessage());
+                    StringWriter sw = new StringWriter();
+                    e.printStackTrace(new PrintWriter(sw));
+                    addComponent(new Label(sw.toString(),
+                            ContentMode.PREFORMATTED));
                 }
 
             }
@@ -64,20 +76,16 @@ public class UISerialization extends AbstractTestUI {
     }
 
     protected void serializeInstance(Class<?> cls)
-            throws InstantiationException, IllegalAccessException {
+            throws InstantiationException, IllegalAccessException, IOException {
         serialize((Serializable) cls.newInstance());
     }
 
-    protected byte[] serialize(Serializable serializable) {
+    protected byte[] serialize(Serializable serializable) throws IOException {
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         ObjectOutputStream oos;
-        try {
-            oos = new ObjectOutputStream(os);
-            oos.writeObject(serializable);
-            return os.toByteArray();
-        } catch (IOException e) {
-            throw new RuntimeException("Serialization failed", e);
-        }
+        oos = new ObjectOutputStream(os);
+        oos.writeObject(serializable);
+        return os.toByteArray();
     }
 
     protected Object deserialize(byte[] result) {
diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html
index 6e3eb906b7..ac81dfdefb 100644
--- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html
+++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.html
@@ -16,11 +16,6 @@
 	<td>/run/com.vaadin.tests.components.window.CloseSubWindow?restartApplication</td>
 	<td></td>
 </tr>
-<tr>
-	<td>waitForVaadin</td>
-	<td></td>
-	<td></td>
-</tr>
 <tr>
 	<td>click</td>
 	<td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::PID_Sopensub/domChild[0]/domChild[0]</td>
@@ -45,7 +40,7 @@
 <!--Click close in title bar-->
 <tr>
 	<td>click</td>
-	<td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentswindowCloseSubWindow::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td></td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
index e2a59b6005..6aad3e9170 100644
--- a/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
+++ b/uitest/src/com/vaadin/tests/components/window/CloseSubWindow.java
@@ -33,7 +33,7 @@ public class CloseSubWindow extends TestBase {
     private Window createClosableSubWindow(final String title) {
         VerticalLayout layout = new VerticalLayout();
         layout.setMargin(true);
-        layout.setSizeFull();
+        layout.setSizeUndefined();
         final Window window = new Window(title, layout);
         window.setSizeUndefined();
         window.setClosable(true);
diff --git a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html
index 0476de6c35..8374a90b52 100644
--- a/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html
+++ b/uitest/src/com/vaadin/tests/components/window/SubWindowOrder.html
@@ -90,7 +90,7 @@
 <!--Close window 4, which is the topmost window-->
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[3]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,15</td>
 </tr>
 <tr>
@@ -101,7 +101,7 @@
 <!--Close Dialog 3 (topmost)-->
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>6,8</td>
 </tr>
 <!--Make Dialog 5 (topmost) non-modal-->
@@ -139,7 +139,7 @@
 <!--Close dialog 5-->
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentswindowSubWindowOrder::/VWindow[2]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,5</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
index 090579d81d..ed76caed54 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -170,7 +170,7 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-original-pos-window-1-centered</td>
+	<td>window-2-original-pos-window-1-centered-again</td>
 	<td></td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html
index 923276b613..fa63e5e1e6 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html
+++ b/uitest/src/com/vaadin/tests/components/window/WindowWithInvalidCloseListener.html
@@ -18,7 +18,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowWithInvalidCloseListener::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>6,7</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
index 11640ef6c3..fb4c266db1 100644
--- a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
+++ b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
@@ -28,7 +28,7 @@
 </tr>
 <tr>
 	<td>assertElementPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -38,7 +38,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -48,7 +48,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -58,7 +58,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -68,7 +68,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -78,7 +78,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -88,7 +88,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
@@ -98,7 +98,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 </tbody></table>
diff --git a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html
index 16f3db6a1a..543faa30dd 100644
--- a/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html
+++ b/uitest/src/com/vaadin/tests/requesthandlers/AppResource404.html
@@ -53,7 +53,12 @@
 </tr>
 <tr>
 	<td>assertTextPresent</td>
-	<td>/APP can not be found</td>
+	<td>HTTP ERROR 404</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>Problem accessing /run/APP/</td>
 	<td></td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From 6f593d5847389edfc9dbb7bb65114dc4be6066ae Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Wed, 10 Apr 2013 10:21:59 +0300
Subject: Don't process push messages until init JSON is processed (#11529)

* The test is not running reliably in all browsers, but assuming this is
a symptom of other push issues and not related to this particular bug.

Change-Id: I848b57502aa01467b0f60624cf599247ec76f32f
---
 .../com/vaadin/client/ApplicationConnection.java   | 65 ++++++++++++++++++++--
 uitest/src/com/vaadin/tests/push/PushFromInit.html | 32 +++++++++++
 uitest/src/com/vaadin/tests/push/PushFromInit.java | 36 ++++++++++++
 3 files changed, 128 insertions(+), 5 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/push/PushFromInit.html
 create mode 100644 uitest/src/com/vaadin/tests/push/PushFromInit.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 0341a9d5c4..2fa82c6004 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -183,6 +183,19 @@ public class ApplicationConnection {
 
     protected boolean applicationRunning = false;
 
+    /**
+     * Keep track of whether the initialization JSON has been handled. We should
+     * not process any push messages until the initial JSON has been processed.
+     */
+    private boolean initJsonHandled = false;
+
+    /**
+     * Keep track of any push messages that arrive before
+     * {@link #initJsonHandled} is set to true.
+     */
+    private JsArrayString incommingPushMessageQueue = JsArrayString
+            .createArray().cast();
+
     private boolean hasActiveRequest = false;
 
     /**
@@ -1114,6 +1127,26 @@ public class ApplicationConnection {
             checkForPendingVariableBursts();
             runPostRequestHooks(configuration.getRootPanelId());
         }
+
+        if (!initJsonHandled) {
+            /*
+             * Assume that the first request that is fully handled is the one
+             * with the initialization data.
+             */
+            initJsonHandled = true;
+
+            int queueLength = incommingPushMessageQueue.length();
+            if (queueLength > 0) {
+                VConsole.log("Init handled, processing " + queueLength
+                        + " enqueued messages");
+                for (int i = 0; i < queueLength; i++) {
+                    handlePushMessage(incommingPushMessageQueue.get(i));
+                }
+                incommingPushMessageQueue.setLength(0);
+            }
+
+        }
+
         // deferring to avoid flickering
         Scheduler.get().scheduleDeferred(new Command() {
             @Override
@@ -1258,6 +1291,14 @@ public class ApplicationConnection {
             return;
         }
 
+        /*
+         * Lock response handling to avoid a situation where something pushed
+         * from the server gets processed while waiting for e.g. lazily loaded
+         * connectors that are needed for processing the current message.
+         */
+        final Object lock = new Object();
+        suspendReponseHandling(lock);
+
         VConsole.log("Handling message from server");
         eventBus.fireEvent(new ResponseHandlingStartedEvent(this));
 
@@ -1476,6 +1517,7 @@ public class ApplicationConnection {
                     // not sent asynchronously
                     endRequest();
                 }
+                resumeResponseHandling(lock);
 
                 if (Profiler.isEnabled()) {
                     Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@@ -3264,11 +3306,19 @@ public class ApplicationConnection {
      * suspended.
      */
     private void handlePendingMessages() {
-        for (PendingUIDLMessage pending : pendingUIDLMessages) {
-            handleUIDLMessage(pending.getStart(), pending.getJsonText(),
-                    pending.getJson());
+        if (!pendingUIDLMessages.isEmpty()) {
+            /*
+             * Clear the list before processing enqueued messages to support
+             * reentrancy
+             */
+            List<PendingUIDLMessage> pendingMessages = pendingUIDLMessages;
+            pendingUIDLMessages = new ArrayList<PendingUIDLMessage>();
+
+            for (PendingUIDLMessage pending : pendingMessages) {
+                handleReceivedJSONMessage(pending.getStart(),
+                        pending.getJsonText(), pending.getJson());
+            }
         }
-        pendingUIDLMessages.clear();
     }
 
     private boolean handleErrorInDelegate(String details, int statusCode) {
@@ -3348,6 +3398,11 @@ public class ApplicationConnection {
     }
 
     public void handlePushMessage(String message) {
-        handleJSONText(message, 200);
+        if (initJsonHandled) {
+            handleJSONText(message, 200);
+        } else {
+            VConsole.log("Enqueuing push message has init has not yet been handled");
+            incommingPushMessageQueue.push(message);
+        }
     }
 }
diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.html b/uitest/src/com/vaadin/tests/push/PushFromInit.html
new file mode 100644
index 0000000000..d009eb3baf
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/PushFromInit.html
@@ -0,0 +1,32 @@
+<?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="" />
+<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-push/com.vaadin.tests.push.PushFromInit?debug&amp;restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>waitForText</td>
+	<td>vaadin=runpushcomvaadintestspushPushFromInit::PID_SLog_row_1</td>
+	<td>1. Logged in init</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushPushFromInit::PID_SLog_row_0</td>
+	<td>2. Logged from background thread started in init</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java
new file mode 100644
index 0000000000..c43739ec04
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/PushFromInit.java
@@ -0,0 +1,36 @@
+package com.vaadin.tests.push;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+
+public class PushFromInit extends AbstractTestUIWithLog {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        new Thread() {
+            @Override
+            public void run() {
+                runSafely(new Runnable() {
+                    @Override
+                    public void run() {
+                        log("Logged from background thread started in init");
+                    }
+                });
+            }
+        }.start();
+        log("Logged in init");
+        addComponent(new Button("Sync"));
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Pusing something to a newly created UI should not cause race conditions";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(11529);
+    }
+
+}
-- 
cgit v1.2.3


From fd4f1d280e8eb6a453868db01b8accc1e7b8d0b1 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 9 Apr 2013 01:01:48 +0300
Subject: Fixed test to close windows instead of maximizing them

Change-Id: I4c1bd7d8962f30cf756512e8d8e1f198b9604ec2
---
 .../com/vaadin/tests/components/uitest/base_theme_test.html    | 10 +++++-----
 .../vaadin/tests/components/uitest/chameleon_theme_test.html   | 10 +++++-----
 .../com/vaadin/tests/components/uitest/liferay_theme_test.html | 10 +++++-----
 .../vaadin/tests/components/uitest/reindeer_theme_test.html    | 10 +++++-----
 .../com/vaadin/tests/components/uitest/runo_theme_test.html    | 10 +++++-----
 5 files changed, 25 insertions(+), 25 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html
index 0308a09a16..614ae7bcda 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html
+++ b/uitest/src/com/vaadin/tests/components/uitest/base_theme_test.html
@@ -289,7 +289,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,8</td>
 </tr>
 <tr>
@@ -304,7 +304,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,6</td>
 </tr>
 <tr>
@@ -319,7 +319,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,5</td>
 </tr>
 <tr>
@@ -334,7 +334,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,6</td>
 </tr>
 <tr>
@@ -349,7 +349,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,7</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html
index fb00029d8f..7d9ffc65b8 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html
+++ b/uitest/src/com/vaadin/tests/components/uitest/chameleon_theme_test.html
@@ -289,7 +289,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,8</td>
 </tr>
 <tr>
@@ -304,7 +304,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,6</td>
 </tr>
 <tr>
@@ -319,7 +319,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,5</td>
 </tr>
 <tr>
@@ -334,7 +334,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,6</td>
 </tr>
 <tr>
@@ -349,7 +349,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,7</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html
index 193c648916..d0ee96c7ef 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html
+++ b/uitest/src/com/vaadin/tests/components/uitest/liferay_theme_test.html
@@ -289,7 +289,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,8</td>
 </tr>
 <tr>
@@ -304,7 +304,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,6</td>
 </tr>
 <tr>
@@ -319,7 +319,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,5</td>
 </tr>
 <tr>
@@ -334,7 +334,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,6</td>
 </tr>
 <tr>
@@ -349,7 +349,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,7</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html
index b1340831bc..a330f5bf61 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html
+++ b/uitest/src/com/vaadin/tests/components/uitest/reindeer_theme_test.html
@@ -289,7 +289,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,8</td>
 </tr>
 <tr>
@@ -304,7 +304,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,6</td>
 </tr>
 <tr>
@@ -319,7 +319,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,5</td>
 </tr>
 <tr>
@@ -334,7 +334,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,6</td>
 </tr>
 <tr>
@@ -349,7 +349,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,7</td>
 </tr>
 <tr>
diff --git a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html
index fadc503abd..61ba58a0e6 100644
--- a/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html
+++ b/uitest/src/com/vaadin/tests/components/uitest/runo_theme_test.html
@@ -289,7 +289,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,8</td>
 </tr>
 <tr>
@@ -304,7 +304,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,6</td>
 </tr>
 <tr>
@@ -319,7 +319,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,5</td>
 </tr>
 <tr>
@@ -334,7 +334,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>9,6</td>
 </tr>
 <tr>
@@ -349,7 +349,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runThemeTestUI::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>10,7</td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From 150352f64cdb49a27b110bd32e049c307fcf3486 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Fri, 5 Apr 2013 18:33:55 +0300
Subject: Implemented poll interval for UI (#11495)

Change-Id: Ic56b0123970f18e282c75d67863569ac55c72ea8
---
 .../com/vaadin/client/ApplicationConnection.java   | 17 ++++
 .../src/com/vaadin/client/ui/ui/UIConnector.java   | 38 +++++++++
 server/src/com/vaadin/ui/UI.java                   | 34 ++++++++
 .../shared/communication/MethodInvocation.java     | 27 +++++++
 .../src/com/vaadin/shared/ui/ui/UIServerRpc.java   |  7 ++
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |  1 +
 .../com/vaadin/tests/components/ui/UIPolling.html  | 53 +++++++++++++
 .../com/vaadin/tests/components/ui/UIPolling.java  | 90 ++++++++++++++++++++++
 8 files changed, 267 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIPolling.html
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/UIPolling.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 2fa82c6004..2cc5a85996 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -2387,6 +2387,23 @@ public class ApplicationConnection {
         }
     }
 
+    /**
+     * Removes any pending invocation of the given method from the queue
+     * 
+     * @param invocation
+     *            The invocation to remove
+     */
+    public void removePendingInvocations(MethodInvocation invocation) {
+        Iterator<MethodInvocation> iter = pendingInvocations.values()
+                .iterator();
+        while (iter.hasNext()) {
+            MethodInvocation mi = iter.next();
+            if (mi.equals(invocation)) {
+                iter.remove();
+            }
+        }
+    }
+
     /**
      * This method sends currently queued variable changes to server. It is
      * called when immediate variable update must happen.
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 07481063c3..f3b4f36670 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -37,6 +37,7 @@ import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
@@ -61,6 +62,7 @@ import com.vaadin.client.ui.layout.MayScrollChildren;
 import com.vaadin.client.ui.window.WindowConnector;
 import com.vaadin.server.Page.Styles;
 import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.communication.MethodInvocation;
 import com.vaadin.shared.ui.ComponentStateUtil;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.Connect.LoadStyle;
@@ -417,6 +419,8 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
 
     };
 
+    private Timer pollTimer = null;
+
     @Override
     public void updateCaption(ComponentConnector component) {
         // NOP The main view never draws caption for its layout
@@ -580,5 +584,39 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
             getConnection().getLoadingIndicator().setDelayStateDelay(
                     getState().loadingIndicatorConfiguration.delayStateDelay);
         }
+
+        if (stateChangeEvent.hasPropertyChanged("pollInterval")) {
+            configurePolling();
+        }
+    }
+
+    private void configurePolling() {
+        if (pollTimer != null) {
+            pollTimer.cancel();
+            pollTimer = null;
+        }
+        if (getState().pollInterval >= 0) {
+            pollTimer = new Timer() {
+                @Override
+                public void run() {
+                    /*
+                     * Verify that polling has not recently been canceled. This
+                     * is needed because Timer.cancel() does not always work
+                     * properly in IE 8 until GWT issue 8101 has been fixed.
+                     */
+                    if (pollTimer != null) {
+                        getRpcProxy(UIServerRpc.class).poll();
+                        // Send changes even though poll is @Delayed
+                        getConnection().sendPendingVariableChanges();
+                    }
+                }
+            };
+            pollTimer.scheduleRepeating(getState().pollInterval);
+        } else {
+            // Ensure no more polls are sent as polling has been disabled
+            getConnection().removePendingInvocations(
+                    new MethodInvocation(getConnectorId(), UIServerRpc.class
+                            .getName(), "poll"));
+        }
     }
 }
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 2d9f49b122..6160978542 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -148,6 +148,14 @@ public abstract class UI extends AbstractSingleComponentContainer implements
             UI.this.scrollTop = scrollTop;
             UI.this.scrollLeft = scrollLeft;
         }
+
+        @Override
+        public void poll() {
+            /*
+             * No-op. This is only called to cause a server visit to check for
+             * changes.
+             */
+        }
     };
 
     /**
@@ -1171,4 +1179,30 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     public void setPushConnection(PushConnection connection) {
         pushConnection = connection;
     }
+
+    /**
+     * Sets the interval with which the UI should poll the server to see if
+     * there are any changes. Polling is disabled by default.
+     * <p>
+     * Note that it is possible to enable push and polling at the same time but
+     * it should not be done to avoid excessive server traffic.
+     * </p>
+     * 
+     * @param intervalInMillis
+     *            The interval (in ms) with which the UI should poll the server
+     *            or -1 to disable polling
+     */
+    public void setPollInterval(int intervalInMillis) {
+        getState().pollInterval = intervalInMillis;
+    }
+
+    /**
+     * Returns the interval with which the UI polls the server.
+     * 
+     * @return The interval (in ms) with which the UI polls the server or -1 if
+     *         polling is disabled
+     */
+    public int getPollInterval() {
+        return getState(false).pollInterval;
+    }
 }
diff --git a/shared/src/com/vaadin/shared/communication/MethodInvocation.java b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
index 417ced76be..d5bf8324ef 100644
--- a/shared/src/com/vaadin/shared/communication/MethodInvocation.java
+++ b/shared/src/com/vaadin/shared/communication/MethodInvocation.java
@@ -19,6 +19,8 @@ package com.vaadin.shared.communication;
 import java.io.Serializable;
 import java.util.Arrays;
 
+import com.vaadin.shared.util.SharedUtil;
+
 /**
  * Information needed by the framework to send an RPC method invocation from the
  * client to the server or vice versa.
@@ -85,4 +87,29 @@ public class MethodInvocation implements Serializable {
         return connectorId + "-" + getInterfaceName() + "-" + getMethodName();
     }
 
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof MethodInvocation)) {
+            return false;
+        }
+        MethodInvocation other = (MethodInvocation) obj;
+        if (!SharedUtil.equals(getConnectorId(), other.getConnectorId())) {
+            return false;
+        }
+
+        if (!SharedUtil.equals(getInterfaceName(), other.getInterfaceName())) {
+            return false;
+        }
+
+        if (!SharedUtil.equals(getMethodName(), other.getMethodName())) {
+            return false;
+        }
+
+        if (!SharedUtil.equals(getParameters(), other.getParameters())) {
+            return false;
+        }
+
+        return true;
+
+    }
 }
\ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
index 358ba2e24e..576ee83980 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIServerRpc.java
@@ -26,4 +26,11 @@ public interface UIServerRpc extends ClickRpc, ServerRpc {
 
     @Delayed(lastOnly = true)
     public void scroll(int scrollTop, int scrollLeft);
+
+    @Delayed(lastOnly = true)
+    /*
+     * @Delayed just to get lastOnly semantics, sendPendingVariableChanges()
+     * should always be called to ensure the message is flushed right away.
+     */
+    public void poll();
 }
\ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index d5ee4c30e6..fbb6427c6f 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -22,6 +22,7 @@ import com.vaadin.shared.ui.TabIndexState;
 public class UIState extends TabIndexState {
     public TooltipConfiguration tooltipConfiguration = new TooltipConfiguration();
     public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration();
+    public int pollInterval = -1;
 
     public static class LoadingIndicatorConfiguration implements Serializable {
         public int initialDelay = 300;
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.html b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html
new file mode 100644
index 0000000000..0e3cc2bc6e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html
@@ -0,0 +1,53 @@
+<?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/run/" />
+<title>WindowMaximizeRestoreTest</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">WindowMaximizeRestoreTest</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/UIPolling?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>id=gwt-uid-5</td>
+	<td>500</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<!--Ensure polling has taken place-->
+<tr>
+	<td>assertTextPresent</td>
+	<td>2. 1000ms has passed</td>
+	<td></td>
+</tr>
+<tr>
+	<td>type</td>
+	<td>id=gwt-uid-5</td>
+	<td>-1</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<!--Ensure polling has stopped-->
+<tr>
+	<td>assertTextNotPresent</td>
+	<td>8. 4000ms has passed</td>
+	<td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java
new file mode 100644
index 0000000000..a7add63801
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.components.ui;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.MethodProperty;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.TextField;
+
+public class UIPolling extends AbstractTestUIWithLog {
+
+    protected static final long SLEEP_TIME = 500;
+
+    private class BackgroundLogger extends Thread {
+
+        @Override
+        public void run() {
+            int i = 0;
+            while (true) {
+                i++;
+                try {
+                    Thread.sleep(SLEEP_TIME);
+                } catch (InterruptedException e) {
+                }
+                final int iteration = i;
+                runSafely(new Runnable() {
+                    @Override
+                    public void run() {
+                        log.log((iteration * SLEEP_TIME) + "ms has passed");
+                    }
+                });
+            }
+        }
+    }
+
+    private BackgroundLogger logger = null;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        log = new Log(20);
+        log.setNumberLogRows(true);
+        TextField pollingInterval = new TextField("Poll interval",
+                new MethodProperty<Integer>(this, "pollInterval"));
+        pollingInterval.setImmediate(true);
+        pollingInterval.setValue("-1");
+        pollingInterval.addValueChangeListener(new ValueChangeListener() {
+
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                if (logger != null) {
+                    logger.stop();
+                    logger = null;
+                }
+                if (getPollInterval() >= 0) {
+                    logger = new BackgroundLogger();
+                    logger.start();
+                }
+            }
+        });
+        addComponent(pollingInterval);
+
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests the polling feature of UI. Set the polling interval using the text field. Enabling polling will at the same time start a background thread which logs every 500ms";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11495;
+    }
+
+}
-- 
cgit v1.2.3


From c89b2e6556b1432cb2b5f9de2868f3104b7ff000 Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Thu, 11 Apr 2013 13:47:51 +0300
Subject: TestBench test for Button (#11581)

Makes sure the WAI-ARIA functions work

Change-Id: If3835f038f5cca009bef678fdfe037d4287ece7e
---
 client/src/com/vaadin/client/ui/VButton.java       |  4 +-
 .../tests/components/button/ButtonsWaiAria.html    | 82 ++++++++++++++++++++++
 .../tests/components/button/ButtonsWaiAria.java    | 51 ++++++++++++++
 3 files changed, 136 insertions(+), 1 deletion(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
 create mode 100644 uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VButton.java b/client/src/com/vaadin/client/ui/VButton.java
index 28a2221380..c67a9f8747 100644
--- a/client/src/com/vaadin/client/ui/VButton.java
+++ b/client/src/com/vaadin/client/ui/VButton.java
@@ -357,12 +357,14 @@ public class VButton extends FocusWidget implements ClickHandler {
             this.enabled = enabled;
             if (!enabled) {
                 cleanupCaptureState();
+                Roles.getButtonRole().setAriaDisabledState(getElement(),
+                        !enabled);
                 super.setTabIndex(-1);
             } else {
+                Roles.getButtonRole().removeAriaDisabledState(getElement());
                 super.setTabIndex(tabIndex);
             }
 
-            Roles.getButtonRole().setAriaDisabledState(getElement(), !enabled);
         }
     }
 
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
new file mode 100644
index 0000000000..42c39ca0ed
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
@@ -0,0 +1,82 @@
+<?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://127.0.0.1:8080/" />
+<title>ButtonsWaiAria</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ButtonsWaiAria</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.button.ButtonsWaiAria?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>verifyElementPresent</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]@role</td>
+	<td>button</td>
+</tr>
+<tr>
+	<td>verifyElementPresent</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementPresent</td>
+	<td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div[5]/div/span/img[@alt='']</td>
+	<td></td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]@alt</td>
+	<td>emptyAlt</td>
+</tr>
+<tr>
+	<td>verifyElementPresent</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]@alt</td>
+	<td>user icon</td>
+</tr>
+<tr>
+	<td>verifyElementPresent</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::PID_Scheckboxaction-Enabled/domChild[0]</td>
+	<td>7,7</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/@aria-disabled</td>
+	<td>true</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::PID_Scheckboxaction-Enabled/domChild[0]</td>
+	<td>7,7</td>
+</tr>
+<tr>
+	<td>assertElementNotPresent</td>
+	<td>/html/body/div/div/div[2]/div/div[2]/div/div[3]/div[@aria-disabled]</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java
new file mode 100644
index 0000000000..1208b8be3b
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.java
@@ -0,0 +1,51 @@
+package com.vaadin.tests.components.button;
+
+import com.vaadin.tests.components.ComponentTestCase;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.NativeButton;
+
+public class ButtonsWaiAria extends ComponentTestCase<Button> {
+
+    @Override
+    protected Class<Button> getTestClass() {
+        return Button.class;
+    }
+
+    @Override
+    protected void initializeComponents() {
+
+        Button l;
+        boolean nat = false;
+
+        l = createButton("Default Button", nat);
+        addTestComponent(l);
+
+        l = createButton("Icon Button, empty alt", nat);
+        l.setIcon(ICON_16_USER_PNG_CACHEABLE);
+        addTestComponent(l);
+
+        l = createButton("Icon Button with alt", nat);
+        l.setIcon(ICON_16_USER_PNG_CACHEABLE, "user icon");
+        addTestComponent(l);
+
+        l = createButton("Tooltip Button", nat);
+        l.setDescription("Tooltip");
+        addTestComponent(l);
+    }
+
+    private Button createButton(String text, boolean nativeButton) {
+        Button b;
+        if (nativeButton) {
+            b = new NativeButton(text);
+        } else {
+            b = new Button(text);
+        }
+
+        return b;
+    }
+
+    @Override
+    protected String getDescription() {
+        return "A generic test for Buttons in different configurations";
+    }
+}
-- 
cgit v1.2.3


From 5dfbd29c46b4b7885e719d9320da0c4894c0a126 Mon Sep 17 00:00:00 2001
From: Marc Englund <marc@vaadin.com>
Date: Mon, 15 Apr 2013 10:45:32 +0300
Subject: Fixes test (locator) and quiet mode for DebugWindow #11603

Change-Id: If80e903bec9cb4dbd9dc87d0994634f4eaf0b9ae
Ticket: 11603
---
 .../com/vaadin/client/debug/internal/ConsoleAdapter.java    | 13 ++++++++++---
 uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html   |  2 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java b/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java
index 13ec8a43ff..4b9e831ec5 100644
--- a/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java
+++ b/client/src/com/vaadin/client/debug/internal/ConsoleAdapter.java
@@ -114,16 +114,23 @@ public class ConsoleAdapter implements Console {
         window.meta(applicationConnection, meta);
     }
 
+    private boolean quietMode = false;
+
     @Override
-    public void setQuietMode(boolean quietDebugMode) {
-        if (quietDebugMode) {
+    public void setQuietMode(boolean quietMode) {
+        this.quietMode = quietMode;
+        if (quietMode) {
             window.close();
+        } else {
+            // NOP can't switch ATM
         }
     }
 
     @Override
     public void init() {
-        window.init();
+        if (!quietMode) {
+            window.init();
+        }
     }
 
     static void handleError(Throwable e, Console target) {
diff --git a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
index fb4c266db1..ff5c731e5c 100644
--- a/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
+++ b/uitest/src/com/vaadin/tests/debug/DebugWindowPresent.html
@@ -18,7 +18,7 @@
 </tr>
 <tr>
 	<td>assertElementPresent</td>
-	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugConsole[0]</td>
+	<td>vaadin=runcomvaadintestsdebugDebugWindowPresent::Root/VDebugWindow[0]</td>
 	<td></td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From 224cd8e24ac133e00685dc03c0cf30832589421a Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Mon, 15 Apr 2013 16:01:51 +0300
Subject: Simple test for testing push capabilities #11494

Change-Id: I7dc3b861c2fa19bd1cffad93911c525fc5a2d24c
---
 uitest/src/com/vaadin/tests/push/BasicPush.html |  88 ++++++++++++++++++++
 uitest/src/com/vaadin/tests/push/BasicPush.java | 102 ++++++++++++++++++++++++
 2 files changed, 190 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/push/BasicPush.html
 create mode 100644 uitest/src/com/vaadin/tests/push/BasicPush.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.html b/uitest/src/com/vaadin/tests/push/BasicPush.html
new file mode 100644
index 0000000000..f69a573425
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.html
@@ -0,0 +1,88 @@
+<?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-push/com.vaadin.tests.push.BasicPush?restartApplication&amp;debug</td>
+	<td></td>
+</tr>
+<!--Test client initiated push -->
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>0</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>4</td>
+</tr>
+<!--Test server initiated push-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>0</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>3000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>3000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java
new file mode 100644
index 0000000000..17d107bb8c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.java
@@ -0,0 +1,102 @@
+package com.vaadin.tests.push;
+
+import java.util.Date;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import com.vaadin.data.util.ObjectProperty;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.label.ContentMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+
+public class BasicPush extends AbstractTestUI {
+
+    private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0);
+
+    private ObjectProperty<Integer> counter2 = new ObjectProperty<Integer>(0);
+
+    private final Timer timer = new Timer(true);
+
+    private final TimerTask task = new TimerTask() {
+
+        @Override
+        public void run() {
+            runSafely(new Runnable() {
+                @Override
+                public void run() {
+                    counter2.setValue(counter2.getValue() + 1);
+                }
+            });
+        }
+    };
+
+    @Override
+    protected void setup(VaadinRequest request) {
+
+        spacer();
+
+        /*
+         * Client initiated push.
+         */
+        Label lbl = new Label(counter);
+        lbl.setCaption("Client counter (click 'increment' to update):");
+        addComponent(lbl);
+
+        addComponent(new Button("Increment", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                counter.setValue(counter.getValue() + 1);
+            }
+        }));
+
+        spacer();
+
+        /*
+         * Server initiated push.
+         */
+        lbl = new Label(counter2);
+        lbl.setCaption("Server counter (updates each 3s by server thread) :");
+        addComponent(lbl);
+
+        addComponent(new Button("Reset", new Button.ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                counter2.setValue(0);
+            }
+        }));
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "This test tests the very basic operations of push. "
+                + "It tests that client initiated changes are "
+                + "recieved back to the client as well as server "
+                + "initiated changes are correctly updated to the client.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11494;
+    }
+
+    private void spacer() {
+        addComponent(new Label("<hr/>", ContentMode.HTML));
+    }
+
+    @Override
+    public void attach() {
+        super.attach();
+        timer.scheduleAtFixedRate(task, new Date(), 3000);
+    }
+
+    @Override
+    public void detach() {
+        super.detach();
+        timer.cancel();
+    }
+}
-- 
cgit v1.2.3


From 847389883fc5203624cc5df804c953fc5db19da6 Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Wed, 17 Apr 2013 10:41:07 +0300
Subject: Fix for WAI-ARIA Button test for IE8 (#11616)

Test for empty attribute fails

Change-Id: Id0b992482454daa7c47674e152fb1b414fd4a38d
---
 uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html | 5 -----
 1 file changed, 5 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
index 42c39ca0ed..8d10438c1d 100644
--- a/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
+++ b/uitest/src/com/vaadin/tests/components/button/ButtonsWaiAria.html
@@ -36,11 +36,6 @@
 	<td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div[5]/div/span/img[@alt='']</td>
 	<td></td>
 </tr>
-<tr>
-	<td>storeAttribute</td>
-	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]@alt</td>
-	<td>emptyAlt</td>
-</tr>
 <tr>
 	<td>verifyElementPresent</td>
 	<td>vaadin=runcomvaadintestscomponentsbuttonButtonsWaiAria::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/</td>
-- 
cgit v1.2.3


From 0f75f202d333ac507fb3e5efb8e9bd4d4719e098 Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Wed, 17 Apr 2013 11:46:19 +0300
Subject: Added test for testing push with different transports #11494

Change-Id: I0296bdee1925ba93ca7e4e65c68215e025d072f6
---
 build/ide.xml                                      | 19 ++++-
 .../client/communication/PushConnection.java       | 34 +++++++--
 uitest/src/com/vaadin/tests/push/BasicPush.java    |  3 +
 .../src/com/vaadin/tests/push/StreamingPush.html   | 88 ++++++++++++++++++++++
 .../tests/widgetset/TestingWidgetSet.gwt.xml       |  4 +
 .../widgetset/client/TestingPushConnection.java    | 30 ++++++++
 6 files changed, 169 insertions(+), 9 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/push/StreamingPush.html
 create mode 100644 uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java

(limited to 'uitest/src')

diff --git a/build/ide.xml b/build/ide.xml
index 5b27488d59..e040dc5c8c 100755
--- a/build/ide.xml
+++ b/build/ide.xml
@@ -82,8 +82,22 @@
 		</java>
 
 	</target>
+	
+	
 	<target name="default-widgetset">
-		<property name="module" value="com.vaadin.DefaultWidgetSet" />
+		<antcall target="compile-widgetset">
+			<param name="widgetset" value="com.vaadin.DefaultWidgetSet" />
+		</antcall>
+	</target>
+	
+	<target name="testing-widgetset">
+		<antcall target="compile-widgetset">
+			<param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet" />
+		</antcall>
+	</target>
+	
+	<target name="compile-widgetset">
+		<property name="module" value="${widgetset}" />
 		<property name="module.output.dir" location="WebContent/VAADIN/widgetsets" />
 		<property name="style" value="PRETTY" />
 		<property name="localWorkers" value="2" />
@@ -119,6 +133,5 @@
 			<jvmarg value="-Djava.awt.headless=true" />
 			<jvmarg value="-Dgwt.usearchives=false" />
 		</java>
-
-	</target>
+	</target>		
 </project>
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/communication/PushConnection.java b/client/src/com/vaadin/client/communication/PushConnection.java
index 0731d513ea..e3d2e576e6 100644
--- a/client/src/com/vaadin/client/communication/PushConnection.java
+++ b/client/src/com/vaadin/client/communication/PushConnection.java
@@ -42,7 +42,7 @@ public class PushConnection {
 
     private boolean connected = false;
 
-    private AtmosphereConfiguration config = createConfig();
+    private AtmosphereConfiguration config;
 
     public PushConnection() {
     }
@@ -72,7 +72,10 @@ public class PushConnection {
         }
     }
 
-    protected JavaScriptObject getConfig() {
+    protected AtmosphereConfiguration getConfig() {
+        if (config == null) {
+            config = createConfig();
+        }
         return config;
     }
 
@@ -102,8 +105,8 @@ public class PushConnection {
      */
     protected void onTransportFailure() {
         VConsole.log("Push connection using primary method ("
-                + config.getTransport() + ") failed. Trying with "
-                + config.getFallbackTransport());
+                + getConfig().getTransport() + ") failed. Trying with "
+                + getConfig().getFallbackTransport());
     }
 
     /**
@@ -112,7 +115,8 @@ public class PushConnection {
      * 
      */
     protected void onError() {
-        VConsole.error("Push connection using " + config.getTransport()
+        VConsole.error("Push connection using "
+                + getConfig().getTransport()
                 + " failed!");
     }
 
@@ -126,11 +130,21 @@ public class PushConnection {
            return this[key];
          }-*/;
 
+        protected final native void setStringValue(String key, String value)
+        /*-{
+            this[key] = value;
+        }-*/;
+
         protected final native int getIntValue(String key)
         /*-{
            return this[key];
          }-*/;
 
+        protected final native void setIntValue(String key, int value)
+        /*-{
+            this[key] = value;
+        }-*/;
+
     }
 
     public static class AtmosphereConfiguration extends AbstractJSO {
@@ -146,6 +160,14 @@ public class PushConnection {
         public final String getFallbackTransport() {
             return getStringValue("fallbackTransport");
         }
+
+        public final void setTransport(String transport) {
+            setStringValue("transport", transport);
+        }
+
+        public final void setFallbackTransport(String fallbackTransport) {
+            setStringValue("fallbackTransport", fallbackTransport);
+        }
     }
 
     public static class AtmosphereResponse extends AbstractJSO {
@@ -172,7 +194,7 @@ public class PushConnection {
 
     }
 
-    private static native AtmosphereConfiguration createConfig()
+    protected native AtmosphereConfiguration createConfig()
     /*-{
         return {
             transport: 'websocket',
diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java
index 17d107bb8c..43f8236999 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPush.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.java
@@ -4,14 +4,17 @@ import java.util.Date;
 import java.util.Timer;
 import java.util.TimerTask;
 
+import com.vaadin.annotations.Widgetset;
 import com.vaadin.data.util.ObjectProperty;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.shared.ui.label.ContentMode;
 import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
 import com.vaadin.ui.Label;
 
+@Widgetset(TestingWidgetSet.NAME)
 public class BasicPush extends AbstractTestUI {
 
     private ObjectProperty<Integer> counter = new ObjectProperty<Integer>(0);
diff --git a/uitest/src/com/vaadin/tests/push/StreamingPush.html b/uitest/src/com/vaadin/tests/push/StreamingPush.html
new file mode 100644
index 0000000000..533f571b9c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/StreamingPush.html
@@ -0,0 +1,88 @@
+<?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-push/com.vaadin.tests.push.BasicPush?restartApplication&amp;debug&amp;transport=streaming</td>
+	<td></td>
+</tr>
+<!--Test client initiated push -->
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>0</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-5</td>
+	<td>4</td>
+</tr>
+<!--Test server initiated push-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>0</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>3000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>3000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>id=gwt-uid-7</td>
+	<td>2</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
index 919a4a5d69..1b47a86113 100644
--- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
+++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
@@ -7,5 +7,9 @@
     <replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector">
         <when-type-is class="com.vaadin.client.ui.ui.UIConnector" />
     </replace-with>
+    
+     <replace-with class="com.vaadin.tests.widgetset.client.TestingPushConnection">
+        <when-type-is class="com.vaadin.client.communication.PushConnection" />
+    </replace-with>
 	
 </module>
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
new file mode 100644
index 0000000000..8453daabcd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.widgetset.client;
+
+import com.google.gwt.user.client.Window;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.communication.PushConnection;
+
+public class TestingPushConnection extends PushConnection {
+
+    private String transport;
+
+    @Override
+    public void init(ApplicationConnection connection) {
+        super.init(connection);
+        transport = Window.Location.getParameter("transport");
+    }
+
+    /*
+     * Force transport
+     */
+    @Override
+    protected AtmosphereConfiguration createConfig() {
+        AtmosphereConfiguration conf = super.createConfig();
+        if (transport != null) {
+            conf.setTransport(transport);
+            conf.setFallbackTransport(transport);
+        }
+        return conf;
+    }
+
+}
-- 
cgit v1.2.3


From 5efb8f01e79bac95955b189d5999ba4ae544a137 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 18 Apr 2013 01:08:55 +0300
Subject: Simple speed test for testing roundtrips/s in various browsers

Change-Id: Id6e96e8d115b02c79038396dfada5c04e0f451ed
---
 .../src/com/vaadin/tests/push/RoundTripTest.java   |  67 +++++++++++++
 .../widgetset/client/RoundTripTesterConnector.java | 106 +++++++++++++++++++++
 .../tests/widgetset/client/RoundTripTesterRpc.java |  25 +++++
 .../tests/widgetset/server/RoundTripTester.java    |  59 ++++++++++++
 4 files changed, 257 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/push/RoundTripTest.java
 create mode 100644 uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java
 create mode 100644 uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java
 create mode 100644 uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/push/RoundTripTest.java b/uitest/src/com/vaadin/tests/push/RoundTripTest.java
new file mode 100644
index 0000000000..a059a1d275
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/RoundTripTest.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.push;
+
+import com.vaadin.annotations.Widgetset;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.widgetset.TestingWidgetSet;
+import com.vaadin.tests.widgetset.server.RoundTripTester;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Button.ClickListener;
+import com.vaadin.ui.TextField;
+
+@Widgetset(TestingWidgetSet.NAME)
+public class RoundTripTest extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        final RoundTripTester roundTripTester = new RoundTripTester();
+        final TextField payloadSize = new TextField("Payload size (bytes)");
+        payloadSize.setConverter(Integer.class);
+        payloadSize.setConvertedValue(10000);
+        addComponent(payloadSize);
+        final TextField testDuration = new TextField("Test duration (ms)");
+        testDuration.setConverter(Integer.class);
+        testDuration.setConvertedValue(10000);
+        addComponent(testDuration);
+
+        Button start = new Button("Start test");
+        start.addClickListener(new ClickListener() {
+
+            @Override
+            public void buttonClick(ClickEvent event) {
+                roundTripTester.start(
+                        (Integer) testDuration.getConvertedValue(),
+                        (Integer) payloadSize.getConvertedValue());
+            }
+        });
+        addComponent(roundTripTester);
+        addComponent(start);
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Tests how many roundtrips per second you can get using the given package size";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11370;
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java
new file mode 100644
index 0000000000..94972d92f4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterConnector.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.widgetset.client;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.Duration;
+import com.google.gwt.user.client.ui.HTML;
+import com.vaadin.client.ui.AbstractComponentConnector;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.tests.widgetset.server.RoundTripTester;
+
+@Connect(RoundTripTester.class)
+public class RoundTripTesterConnector extends AbstractComponentConnector {
+
+    private double lastPrintedTime = -1;
+    private int receivedPings = 0;
+    private List<Double> throughputData = new ArrayList<Double>();
+    private int payloadSize = 0;
+
+    @Override
+    protected void init() {
+        super.init();
+        registerRpc(RoundTripTesterRpc.class, new RoundTripTesterRpc() {
+
+            @Override
+            public void ping(int nr, String payload) {
+                getRpcProxy(RoundTripTesterRpc.class).ping(nr + 1, payload);
+                payloadSize = payload.length();
+
+                double now = Duration.currentTimeMillis();
+                if (lastPrintedTime == -1) {
+                    lastPrintedTime = now;
+                    return;
+                }
+                receivedPings++;
+
+                if (now - lastPrintedTime > 1000) {
+                    double roundtripsPerSecond = receivedPings
+                            / (now - lastPrintedTime) * 1000;
+                    throughputData.add(roundtripsPerSecond);
+                    getWidget().setText(
+                            roundtripsPerSecond + " roundtrips/second");
+
+                    lastPrintedTime = now;
+                    receivedPings = 0;
+                }
+
+            }
+
+            @Override
+            public void done() {
+                String result = "Test results for payload of size "
+                        + payloadSize + ":";
+                double max = -1;
+                double min = 1239482038939.0;
+                double avg = 0;
+
+                for (Double throughput : throughputData) {
+                    if (throughput > max) {
+                        max = throughput;
+                    }
+                    if (throughput < min) {
+                        min = throughput;
+                    }
+
+                    avg += throughput;
+                }
+                avg /= throughputData.size();
+
+                for (Double throughput : throughputData) {
+                    result += "<br/>" + formatThroughput(throughput);
+                }
+                result += "<br/>Max: " + formatThroughput(max);
+                result += "<br/>Min: " + formatThroughput(min);
+                result += "<br/>Average: " + formatThroughput(avg);
+                getWidget().setHTML(result);
+                getRpcProxy(RoundTripTesterRpc.class).done();
+            }
+
+            private String formatThroughput(double throughput) {
+                return throughput + " roundtrips / second";
+            }
+        });
+    }
+
+    @Override
+    public HTML getWidget() {
+        return (HTML) super.getWidget();
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java
new file mode 100644
index 0000000000..24c981e0c2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/client/RoundTripTesterRpc.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.widgetset.client;
+
+import com.vaadin.shared.communication.ClientRpc;
+import com.vaadin.shared.communication.ServerRpc;
+
+public interface RoundTripTesterRpc extends ServerRpc, ClientRpc {
+    public void ping(int nr, String payload);
+
+    public void done();
+}
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java
new file mode 100644
index 0000000000..d16a7a7811
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.widgetset.server;
+
+import com.vaadin.tests.util.LoremIpsum;
+import com.vaadin.tests.widgetset.client.RoundTripTesterRpc;
+import com.vaadin.ui.AbstractComponent;
+
+public class RoundTripTester extends AbstractComponent {
+    private long testStart = 0;
+    private long testEnd = 0;
+
+    public RoundTripTester() {
+        registerRpc(new RoundTripTesterRpc() {
+            @Override
+            public void ping(int nr, String payload) {
+                if (System.currentTimeMillis() < testEnd) {
+                    getRpcProxy(RoundTripTesterRpc.class).ping(nr + 1, payload);
+                } else {
+                    getRpcProxy(RoundTripTesterRpc.class).done();
+                }
+            }
+
+            @Override
+            public void done() {
+            }
+        });
+    }
+
+    public void start(long testDuration, int payloadSize) {
+        testStart = System.currentTimeMillis();
+        testEnd = testStart + testDuration;
+        getRpcProxy(RoundTripTesterRpc.class).ping(1, generatePayload(payloadSize));
+    }
+
+    private String generatePayload(int payloadSize) {
+        StringBuilder sb = new StringBuilder();
+        while (payloadSize > 10000) {
+            payloadSize -= 10000;
+            sb.append(LoremIpsum.get(10000));
+        }
+        sb.append(LoremIpsum.get(payloadSize));
+        return sb.toString();
+    }
+
+}
-- 
cgit v1.2.3


From 19c3783d3e3cb9ba56e3587581115f354ab04fa0 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Thu, 18 Apr 2013 15:28:41 +0300
Subject: Clean the connector map after pushing (#11624)

Removing UidlRequestHandler.postHandleRequest should not affect
backwards compatibility as UidlRequestHandler is a new class.

Change-Id: I7f3753b1c3d37afcc973d3e5571c0d1708177bf9
---
 .../server/communication/UidlRequestHandler.java   | 14 -------
 .../vaadin/server/communication/UidlWriter.java    |  1 +
 .../vaadin/tests/push/PushReattachedComponent.html | 47 ++++++++++++++++++++++
 3 files changed, 48 insertions(+), 14 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/push/PushReattachedComponent.html

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
index 14303daebc..dba247258a 100644
--- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java
+++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
@@ -111,7 +111,6 @@ public class UidlRequestHandler extends SynchronizedRequestHandler {
 
             writeUidl(request, response, uI, stringWriter, repaintAll,
                     analyzeLayouts);
-            postHandleRequest(uI);
         } catch (JSONException e) {
             getLogger().log(Level.SEVERE, "Error writing JSON to response", e);
             // Refresh on client side
@@ -178,19 +177,6 @@ public class UidlRequestHandler extends SynchronizedRequestHandler {
         closeJsonMessage(writer);
     }
 
-    /**
-     * Method called after the paint phase while still being synchronized on the
-     * session
-     * 
-     * @param uI
-     * 
-     */
-    protected void postHandleRequest(UI uI) {
-        // Remove connectors that have been detached from the session during
-        // handling of the request
-        uI.getConnectorTracker().cleanConnectorMap();
-    }
-
     protected void closeJsonMessage(Writer outWriter) throws IOException {
         outWriter.write("}]");
     }
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index 79ae8af07e..fbe2fb86d5 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -295,6 +295,7 @@ public class UidlWriter implements Serializable {
             writePerformanceData(ui, writer);
         } finally {
             uiConnectorTracker.setWritingResponse(false);
+            uiConnectorTracker.cleanConnectorMap();
         }
     }
 
diff --git a/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html
new file mode 100644
index 0000000000..e1f6a5f048
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/PushReattachedComponent.html
@@ -0,0 +1,47 @@
+<?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://192.168.2.162: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-push/com.vaadin.tests.components.panel.PanelChangeContents?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>stats</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>companies</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestscomponentspanelPanelChangeContents::/VVerticalLayout[0]/Slot[1]/VPanel[0]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>stats</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From 0cbba9d6f4a65c04ca0e396c440de0c1c25945ec Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Thu, 18 Apr 2013 12:35:10 +0300
Subject: Initial support for toggling push on the fly (#11506)

Still missing is the ability to load vaadinPush.js if it has not yet
been loaded.

Change-Id: Ibe3596c38a7c4e3432b0396072866ee3072e6d30
---
 .../com/vaadin/client/ApplicationConnection.java   |  20 +++-
 .../client/communication/PushConnection.java       | 105 ++++++++++++++++++++-
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |   4 +
 .../communication/AtmospherePushConnection.java    |   8 ++
 .../server/communication/PushConnection.java       |   5 +
 .../vaadin/server/communication/PushHandler.java   |  46 ++++++++-
 server/src/com/vaadin/ui/UI.java                   |  39 +++++---
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |   3 +
 uitest/src/com/vaadin/tests/push/TogglePush.html   |  91 ++++++++++++++++++
 uitest/src/com/vaadin/tests/push/TogglePush.java   |  82 ++++++++++++++++
 10 files changed, 376 insertions(+), 27 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/push/TogglePush.html
 create mode 100644 uitest/src/com/vaadin/tests/push/TogglePush.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 04e3ab9dc6..bc8d82cd30 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -455,7 +455,7 @@ public class ApplicationConnection {
 
         scheduleHeartbeat();
 
-        initializePush();
+        setPushEnabled(getConfiguration().getPushMode().isEnabled());
 
         Window.addWindowClosingHandler(new ClosingHandler() {
             @Override
@@ -3393,8 +3393,19 @@ public class ApplicationConnection {
                 focusedElement);
     }
 
-    private void initializePush() {
-        if (getConfiguration().getPushMode().isEnabled()) {
+    /**
+     * Sets the status for the push connection.
+     * 
+     * @param enabled
+     *            <code>true</code> to enable the push connection;
+     *            <code>false</code> to disable the push connection.
+     */
+    public void setPushEnabled(boolean enabled) {
+        if (enabled && push == null) {
+            /*
+             * TODO support for loading atmosphere.js on demand will be added in
+             * another commit.
+             */
             push = GWT.create(PushConnection.class);
             push.init(this);
 
@@ -3410,6 +3421,9 @@ public class ApplicationConnection {
                     push.connect(pushUri);
                 }
             });
+        } else if (!enabled && push != null) {
+            push.disconnect();
+            push = null;
         }
     }
 
diff --git a/client/src/com/vaadin/client/communication/PushConnection.java b/client/src/com/vaadin/client/communication/PushConnection.java
index f72066c149..8619cd00d2 100644
--- a/client/src/com/vaadin/client/communication/PushConnection.java
+++ b/client/src/com/vaadin/client/communication/PushConnection.java
@@ -34,16 +34,47 @@ import com.vaadin.client.VConsole;
  */
 public class PushConnection {
 
+    protected enum State {
+        /**
+         * Connection is newly created and has not yet been started.
+         */
+        NEW,
+
+        /**
+         * Opening request has been sent, but still waiting for confirmation
+         */
+        CONNECT_PENDING,
+
+        /**
+         * Connection is open and ready to use.
+         */
+        CONNECTED,
+
+        /**
+         * Connection was disconnected while the connection was pending. Wait
+         * for the connection to get established before closing it. No new
+         * messages are accepted, but pending messages will still be delivered.
+         */
+        DISCONNECT_PENDING,
+
+        /**
+         * Connection has been disconnected and should not be used any more.
+         */
+        DISCONNECTED;
+    }
+
     private ApplicationConnection connection;
 
     private JavaScriptObject socket;
 
     private ArrayList<String> messageQueue = new ArrayList<String>();
 
-    private boolean connected = false;
+    private State state = State.NEW;
 
     private AtmosphereConfiguration config;
 
+    private String uri;
+
     public PushConnection() {
     }
 
@@ -58,17 +89,33 @@ public class PushConnection {
     }
 
     public void connect(String uri) {
+        if (state != State.NEW) {
+            throw new IllegalStateException(
+                    "Connection has already been connected.");
+        }
+
+        state = State.CONNECT_PENDING;
+        // uri is needed to identify the right connection when closing
+        this.uri = uri;
         VConsole.log("Establishing push connection");
         socket = doConnect(uri, getConfig());
     }
 
     public void push(String message) {
-        if (!connected) {
+        switch (state) {
+        case CONNECT_PENDING:
             VConsole.log("Queuing push message: " + message);
             messageQueue.add(message);
-        } else {
+            break;
+        case CONNECTED:
             VConsole.log("Sending push message: " + message);
             doPush(socket, message);
+            break;
+        case NEW:
+            throw new IllegalStateException("Can not push before connecting");
+        case DISCONNECT_PENDING:
+        case DISCONNECTED:
+            throw new IllegalStateException("Can not push after disconnecting");
         }
     }
 
@@ -82,11 +129,54 @@ public class PushConnection {
     protected void onOpen(AtmosphereResponse response) {
         VConsole.log("Push connection established using "
                 + response.getTransport());
-        connected = true;
         for (String message : messageQueue) {
-            push(message);
+            doPush(socket, message);
         }
         messageQueue.clear();
+
+        switch (state) {
+        case CONNECT_PENDING:
+            state = State.CONNECTED;
+            break;
+        case DISCONNECT_PENDING:
+            // Set state to connected to make disconnect close the connection
+            state = State.CONNECTED;
+            disconnect();
+            break;
+        case CONNECTED:
+            // IE likes to open the same connection multiple times, just ignore
+            break;
+        default:
+            throw new IllegalStateException(
+                    "Got onOpen event when conncetion state is " + state
+                            + ". This should never happen.");
+        }
+    }
+
+    /**
+     * Closes the push connection.
+     */
+    public void disconnect() {
+        switch (state) {
+        case NEW:
+            // Nothing to close up, just update state
+            state = State.DISCONNECTED;
+            break;
+        case CONNECT_PENDING:
+            // Wait until connection is established before closing it
+            state = State.DISCONNECT_PENDING;
+            break;
+        case CONNECTED:
+            // Normal disconnect
+            VConsole.log("Closing push connection");
+            doDisconnect(uri);
+            state = State.DISCONNECTED;
+            break;
+        case DISCONNECT_PENDING:
+        case DISCONNECTED:
+            // Nothing more to do
+            break;
+        }
     }
 
     protected void onMessage(AtmosphereResponse response) {
@@ -231,4 +321,9 @@ public class PushConnection {
     /*-{
        socket.push(message);
     }-*/;
+
+    private static native void doDisconnect(String url)
+    /*-{
+       $wnd.jQueryVaadin.atmosphere.unsubscribeUrl(url);
+    }-*/;
 }
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index f3b4f36670..26ca6b559a 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -588,6 +588,10 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
         if (stateChangeEvent.hasPropertyChanged("pollInterval")) {
             configurePolling();
         }
+
+        if (stateChangeEvent.hasPropertyChanged("pushMode")) {
+            getConnection().setPushEnabled(getState().pushMode.isEnabled());
+        }
     }
 
     private void configurePolling() {
diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
index 9b98153a23..a5025e2356 100644
--- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
+++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
@@ -117,4 +117,12 @@ public class AtmospherePushConnection implements Serializable, PushConnection {
     protected AtmosphereResource getResource() {
         return resource;
     }
+
+    @Override
+    public void disconnect() {
+        resource.resume();
+        assert !resource.getBroadcaster().getAtmosphereResources()
+                .contains(resource);
+        resource = null;
+    }
 }
diff --git a/server/src/com/vaadin/server/communication/PushConnection.java b/server/src/com/vaadin/server/communication/PushConnection.java
index 590219b1b5..eecf4d93a4 100644
--- a/server/src/com/vaadin/server/communication/PushConnection.java
+++ b/server/src/com/vaadin/server/communication/PushConnection.java
@@ -35,4 +35,9 @@ public interface PushConnection {
      */
     public void push();
 
+    /**
+     * Disconnects the connection.
+     */
+    public void disconnect();
+
 }
\ No newline at end of file
diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java
index a9e6c17751..bdc8c723a5 100644
--- a/server/src/com/vaadin/server/communication/PushHandler.java
+++ b/server/src/com/vaadin/server/communication/PushHandler.java
@@ -38,6 +38,7 @@ import com.vaadin.server.VaadinServletRequest;
 import com.vaadin.server.VaadinServletService;
 import com.vaadin.server.VaadinSession;
 import com.vaadin.server.WebBrowser;
+import com.vaadin.shared.communication.PushMode;
 import com.vaadin.ui.UI;
 
 /**
@@ -138,6 +139,46 @@ public class PushHandler implements AtmosphereHandler {
         }
     };
 
+    /**
+     * Callback used when a connection is closed by the client.
+     */
+    PushEventCallback disconnectCallback = new PushEventCallback() {
+        @Override
+        public void run(AtmosphereResource resource, UI ui) throws IOException {
+            PushMode pushMode = ui.getPushMode();
+            AtmospherePushConnection pushConnection = getConnectionForUI(ui);
+
+            String id = resource.uuid();
+
+            if (pushConnection == null) {
+                getLogger()
+                        .log(Level.WARNING,
+                                "Could not find push connection to close: {0} with transport {1}",
+                                new Object[] { id, resource.transport() });
+            } else {
+                if (!pushMode.isEnabled()) {
+                    /*
+                     * The client is expected to close the connection after push
+                     * mode has been set to disabled, just clean up some stuff
+                     * and be done with it
+                     */
+                    getLogger().log(Level.FINEST,
+                            "Connection closed for resource {0}", id);
+                } else {
+                    /*
+                     * Unexpected cancel, e.g. if the user closes the browser
+                     * tab.
+                     */
+                    getLogger()
+                            .log(Level.FINE,
+                                    "Connection unexpectedly closed for resource {0} with transport {1}",
+                                    new Object[] { id, resource.transport() });
+                }
+                ui.setPushConnection(null);
+            }
+        }
+    };
+
     private static final String LONG_PADDING;
 
     static {
@@ -234,10 +275,7 @@ public class PushHandler implements AtmosphereHandler {
 
         String id = resource.uuid();
         if (event.isCancelled()) {
-            // The client closed the connection.
-            // TODO Do some cleanup
-            getLogger().log(Level.FINER, "Connection closed for resource {0}",
-                    id);
+            callWithUi(resource, disconnectCallback);
         } else if (event.isResuming()) {
             // A connection that was suspended earlier was resumed (committed to
             // the client.) Should only happen if the transport is JSONP or
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 4eff7645e2..e1646a5ac5 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -130,8 +130,6 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      */
     private int scrollLeft = 0;
 
-    private PushMode pushMode;
-
     private UIServerRpc rpc = new UIServerRpc() {
         @Override
         public void click(MouseEventDetails mouseDetails) {
@@ -1189,11 +1187,19 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * Sets the internal push connection object used by this UI. This method
      * should only be called by the framework.
      */
-    public void setPushConnection(PushConnection connection) {
-        assert pushConnection == null;
-        assert connection != null;
-        pushConnection = connection;
-        if (hasPendingPush) {
+    public void setPushConnection(PushConnection pushConnection) {
+        assert (pushConnection != null) == (getPushMode().isEnabled());
+
+        if (pushConnection == this.pushConnection) {
+            return;
+        }
+
+        if (this.pushConnection != null) {
+            this.pushConnection.disconnect();
+        }
+
+        this.pushConnection = pushConnection;
+        if (pushConnection != null && hasPendingPush) {
             hasPendingPush = false;
             pushConnection.push();
         }
@@ -1232,12 +1238,12 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * @return The push mode.
      */
     public PushMode getPushMode() {
-        return pushMode;
+        return getState(false).pushMode;
     }
 
     /**
      * Sets the mode of bidirectional ("push") communication that should be used
-     * in this UI. Set once on UI creation and cannot be changed afterwards.
+     * in this UI.
      * 
      * @param pushMode
      *            The push mode to use.
@@ -1245,16 +1251,13 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * @throws IllegalArgumentException
      *             if the argument is null.
      * @throws IllegalStateException
-     *             if the mode is already set or if push support is not
-     *             available.
+     *             if push support is not available.
      */
     public void setPushMode(PushMode pushMode) {
         if (pushMode == null) {
             throw new IllegalArgumentException("Push mode cannot be null");
         }
-        if (this.pushMode != null) {
-            throw new IllegalStateException("Push mode already set");
-        }
+
         if (pushMode.isEnabled()) {
             VaadinSession session = getSession();
             if (session != null && !session.getService().ensurePushAvailable()) {
@@ -1262,7 +1265,13 @@ public abstract class UI extends AbstractSingleComponentContainer implements
                         "Push is not available. See previous log messages for more information.");
             }
         }
-        this.pushMode = pushMode;
+
+        /*
+         * Client-side will open a new connection or disconnect the old
+         * connection, so there's nothing more to do on the server at this
+         * point.
+         */
+        getState().pushMode = pushMode;
     }
 
 }
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index fbb6427c6f..589744a48c 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -17,6 +17,7 @@ package com.vaadin.shared.ui.ui;
 
 import java.io.Serializable;
 
+import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.TabIndexState;
 
 public class UIState extends TabIndexState {
@@ -24,6 +25,8 @@ public class UIState extends TabIndexState {
     public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration();
     public int pollInterval = -1;
 
+    public PushMode pushMode = PushMode.DISABLED;
+
     public static class LoadingIndicatorConfiguration implements Serializable {
         public int initialDelay = 300;
         public int delayStateDelay = 1500;
diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.html b/uitest/src/com/vaadin/tests/push/TogglePush.html
new file mode 100644
index 0000000000..b752d2120c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/TogglePush.html
@@ -0,0 +1,91 @@
+<?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="" />
+<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-push/com.vaadin.tests.push.TogglePush?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<!--Push is enabled, so text gets updated-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 1 times</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>61,6</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<!--Push is disabled, so text is not updated-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 1 times</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Direct update is visible, and includes previous update-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 3 times</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>61,3</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<!--Push is enabled again, so text gets updated-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 4 times</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java
new file mode 100644
index 0000000000..8e9eafeabb
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/TogglePush.java
@@ -0,0 +1,82 @@
+package com.vaadin.tests.push;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.communication.PushMode;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Label;
+
+public class TogglePush extends AbstractTestUI {
+    private final Label counterLabel = new Label();
+    private int counter = 0;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        updateCounter();
+        addComponent(counterLabel);
+
+        CheckBox pushSetting = new CheckBox("Push enabled");
+        pushSetting.setValue(Boolean.valueOf(getPushMode().isEnabled()));
+        pushSetting.setImmediate(true);
+        pushSetting.addValueChangeListener(new ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                if (event.getProperty().getValue() == Boolean.TRUE) {
+                    setPushMode(PushMode.AUTOMATIC);
+                } else {
+                    setPushMode(PushMode.DISABLED);
+                }
+            }
+        });
+        addComponent(pushSetting);
+
+        addComponent(new Button("Update counter now",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        updateCounter();
+                    }
+                }));
+
+        addComponent(new Button("Update counter in 1 sec",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        new Timer().schedule(new TimerTask() {
+                            @Override
+                            public void run() {
+                                runSafely(new Runnable() {
+                                    @Override
+                                    public void run() {
+                                        updateCounter();
+                                    }
+                                });
+                            }
+                        }, 1000);
+                    }
+                }));
+    }
+
+    public void updateCounter() {
+        counterLabel.setValue("Counter has been updated " + counter++
+                + " times");
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Basic test for enabling and disabling push on the fly.";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(11506);
+    }
+
+}
-- 
cgit v1.2.3


From 2c46baf7206d3735d737b8bda08596abe2fd649b Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Mon, 22 Apr 2013 13:19:31 +0300
Subject: Add PushConnection interface (#11655)

* Add PushConnection interface and rename old class to
AtmospherePushConnection
* Define deferred binding to use AtmospherePushConnection by default
* Redesign connection and disconnection workflow to better cope with
situations where connection is quickly toggled

Change-Id: I9b9427c2df40d446a25895eb39e7b166cb929a85
---
 client/src/com/vaadin/Vaadin.gwt.xml               |   4 +
 .../com/vaadin/client/ApplicationConnection.java   |  41 +--
 .../communication/AtmospherePushConnection.java    | 401 +++++++++++++++++++++
 .../client/communication/PushConnection.java       | 380 +++----------------
 .../widgetset/client/TestingPushConnection.java    |   4 +-
 5 files changed, 468 insertions(+), 362 deletions(-)
 create mode 100644 client/src/com/vaadin/client/communication/AtmospherePushConnection.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/Vaadin.gwt.xml b/client/src/com/vaadin/Vaadin.gwt.xml
index 11197bffc5..6529743503 100644
--- a/client/src/com/vaadin/Vaadin.gwt.xml
+++ b/client/src/com/vaadin/Vaadin.gwt.xml
@@ -39,6 +39,10 @@
             class="com.vaadin.client.metadata.ConnectorBundleLoader" />
     </generate-with>
     
+    <replace-with class="com.vaadin.client.communication.AtmospherePushConnection">
+        <when-type-is class="com.vaadin.client.communication.PushConnection" />
+    </replace-with>    
+    
     <!-- Set vaadin.profiler to true to include profiling support in the module -->
     <define-property name="vaadin.profiler" values="true,false" />
     <set-property name="vaadin.profiler" value="false" />    
diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 179a19ed85..93a2e90c07 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -2431,7 +2431,7 @@ public class ApplicationConnection {
 
     private void doSendPendingVariableChanges() {
         if (applicationRunning) {
-            if (hasActiveRequest()) {
+            if (hasActiveRequest() || (push != null && !push.isActive())) {
                 // skip empty queues if there are pending bursts to be sent
                 if (pendingInvocations.size() > 0 || pendingBursts.size() == 0) {
                     pendingBursts.add(pendingInvocations);
@@ -3402,32 +3402,31 @@ public class ApplicationConnection {
      */
     public void setPushEnabled(boolean enabled) {
         if (enabled && push == null) {
-
-            final PushConnection push = GWT.create(PushConnection.class);
+            push = GWT.create(PushConnection.class);
             push.init(this);
-
-            push.runWhenAtmosphereLoaded(new Command() {
+        } else if (!enabled && push != null && push.isActive()) {
+            push.disconnect(new Command() {
                 @Override
                 public void execute() {
-                    ApplicationConnection.this.push = push;
-
-                    final String pushUri = addGetParameters(
-                            translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
-                                    + ApplicationConstants.PUSH_PATH + '/'),
-                            UIConstants.UI_ID_PARAMETER + "="
-                                    + getConfiguration().getUIId());
+                    push = null;
+                    /*
+                     * If push has been enabled again while we were waiting for
+                     * the old connection to disconnect, now is the right time
+                     * to open a new connection
+                     */
+                    if (uIConnector.getState().pushMode.isEnabled()) {
+                        setPushEnabled(true);
+                    }
 
-                    Scheduler.get().scheduleDeferred(new Command() {
-                        @Override
-                        public void execute() {
-                            push.connect(pushUri);
-                        }
-                    });
+                    /*
+                     * Send anything that was enqueued while we waited for the
+                     * connection to close
+                     */
+                    if (pendingInvocations.size() > 0) {
+                        sendPendingVariableChanges();
+                    }
                 }
             });
-        } else if (!enabled && push != null) {
-            push.disconnect();
-            push = null;
         }
     }
 
diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
new file mode 100644
index 0000000000..d3321a41a7
--- /dev/null
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -0,0 +1,401 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.client.communication;
+
+import java.util.ArrayList;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.user.client.Command;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ResourceLoader;
+import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
+import com.vaadin.client.ResourceLoader.ResourceLoadListener;
+import com.vaadin.client.VConsole;
+import com.vaadin.shared.ApplicationConstants;
+import com.vaadin.shared.ui.ui.UIConstants;
+
+/**
+ * The default {@link PushConnection} implementation that uses Atmosphere for
+ * handling the communication channel.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public class AtmospherePushConnection implements PushConnection {
+
+    protected enum State {
+        /**
+         * Opening request has been sent, but still waiting for confirmation
+         */
+        CONNECT_PENDING,
+
+        /**
+         * Connection is open and ready to use.
+         */
+        CONNECTED,
+
+        /**
+         * Connection was disconnected while the connection was pending. Wait
+         * for the connection to get established before closing it. No new
+         * messages are accepted, but pending messages will still be delivered.
+         */
+        DISCONNECT_PENDING,
+
+        /**
+         * Connection has been disconnected and should not be used any more.
+         */
+        DISCONNECTED;
+    }
+
+    private ApplicationConnection connection;
+
+    private JavaScriptObject socket;
+
+    private ArrayList<String> messageQueue = new ArrayList<String>();
+
+    private State state = State.CONNECT_PENDING;
+
+    private AtmosphereConfiguration config;
+
+    private String uri;
+
+    /**
+     * Keeps track of the disconnect confirmation command for cases where
+     * pending messages should be pushed before actually disconnecting.
+     */
+    private Command pendingDisconnectCommand;
+
+    public AtmospherePushConnection() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.client.communication.PushConenction#init(com.vaadin.client
+     * .ApplicationConnection)
+     */
+    @Override
+    public void init(final ApplicationConnection connection) {
+        this.connection = connection;
+
+        runWhenAtmosphereLoaded(new Command() {
+            @Override
+            public void execute() {
+                Scheduler.get().scheduleDeferred(new Command() {
+                    @Override
+                    public void execute() {
+                        connect();
+                    }
+                });
+            }
+        });
+    }
+
+    private void connect() {
+        String baseUrl = connection
+                .translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
+                        + ApplicationConstants.PUSH_PATH + '/');
+        String extraParams = UIConstants.UI_ID_PARAMETER + "="
+                + connection.getConfiguration().getUIId();
+
+        // uri is needed to identify the right connection when closing
+        uri = ApplicationConnection.addGetParameters(baseUrl, extraParams);
+
+        VConsole.log("Establishing push connection");
+        socket = doConnect(uri, getConfig());
+    }
+
+    @Override
+    public boolean isActive() {
+        switch (state) {
+        case CONNECT_PENDING:
+        case CONNECTED:
+            return true;
+        default:
+            return false;
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.client.communication.PushConenction#push(java.lang.String)
+     */
+    @Override
+    public void push(String message) {
+        switch (state) {
+        case CONNECT_PENDING:
+            assert isActive();
+            VConsole.log("Queuing push message: " + message);
+            messageQueue.add(message);
+            break;
+        case CONNECTED:
+            assert isActive();
+            VConsole.log("Sending push message: " + message);
+            doPush(socket, message);
+            break;
+        case DISCONNECT_PENDING:
+        case DISCONNECTED:
+            throw new IllegalStateException("Can not push after disconnecting");
+        }
+    }
+
+    protected AtmosphereConfiguration getConfig() {
+        if (config == null) {
+            config = createConfig();
+        }
+        return config;
+    }
+
+    protected void onOpen(AtmosphereResponse response) {
+        VConsole.log("Push connection established using "
+                + response.getTransport());
+        for (String message : messageQueue) {
+            doPush(socket, message);
+        }
+        messageQueue.clear();
+
+        switch (state) {
+        case CONNECT_PENDING:
+            state = State.CONNECTED;
+            break;
+        case DISCONNECT_PENDING:
+            // Set state to connected to make disconnect close the connection
+            state = State.CONNECTED;
+            assert pendingDisconnectCommand != null;
+            disconnect(pendingDisconnectCommand);
+            break;
+        case CONNECTED:
+            // IE likes to open the same connection multiple times, just ignore
+            break;
+        default:
+            throw new IllegalStateException(
+                    "Got onOpen event when conncetion state is " + state
+                            + ". This should never happen.");
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.communication.PushConenction#disconnect()
+     */
+    @Override
+    public void disconnect(Command command) {
+        assert command != null;
+
+        switch (state) {
+        case CONNECT_PENDING:
+            // Make the connection callback initiate the disconnection again
+            state = State.DISCONNECT_PENDING;
+            pendingDisconnectCommand = command;
+            break;
+        case CONNECTED:
+            // Normal disconnect
+            VConsole.log("Closing push connection");
+            doDisconnect(uri);
+            state = State.DISCONNECTED;
+            command.execute();
+            break;
+        case DISCONNECT_PENDING:
+        case DISCONNECTED:
+            throw new IllegalStateException("Can not disconnect more than once");
+        }
+    }
+
+    protected void onMessage(AtmosphereResponse response) {
+        String message = response.getResponseBody();
+        if (message.startsWith("for(;;);")) {
+            VConsole.log("Received push message: " + message);
+            // "for(;;);[{json}]" -> "{json}"
+            message = message.substring(9, message.length() - 1);
+            connection.handlePushMessage(message);
+        }
+    }
+
+    /**
+     * Called if the transport mechanism cannot be used and the fallback will be
+     * tried
+     */
+    protected void onTransportFailure() {
+        VConsole.log("Push connection using primary method ("
+                + getConfig().getTransport() + ") failed. Trying with "
+                + getConfig().getFallbackTransport());
+    }
+
+    /**
+     * Called if the push connection fails. Atmosphere will automatically retry
+     * the connection until successful.
+     * 
+     */
+    protected void onError() {
+        VConsole.error("Push connection using "
+                + getConfig().getTransport()
+                + " failed!");
+    }
+
+    public static abstract class AbstractJSO extends JavaScriptObject {
+        protected AbstractJSO() {
+
+        }
+
+        protected final native String getStringValue(String key)
+        /*-{
+           return this[key];
+         }-*/;
+
+        protected final native void setStringValue(String key, String value)
+        /*-{
+            this[key] = value;
+        }-*/;
+
+        protected final native int getIntValue(String key)
+        /*-{
+           return this[key];
+         }-*/;
+
+        protected final native void setIntValue(String key, int value)
+        /*-{
+            this[key] = value;
+        }-*/;
+
+    }
+
+    public static class AtmosphereConfiguration extends AbstractJSO {
+
+        protected AtmosphereConfiguration() {
+            super();
+        }
+
+        public final String getTransport() {
+            return getStringValue("transport");
+        }
+
+        public final String getFallbackTransport() {
+            return getStringValue("fallbackTransport");
+        }
+
+        public final void setTransport(String transport) {
+            setStringValue("transport", transport);
+        }
+
+        public final void setFallbackTransport(String fallbackTransport) {
+            setStringValue("fallbackTransport", fallbackTransport);
+        }
+    }
+
+    public static class AtmosphereResponse extends AbstractJSO {
+
+        protected AtmosphereResponse() {
+
+        }
+
+        public final String getResponseBody() {
+            return getStringValue("responseBody");
+        }
+
+        public final String getState() {
+            return getStringValue("state");
+        }
+
+        public final String getError() {
+            return getStringValue("error");
+        }
+
+        public final String getTransport() {
+            return getStringValue("transport");
+        }
+
+    }
+
+    protected native AtmosphereConfiguration createConfig()
+    /*-{
+        return {
+            transport: 'websocket',
+            fallbackTransport: 'streaming',
+            contentType: 'application/json; charset=UTF-8',
+            reconnectInterval: '5000',
+            trackMessageLength: true 
+        };
+    }-*/;
+
+    private native JavaScriptObject doConnect(String uri,
+            JavaScriptObject config)
+    /*-{
+        var self = this;
+
+        config.url = uri;
+        config.onOpen = $entry(function(response) {
+            self.@com.vaadin.client.communication.AtmospherePushConnection::onOpen(*)(response);
+        });
+        config.onMessage = $entry(function(response) {
+            self.@com.vaadin.client.communication.AtmospherePushConnection::onMessage(*)(response);
+        });
+        config.onError = $entry(function(response) {
+            self.@com.vaadin.client.communication.AtmospherePushConnection::onError()(response);
+        });
+        config.onTransportFailure = $entry(function(reason,request) {
+            self.@com.vaadin.client.communication.AtmospherePushConnection::onTransportFailure(*)(reason);
+        });
+
+        return $wnd.jQueryVaadin.atmosphere.subscribe(config);
+    }-*/;
+
+    private native void doPush(JavaScriptObject socket, String message)
+    /*-{
+       socket.push(message);
+    }-*/;
+
+    private static native void doDisconnect(String url)
+    /*-{
+       $wnd.jQueryVaadin.atmosphere.unsubscribeUrl(url);
+    }-*/;
+
+    private static native boolean isAtmosphereLoaded()
+    /*-{
+        return $wnd.jQueryVaadin != undefined;  
+    }-*/;
+
+    private void runWhenAtmosphereLoaded(final Command command) {
+
+        if (isAtmosphereLoaded()) {
+            command.execute();
+        } else {
+            VConsole.log("Loading " + ApplicationConstants.VAADIN_PUSH_JS);
+            ResourceLoader.get().loadScript(
+                    connection.getConfiguration().getVaadinDirUrl()
+                            + ApplicationConstants.VAADIN_PUSH_JS,
+                    new ResourceLoadListener() {
+                        @Override
+                        public void onLoad(ResourceLoadEvent event) {
+                            VConsole.log(ApplicationConstants.VAADIN_PUSH_JS
+                                    + " loaded");
+                            command.execute();
+                        }
+
+                        @Override
+                        public void onError(ResourceLoadEvent event) {
+                            VConsole.error(event.getResourceUrl()
+                                    + " could not be loaded. Push will not work.");
+                        }
+                    });
+        }
+    }
+}
diff --git a/client/src/com/vaadin/client/communication/PushConnection.java b/client/src/com/vaadin/client/communication/PushConnection.java
index b872460de4..33b1c31411 100644
--- a/client/src/com/vaadin/client/communication/PushConnection.java
+++ b/client/src/com/vaadin/client/communication/PushConnection.java
@@ -1,31 +1,7 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
 package com.vaadin.client.communication;
 
-import java.util.ArrayList;
-
-import com.google.gwt.core.client.JavaScriptObject;
 import com.google.gwt.user.client.Command;
 import com.vaadin.client.ApplicationConnection;
-import com.vaadin.client.ResourceLoader;
-import com.vaadin.client.ResourceLoader.ResourceLoadEvent;
-import com.vaadin.client.ResourceLoader.ResourceLoadListener;
-import com.vaadin.client.VConsole;
-import com.vaadin.shared.ApplicationConstants;
 
 /**
  * Represents the client-side endpoint of a bidirectional ("push") communication
@@ -37,337 +13,63 @@ import com.vaadin.shared.ApplicationConstants;
  * @author Vaadin Ltd
  * @since 7.1
  */
-public class PushConnection {
-
-    protected enum State {
-        /**
-         * Connection is newly created and has not yet been started.
-         */
-        NEW,
-
-        /**
-         * Opening request has been sent, but still waiting for confirmation
-         */
-        CONNECT_PENDING,
-
-        /**
-         * Connection is open and ready to use.
-         */
-        CONNECTED,
-
-        /**
-         * Connection was disconnected while the connection was pending. Wait
-         * for the connection to get established before closing it. No new
-         * messages are accepted, but pending messages will still be delivered.
-         */
-        DISCONNECT_PENDING,
-
-        /**
-         * Connection has been disconnected and should not be used any more.
-         */
-        DISCONNECTED;
-    }
-
-    private ApplicationConnection connection;
-
-    private JavaScriptObject socket;
-
-    private ArrayList<String> messageQueue = new ArrayList<String>();
-
-    private State state = State.NEW;
-
-    private AtmosphereConfiguration config;
-
-    private String uri;
-
-    public PushConnection() {
-    }
+public interface PushConnection {
 
     /**
-     * Two-phase construction to allow using GWT.create()
+     * Two-phase construction to allow using GWT.create().
      * 
      * @param connection
      *            The ApplicationConnection
      */
-    public void init(ApplicationConnection connection) {
-        this.connection = connection;
-    }
-
-    public void connect(String uri) {
-        if (state != State.NEW) {
-            throw new IllegalStateException(
-                    "Connection has already been connected.");
-        }
-
-        state = State.CONNECT_PENDING;
-        // uri is needed to identify the right connection when closing
-        this.uri = uri;
-        VConsole.log("Establishing push connection");
-        socket = doConnect(uri, getConfig());
-    }
-
-    public void push(String message) {
-        switch (state) {
-        case CONNECT_PENDING:
-            VConsole.log("Queuing push message: " + message);
-            messageQueue.add(message);
-            break;
-        case CONNECTED:
-            VConsole.log("Sending push message: " + message);
-            doPush(socket, message);
-            break;
-        case NEW:
-            throw new IllegalStateException("Can not push before connecting");
-        case DISCONNECT_PENDING:
-        case DISCONNECTED:
-            throw new IllegalStateException("Can not push after disconnecting");
-        }
-    }
-
-    protected AtmosphereConfiguration getConfig() {
-        if (config == null) {
-            config = createConfig();
-        }
-        return config;
-    }
-
-    protected void onOpen(AtmosphereResponse response) {
-        VConsole.log("Push connection established using "
-                + response.getTransport());
-        for (String message : messageQueue) {
-            doPush(socket, message);
-        }
-        messageQueue.clear();
-
-        switch (state) {
-        case CONNECT_PENDING:
-            state = State.CONNECTED;
-            break;
-        case DISCONNECT_PENDING:
-            // Set state to connected to make disconnect close the connection
-            state = State.CONNECTED;
-            disconnect();
-            break;
-        case CONNECTED:
-            // IE likes to open the same connection multiple times, just ignore
-            break;
-        default:
-            throw new IllegalStateException(
-                    "Got onOpen event when conncetion state is " + state
-                            + ". This should never happen.");
-        }
-    }
+    public void init(ApplicationConnection connection);
 
     /**
-     * Closes the push connection.
-     */
-    public void disconnect() {
-        switch (state) {
-        case NEW:
-            // Nothing to close up, just update state
-            state = State.DISCONNECTED;
-            break;
-        case CONNECT_PENDING:
-            // Wait until connection is established before closing it
-            state = State.DISCONNECT_PENDING;
-            break;
-        case CONNECTED:
-            // Normal disconnect
-            VConsole.log("Closing push connection");
-            doDisconnect(uri);
-            state = State.DISCONNECTED;
-            break;
-        case DISCONNECT_PENDING:
-        case DISCONNECTED:
-            // Nothing more to do
-            break;
-        }
-    }
-
-    protected void onMessage(AtmosphereResponse response) {
-        String message = response.getResponseBody();
-        if (message.startsWith("for(;;);")) {
-            VConsole.log("Received push message: " + message);
-            // "for(;;);[{json}]" -> "{json}"
-            message = message.substring(9, message.length() - 1);
-            connection.handlePushMessage(message);
-        }
-    }
-
-    /**
-     * Called if the transport mechanism cannot be used and the fallback will be
-     * tried
+     * Pushes a message to the server. Will throw an exception if the connection
+     * is not active (see {@link #isActive()}).
+     * <p>
+     * Implementation detail: The implementation is responsible for queuing
+     * messages that are pushed after {@link #init(ApplicationConnection)} has
+     * been called but before the connection has internally been set up and then
+     * replay those messages in the original order when the connection has been
+     * established.
+     * 
+     * @param message
+     *            the message to push
+     * @throws IllegalStateException
+     *             if this connection is not active
+     * 
+     * @see #isActive()
      */
-    protected void onTransportFailure() {
-        VConsole.log("Push connection using primary method ("
-                + getConfig().getTransport() + ") failed. Trying with "
-                + getConfig().getFallbackTransport());
-    }
+    public void push(String message);
 
     /**
-     * Called if the push connection fails. Atmosphere will automatically retry
-     * the connection until successful.
+     * Checks whether this push connection is in a state where it can push
+     * messages to the server. A connection is active until
+     * {@link #disconnect(Command)} has been called.
      * 
+     * @return <code>true</code> if this connection can accept new messages;
+     *         <code>false</code> if this connection is disconnected or
+     *         disconnecting.
      */
-    protected void onError() {
-        VConsole.error("Push connection using "
-                + getConfig().getTransport()
-                + " failed!");
-    }
-
-    public static abstract class AbstractJSO extends JavaScriptObject {
-        protected AbstractJSO() {
-
-        }
-
-        protected final native String getStringValue(String key)
-        /*-{
-           return this[key];
-         }-*/;
-
-        protected final native void setStringValue(String key, String value)
-        /*-{
-            this[key] = value;
-        }-*/;
-
-        protected final native int getIntValue(String key)
-        /*-{
-           return this[key];
-         }-*/;
-
-        protected final native void setIntValue(String key, int value)
-        /*-{
-            this[key] = value;
-        }-*/;
-
-    }
-
-    public static class AtmosphereConfiguration extends AbstractJSO {
-
-        protected AtmosphereConfiguration() {
-            super();
-        }
-
-        public final String getTransport() {
-            return getStringValue("transport");
-        }
-
-        public final String getFallbackTransport() {
-            return getStringValue("fallbackTransport");
-        }
-
-        public final void setTransport(String transport) {
-            setStringValue("transport", transport);
-        }
-
-        public final void setFallbackTransport(String fallbackTransport) {
-            setStringValue("fallbackTransport", fallbackTransport);
-        }
-    }
-
-    public static class AtmosphereResponse extends AbstractJSO {
-
-        protected AtmosphereResponse() {
-
-        }
-
-        public final String getResponseBody() {
-            return getStringValue("responseBody");
-        }
-
-        public final String getState() {
-            return getStringValue("state");
-        }
-
-        public final String getError() {
-            return getStringValue("error");
-        }
-
-        public final String getTransport() {
-            return getStringValue("transport");
-        }
-
-    }
-
-    protected native AtmosphereConfiguration createConfig()
-    /*-{
-        return {
-            transport: 'websocket',
-            fallbackTransport: 'streaming',
-            contentType: 'application/json; charset=UTF-8',
-            reconnectInterval: '5000',
-            trackMessageLength: true 
-        };
-    }-*/;
-
-    private native JavaScriptObject doConnect(String uri,
-            JavaScriptObject config)
-    /*-{
-        var self = this;
-
-        config.url = uri;
-        config.onOpen = $entry(function(response) {
-            self.@com.vaadin.client.communication.PushConnection::onOpen(*)(response);
-        });
-        config.onMessage = $entry(function(response) {
-            self.@com.vaadin.client.communication.PushConnection::onMessage(*)(response);
-        });
-        config.onError = $entry(function(response) {
-            self.@com.vaadin.client.communication.PushConnection::onError()(response);
-        });
-        config.onTransportFailure = $entry(function(reason,request) {
-            self.@com.vaadin.client.communication.PushConnection::onTransportFailure(*)(reason);
-        });
-
-        return $wnd.jQueryVaadin.atmosphere.subscribe(config);
-    }-*/;
-
-    private native void doPush(JavaScriptObject socket, String message)
-    /*-{
-       socket.push(message);
-    }-*/;
-
-    private static native void doDisconnect(String url)
-    /*-{
-       $wnd.jQueryVaadin.atmosphere.unsubscribeUrl(url);
-    }-*/;
-
-    private static native boolean isAtmosphereLoaded()
-    /*-{
-        return $wnd.jQueryVaadin != undefined;  
-    }-*/;
+    public boolean isActive();
 
     /**
-     * Runs the provided command when the Atmosphere javascript has been loaded.
-     * If the script has already been loaded, the command is run immediately.
+     * Closes the push connection. To ensure correct message delivery order, new
+     * messages should not be sent using any other channel until it has been
+     * confirmed that all messages pending for this connection have been
+     * delivered. The provided command callback is invoked when messages can be
+     * passed using some other communication channel.
+     * <p>
+     * After this method has been called, {@link #isActive()} returns
+     * <code>false</code>. Calling this method for a connection that is no
+     * longer active will throw an exception.
      * 
      * @param command
-     *            the command to run when Atmosphere has been loaded.
+     *            callback command invoked when the connection has been properly
+     *            disconnected
+     * @throws IllegalStateException
+     *             if this connection is not active
      */
-    public void runWhenAtmosphereLoaded(final Command command) {
-        assert command != null;
-
-        if (isAtmosphereLoaded()) {
-            command.execute();
-        } else {
-            VConsole.log("Loading " + ApplicationConstants.VAADIN_PUSH_JS);
-            ResourceLoader.get().loadScript(
-                    connection.getConfiguration().getVaadinDirUrl()
-                            + ApplicationConstants.VAADIN_PUSH_JS,
-                    new ResourceLoadListener() {
-                        @Override
-                        public void onLoad(ResourceLoadEvent event) {
-                            VConsole.log(ApplicationConstants.VAADIN_PUSH_JS
-                                    + " loaded");
-                            command.execute();
-                        }
+    public void disconnect(Command command);
 
-                        @Override
-                        public void onError(ResourceLoadEvent event) {
-                            VConsole.log(event.getResourceUrl()
-                                    + " could not be loaded. Push will not work.");
-                        }
-                    });
-        }
-    }
-}
+}
\ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
index 8453daabcd..8d00598907 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
@@ -2,9 +2,9 @@ package com.vaadin.tests.widgetset.client;
 
 import com.google.gwt.user.client.Window;
 import com.vaadin.client.ApplicationConnection;
-import com.vaadin.client.communication.PushConnection;
+import com.vaadin.client.communication.AtmospherePushConnection;
 
-public class TestingPushConnection extends PushConnection {
+public class TestingPushConnection extends AtmospherePushConnection {
 
     private String transport;
 
-- 
cgit v1.2.3


From 069e4d2d870fc174df10680275fe7614274edba7 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 22 Apr 2013 13:52:21 +0300
Subject: Renamed DisplayState to WindowMode (#11662)

Change-Id: I0f70c4195a0871185a1924b008ebd855068e5787
---
 client/src/com/vaadin/client/ui/VWindow.java       |   7 +-
 .../vaadin/client/ui/window/WindowConnector.java   |  43 ++++----
 server/src/com/vaadin/ui/Window.java               | 117 ++++++++++-----------
 .../com/vaadin/shared/ui/window/WindowMode.java    |  39 +++++++
 .../vaadin/shared/ui/window/WindowServerRpc.java   |   3 +-
 .../com/vaadin/shared/ui/window/WindowState.java   |   6 +-
 .../window/WindowMaximizeRestoreTest.java          |  22 ++--
 7 files changed, 132 insertions(+), 105 deletions(-)
 create mode 100644 shared/src/com/vaadin/shared/ui/window/WindowMode.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index bd9a0ed07c..138a7f7adc 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -49,7 +49,7 @@ import com.vaadin.client.LayoutManager;
 import com.vaadin.client.Util;
 import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
 import com.vaadin.shared.EventId;
-import com.vaadin.shared.ui.window.WindowState.DisplayState;
+import com.vaadin.shared.ui.window.WindowMode;
 
 /**
  * "Sub window" component.
@@ -571,10 +571,9 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         }
     }
 
-    public void updateMaximizeRestoreClassName(boolean visible,
-            DisplayState state) {
+    public void updateMaximizeRestoreClassName(boolean visible, WindowMode windowMode) {
         String className;
-        if (state == DisplayState.MAXIMIZED) {
+        if (windowMode == WindowMode.MAXIMIZED) {
             className = CLASSNAME + "-restorebox";
         } else {
             className = CLASSNAME + "-maximizebox";
diff --git a/client/src/com/vaadin/client/ui/window/WindowConnector.java b/client/src/com/vaadin/client/ui/window/WindowConnector.java
index 66907fbfa4..f1ea99f3f5 100644
--- a/client/src/com/vaadin/client/ui/window/WindowConnector.java
+++ b/client/src/com/vaadin/client/ui/window/WindowConnector.java
@@ -45,9 +45,9 @@ import com.vaadin.client.ui.VWindow;
 import com.vaadin.client.ui.layout.MayScrollChildren;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.window.WindowMode;
 import com.vaadin.shared.ui.window.WindowServerRpc;
 import com.vaadin.shared.ui.window.WindowState;
-import com.vaadin.shared.ui.window.WindowState.DisplayState;
 
 @Connect(value = com.vaadin.ui.Window.class)
 public class WindowConnector extends AbstractSingleComponentContainerConnector
@@ -245,8 +245,7 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
     @Override
     public void postLayout() {
         VWindow window = getWidget();
-        if (window.centered
-                && getState().displayState != DisplayState.MAXIMIZED) {
+        if (window.centered && getState().windowMode != WindowMode.MAXIMIZED) {
             window.center();
         }
         window.positionOrSizeUpdated();
@@ -272,16 +271,15 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
             window.show();
         }
         boolean resizeable = state.resizable
-                && state.displayState == DisplayState.NORMAL;
+                && state.windowMode == WindowMode.NORMAL;
         window.setResizable(resizeable);
 
         window.resizeLazy = state.resizeLazy;
 
         window.setDraggable(state.draggable
-                && state.displayState == DisplayState.NORMAL);
+                && state.windowMode == WindowMode.NORMAL);
 
-        window.updateMaximizeRestoreClassName(state.resizable,
-                state.displayState);
+        window.updateMaximizeRestoreClassName(state.resizable, state.windowMode);
 
         // Caption must be set before required header size is measured. If
         // the caption attribute is missing the caption should be cleared.
@@ -320,12 +318,12 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
         }
     }
 
-    // Need to override default because of DisplayState
+    // Need to override default because of window mode
     @Override
     protected void updateComponentSize() {
-        if (getState().displayState == DisplayState.NORMAL) {
+        if (getState().windowMode == WindowMode.NORMAL) {
             super.updateComponentSize();
-        } else if (getState().displayState == DisplayState.MAXIMIZED) {
+        } else if (getState().windowMode == WindowMode.MAXIMIZED) {
             super.updateComponentSize("100%", "100%");
         }
     }
@@ -333,45 +331,44 @@ public class WindowConnector extends AbstractSingleComponentContainerConnector
     protected void updateWindowPosition() {
         VWindow window = getWidget();
         WindowState state = getState();
-        if (state.displayState == DisplayState.NORMAL) {
+        if (state.windowMode == WindowMode.NORMAL) {
             // if centered, position handled in postLayout()
             if (!state.centered) {
                 window.setPopupPosition(state.positionX, state.positionY);
             }
-        } else if (state.displayState == DisplayState.MAXIMIZED) {
+        } else if (state.windowMode == WindowMode.MAXIMIZED) {
             window.setPopupPositionNoUpdate(0, 0);
             window.bringToFront();
         }
     }
 
-    protected void updateDisplayState() {
+    protected void updateWindowMode() {
         VWindow window = getWidget();
         WindowState state = getState();
 
         // update draggable on widget
         window.setDraggable(state.draggable
-                && state.displayState == DisplayState.NORMAL);
+                && state.windowMode == WindowMode.NORMAL);
         // update resizable on widget
         window.setResizable(state.resizable
-                && state.displayState == DisplayState.NORMAL);
+                && state.windowMode == WindowMode.NORMAL);
         updateComponentSize();
         updateWindowPosition();
-        window.updateMaximizeRestoreClassName(state.resizable,
-                state.displayState);
+        window.updateMaximizeRestoreClassName(state.resizable, state.windowMode);
         window.updateContentsSize();
     }
 
     protected void onMaximizeRestore() {
         WindowState state = getState();
         if (state.resizable) {
-            if (state.displayState == DisplayState.MAXIMIZED) {
-                state.displayState = DisplayState.NORMAL;
+            if (state.windowMode == WindowMode.MAXIMIZED) {
+                state.windowMode = WindowMode.NORMAL;
             } else {
-                state.displayState = DisplayState.MAXIMIZED;
+                state.windowMode = WindowMode.MAXIMIZED;
             }
-            updateDisplayState();
-            getRpcProxy(WindowServerRpc.class).windowDisplayStateChanged(
-                    state.displayState);
+            updateWindowMode();
+            getRpcProxy(WindowServerRpc.class).windowModeChanged(
+                    state.windowMode);
         }
     }
 
diff --git a/server/src/com/vaadin/ui/Window.java b/server/src/com/vaadin/ui/Window.java
index 479992d084..9f64c9118e 100644
--- a/server/src/com/vaadin/ui/Window.java
+++ b/server/src/com/vaadin/ui/Window.java
@@ -35,9 +35,9 @@ import com.vaadin.server.ClientConnector;
 import com.vaadin.server.PaintException;
 import com.vaadin.server.PaintTarget;
 import com.vaadin.shared.MouseEventDetails;
+import com.vaadin.shared.ui.window.WindowMode;
 import com.vaadin.shared.ui.window.WindowServerRpc;
 import com.vaadin.shared.ui.window.WindowState;
-import com.vaadin.shared.ui.window.WindowState.DisplayState;
 import com.vaadin.util.ReflectTools;
 
 /**
@@ -75,8 +75,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         }
 
         @Override
-        public void windowDisplayStateChanged(DisplayState newState) {
-            setDisplayState(newState);
+        public void windowModeChanged(WindowMode newState) {
+            setWindowMode(newState);
         }
     };
 
@@ -241,8 +241,7 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Gets the distance of Window left border in pixels from left border of the
-     * containing (main window) when the window is in
-     * {@link DisplayState#NORMAL}.
+     * containing (main window) when the window is in {@link WindowMode#NORMAL}.
      * 
      * @return the Distance of Window left border in pixels from left border of
      *         the containing (main window).or -1 if unspecified
@@ -254,8 +253,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Sets the distance of Window left border in pixels from left border of the
-     * containing (main window). Has effect only if in
-     * {@link DisplayState#NORMAL} mode.
+     * containing (main window). Has effect only if in {@link WindowMode#NORMAL}
+     * mode.
      * 
      * @param positionX
      *            the Distance of Window left border in pixels from left border
@@ -269,8 +268,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Gets the distance of Window top border in pixels from top border of the
-     * containing (main window) when the window is in
-     * {@link DisplayState#NORMAL} state, or when next set to that state.
+     * containing (main window) when the window is in {@link WindowMode#NORMAL}
+     * state, or when next set to that state.
      * 
      * @return Distance of Window top border in pixels from top border of the
      *         containing (main window). or -1 if unspecified
@@ -283,8 +282,8 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
 
     /**
      * Sets the distance of Window top border in pixels from top border of the
-     * containing (main window). Has effect only if in
-     * {@link DisplayState#NORMAL} mode.
+     * containing (main window). Has effect only if in {@link WindowMode#NORMAL}
+     * mode.
      * 
      * @param positionY
      *            the Distance of Window top border in pixels from top border of
@@ -413,24 +412,23 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
     }
 
     /**
-     * Event which is fired when the display state of the Window changes.
+     * Event which is fired when the mode of the Window changes.
      * 
      * @author Vaadin Ltd
      * @since 7.1
      * 
      */
-    public static class DisplayStateChangeEvent extends Component.Event {
+    public static class WindowModeChangeEvent extends Component.Event {
 
-        private final DisplayState displayState;
+        private final WindowMode windowMode;
 
         /**
          * 
          * @param source
          */
-        public DisplayStateChangeEvent(Component source,
-                DisplayState displayState) {
+        public WindowModeChangeEvent(Component source, WindowMode windowMode) {
             super(source);
-            this.displayState = displayState;
+            this.windowMode = windowMode;
         }
 
         /**
@@ -443,73 +441,69 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
         }
 
         /**
-         * Gets the new DisplayState.
+         * Gets the new window mode.
          * 
-         * @return the displayState
+         * @return the new mode
          */
-        public DisplayState getDisplayState() {
-            return displayState;
+        public WindowMode getWindowMode() {
+            return windowMode;
         }
     }
 
     /**
      * An interface used for listening to Window maximize / restore events. Add
-     * the DisplayStateChangeListener to a window and
-     * {@link DisplayStateChangeListener#displayStateChanged(DisplayStateChangeEvent)}
+     * the WindowModeChangeListener to a window and
+     * {@link WindowModeChangeListener#windowModeChanged(WindowModeChangeEvent)}
      * will be called whenever the window is maximized (
-     * {@link DisplayState#MAXIMIZED}) or restored ({@link DisplayState#NORMAL}
-     * ).
+     * {@link WindowMode#MAXIMIZED}) or restored ({@link WindowMode#NORMAL} ).
      */
-    public interface DisplayStateChangeListener extends Serializable {
+    public interface WindowModeChangeListener extends Serializable {
 
-        public static final Method displayStateChangeMethod = ReflectTools
-                .findMethod(DisplayStateChangeListener.class,
-                        "displayStateChanged", DisplayStateChangeEvent.class);
+        public static final Method windowModeChangeMethod = ReflectTools
+                .findMethod(WindowModeChangeListener.class,
+                        "windowModeChanged", WindowModeChangeEvent.class);
 
         /**
          * Called when the user maximizes / restores a window. Use
-         * {@link DisplayStateChangeEvent#getWindow()} to get a reference to the
+         * {@link WindowModeChangeEvent#getWindow()} to get a reference to the
          * {@link Window} that was maximized / restored. Use
-         * {@link DisplayStateChangeEvent#getDisplayState()} to get a reference
-         * to the new state.
+         * {@link WindowModeChangeEvent#getWindowMode()} to get a reference to
+         * the new state.
          * 
          * @param event
          */
-        public void displayStateChanged(DisplayStateChangeEvent event);
+        public void windowModeChanged(WindowModeChangeEvent event);
     }
 
     /**
-     * Adds a DisplayStateChangeListener to the window.
+     * Adds a WindowModeChangeListener to the window.
      * 
-     * The DisplayStateChangeEvent is fired when the user changed the display
+     * The WindowModeChangeEvent is fired when the user changed the display
      * state by clicking the maximize/restore button or by double clicking on
      * the window header. The event is also fired if the state is changed using
-     * {@link #setDisplayState(DisplayState)}.
+     * {@link #setWindowMode(WindowMode)}.
      * 
      * @param listener
-     *            the DisplayStateChangeListener to add.
+     *            the WindowModeChangeListener to add.
      */
-    public void addDisplayStateChangeListener(
-            DisplayStateChangeListener listener) {
-        addListener(DisplayStateChangeEvent.class, listener,
-                DisplayStateChangeListener.displayStateChangeMethod);
+    public void addWindowModeChangeListener(WindowModeChangeListener listener) {
+        addListener(WindowModeChangeEvent.class, listener,
+                WindowModeChangeListener.windowModeChangeMethod);
     }
 
     /**
-     * Removes the DisplayStateChangeListener from the window.
+     * Removes the WindowModeChangeListener from the window.
      * 
      * @param listener
-     *            the DisplayStateChangeListener to remove.
+     *            the WindowModeChangeListener to remove.
      */
-    public void removeDisplayStateChangeListener(
-            DisplayStateChangeListener listener) {
-        removeListener(DisplayStateChangeEvent.class, listener,
-                DisplayStateChangeListener.displayStateChangeMethod);
+    public void removeWindowModeChangeListener(WindowModeChangeListener listener) {
+        removeListener(WindowModeChangeEvent.class, listener,
+                WindowModeChangeListener.windowModeChangeMethod);
     }
 
-    protected void fireWindowDisplayStateChange() {
-        fireEvent(new Window.DisplayStateChangeEvent(this,
-                getState().displayState));
+    protected void fireWindowWindowModeChange() {
+        fireEvent(new Window.WindowModeChangeEvent(this, getState().windowMode));
     }
 
     /**
@@ -782,23 +776,26 @@ public class Window extends Panel implements FocusNotifier, BlurNotifier,
     }
 
     /**
-     * Gets the current DisplayState of the window.
+     * Gets the current mode of the window.
      * 
-     * @return displayState the current DisplayState.
+     * @see WindowMode
+     * @return the mode of the window.
      */
-    public DisplayState getDisplayState() {
-        return getState(false).displayState;
+    public WindowMode getWindowMode() {
+        return getState(false).windowMode;
     }
 
     /**
-     * Sets the DisplayState for the window.
+     * Sets the mode for the window
      * 
-     * @param displayState
+     * @see WindowMode
+     * @param windowMode
+     *            The new mode
      */
-    public void setDisplayState(DisplayState displayState) {
-        if (displayState != getDisplayState()) {
-            getState().displayState = displayState;
-            fireWindowDisplayStateChange();
+    public void setWindowMode(WindowMode windowMode) {
+        if (windowMode != getWindowMode()) {
+            getState().windowMode = windowMode;
+            fireWindowWindowModeChange();
         }
     }
 
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowMode.java b/shared/src/com/vaadin/shared/ui/window/WindowMode.java
new file mode 100644
index 0000000000..04af77a086
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/window/WindowMode.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.window;
+
+/**
+ * Determines the mode of the Window.
+ * <p>
+ * A window mode decides the size and position of the Window. It can be set to
+ * {@link #NORMAL} or {@link #MAXIMIZED}.
+ * 
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public enum WindowMode {
+    /**
+     * Normal mode. The window size and position is determined by the window
+     * state.
+     */
+    NORMAL,
+    /**
+     * Maximized mode. The window is positioned in the top left corner and fills
+     * the whole screen.
+     */
+    MAXIMIZED;
+}
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
index 0128adca40..cfb10ad86a 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
@@ -18,11 +18,10 @@ package com.vaadin.shared.ui.window;
 import com.vaadin.shared.annotations.Delayed;
 import com.vaadin.shared.communication.ServerRpc;
 import com.vaadin.shared.ui.ClickRpc;
-import com.vaadin.shared.ui.window.WindowState.DisplayState;
 
 public interface WindowServerRpc extends ClickRpc, ServerRpc {
 
     @Delayed(lastOnly = true)
-    public void windowDisplayStateChanged(DisplayState newState);
+    public void windowModeChanged(WindowMode newState);
 
 }
\ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/window/WindowState.java b/shared/src/com/vaadin/shared/ui/window/WindowState.java
index eb6f1c758a..5a2d2b81b0 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowState.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowState.java
@@ -22,10 +22,6 @@ public class WindowState extends PanelState {
         primaryStyleName = "v-window";
     }
 
-    public enum DisplayState {
-        NORMAL, MAXIMIZED;
-    }
-
     public boolean modal = false;
     public boolean resizable = true;
     public boolean resizeLazy = false;
@@ -33,5 +29,5 @@ public class WindowState extends PanelState {
     public boolean centered = false;;
     public int positionX = -1;
     public int positionY = -1;
-    public DisplayState displayState = DisplayState.NORMAL;
+    public WindowMode windowMode = WindowMode.NORMAL;
 }
\ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
index fe45b036a1..a8102a7d1a 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.java
@@ -4,7 +4,7 @@ import com.vaadin.data.Item;
 import com.vaadin.data.Property.ValueChangeEvent;
 import com.vaadin.data.Property.ValueChangeListener;
 import com.vaadin.server.VaadinRequest;
-import com.vaadin.shared.ui.window.WindowState.DisplayState;
+import com.vaadin.shared.ui.window.WindowMode;
 import com.vaadin.tests.components.AbstractTestUI;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
@@ -17,8 +17,8 @@ import com.vaadin.ui.VerticalLayout;
 import com.vaadin.ui.Window;
 import com.vaadin.ui.Window.CloseEvent;
 import com.vaadin.ui.Window.CloseListener;
-import com.vaadin.ui.Window.DisplayStateChangeEvent;
-import com.vaadin.ui.Window.DisplayStateChangeListener;
+import com.vaadin.ui.Window.WindowModeChangeEvent;
+import com.vaadin.ui.Window.WindowModeChangeListener;
 
 public class WindowMaximizeRestoreTest extends AbstractTestUI {
     Button.ClickListener addListener = new Button.ClickListener() {
@@ -72,11 +72,11 @@ public class WindowMaximizeRestoreTest extends AbstractTestUI {
 
             @Override
             public void buttonClick(ClickEvent event) {
-                if (w.getDisplayState() == DisplayState.MAXIMIZED) {
-                    w.setDisplayState(DisplayState.NORMAL);
+                if (w.getWindowMode() == WindowMode.MAXIMIZED) {
+                    w.setWindowMode(WindowMode.NORMAL);
                     maximize.setCaption("Maximize");
                 } else {
-                    w.setDisplayState(DisplayState.MAXIMIZED);
+                    w.setWindowMode(WindowMode.MAXIMIZED);
                     maximize.setCaption("Restore");
                 }
             }
@@ -85,15 +85,15 @@ public class WindowMaximizeRestoreTest extends AbstractTestUI {
         maximize.addClickListener(listener);
         ((ComponentContainer) w.getContent()).addComponent(maximize);
 
-        w.addDisplayStateChangeListener(new DisplayStateChangeListener() {
+        w.addWindowModeChangeListener(new WindowModeChangeListener() {
 
             @Override
-            public void displayStateChanged(DisplayStateChangeEvent event) {
-                DisplayState state = (event.getWindow().getDisplayState());
-                if (state == DisplayState.NORMAL) {
+            public void windowModeChanged(WindowModeChangeEvent event) {
+                WindowMode state = (event.getWindow().getWindowMode());
+                if (state == WindowMode.NORMAL) {
                     w.setCaption("Window " + w.getData() + " Normal");
                     maximize.setCaption("Maximize");
-                } else if (state == DisplayState.MAXIMIZED) {
+                } else if (state == WindowMode.MAXIMIZED) {
                     w.setCaption("Window " + w.getData() + " Maximized");
                     maximize.setCaption("Restore");
                 }
-- 
cgit v1.2.3


From 09cb9d88956b5c892d8dba9b1a3f3dd9cdfd078a Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 22 Apr 2013 14:02:46 +0300
Subject: Renamed UI.getTooltip to getTooltipConfiguration (#11663)

Change-Id: Idd33f68171b40b4097454418b78f75aee8f76eab
---
 server/src/com/vaadin/ui/Tooltip.java              | 240 ---------------------
 server/src/com/vaadin/ui/TooltipConfiguration.java | 240 +++++++++++++++++++++
 server/src/com/vaadin/ui/UI.java                   |   6 +-
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |   4 +-
 .../tests/components/ui/TooltipConfiguration.java  |  10 +-
 5 files changed, 250 insertions(+), 250 deletions(-)
 delete mode 100644 server/src/com/vaadin/ui/Tooltip.java
 create mode 100644 server/src/com/vaadin/ui/TooltipConfiguration.java

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/ui/Tooltip.java b/server/src/com/vaadin/ui/Tooltip.java
deleted file mode 100644
index 093bb33b51..0000000000
--- a/server/src/com/vaadin/ui/Tooltip.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui;
-
-import java.io.Serializable;
-
-import com.vaadin.shared.ui.ui.UIState.TooltipConfiguration;
-
-/**
- * Provides method for configuring the tooltip.
- * 
- * @author Vaadin Ltd
- * @since 7.1
- */
-public interface Tooltip extends Serializable {
-    /**
-     * Returns the time (in ms) the tooltip should be displayed after an event
-     * that will cause it to be closed (e.g. mouse click outside the component,
-     * key down).
-     * 
-     * @return The close timeout
-     */
-    public int getCloseTimeout();
-
-    /**
-     * Sets the time (in ms) the tooltip should be displayed after an event that
-     * will cause it to be closed (e.g. mouse click outside the component, key
-     * down).
-     * 
-     * @param closeTimeout
-     *            The close timeout
-     */
-    public void setCloseTimeout(int closeTimeout);
-
-    /**
-     * Returns the time (in ms) during which {@link #getQuickOpenDelay()} should
-     * be used instead of {@link #getOpenDelay()}. The quick open delay is used
-     * when the tooltip has very recently been shown, is currently hidden but
-     * about to be shown again.
-     * 
-     * @return The quick open timeout
-     */
-    public int getQuickOpenTimeout();
-
-    /**
-     * Sets the time (in ms) that determines when {@link #getQuickOpenDelay()}
-     * should be used instead of {@link #getOpenDelay()}. The quick open delay
-     * is used when the tooltip has very recently been shown, is currently
-     * hidden but about to be shown again.
-     * 
-     * @param quickOpenTimeout
-     *            The quick open timeout
-     */
-    public void setQuickOpenTimeout(int quickOpenTimeout);
-
-    /**
-     * Returns the time (in ms) that should elapse before a tooltip will be
-     * shown, in the situation when a tooltip has very recently been shown
-     * (within {@link #getQuickOpenDelay()} ms).
-     * 
-     * @return The quick open delay
-     */
-    public int getQuickOpenDelay();
-
-    /**
-     * Sets the time (in ms) that should elapse before a tooltip will be shown,
-     * in the situation when a tooltip has very recently been shown (within
-     * {@link #getQuickOpenDelay()} ms).
-     * 
-     * @param quickOpenDelay
-     *            The quick open delay
-     */
-    public void setQuickOpenDelay(int quickOpenDelay);
-
-    /**
-     * Returns the time (in ms) that should elapse after an event triggering
-     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
-     * shown. If a tooltip has recently been shown, then
-     * {@link #getQuickOpenDelay()} is used instead of this.
-     * 
-     * @return The open delay
-     */
-    public int getOpenDelay();
-
-    /**
-     * Sets the time (in ms) that should elapse after an event triggering
-     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
-     * shown. If a tooltip has recently been shown, then
-     * {@link #getQuickOpenDelay()} is used instead of this.
-     * 
-     * @param openDelay
-     *            The open delay
-     */
-    public void setOpenDelay(int openDelay);
-
-    /**
-     * Returns the maximum width of the tooltip popup.
-     * 
-     * @return The maximum width the tooltip popup
-     */
-    public int getMaxWidth();
-
-    /**
-     * Sets the maximum width of the tooltip popup.
-     * 
-     * @param maxWidth
-     *            The maximum width the tooltip popup
-     */
-    public void setMaxWidth(int maxWidth);
-}
-
-class TooltipImpl implements Tooltip {
-    private UI ui;
-
-    public TooltipImpl(UI ui) {
-        this.ui = ui;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.UI.Tooltip#getCloseTimeout()
-     */
-    @Override
-    public int getCloseTimeout() {
-        return getState(false).closeTimeout;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#setCloseTimeout(int)
-     */
-    @Override
-    public void setCloseTimeout(int closeTimeout) {
-        getState().closeTimeout = closeTimeout;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#getQuickOpenTimeout()
-     */
-    @Override
-    public int getQuickOpenTimeout() {
-        return getState(false).quickOpenTimeout;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#setQuickOpenTimeout(int)
-     */
-    @Override
-    public void setQuickOpenTimeout(int quickOpenTimeout) {
-        getState().quickOpenTimeout = quickOpenTimeout;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#getQuickOpenDelay()
-     */
-    @Override
-    public int getQuickOpenDelay() {
-        return getState(false).quickOpenDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#setQuickOpenDelay(int)
-     */
-    @Override
-    public void setQuickOpenDelay(int quickOpenDelay) {
-        getState().quickOpenDelay = quickOpenDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#getOpenDelay()
-     */
-    @Override
-    public int getOpenDelay() {
-        return getState(false).openDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#setOpenDelay(int)
-     */
-    @Override
-    public void setOpenDelay(int openDelay) {
-        getState().openDelay = openDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#getMaxWidth()
-     */
-    @Override
-    public int getMaxWidth() {
-        return getState(false).maxWidth;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.Tooltip#setMaxWidth(int)
-     */
-    @Override
-    public void setMaxWidth(int maxWidth) {
-        getState().maxWidth = maxWidth;
-    }
-
-    private TooltipConfiguration getState() {
-        return ui.getState().tooltipConfiguration;
-    }
-
-    private TooltipConfiguration getState(boolean markAsDirty) {
-        return ui.getState(markAsDirty).tooltipConfiguration;
-    }
-
-}
diff --git a/server/src/com/vaadin/ui/TooltipConfiguration.java b/server/src/com/vaadin/ui/TooltipConfiguration.java
new file mode 100644
index 0000000000..f9120aa18d
--- /dev/null
+++ b/server/src/com/vaadin/ui/TooltipConfiguration.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.ui.UIState.TooltipConfigurationState;
+
+/**
+ * Provides method for configuring the tooltip.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public interface TooltipConfiguration extends Serializable {
+    /**
+     * Returns the time (in ms) the tooltip should be displayed after an event
+     * that will cause it to be closed (e.g. mouse click outside the component,
+     * key down).
+     * 
+     * @return The close timeout
+     */
+    public int getCloseTimeout();
+
+    /**
+     * Sets the time (in ms) the tooltip should be displayed after an event that
+     * will cause it to be closed (e.g. mouse click outside the component, key
+     * down).
+     * 
+     * @param closeTimeout
+     *            The close timeout
+     */
+    public void setCloseTimeout(int closeTimeout);
+
+    /**
+     * Returns the time (in ms) during which {@link #getQuickOpenDelay()} should
+     * be used instead of {@link #getOpenDelay()}. The quick open delay is used
+     * when the tooltip has very recently been shown, is currently hidden but
+     * about to be shown again.
+     * 
+     * @return The quick open timeout
+     */
+    public int getQuickOpenTimeout();
+
+    /**
+     * Sets the time (in ms) that determines when {@link #getQuickOpenDelay()}
+     * should be used instead of {@link #getOpenDelay()}. The quick open delay
+     * is used when the tooltip has very recently been shown, is currently
+     * hidden but about to be shown again.
+     * 
+     * @param quickOpenTimeout
+     *            The quick open timeout
+     */
+    public void setQuickOpenTimeout(int quickOpenTimeout);
+
+    /**
+     * Returns the time (in ms) that should elapse before a tooltip will be
+     * shown, in the situation when a tooltip has very recently been shown
+     * (within {@link #getQuickOpenDelay()} ms).
+     * 
+     * @return The quick open delay
+     */
+    public int getQuickOpenDelay();
+
+    /**
+     * Sets the time (in ms) that should elapse before a tooltip will be shown,
+     * in the situation when a tooltip has very recently been shown (within
+     * {@link #getQuickOpenDelay()} ms).
+     * 
+     * @param quickOpenDelay
+     *            The quick open delay
+     */
+    public void setQuickOpenDelay(int quickOpenDelay);
+
+    /**
+     * Returns the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @return The open delay
+     */
+    public int getOpenDelay();
+
+    /**
+     * Sets the time (in ms) that should elapse after an event triggering
+     * tooltip showing has occurred (e.g. mouse over) before the tooltip is
+     * shown. If a tooltip has recently been shown, then
+     * {@link #getQuickOpenDelay()} is used instead of this.
+     * 
+     * @param openDelay
+     *            The open delay
+     */
+    public void setOpenDelay(int openDelay);
+
+    /**
+     * Returns the maximum width of the tooltip popup.
+     * 
+     * @return The maximum width the tooltip popup
+     */
+    public int getMaxWidth();
+
+    /**
+     * Sets the maximum width of the tooltip popup.
+     * 
+     * @param maxWidth
+     *            The maximum width the tooltip popup
+     */
+    public void setMaxWidth(int maxWidth);
+}
+
+class TooltipConfigurationImpl implements TooltipConfiguration {
+    private UI ui;
+
+    public TooltipConfigurationImpl(UI ui) {
+        this.ui = ui;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.UI.Tooltip#getCloseTimeout()
+     */
+    @Override
+    public int getCloseTimeout() {
+        return getState(false).closeTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setCloseTimeout(int)
+     */
+    @Override
+    public void setCloseTimeout(int closeTimeout) {
+        getState().closeTimeout = closeTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getQuickOpenTimeout()
+     */
+    @Override
+    public int getQuickOpenTimeout() {
+        return getState(false).quickOpenTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setQuickOpenTimeout(int)
+     */
+    @Override
+    public void setQuickOpenTimeout(int quickOpenTimeout) {
+        getState().quickOpenTimeout = quickOpenTimeout;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getQuickOpenDelay()
+     */
+    @Override
+    public int getQuickOpenDelay() {
+        return getState(false).quickOpenDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setQuickOpenDelay(int)
+     */
+    @Override
+    public void setQuickOpenDelay(int quickOpenDelay) {
+        getState().quickOpenDelay = quickOpenDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getOpenDelay()
+     */
+    @Override
+    public int getOpenDelay() {
+        return getState(false).openDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setOpenDelay(int)
+     */
+    @Override
+    public void setOpenDelay(int openDelay) {
+        getState().openDelay = openDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#getMaxWidth()
+     */
+    @Override
+    public int getMaxWidth() {
+        return getState(false).maxWidth;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.Tooltip#setMaxWidth(int)
+     */
+    @Override
+    public void setMaxWidth(int maxWidth) {
+        getState().maxWidth = maxWidth;
+    }
+
+    private TooltipConfigurationState getState() {
+        return ui.getState().tooltipConfiguration;
+    }
+
+    private TooltipConfigurationState getState(boolean markAsDirty) {
+        return ui.getState(markAsDirty).tooltipConfiguration;
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 5bef772c95..b6574fe1b2 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -167,7 +167,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private boolean closing = false;
 
-    private Tooltip tooltip = new TooltipImpl(this);
+    private TooltipConfiguration tooltipConfiguration = new TooltipConfigurationImpl(this);
 
     /**
      * Creates a new empty UI without a caption. The content of the UI must be
@@ -1123,8 +1123,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * 
      * @return The instance used for tooltip configuration
      */
-    public Tooltip getTooltip() {
-        return tooltip;
+    public TooltipConfiguration getTooltipConfiguration() {
+        return tooltipConfiguration;
     }
 
     /**
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 589744a48c..9e9f179f0b 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -21,7 +21,7 @@ import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.TabIndexState;
 
 public class UIState extends TabIndexState {
-    public TooltipConfiguration tooltipConfiguration = new TooltipConfiguration();
+    public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState();
     public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration();
     public int pollInterval = -1;
 
@@ -33,7 +33,7 @@ public class UIState extends TabIndexState {
         public int waitStateDelay = 5000;
     }
 
-    public static class TooltipConfiguration implements Serializable {
+    public static class TooltipConfigurationState implements Serializable {
         public int openDelay = 750;
         public int quickOpenDelay = 100;
         public int quickOpenTimeout = 1000;
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
index b8998ff32e..2227e89256 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
@@ -32,7 +32,7 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
         closeTimeout.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getTooltip().setCloseTimeout(
+                getTooltipConfiguration().setCloseTimeout(
                         (Integer) closeTimeout.getConvertedValue());
             }
         });
@@ -41,7 +41,7 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
         maxWidth.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getTooltip()
+                getTooltipConfiguration()
                         .setMaxWidth((Integer) maxWidth.getConvertedValue());
             }
         });
@@ -50,7 +50,7 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
         openDelay.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getTooltip().setOpenDelay(
+                getTooltipConfiguration().setOpenDelay(
                         (Integer) openDelay.getConvertedValue());
             }
         });
@@ -61,7 +61,7 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getTooltip().setQuickOpenDelay(
+                        getTooltipConfiguration().setQuickOpenDelay(
                                 (Integer) quickOpenDelay.getConvertedValue());
                     }
                 });
@@ -72,7 +72,7 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getTooltip().setQuickOpenTimeout(
+                        getTooltipConfiguration().setQuickOpenTimeout(
                                 (Integer) quickOpenTimeout.getConvertedValue());
                     }
                 });
-- 
cgit v1.2.3


From f596fea90a03df5191ff65aa82cf70a879809774 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 22 Apr 2013 14:06:54 +0300
Subject: Renamed UI.getLoadingIndicator -> getLoadingIndicatorConfiguration
 (#11665)

Change-Id: If80abf821abd9c6c025e49b249339eb20d56f7ce
---
 server/src/com/vaadin/ui/LoadingIndicator.java     | 159 ---------------------
 .../vaadin/ui/LoadingIndicatorConfiguration.java   | 159 +++++++++++++++++++++
 server/src/com/vaadin/ui/UI.java                   |   6 +-
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |   4 +-
 .../ui/LoadingIndicatorConfigurationTest.java      |   6 +-
 5 files changed, 167 insertions(+), 167 deletions(-)
 delete mode 100644 server/src/com/vaadin/ui/LoadingIndicator.java
 create mode 100644 server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/ui/LoadingIndicator.java b/server/src/com/vaadin/ui/LoadingIndicator.java
deleted file mode 100644
index 5740ee772d..0000000000
--- a/server/src/com/vaadin/ui/LoadingIndicator.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.vaadin.ui;
-
-import java.io.Serializable;
-
-import com.vaadin.shared.ui.ui.UIState.LoadingIndicatorConfiguration;
-
-/**
- * Provides method for configuring the loading indicator.
- * 
- * @author Vaadin Ltd
- * @since 7.1
- */
-public interface LoadingIndicator extends Serializable {
-    /**
-     * Sets the delay before the loading indicator is shown. The default is
-     * 300ms.
-     * 
-     * @param initialDelay
-     *            The initial delay (in ms)
-     */
-    public void setInitialDelay(int initialDelay);
-
-    /**
-     * Returns the delay before the loading indicator is shown.
-     * 
-     * @return The initial delay (in ms)
-     */
-    public int getInitialDelay();
-
-    /**
-     * Sets the delay before the loading indicator goes into the "delay" state.
-     * The delay is calculated from the time when the loading indicator was
-     * triggered. The default is 1500ms.
-     * 
-     * @param delayStateDelay
-     *            The delay before going into the "delay" state (in ms)
-     */
-    public void setDelayStateDelay(int delayStateDelay);
-
-    /**
-     * Returns the delay before the loading indicator goes into the "delay"
-     * state. The delay is calculated from the time when the loading indicator
-     * was triggered.
-     * 
-     * @return The delay before going into the "delay" state (in ms)
-     */
-    public int getDelayStateDelay();
-
-    /**
-     * Sets the delay before the loading indicator goes into the "wait" state.
-     * The delay is calculated from the time when the loading indicator was
-     * triggered. The default is 5000ms.
-     * 
-     * @param waitStateDelay
-     *            The delay before going into the "wait" state (in ms)
-     */
-    public void setWaitStateDelay(int waitStateDelay);
-
-    /**
-     * Returns the delay before the loading indicator goes into the "wait"
-     * state. The delay is calculated from the time when the loading indicator
-     * was triggered.
-     * 
-     * @return The delay before going into the "wait" state (in ms)
-     */
-    public int getWaitStateDelay();
-}
-
-class LoadingIndicatorImpl implements LoadingIndicator {
-    private UI ui;
-
-    public LoadingIndicatorImpl(UI ui) {
-        this.ui = ui;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#setInitialDelay(int)
-     */
-    @Override
-    public void setInitialDelay(int initialDelay) {
-        getState().initialDelay = initialDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#getInitialDelay()
-     */
-    @Override
-    public int getInitialDelay() {
-        return getState(false).initialDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#setDelayStateDelay(int)
-     */
-    @Override
-    public void setDelayStateDelay(int delayStateDelay) {
-        getState().delayStateDelay = delayStateDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#getDelayStateDelay()
-     */
-    @Override
-    public int getDelayStateDelay() {
-        return getState(false).delayStateDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#setWaitStateDelay(int)
-     */
-    @Override
-    public void setWaitStateDelay(int waitStateDelay) {
-        getState().waitStateDelay = waitStateDelay;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.LoadingIndicator#getWaitStateDelay()
-     */
-    @Override
-    public int getWaitStateDelay() {
-        return getState(false).waitStateDelay;
-    }
-
-    private LoadingIndicatorConfiguration getState() {
-        return ui.getState().loadingIndicatorConfiguration;
-    }
-
-    private LoadingIndicatorConfiguration getState(boolean markAsDirty) {
-        return ui.getState(markAsDirty).loadingIndicatorConfiguration;
-    }
-
-}
diff --git a/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
new file mode 100644
index 0000000000..ca6c158aa5
--- /dev/null
+++ b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.ui;
+
+import java.io.Serializable;
+
+import com.vaadin.shared.ui.ui.UIState.LoadingIndicatorConfigurationState;
+
+/**
+ * Provides method for configuring the loading indicator.
+ * 
+ * @author Vaadin Ltd
+ * @since 7.1
+ */
+public interface LoadingIndicatorConfiguration extends Serializable {
+    /**
+     * Sets the delay before the loading indicator is shown. The default is
+     * 300ms.
+     * 
+     * @param initialDelay
+     *            The initial delay (in ms)
+     */
+    public void setInitialDelay(int initialDelay);
+
+    /**
+     * Returns the delay before the loading indicator is shown.
+     * 
+     * @return The initial delay (in ms)
+     */
+    public int getInitialDelay();
+
+    /**
+     * Sets the delay before the loading indicator goes into the "delay" state.
+     * The delay is calculated from the time when the loading indicator was
+     * triggered. The default is 1500ms.
+     * 
+     * @param delayStateDelay
+     *            The delay before going into the "delay" state (in ms)
+     */
+    public void setDelayStateDelay(int delayStateDelay);
+
+    /**
+     * Returns the delay before the loading indicator goes into the "delay"
+     * state. The delay is calculated from the time when the loading indicator
+     * was triggered.
+     * 
+     * @return The delay before going into the "delay" state (in ms)
+     */
+    public int getDelayStateDelay();
+
+    /**
+     * Sets the delay before the loading indicator goes into the "wait" state.
+     * The delay is calculated from the time when the loading indicator was
+     * triggered. The default is 5000ms.
+     * 
+     * @param waitStateDelay
+     *            The delay before going into the "wait" state (in ms)
+     */
+    public void setWaitStateDelay(int waitStateDelay);
+
+    /**
+     * Returns the delay before the loading indicator goes into the "wait"
+     * state. The delay is calculated from the time when the loading indicator
+     * was triggered.
+     * 
+     * @return The delay before going into the "wait" state (in ms)
+     */
+    public int getWaitStateDelay();
+}
+
+class LoadingIndicatorConfigurationImpl implements LoadingIndicatorConfiguration {
+    private UI ui;
+
+    public LoadingIndicatorConfigurationImpl(UI ui) {
+        this.ui = ui;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setInitialDelay(int)
+     */
+    @Override
+    public void setInitialDelay(int initialDelay) {
+        getState().initialDelay = initialDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getInitialDelay()
+     */
+    @Override
+    public int getInitialDelay() {
+        return getState(false).initialDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setDelayStateDelay(int)
+     */
+    @Override
+    public void setDelayStateDelay(int delayStateDelay) {
+        getState().delayStateDelay = delayStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getDelayStateDelay()
+     */
+    @Override
+    public int getDelayStateDelay() {
+        return getState(false).delayStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#setWaitStateDelay(int)
+     */
+    @Override
+    public void setWaitStateDelay(int waitStateDelay) {
+        getState().waitStateDelay = waitStateDelay;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.ui.LoadingIndicator#getWaitStateDelay()
+     */
+    @Override
+    public int getWaitStateDelay() {
+        return getState(false).waitStateDelay;
+    }
+
+    private LoadingIndicatorConfigurationState getState() {
+        return ui.getState().loadingIndicatorConfiguration;
+    }
+
+    private LoadingIndicatorConfigurationState getState(boolean markAsDirty) {
+        return ui.getState(markAsDirty).loadingIndicatorConfiguration;
+    }
+
+}
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index b6574fe1b2..837d793b19 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -118,7 +118,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private Page page = new Page(this);
 
-    private LoadingIndicator loadingIndicator = new LoadingIndicatorImpl(this);
+    private LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfigurationImpl(this);
 
     /**
      * Scroll Y position.
@@ -1132,8 +1132,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * 
      * @return The instance used for configuring the loading indicator
      */
-    public LoadingIndicator getLoadingIndicator() {
-        return loadingIndicator;
+    public LoadingIndicatorConfiguration getLoadingIndicatorConfiguration() {
+        return loadingIndicatorConfiguration;
     }
 
     /**
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 9e9f179f0b..ee3478f0a0 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -22,12 +22,12 @@ import com.vaadin.shared.ui.TabIndexState;
 
 public class UIState extends TabIndexState {
     public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState();
-    public LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfiguration();
+    public LoadingIndicatorConfigurationState loadingIndicatorConfiguration = new LoadingIndicatorConfigurationState();
     public int pollInterval = -1;
 
     public PushMode pushMode = PushMode.DISABLED;
 
-    public static class LoadingIndicatorConfiguration implements Serializable {
+    public static class LoadingIndicatorConfigurationState implements Serializable {
         public int initialDelay = 300;
         public int delayStateDelay = 1500;
         public int waitStateDelay = 5000;
diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
index 0f15ff2fe0..8917a1aa6d 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
@@ -41,7 +41,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
         initialDelay.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getLoadingIndicator().setInitialDelay(
+                getLoadingIndicatorConfiguration().setInitialDelay(
                         (Integer) initialDelay.getConvertedValue());
             }
         });
@@ -51,7 +51,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicator().setDelayStateDelay(
+                        getLoadingIndicatorConfiguration().setDelayStateDelay(
                                 (Integer) delayStateDelay.getConvertedValue());
                     }
                 });
@@ -61,7 +61,7 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicator().setWaitStateDelay(
+                        getLoadingIndicatorConfiguration().setWaitStateDelay(
                                 (Integer) waitStateDelay.getConvertedValue());
                     }
                 });
-- 
cgit v1.2.3


From c844d94b81b2645f2800e17557fe6e300e85de96 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 22 Apr 2013 14:18:32 +0300
Subject: Renamed loading indicator states to 'first','second','third' (#11668)

Change-Id: I127070e2014bebf8aa09778b2dffee5481845ab4
---
 .../src/com/vaadin/client/VLoadingIndicator.java   | 113 +++++++++++----------
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  12 +--
 .../vaadin/ui/LoadingIndicatorConfiguration.java   |  77 +++++++-------
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |   9 +-
 .../ui/LoadingIndicatorConfigurationTest.java      |  38 +++----
 5 files changed, 129 insertions(+), 120 deletions(-)

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/VLoadingIndicator.java b/client/src/com/vaadin/client/VLoadingIndicator.java
index 0ef85925cd..fcce35781d 100644
--- a/client/src/com/vaadin/client/VLoadingIndicator.java
+++ b/client/src/com/vaadin/client/VLoadingIndicator.java
@@ -24,7 +24,7 @@ import com.google.gwt.user.client.Timer;
 
 /**
  * Class representing the loading indicator for Vaadin applications. The loading
- * indicator has four states: "triggered", "initial", "delay" and "wait". When
+ * indicator has four states: "triggered", "first", "second" and "third". When
  * {@link #trigger()} is called the indicator moves to its "triggered" state and
  * then transitions from one state to the next when the timeouts specified using
  * the set*StateDelay methods occur.
@@ -38,9 +38,9 @@ public class VLoadingIndicator {
 
     private ApplicationConnection connection;
 
-    private int initialStateDelay = 300;
-    private int delayStateDelay = 1500;
-    private int waitStateDelay = 5000;
+    private int firstDelay = 300;
+    private int secondDelay = 1500;
+    private int thirdDelay = 5000;
 
     /**
      * Timer with method for checking if it has been cancelled. This class is a
@@ -81,7 +81,7 @@ public class VLoadingIndicator {
         }
     }
 
-    private Timer initialTimer = new LoadingIndicatorTimer() {
+    private Timer firstTimer = new LoadingIndicatorTimer() {
         @Override
         public void run() {
             if (isCancelled()) {
@@ -91,24 +91,30 @@ public class VLoadingIndicator {
             show();
         }
     };
-    private Timer delayStateTimer = new LoadingIndicatorTimer() {
+    private Timer secondTimer = new LoadingIndicatorTimer() {
         @Override
         public void run() {
             if (isCancelled()) {
                 // IE8 does not properly cancel the timer in all cases.
                 return;
             }
-            getElement().setClassName(PRIMARY_STYLE_NAME + "-delay");
+            getElement().setClassName(PRIMARY_STYLE_NAME);
+            getElement().addClassName("second");
+            // For backwards compatibility only
+            getElement().addClassName(PRIMARY_STYLE_NAME + "-delay");
         }
     };
-    private Timer waitStateTimer = new LoadingIndicatorTimer() {
+    private Timer thirdTimer = new LoadingIndicatorTimer() {
         @Override
         public void run() {
             if (isCancelled()) {
                 // IE8 does not properly cancel the timer in all cases.
                 return;
             }
-            getElement().setClassName(PRIMARY_STYLE_NAME + "-wait");
+            getElement().setClassName(PRIMARY_STYLE_NAME);
+            getElement().addClassName("third");
+            // For backwards compatibility only
+            getElement().addClassName(PRIMARY_STYLE_NAME + "-wait");
         }
     };
 
@@ -116,107 +122,108 @@ public class VLoadingIndicator {
 
     /**
      * Returns the delay (in ms) which must pass before the loading indicator
-     * moves into the "initial" state and is shown to the user
+     * moves into the "first" state and is shown to the user
      * 
-     * @return The delay (in ms) until moving into the "initial" state. Counted
+     * @return The delay (in ms) until moving into the "first" state. Counted
      *         from when {@link #trigger()} is called.
      */
-    public int getInitialStateDelay() {
-        return initialStateDelay;
+    public int getFirstDelay() {
+        return firstDelay;
     }
 
     /**
      * Sets the delay (in ms) which must pass before the loading indicator moves
-     * into the "initial" state and is shown to the user
+     * into the "first" state and is shown to the user
      * 
-     * @param initialStateDelay
-     *            The delay (in ms) until moving into the "initial" state.
-     *            Counted from when {@link #trigger()} is called.
+     * @param firstDelay
+     *            The delay (in ms) until moving into the "first" state. Counted
+     *            from when {@link #trigger()} is called.
      */
-    public void setInitialStateDelay(int initialStateDelay) {
-        this.initialStateDelay = initialStateDelay;
+    public void setFirstDelay(int firstDelay) {
+        this.firstDelay = firstDelay;
     }
 
     /**
      * Returns the delay (in ms) which must pass before the loading indicator
-     * moves to its "delay" state.
+     * moves to its "second" state.
      * 
      * @return The delay (in ms) until the loading indicator moves into its
-     *         "delay" state. Counted from when {@link #trigger()} is called.
+     *         "second" state. Counted from when {@link #trigger()} is called.
      */
-    public int getDelayStateDelay() {
-        return delayStateDelay;
+    public int getSecondDelay() {
+        return secondDelay;
     }
 
     /**
      * Sets the delay (in ms) which must pass before the loading indicator moves
-     * to its "delay" state.
+     * to its "second" state.
      * 
-     * @param delayStateDelay
+     * @param secondDelay
      *            The delay (in ms) until the loading indicator moves into its
-     *            "delay" state. Counted from when {@link #trigger()} is called.
+     *            "second" state. Counted from when {@link #trigger()} is
+     *            called.
      */
-    public void setDelayStateDelay(int delayStateDelay) {
-        this.delayStateDelay = delayStateDelay;
+    public void setSecondDelay(int secondDelay) {
+        this.secondDelay = secondDelay;
     }
 
     /**
      * Returns the delay (in ms) which must pass before the loading indicator
-     * moves to its "wait" state.
+     * moves to its "third" state.
      * 
      * @return The delay (in ms) until the loading indicator moves into its
-     *         "wait" state. Counted from when {@link #trigger()} is called.
+     *         "third" state. Counted from when {@link #trigger()} is called.
      */
-    public int getWaitStateDelay() {
-        return waitStateDelay;
+    public int getThirdDelay() {
+        return thirdDelay;
     }
 
     /**
      * Sets the delay (in ms) which must pass before the loading indicator moves
-     * to its "wait" state.
+     * to its "third" state.
      * 
-     * @param loadingIndicatorThirdDelay
+     * @param thirdDelay
      *            The delay (in ms) from the event until changing the loading
-     *            indicator into its "wait" state. Counted from when
+     *            indicator into its "third" state. Counted from when
      *            {@link #trigger()} is called.
      */
-    public void setWaitStateDelay(int loadingIndicatorThirdDelay) {
-        waitStateDelay = loadingIndicatorThirdDelay;
+    public void setThirdDelay(int thirdDelay) {
+        this.thirdDelay = thirdDelay;
     }
 
     /**
      * Triggers displaying of this loading indicator. The loading indicator will
-     * actually be shown by {@link #show()} when the initial delay (as specified
-     * by {@link #getInitialStateDelay()}) has passed.
+     * actually be shown by {@link #show()} when the "first" delay (as specified
+     * by {@link #getFirstDelay()}) has passed.
      * <p>
      * The loading indicator will be hidden if shown when calling this method.
      * </p>
      */
     public void trigger() {
         hide();
-        initialTimer.schedule(getInitialStateDelay());
+        firstTimer.schedule(getFirstDelay());
     }
 
     /**
      * Shows the loading indicator in its standard state and triggers timers for
-     * transitioning into the "delay" and "wait" states.
+     * transitioning into the "second" and "third" states.
      */
     public void show() {
         // Reset possible style name and display mode
         getElement().setClassName(PRIMARY_STYLE_NAME);
+        getElement().addClassName("first");
         getElement().getStyle().setDisplay(Display.BLOCK);
 
-        // Schedule the "delay" loading indicator
-        int delayStateTimerDelay = getDelayStateDelay()
-                - getInitialStateDelay();
-        if (delayStateTimerDelay >= 0) {
-            delayStateTimer.schedule(delayStateTimerDelay);
+        // Schedule the "second" loading indicator
+        int secondTimerDelay = getSecondDelay() - getFirstDelay();
+        if (secondTimerDelay >= 0) {
+            secondTimer.schedule(secondTimerDelay);
         }
 
-        // Schedule the "wait" loading indicator
-        int waitStateTimerDelay = getWaitStateDelay() - getInitialStateDelay();
-        if (waitStateTimerDelay >= 0) {
-            waitStateTimer.schedule(waitStateTimerDelay);
+        // Schedule the "third" loading indicator
+        int thirdTimerDelay = getThirdDelay() - getFirstDelay();
+        if (thirdTimerDelay >= 0) {
+            thirdTimer.schedule(thirdTimerDelay);
         }
     }
 
@@ -246,9 +253,9 @@ public class VLoadingIndicator {
      * timers.
      */
     public void hide() {
-        initialTimer.cancel();
-        delayStateTimer.cancel();
-        waitStateTimer.cancel();
+        firstTimer.cancel();
+        secondTimer.cancel();
+        thirdTimer.cancel();
 
         getElement().getStyle().setDisplay(Display.NONE);
     }
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 26ca6b559a..e7c4c5b4a8 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -577,12 +577,12 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
 
         if (stateChangeEvent
                 .hasPropertyChanged("loadingIndicatorConfiguration")) {
-            getConnection().getLoadingIndicator().setInitialStateDelay(
-                    getState().loadingIndicatorConfiguration.initialDelay);
-            getConnection().getLoadingIndicator().setWaitStateDelay(
-                    getState().loadingIndicatorConfiguration.waitStateDelay);
-            getConnection().getLoadingIndicator().setDelayStateDelay(
-                    getState().loadingIndicatorConfiguration.delayStateDelay);
+            getConnection().getLoadingIndicator().setFirstDelay(
+                    getState().loadingIndicatorConfiguration.firstDelay);
+            getConnection().getLoadingIndicator().setSecondDelay(
+                    getState().loadingIndicatorConfiguration.secondDelay);
+            getConnection().getLoadingIndicator().setThirdDelay(
+                    getState().loadingIndicatorConfiguration.thirdDelay);
         }
 
         if (stateChangeEvent.hasPropertyChanged("pollInterval")) {
diff --git a/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
index ca6c158aa5..57ccdc1b64 100644
--- a/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
+++ b/server/src/com/vaadin/ui/LoadingIndicatorConfiguration.java
@@ -30,58 +30,59 @@ public interface LoadingIndicatorConfiguration extends Serializable {
      * Sets the delay before the loading indicator is shown. The default is
      * 300ms.
      * 
-     * @param initialDelay
-     *            The initial delay (in ms)
+     * @param firstDelay
+     *            The first delay (in ms)
      */
-    public void setInitialDelay(int initialDelay);
+    public void setFirstDelay(int firstDelay);
 
     /**
      * Returns the delay before the loading indicator is shown.
      * 
-     * @return The initial delay (in ms)
+     * @return The first delay (in ms)
      */
-    public int getInitialDelay();
+    public int getFirstDelay();
 
     /**
-     * Sets the delay before the loading indicator goes into the "delay" state.
+     * Sets the delay before the loading indicator goes into the "second" state.
      * The delay is calculated from the time when the loading indicator was
      * triggered. The default is 1500ms.
      * 
-     * @param delayStateDelay
-     *            The delay before going into the "delay" state (in ms)
+     * @param secondDelay
+     *            The delay before going into the "second" state (in ms)
      */
-    public void setDelayStateDelay(int delayStateDelay);
+    public void setSecondDelay(int secondDelay);
 
     /**
-     * Returns the delay before the loading indicator goes into the "delay"
+     * Returns the delay before the loading indicator goes into the "second"
      * state. The delay is calculated from the time when the loading indicator
      * was triggered.
      * 
-     * @return The delay before going into the "delay" state (in ms)
+     * @return The delay before going into the "second" state (in ms)
      */
-    public int getDelayStateDelay();
+    public int getSecondDelay();
 
     /**
-     * Sets the delay before the loading indicator goes into the "wait" state.
+     * Sets the delay before the loading indicator goes into the "third" state.
      * The delay is calculated from the time when the loading indicator was
      * triggered. The default is 5000ms.
      * 
-     * @param waitStateDelay
-     *            The delay before going into the "wait" state (in ms)
+     * @param thirdDelay
+     *            The delay before going into the "third" state (in ms)
      */
-    public void setWaitStateDelay(int waitStateDelay);
+    public void setThirdDelay(int thirdDelay);
 
     /**
-     * Returns the delay before the loading indicator goes into the "wait"
+     * Returns the delay before the loading indicator goes into the "third"
      * state. The delay is calculated from the time when the loading indicator
      * was triggered.
      * 
-     * @return The delay before going into the "wait" state (in ms)
+     * @return The delay before going into the "third" state (in ms)
      */
-    public int getWaitStateDelay();
+    public int getThirdDelay();
 }
 
-class LoadingIndicatorConfigurationImpl implements LoadingIndicatorConfiguration {
+class LoadingIndicatorConfigurationImpl implements
+        LoadingIndicatorConfiguration {
     private UI ui;
 
     public LoadingIndicatorConfigurationImpl(UI ui) {
@@ -91,61 +92,61 @@ class LoadingIndicatorConfigurationImpl implements LoadingIndicatorConfiguration
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#setInitialDelay(int)
+     * @see com.vaadin.ui.LoadingIndicator#setFirstDelay(int)
      */
     @Override
-    public void setInitialDelay(int initialDelay) {
-        getState().initialDelay = initialDelay;
+    public void setFirstDelay(int firstDelay) {
+        getState().firstDelay = firstDelay;
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#getInitialDelay()
+     * @see com.vaadin.ui.LoadingIndicator#getFirstDelay()
      */
     @Override
-    public int getInitialDelay() {
-        return getState(false).initialDelay;
+    public int getFirstDelay() {
+        return getState(false).firstDelay;
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#setDelayStateDelay(int)
+     * @see com.vaadin.ui.LoadingIndicator#setSecondDelay(int)
      */
     @Override
-    public void setDelayStateDelay(int delayStateDelay) {
-        getState().delayStateDelay = delayStateDelay;
+    public void setSecondDelay(int secondDelay) {
+        getState().secondDelay = secondDelay;
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#getDelayStateDelay()
+     * @see com.vaadin.ui.LoadingIndicator#getSecondDelay()
      */
     @Override
-    public int getDelayStateDelay() {
-        return getState(false).delayStateDelay;
+    public int getSecondDelay() {
+        return getState(false).secondDelay;
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#setWaitStateDelay(int)
+     * @see com.vaadin.ui.LoadingIndicator#setThirdDelay(int)
      */
     @Override
-    public void setWaitStateDelay(int waitStateDelay) {
-        getState().waitStateDelay = waitStateDelay;
+    public void setThirdDelay(int thirdDelay) {
+        getState().thirdDelay = thirdDelay;
     }
 
     /*
      * (non-Javadoc)
      * 
-     * @see com.vaadin.ui.LoadingIndicator#getWaitStateDelay()
+     * @see com.vaadin.ui.LoadingIndicator#getThirdDelay()
      */
     @Override
-    public int getWaitStateDelay() {
-        return getState(false).waitStateDelay;
+    public int getThirdDelay() {
+        return getState(false).thirdDelay;
     }
 
     private LoadingIndicatorConfigurationState getState() {
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index ee3478f0a0..e8be9d674c 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -27,10 +27,11 @@ public class UIState extends TabIndexState {
 
     public PushMode pushMode = PushMode.DISABLED;
 
-    public static class LoadingIndicatorConfigurationState implements Serializable {
-        public int initialDelay = 300;
-        public int delayStateDelay = 1500;
-        public int waitStateDelay = 5000;
+    public static class LoadingIndicatorConfigurationState implements
+            Serializable {
+        public int firstDelay = 300;
+        public int secondDelay = 1500;
+        public int thirdDelay = 5000;
     }
 
     public static class TooltipConfigurationState implements Serializable {
diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
index 8917a1aa6d..0d962309e4 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
@@ -13,9 +13,9 @@ import com.vaadin.ui.TextField;
 
 public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
 
-    private TextField initialDelay;
-    private TextField delayStateDelay;
-    private TextField waitStateDelay;
+    private TextField firstDelay;
+    private TextField secondDelay;
+    private TextField thirdDelay;
 
     @Override
     protected void setup(VaadinRequest request) {
@@ -36,38 +36,38 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
             }
         });
 
-        initialDelay = createIntegerTextField("Initial delay (ms)",
-                getState().loadingIndicatorConfiguration.initialDelay);
-        initialDelay.addValueChangeListener(new Property.ValueChangeListener() {
+        firstDelay = createIntegerTextField("First delay (ms)",
+                getState().loadingIndicatorConfiguration.firstDelay);
+        firstDelay.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getLoadingIndicatorConfiguration().setInitialDelay(
-                        (Integer) initialDelay.getConvertedValue());
+                getLoadingIndicatorConfiguration().setFirstDelay(
+                        (Integer) firstDelay.getConvertedValue());
             }
         });
-        delayStateDelay = createIntegerTextField("Delay state delay (ms)",
-                getState().loadingIndicatorConfiguration.delayStateDelay);
-        delayStateDelay
+        secondDelay = createIntegerTextField("Second delay (ms)",
+                getState().loadingIndicatorConfiguration.secondDelay);
+        secondDelay
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicatorConfiguration().setDelayStateDelay(
-                                (Integer) delayStateDelay.getConvertedValue());
+                        getLoadingIndicatorConfiguration().setSecondDelay(
+                                (Integer) secondDelay.getConvertedValue());
                     }
                 });
-        waitStateDelay = createIntegerTextField("Wait state delay (ms)",
-                getState().loadingIndicatorConfiguration.waitStateDelay);
-        waitStateDelay
+        thirdDelay = createIntegerTextField("Third delay (ms)",
+                getState().loadingIndicatorConfiguration.thirdDelay);
+        thirdDelay
                 .addValueChangeListener(new Property.ValueChangeListener() {
                     @Override
                     public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicatorConfiguration().setWaitStateDelay(
-                                (Integer) waitStateDelay.getConvertedValue());
+                        getLoadingIndicatorConfiguration().setThirdDelay(
+                                (Integer) thirdDelay.getConvertedValue());
                     }
                 });
 
         getLayout()
-                .addComponents(initialDelay, delayStateDelay, waitStateDelay);
+                .addComponents(firstDelay, secondDelay, thirdDelay);
 
         HorizontalLayout hl = new HorizontalLayout();
         hl.setMargin(true);
-- 
cgit v1.2.3


From 49ac6f4da031d2132035d69105fd3240949d9805 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 16 Apr 2013 13:57:14 +0300
Subject: Sources for the "Broadcasting messages to other users" tutorial

Change-Id: I1408d2b4c33bb51393867b2a089035699a5af756
---
 .../broadcastingmessages/Broadcaster.java          | 63 ++++++++++++++++++++++
 .../broadcastingmessages/BroadcasterUI.java        | 58 ++++++++++++++++++++
 2 files changed, 121 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
 create mode 100644 uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
new file mode 100644
index 0000000000..e355cd1dbd
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
@@ -0,0 +1,63 @@
+package com.vaadin.tests.minitutorials.broadcastingmessages;
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Broadcaster {
+
+    private static List<BroadcastListener> listeners = new ArrayList<BroadcastListener>();
+
+    public synchronized static void register(BroadcastListener listener) {
+        listeners.add(listener);
+    }
+
+    public synchronized static void unregister(BroadcastListener listener) {
+        listeners.remove(listener);
+    }
+
+    private synchronized static List<BroadcastListener> getListeners() {
+        List<BroadcastListener> listenerCopy = new ArrayList<BroadcastListener>();
+        listenerCopy.addAll(listeners);
+        return listenerCopy;
+    }
+
+    public static void broadcast(final String message) {
+        // Make a copy of the listener list while synchronized, can't be
+        // synchronized while firing the event or we would have to fire each
+        // event in a separate thread.
+        final List<BroadcastListener> listenerCopy = getListeners();
+
+        // We spawn another thread to avoid potential deadlocks with
+        // multiple UIs locked simultaneously
+        Thread eventThread = new Thread() {
+            @Override
+            public void run() {
+                for (BroadcastListener listener : listenerCopy) {
+                    listener.receiveBroadcast(message);
+                }
+            }
+        };
+        eventThread.start();
+    }
+
+    public interface BroadcastListener {
+        public void receiveBroadcast(String message);
+    }
+
+}
diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
new file mode 100644
index 0000000000..80c847250d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
@@ -0,0 +1,58 @@
+package com.vaadin.tests.minitutorials.broadcastingmessages;
+
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.minitutorials.broadcastingmessages.Broadcaster.BroadcastListener;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.Notification.Type;
+import com.vaadin.ui.TextArea;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+
+public class BroadcasterUI extends UI implements BroadcastListener {
+
+    @Override
+    protected void init(VaadinRequest request) {
+        final VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        setContent(layout);
+
+        final TextArea message = new TextArea("",
+                "The system is going down for maintenance in 10 minutes");
+        layout.addComponent(message);
+
+        final Button button = new Button("Broadcast");
+        layout.addComponent(button);
+        button.addClickListener(new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                Broadcaster.broadcast(message.getValue());
+            }
+        });
+
+        // Register broadcast listener
+        Broadcaster.register(this);
+    }
+
+    @Override
+    public void detach() {
+        Broadcaster.unregister(this);
+        super.detach();
+    }
+
+    @Override
+    public void receiveBroadcast(final String message) {
+        runSafely(new Runnable() {
+            @Override
+            public void run() {
+                Notification n = new Notification("Message received", message,
+                        Type.TRAY_NOTIFICATION);
+                n.show(getPage());
+            }
+        });
+
+    }
+
+}
\ No newline at end of file
-- 
cgit v1.2.3


From 437c60c4e8df0ef80569c59bbf309651e84a2daa Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 23 Apr 2013 17:03:05 +0300
Subject: Fixed screenshot identifiers

Change-Id: I7b1ca21ec7fa89f3c725151a7d3dea0493614f93
---
 .../tests/components/window/WindowMaximizeRestoreTest.html | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
index ed76caed54..69ea0181d5 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -144,8 +144,8 @@
 <!--test two windows with screen shot-->
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-original-pos-window-1-centered</td>
 	<td></td>
+	<td>window-2-original-pos-window-1-centered</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -154,8 +154,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-1-maximized-on-top-of-window-2</td>
 	<td></td>
+	<td>window-1-maximized-on-top-of-window-2</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -170,8 +170,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-original-pos-window-1-centered-again</td>
 	<td></td>
+	<td>window-2-original-pos-window-1-centered-again</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -180,8 +180,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-maximized-on-top-of-window-1</td>
 	<td></td>
+	<td>window-2-maximized-on-top-of-window-1</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -190,8 +190,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-closed-window-1-centered</td>
 	<td></td>
+	<td>window-2-closed-window-1-centered</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -205,8 +205,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-2-added-maximized-on-top-of-window-1</td>
 	<td></td>
+	<td>window-2-added-maximized-on-top-of-window-1</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -220,8 +220,8 @@
 </tr>
 <tr>
 	<td>screenCapture</td>
-	<td>window-1-maximized-with-doubleclick</td>
 	<td></td>
+	<td>window-1-maximized-with-doubleclick</td>
 </tr>
 </tbody></table>
 </body>
-- 
cgit v1.2.3


From 5486eb531ad95121c245d86925f7c644678977b6 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 23 Apr 2013 17:20:55 +0300
Subject: Made test work in all browsers

Change-Id: Id3b1edeb121b353fa5c83bbef052fbde2d1e8ae4
---
 uitest/src/com/vaadin/tests/components/ui/UIPolling.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.html b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html
index 0e3cc2bc6e..f770bae009 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIPolling.html
+++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.html
@@ -18,7 +18,7 @@
 </tr>
 <tr>
 	<td>type</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td>
 	<td>500</td>
 </tr>
 <tr>
@@ -34,7 +34,7 @@
 </tr>
 <tr>
 	<td>type</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runUIPolling::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VTextField[0]</td>
 	<td>-1</td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From 7e5534992951fc61260cdd7159e3cb8cb91a2e79 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 23 Apr 2013 17:41:59 +0300
Subject: Updated test as there is no longer a minimum height for a Window

Change-Id: I171ec24350c96a9b662b0407643743bad3793921
---
 .../tests/components/window/CenteredWindowWithUndefinedSize.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
index efe7eb20bf..42fab79376 100644
--- a/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
+++ b/uitest/src/com/vaadin/tests/components/window/CenteredWindowWithUndefinedSize.java
@@ -9,7 +9,7 @@ public class CenteredWindowWithUndefinedSize extends TestBase {
 
     @Override
     protected String getDescription() {
-        return "The centered sub-window with undefined height and a 100% high layout should be rendered in the center of the screen and not in the top-left corner.";
+        return "The centered sub-window with undefined height and a undefined high layout should be rendered in the center of the screen and not in the top-left corner.";
     }
 
     @Override
@@ -23,7 +23,7 @@ public class CenteredWindowWithUndefinedSize extends TestBase {
         layout.setMargin(true);
         Window centered = new Window("A window", layout);
         centered.setSizeUndefined();
-        layout.setSizeFull();
+        layout.setSizeUndefined();
         centered.center();
 
         Label l = new Label("This window should be centered");
-- 
cgit v1.2.3


From 7900166360dac2d2ae8885e0151f46cad472805f Mon Sep 17 00:00:00 2001
From: michaelvogt <michael@vaadin.com>
Date: Mon, 15 Apr 2013 17:35:18 +0300
Subject: TestBench test for tree (#11612)

Together with fix for tree to pass the test

Change-Id: I3d6bead220ab61b171a267d15bda2570f7351d49
---
 client/src/com/vaadin/client/ui/VTree.java         |   4 +-
 .../vaadin/tests/components/tree/SimpleTree.html   | 270 +++++++++++++++++++++
 2 files changed, 273 insertions(+), 1 deletion(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/tree/SimpleTree.html

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VTree.java b/client/src/com/vaadin/client/ui/VTree.java
index e08b483c8c..51c00ca310 100644
--- a/client/src/com/vaadin/client/ui/VTree.java
+++ b/client/src/com/vaadin/client/ui/VTree.java
@@ -877,7 +877,8 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
             String labelId = DOM.createUniqueId();
 
             addStyleName(CLASSNAME);
-            getElement().setId(DOM.createUniqueId());
+            String treeItemId = DOM.createUniqueId();
+            getElement().setId(treeItemId);
             Roles.getTreeitemRole().set(getElement());
             Roles.getTreeitemRole().setAriaSelectedState(getElement(),
                     SelectedValue.FALSE);
@@ -889,6 +890,7 @@ public class VTree extends FocusElementPanel implements VHasDropHandler,
                     + "-caption");
             Element wrapper = DOM.createDiv();
             wrapper.setId(labelId);
+            wrapper.setAttribute("for", treeItemId);
 
             nodeCaptionSpan = DOM.createSpan();
             DOM.appendChild(getElement(), nodeCaptionDiv);
diff --git a/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html
new file mode 100644
index 0000000000..a446f67726
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/tree/SimpleTree.html
@@ -0,0 +1,270 @@
+<?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="" />
+<title>SimpleTree</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">SimpleTree</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/run/com.vaadin.tests.components.tree.SimpleTree?restartApplication</td>
+	<td></td>
+</tr>
+<!--Caption-->
+<tr>
+	<td>verifyElementPresent</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTree[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@id</td>
+	<td>captionid</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@aria-labelledby</td>
+	<td>${captionid}</td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]@id</td>
+	<td>treeid</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[0]@for</td>
+	<td>${treeid}</td>
+</tr>
+<!--Tree-->
+<tr>
+	<td>verifyElementPresent</td>
+	<td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[@aria-multiselectable='false']</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertElementPresent</td>
+	<td>xpath=/html/body/div/div/div[2]/div/div[2]/div/div/div/div[2]/div[@role='tree']</td>
+	<td></td>
+</tr>
+<!--Treeitem-->
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@id</td>
+	<td>captionid</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@aria-labelledby</td>
+	<td>${captionid}</td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+	<td>treeitem10id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]/domChild[0]@for</td>
+	<td>${treeitem10id}</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-level</td>
+	<td>1</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]@role</td>
+	<td>group</td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@id</td>
+	<td>treeitem11id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem11id}@role</td>
+	<td>treeitem</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem11id}@aria-level</td>
+	<td>2</td>
+</tr>
+<!--Open/Close-->
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-expanded</td>
+	<td>true</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=//div[@id='${treeitem10id}']</td>
+	<td>5,5</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-expanded</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=//div[@id='${treeitem10id}']</td>
+	<td>5,5</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-expanded</td>
+	<td>true</td>
+</tr>
+<!--Root Selected-->
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[1]/div[1]/span[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+	<td>treeitem10id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-selected</td>
+	<td>true</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+	<td>false</td>
+</tr>
+<!--First child selected-->
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]/div[1]/div[1]/span[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+	<td>treeitem10id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+	<td>true</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+	<td>false</td>
+</tr>
+<!--Last child selected-->
+<tr>
+	<td>mouseClick</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]/div[1]/div[1]/span[1]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+	<td>treeitem10id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+	<td>true</td>
+</tr>
+<!--Another root selected-->
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[1]@aria-selected</td>
+	<td>true</td>
+</tr>
+<tr>
+	<td>storeAttribute</td>
+	<td>vaadin=runcomvaadintestscomponentstreeSimpleTree::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/domChild[0]/domChild[1]/domChild[0]/domChild[0]@id</td>
+	<td>treeitem10id</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>${treeitem10id}@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[1]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[2]@aria-selected</td>
+	<td>false</td>
+</tr>
+<tr>
+	<td>assertAttribute</td>
+	<td>xpath=//div[@id='${treeitem10id}']/div[2]/div[3]@aria-selected</td>
+	<td>false</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From 220b1150ca411a63009d7f30e0400dc062f10c27 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Thu, 25 Apr 2013 14:01:27 +0300
Subject: Global code clean up

Change-Id: I380d6afbc6b30d817ea6cca3d6b4634ab12522b1
---
 .../communication/AtmospherePushConnection.java    |  3 +-
 .../client/ui/AbstractClickEventHandler.java       |  5 ++--
 client/src/com/vaadin/client/ui/VNativeButton.java |  6 ----
 client/src/com/vaadin/client/ui/VWindow.java       |  3 +-
 server/src/com/vaadin/ui/DateField.java            |  2 --
 server/src/com/vaadin/ui/UI.java                   |  6 ++--
 .../shared/ui/datefield/InlineDateFieldState.java  |  1 -
 .../sass/internal/resolver/VaadinResolver.java     |  2 +-
 .../ui/LoadingIndicatorConfigurationTest.java      | 33 ++++++++++------------
 .../tests/components/ui/TooltipConfiguration.java  |  4 +--
 .../VerticalLayoutSlotExpansionAndAlignment.java   |  1 -
 .../broadcastingmessages/Broadcaster.java          |  2 +-
 .../broadcastingmessages/BroadcasterUI.java        |  1 -
 .../tests/widgetset/server/RoundTripTester.java    |  3 +-
 14 files changed, 30 insertions(+), 42 deletions(-)

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
index d3321a41a7..ef5fc56347 100644
--- a/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
+++ b/client/src/com/vaadin/client/communication/AtmospherePushConnection.java
@@ -246,8 +246,7 @@ public class AtmospherePushConnection implements PushConnection {
      * 
      */
     protected void onError() {
-        VConsole.error("Push connection using "
-                + getConfig().getTransport()
+        VConsole.error("Push connection using " + getConfig().getTransport()
                 + " failed!");
     }
 
diff --git a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java
index 2f97d30ece..e91abe9663 100644
--- a/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java
+++ b/client/src/com/vaadin/client/ui/AbstractClickEventHandler.java
@@ -78,9 +78,8 @@ public abstract class AbstractClickEventHandler implements MouseDownHandler,
                         && elementUnderMouse == lastMouseDownTarget) {
                     mouseUpPreviewMatched = true;
                 } else {
-                    VConsole.log("Ignoring mouseup from "
-                            + elementUnderMouse + " when mousedown was on "
-                            + lastMouseDownTarget);
+                    VConsole.log("Ignoring mouseup from " + elementUnderMouse
+                            + " when mousedown was on " + lastMouseDownTarget);
                 }
             }
         }
diff --git a/client/src/com/vaadin/client/ui/VNativeButton.java b/client/src/com/vaadin/client/ui/VNativeButton.java
index 6e1c5bae77..71413a76e6 100644
--- a/client/src/com/vaadin/client/ui/VNativeButton.java
+++ b/client/src/com/vaadin/client/ui/VNativeButton.java
@@ -16,14 +16,9 @@
 
 package com.vaadin.client.ui;
 
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Document;
 import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.MouseEvent;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Event;
 import com.google.gwt.user.client.ui.Button;
@@ -31,7 +26,6 @@ import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.BrowserInfo;
 import com.vaadin.client.MouseEventDetailsBuilder;
 import com.vaadin.client.Util;
-import com.vaadin.client.VConsole;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.ui.button.ButtonServerRpc;
 
diff --git a/client/src/com/vaadin/client/ui/VWindow.java b/client/src/com/vaadin/client/ui/VWindow.java
index 084ce522c1..0ed5bd57bd 100644
--- a/client/src/com/vaadin/client/ui/VWindow.java
+++ b/client/src/com/vaadin/client/ui/VWindow.java
@@ -571,7 +571,8 @@ public class VWindow extends VOverlay implements ShortcutActionHandlerOwner,
         }
     }
 
-    public void updateMaximizeRestoreClassName(boolean visible, WindowMode windowMode) {
+    public void updateMaximizeRestoreClassName(boolean visible,
+            WindowMode windowMode) {
         String className;
         if (windowMode == WindowMode.MAXIMIZED) {
             className = CLASSNAME + "-restorebox";
diff --git a/server/src/com/vaadin/ui/DateField.java b/server/src/com/vaadin/ui/DateField.java
index 08815f4592..5017fac993 100644
--- a/server/src/com/vaadin/ui/DateField.java
+++ b/server/src/com/vaadin/ui/DateField.java
@@ -19,10 +19,8 @@ package com.vaadin.ui;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 5cbd425ac6..0ad2787cb6 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -118,7 +118,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private Page page = new Page(this);
 
-    private LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfigurationImpl(this);
+    private LoadingIndicatorConfiguration loadingIndicatorConfiguration = new LoadingIndicatorConfigurationImpl(
+            this);
 
     /**
      * Scroll Y position.
@@ -167,7 +168,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private boolean closing = false;
 
-    private TooltipConfiguration tooltipConfiguration = new TooltipConfigurationImpl(this);
+    private TooltipConfiguration tooltipConfiguration = new TooltipConfigurationImpl(
+            this);
 
     /**
      * Creates a new empty UI without a caption. The content of the UI must be
diff --git a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
index d15d8de100..d56e0d27b3 100644
--- a/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
+++ b/shared/src/com/vaadin/shared/ui/datefield/InlineDateFieldState.java
@@ -15,7 +15,6 @@
  */
 package com.vaadin.shared.ui.datefield;
 
-
 public class InlineDateFieldState extends TextualDateFieldState {
     {
         primaryStyleName = "v-inline-datefield";
diff --git a/theme-compiler/src/com/vaadin/sass/internal/resolver/VaadinResolver.java b/theme-compiler/src/com/vaadin/sass/internal/resolver/VaadinResolver.java
index 25c7e04f99..2460c2ad2e 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/resolver/VaadinResolver.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/resolver/VaadinResolver.java
@@ -36,7 +36,7 @@ public class VaadinResolver implements ScssStylesheetResolver {
         }
 
         InputSource source = null;
-        
+
         // Can we find the scss from the file system?
         ScssStylesheetResolver resolver = new FilesystemResolver();
         source = resolver.resolve(identifier);
diff --git a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
index 0d962309e4..3c857a8753 100644
--- a/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
+++ b/uitest/src/com/vaadin/tests/components/ui/LoadingIndicatorConfigurationTest.java
@@ -47,27 +47,24 @@ public class LoadingIndicatorConfigurationTest extends AbstractTestUIWithLog {
         });
         secondDelay = createIntegerTextField("Second delay (ms)",
                 getState().loadingIndicatorConfiguration.secondDelay);
-        secondDelay
-                .addValueChangeListener(new Property.ValueChangeListener() {
-                    @Override
-                    public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicatorConfiguration().setSecondDelay(
-                                (Integer) secondDelay.getConvertedValue());
-                    }
-                });
+        secondDelay.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getLoadingIndicatorConfiguration().setSecondDelay(
+                        (Integer) secondDelay.getConvertedValue());
+            }
+        });
         thirdDelay = createIntegerTextField("Third delay (ms)",
                 getState().loadingIndicatorConfiguration.thirdDelay);
-        thirdDelay
-                .addValueChangeListener(new Property.ValueChangeListener() {
-                    @Override
-                    public void valueChange(ValueChangeEvent event) {
-                        getLoadingIndicatorConfiguration().setThirdDelay(
-                                (Integer) thirdDelay.getConvertedValue());
-                    }
-                });
+        thirdDelay.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                getLoadingIndicatorConfiguration().setThirdDelay(
+                        (Integer) thirdDelay.getConvertedValue());
+            }
+        });
 
-        getLayout()
-                .addComponents(firstDelay, secondDelay, thirdDelay);
+        getLayout().addComponents(firstDelay, secondDelay, thirdDelay);
 
         HorizontalLayout hl = new HorizontalLayout();
         hl.setMargin(true);
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
index 2227e89256..4d201d2a1a 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.java
@@ -41,8 +41,8 @@ public class TooltipConfiguration extends AbstractTestUIWithLog {
         maxWidth.addValueChangeListener(new Property.ValueChangeListener() {
             @Override
             public void valueChange(ValueChangeEvent event) {
-                getTooltipConfiguration()
-                        .setMaxWidth((Integer) maxWidth.getConvertedValue());
+                getTooltipConfiguration().setMaxWidth(
+                        (Integer) maxWidth.getConvertedValue());
             }
         });
         openDelay = createIntegerTextField("Open delay",
diff --git a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java
index bba8ccf120..fe2dd6cea8 100644
--- a/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java
+++ b/uitest/src/com/vaadin/tests/layouts/VerticalLayoutSlotExpansionAndAlignment.java
@@ -1,6 +1,5 @@
 package com.vaadin.tests.layouts;
 
-import com.vaadin.annotations.Theme;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.ui.Alignment;
 import com.vaadin.ui.HorizontalLayout;
diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
index e355cd1dbd..57ad0d97ba 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/Broadcaster.java
@@ -1,4 +1,3 @@
-package com.vaadin.tests.minitutorials.broadcastingmessages;
 /*
  * Copyright 2000-2013 Vaadin Ltd.
  * 
@@ -15,6 +14,7 @@ package com.vaadin.tests.minitutorials.broadcastingmessages;
  * the License.
  */
 
+package com.vaadin.tests.minitutorials.broadcastingmessages;
 
 import java.util.ArrayList;
 import java.util.List;
diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
index 80c847250d..88ab4af967 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
@@ -1,6 +1,5 @@
 package com.vaadin.tests.minitutorials.broadcastingmessages;
 
-
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.minitutorials.broadcastingmessages.Broadcaster.BroadcastListener;
 import com.vaadin.ui.Button;
diff --git a/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java
index d16a7a7811..c8e561e665 100644
--- a/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java
+++ b/uitest/src/com/vaadin/tests/widgetset/server/RoundTripTester.java
@@ -43,7 +43,8 @@ public class RoundTripTester extends AbstractComponent {
     public void start(long testDuration, int payloadSize) {
         testStart = System.currentTimeMillis();
         testEnd = testStart + testDuration;
-        getRpcProxy(RoundTripTesterRpc.class).ping(1, generatePayload(payloadSize));
+        getRpcProxy(RoundTripTesterRpc.class).ping(1,
+                generatePayload(payloadSize));
     }
 
     private String generatePayload(int payloadSize) {
-- 
cgit v1.2.3


From ecc91e1b7bfe23f2d3576d446176999715c2731c Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 25 Apr 2013 14:25:01 +0300
Subject: Close push connection when UI is detached (#11596)

Change-Id: Ibfc5923406b386786ae399b7f53cea47ac885f48
---
 .../com/vaadin/client/ApplicationConnection.java   |   2 +-
 .../src/com/vaadin/client/ui/ui/UIConnector.java   |  17 +++
 server/src/com/vaadin/server/VaadinSession.java    |   2 +-
 .../communication/AtmospherePushConnection.java    |  19 ++-
 .../server/communication/PushConnection.java       |   5 +
 server/src/com/vaadin/ui/UI.java                   |  16 +++
 .../src/com/vaadin/shared/ui/ui/UIClientRpc.java   |  34 +++++
 .../vaadin/tests/applicationcontext/CloseUI.java   | 160 +++++++++++++++++++++
 .../applicationcontext/UIRunSafelyThread.java      |  24 ++++
 9 files changed, 275 insertions(+), 4 deletions(-)
 create mode 100644 shared/src/com/vaadin/shared/ui/ui/UIClientRpc.java
 create mode 100644 uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
 create mode 100644 uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 85cf0f0b46..d77a98a83b 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -1026,7 +1026,7 @@ public class ApplicationConnection {
      * @param details
      *            Optional details for debugging.
      */
-    protected void showSessionExpiredError(String details) {
+    public void showSessionExpiredError(String details) {
         VConsole.error("Session expired: " + details);
         showError(details, configuration.getSessionExpiredError());
     }
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 601349d244..079e133438 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -69,6 +69,7 @@ import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.Connect.LoadStyle;
 import com.vaadin.shared.ui.ui.PageClientRpc;
 import com.vaadin.shared.ui.ui.ScrollClientRpc;
+import com.vaadin.shared.ui.ui.UIClientRpc;
 import com.vaadin.shared.ui.ui.UIConstants;
 import com.vaadin.shared.ui.ui.UIServerRpc;
 import com.vaadin.shared.ui.ui.UIState;
@@ -115,6 +116,22 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
                 getWidget().getElement().setScrollLeft(scrollLeft);
             }
         });
+        registerRpc(UIClientRpc.class, new UIClientRpc() {
+            @Override
+            public void uiClosed(final boolean sessionExpired) {
+                Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+                    @Override
+                    public void execute() {
+                        if (sessionExpired) {
+                            getConnection().showSessionExpiredError(null);
+                        } else {
+                            getState().enabled = false;
+                            updateEnabledState(getState().enabled);
+                        }
+                    }
+                });
+            }
+        });
         getWidget().addResizeHandler(new ResizeHandler() {
             @Override
             public void onResize(ResizeEvent event) {
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index e9b3eb6ada..9c803924e0 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -321,7 +321,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     @Deprecated
     public void removeFromSession(VaadinService service) {
         assert hasLock();
-        session.setAttribute(getSessionAttributeName(service), null);
+        session.removeAttribute(getSessionAttributeName(service));
     }
 
     /**
diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
index a5025e2356..770b0b6a59 100644
--- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
+++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java
@@ -20,6 +20,7 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.util.concurrent.Future;
 
 import org.atmosphere.cpr.AtmosphereResource;
 import org.json.JSONException;
@@ -37,6 +38,7 @@ public class AtmospherePushConnection implements Serializable, PushConnection {
 
     private UI ui;
     private transient AtmosphereResource resource;
+    private Future<String> lastMessage;
 
     public AtmospherePushConnection(UI ui) {
         this.ui = ui;
@@ -79,7 +81,8 @@ public class AtmospherePushConnection implements Serializable, PushConnection {
      *            The message to send
      */
     void sendMessage(String message) {
-        getResource().getBroadcaster().broadcast(message, getResource());
+        lastMessage = getResource().getBroadcaster().broadcast(message,
+                getResource());
     }
 
     /**
@@ -97,7 +100,8 @@ public class AtmospherePushConnection implements Serializable, PushConnection {
     /**
      * Returns whether this connection is currently open.
      */
-    protected boolean isConnected() {
+    @Override
+    public boolean isConnected() {
         return resource != null
                 && resource.getBroadcaster().getAtmosphereResources()
                         .contains(resource);
@@ -120,6 +124,17 @@ public class AtmospherePushConnection implements Serializable, PushConnection {
 
     @Override
     public void disconnect() {
+        if (lastMessage != null) {
+            try {
+                // Wait for the last message to be sent before closing the
+                // connection (assumes that futures are completed in order)
+                lastMessage.get();
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            lastMessage = null;
+        }
+
         resource.resume();
         assert !resource.getBroadcaster().getAtmosphereResources()
                 .contains(resource);
diff --git a/server/src/com/vaadin/server/communication/PushConnection.java b/server/src/com/vaadin/server/communication/PushConnection.java
index eecf4d93a4..4e043f565f 100644
--- a/server/src/com/vaadin/server/communication/PushConnection.java
+++ b/server/src/com/vaadin/server/communication/PushConnection.java
@@ -40,4 +40,9 @@ public interface PushConnection {
      */
     public void disconnect();
 
+    /**
+     * Returns whether this connection is currently open.
+     */
+    public boolean isConnected();
+
 }
\ No newline at end of file
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 961ed289f3..442edfebb1 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -42,6 +42,7 @@ import com.vaadin.shared.EventId;
 import com.vaadin.shared.MouseEventDetails;
 import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.ui.ScrollClientRpc;
+import com.vaadin.shared.ui.ui.UIClientRpc;
 import com.vaadin.shared.ui.ui.UIConstants;
 import com.vaadin.shared.ui.ui.UIServerRpc;
 import com.vaadin.shared.ui.ui.UIState;
@@ -363,6 +364,12 @@ public abstract class UI extends AbstractSingleComponentContainer implements
         } else {
             if (session == null) {
                 detach();
+                if (pushConnection != null && pushConnection.isConnected()) {
+                    // Close the push connection when UI is detached. Otherwise
+                    // the push connection and possibly VaadinSession will live
+                    // on.
+                    pushConnection.disconnect();
+                }
             }
             this.session = session;
         }
@@ -1006,6 +1013,15 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      */
     public void close() {
         closing = true;
+
+        boolean sessionExpired = (session == null || session.isClosing());
+        getRpcProxy(UIClientRpc.class).uiClosed(sessionExpired);
+        if (getPushConnection() != null && getPushConnection().isConnected()) {
+            // Push the Rpc to the client. The connection will be closed when
+            // the UI is detached and cleaned up.
+            getPushConnection().push();
+        }
+
     }
 
     /**
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIClientRpc.java b/shared/src/com/vaadin/shared/ui/ui/UIClientRpc.java
new file mode 100644
index 0000000000..3067b10e24
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/ui/UIClientRpc.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.shared.ui.ui;
+
+import com.vaadin.shared.communication.ClientRpc;
+
+/**
+ * Server to Client RPC methods for UI
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public interface UIClientRpc extends ClientRpc {
+
+    /**
+     * @since
+     * @param sessionExpired
+     */
+    void uiClosed(boolean sessionExpired);
+
+}
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
new file mode 100644
index 0000000000..6d8be4339d
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright 2012 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.applicationcontext;
+
+import com.vaadin.server.Page;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinService;
+import com.vaadin.server.VaadinSession;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.UI;
+
+public class CloseUI extends AbstractTestUI {
+    private static final String OLD_HASH_PARAM = "oldHash";
+    private static final String OLD_SESSION_ID_PARAM = "oldSessionId";
+
+    private final Log log = new Log(6);
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        System.out.println("UI " + getUIId() + " inited");
+
+        final int sessionHash = getSession().hashCode();
+        final String sessionId = request.getWrappedSession().getId();
+
+        log.log("Current session hashcode: " + sessionHash);
+        log.log("Current WrappedSession id: " + sessionId);
+
+        // Log previous values to make it easier to see what has changed
+        String oldHashValue = request.getParameter(OLD_HASH_PARAM);
+        if (oldHashValue != null) {
+            log.log("Old session hashcode: " + oldHashValue);
+            log.log("Same hash as current? "
+                    + oldHashValue.equals(Integer.toString(sessionHash)));
+        }
+
+        String oldSessionId = request.getParameter(OLD_SESSION_ID_PARAM);
+        if (oldSessionId != null) {
+            log.log("Old WrappedSession id: " + oldSessionId);
+            log.log("Same WrappedSession id? " + oldSessionId.equals(sessionId));
+        }
+
+        addComponent(log);
+        addComponent(new Button("Log 'hello'", new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                log.log("Hello");
+            }
+        }));
+        addComponent(new Button("Close UI", new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                close();
+            }
+        }));
+
+        addComponent(new Button("Close UI (background)",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        new UIRunSafelyThread(CloseUI.this) {
+                            @Override
+                            protected void runSafely() {
+                                close();
+                            };
+                        }.start();
+                    }
+                }));
+        addComponent(new Button(
+                "Close UI and redirect to /statictestfiles/static.html",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        getPage().setLocation("/statictestfiles/static.html");
+                        close();
+                    }
+                }));
+        addComponent(new Button(
+                "Close UI and redirect to /statictestfiles/static.html (background)",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        new UIRunSafelyThread(CloseUI.this) {
+
+                            @Override
+                            protected void runSafely() {
+                                getPage().setLocation(
+                                        "/statictestfiles/static.html");
+                                close();
+                            }
+                        };
+                    }
+                }));
+
+    }
+
+    private abstract class RunSafelyThread extends Thread {
+        private UI ui;
+
+        public RunSafelyThread(UI ui) {
+            this.ui = ui;
+        }
+
+        @Override
+        public void run() {
+            ui.runSafely(new Runnable() {
+
+                @Override
+                public void run() {
+                    runSafely();
+                }
+            });
+        }
+
+        protected abstract void runSafely();
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Test for closing the session and redirecting the user";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(9859);
+    }
+
+    @Override
+    public void detach() {
+        super.detach();
+        log.log("Detach of " + this + " (" + getUIId() + ")");
+        boolean correctUI = (UI.getCurrent() == this);
+        boolean correctPage = (Page.getCurrent() == getPage());
+        boolean correctVaadinSession = (VaadinSession.getCurrent() == getSession());
+        boolean correctVaadinService = (VaadinService.getCurrent() == getSession()
+                .getService());
+        log.log("UI.current correct in detach: " + correctUI);
+        log.log("Page.current correct in detach: " + correctPage);
+        log.log("VaadinSession.current correct in detach: "
+                + correctVaadinSession);
+        log.log("VaadinService.current correct in detach: "
+                + correctVaadinService);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
new file mode 100644
index 0000000000..0048cbd741
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
@@ -0,0 +1,24 @@
+package com.vaadin.tests.applicationcontext;
+
+import com.vaadin.ui.UI;
+
+public abstract class UIRunSafelyThread extends Thread {
+    private UI ui;
+
+    public UIRunSafelyThread(UI ui) {
+        this.ui = ui;
+    }
+
+    @Override
+    public void run() {
+        ui.runSafely(new Runnable() {
+
+            @Override
+            public void run() {
+                runSafely();
+            }
+        });
+    }
+
+    protected abstract void runSafely();
+}
\ No newline at end of file
-- 
cgit v1.2.3


From b4218b866880b4071e56ed76ff061010787fadd6 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 25 Apr 2013 14:44:36 +0300
Subject: Ensure RPC are not delivered to closed UIs (#11714)

Change-Id: I7fadaa5d5190c36cd83a06249d7ae1d4475724e0
---
 .../server/communication/ServerRpcHandler.java     | 14 +++++++
 .../tests/applicationcontext/RpcForClosedUI.html   | 45 ++++++++++++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/communication/ServerRpcHandler.java b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
index 64f8dfb223..62949615fb 100644
--- a/server/src/com/vaadin/server/communication/ServerRpcHandler.java
+++ b/server/src/com/vaadin/server/communication/ServerRpcHandler.java
@@ -197,6 +197,20 @@ public class ServerRpcHandler implements Serializable {
                     getLogger().warning(msg);
                     continue;
                 }
+                if (connector.getUI().isClosing()) {
+                    String msg = "Ignoring RPC call for connector "
+                            + connector.getClass().getName();
+                    if (connector instanceof Component) {
+                        String caption = ((Component) connector).getCaption();
+                        if (caption != null) {
+                            msg += ", caption=" + caption;
+                        }
+                    }
+                    msg += " in closed UI";
+                    getLogger().warning(msg);
+                    continue;
+
+                }
 
                 if (invocation instanceof ServerRpcMethodInvocation) {
                     try {
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html
new file mode 100644
index 0000000000..3f48435526
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html
@@ -0,0 +1,45 @@
+<?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://192.168.2.75: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/CloseUI?restartApplication</td>
+	<td></td>
+</tr>
+<!--Close the UI in a background thread-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runCloseUI::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Try to log 'hello'-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runCloseUI::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<!--Ensure 'hello' was not logged-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runCloseUI::PID_SLog_row_0</td>
+	<td>2. Current WrappedSession id: qshk44c2q6bagnnl1k4mdqsh</td>
+</tr>
+<tr>
+	<td>assertTextNotPresent</td>
+	<td>Hello</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From c02a2c43e0e6170c1fc4f781aa9711de7a78ffd1 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 26 Apr 2013 09:02:31 +0300
Subject: Support URL parameters for automatically configuring and running test

Change-Id: Icb7c7fda45fe27bb840a9493c519060a7cea2503
---
 uitest/src/com/vaadin/tests/push/RoundTripTest.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/push/RoundTripTest.java b/uitest/src/com/vaadin/tests/push/RoundTripTest.java
index a059a1d275..ee0bf6dcb1 100644
--- a/uitest/src/com/vaadin/tests/push/RoundTripTest.java
+++ b/uitest/src/com/vaadin/tests/push/RoundTripTest.java
@@ -34,11 +34,17 @@ public class RoundTripTest extends AbstractTestUI {
         final TextField payloadSize = new TextField("Payload size (bytes)");
         payloadSize.setConverter(Integer.class);
         payloadSize.setConvertedValue(10000);
+        if (request.getParameter("payload") != null) {
+            payloadSize.setValue(request.getParameter("payload"));
+        }
         addComponent(payloadSize);
         final TextField testDuration = new TextField("Test duration (ms)");
         testDuration.setConverter(Integer.class);
         testDuration.setConvertedValue(10000);
         addComponent(testDuration);
+        if (request.getParameter("duration") != null) {
+            testDuration.setValue(request.getParameter("duration"));
+        }
 
         Button start = new Button("Start test");
         start.addClickListener(new ClickListener() {
@@ -52,6 +58,10 @@ public class RoundTripTest extends AbstractTestUI {
         });
         addComponent(roundTripTester);
         addComponent(start);
+
+        if (request.getParameter("go") != null) {
+            start.click();
+        }
     }
 
     @Override
-- 
cgit v1.2.3


From d8e0a553f497f0ea40bee0aaaef20aa5cc369685 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 26 Apr 2013 13:26:11 +0300
Subject: Fixed last button in test to actually do something

Change-Id: I78657388ce43539e658ffbb23e995c8a20fe39d5
---
 uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
index 6d8be4339d..47d53c8f52 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
@@ -104,7 +104,7 @@ public class CloseUI extends AbstractTestUI {
                                         "/statictestfiles/static.html");
                                 close();
                             }
-                        };
+                        }.start();
                     }
                 }));
 
-- 
cgit v1.2.3


From 57d9f9d80133c490c2fe48eb4dc0b261108236bd Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 29 Apr 2013 12:30:52 +0300
Subject: Fixed test (gwt-id-X not stable)

Change-Id: I6da73c4dcbe61573b21a54423ba0f86d41ded607
---
 .../com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
index a0c6798edb..6b7bb26b76 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarVisibleHours24H.html
@@ -23,8 +23,8 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>//div[@id='gwt-uid-9']/div</td>
-	<td>7,14</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VGridLayout[0]/VHorizontalLayout[0]/Slot[2]/VFilterSelect[0]#button</td>
+	<td>14,5</td>
 </tr>
 <tr>
 	<td>mouseClick</td>
-- 
cgit v1.2.3


From 97e5714b0aa99e39fd1c6ec7089631ea3a6f9fcb Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 29 Apr 2013 12:31:13 +0300
Subject: Fixed test (maximize button added to DOM)

Change-Id: Id4319afc6eaef6f0afc65400d1208937c89fabbc
---
 .../tests/components/calendar/CalendarWeeklyViewNewEvents.html    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
index b587288a24..fd51a0daad 100644
--- a/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarWeeklyViewNewEvents.html
@@ -313,7 +313,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>8,9</td>
 </tr>
 <!--Edit previously created events and change properties-->
@@ -438,7 +438,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>11,8</td>
 </tr>
 <tr>
@@ -558,7 +558,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>7,8</td>
 </tr>
 <tr>
@@ -583,7 +583,7 @@
 </tr>
 <tr>
 	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[2]</td>
 	<td>12,10</td>
 </tr>
 <!--Go to monthly view and assert inserted events-->
-- 
cgit v1.2.3


From 235d0200c04881e9f99fee17ce55627402d2711a Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 29 Apr 2013 13:57:35 +0300
Subject: Fixed test (gwt-id-X not stable)

Change-Id: I5509c39e1461453d6c75e9fce477e2c202a986c2
---
 .../DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
index e0c5721c27..b19f519cb1 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_EndRangeEarlierThanStartRangeCausesException.html
@@ -83,7 +83,7 @@
 </tr>
 <tr>
 	<td>assertCSSClass</td>
-	<td>//div[@id='gwt-uid-16']/span[2]</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/domChild[0]/domChild[0]/domChild[1]</td>
 	<td>v-errorindicator</td>
 </tr>
 </tbody></table>
-- 
cgit v1.2.3


From fcad91d2c8710dd89dd2a1fb5ea11dc71cac51a1 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 29 Apr 2013 13:58:46 +0300
Subject: Added workaround for #11737 to test

Change-Id: I9541abb5835c6851c3eea0d7567b4a848dc605d0
---
 .../tests/components/window/WindowMaximizeRestoreTest.html    | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
index 69ea0181d5..945564f298 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -162,6 +162,17 @@
 	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
 	<td>43,12</td>
 </tr>
+<!--Remove the following two commands once #11737 is fixed-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+	<td>43,12</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
+	<td>43,12</td>
+</tr>
 <!--maximize window 2 content-->
 <tr>
 	<td>mouseClick</td>
-- 
cgit v1.2.3


From 1f08e16589924841341c2145df6a1a135afb63d6 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Mon, 29 Apr 2013 14:17:42 +0300
Subject: Fixed test (gwt-id-X not stable)

Change-Id: I4def9e78d3985d6f1c28fe7eb816120615cec057
---
 .../table/ColumnCollapsingAndColumnExpansion.html    |  6 +++---
 .../tests/components/ui/TooltipConfiguration.html    | 20 ++++++++++----------
 uitest/src/com/vaadin/tests/push/BasicPush.html      | 12 ++++++------
 uitest/src/com/vaadin/tests/push/StreamingPush.html  | 12 ++++++------
 4 files changed, 25 insertions(+), 25 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
index 261d1939cd..4dc63721a1 100644
--- a/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
+++ b/uitest/src/com/vaadin/tests/components/table/ColumnCollapsingAndColumnExpansion.html
@@ -29,9 +29,9 @@
 </tr>
 <!--Hide 'col2' through table interface-->
 <tr>
-	<td>click</td>
-	<td>//td[@id='gwt-uid-7']/span/div</td>
-	<td></td>
+	<td>mouseClick</td>
+	<td>//tr[2]/td/span/div</td>
+	<td>23,2</td>
 </tr>
 <tr>
 	<td>screenCapture</td>
diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
index 5170d4408f..c1734481c6 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
@@ -29,12 +29,12 @@
 </tr>
 <tr>
 	<td>waitForElementPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td>This is a short tooltip</td>
 </tr>
 <tr>
@@ -44,7 +44,7 @@
 </tr>
 <tr>
 	<td>assertElementNotPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <!--Long close delay-->
@@ -60,12 +60,12 @@
 </tr>
 <tr>
 	<td>waitForElementPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td>This is a short tooltip</td>
 </tr>
 <tr>
@@ -75,7 +75,7 @@
 </tr>
 <tr>
 	<td>assertElementPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <tr>
@@ -96,12 +96,12 @@
 </tr>
 <tr>
 	<td>waitForElementPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <tr>
 	<td>assertElementWidth</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td>500</td>
 </tr>
 <tr>
@@ -122,12 +122,12 @@
 </tr>
 <tr>
 	<td>waitForElementPresent</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td></td>
 </tr>
 <tr>
 	<td>assertElementWidth</td>
-	<td>id=gwt-uid-3</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td>
 	<td>100</td>
 </tr>
 </tbody></table>
diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.html b/uitest/src/com/vaadin/tests/push/BasicPush.html
index f69a573425..173ec90674 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPush.html
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.html
@@ -19,7 +19,7 @@
 <!--Test client initiated push -->
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>0</td>
 </tr>
 <tr>
@@ -29,7 +29,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>1</td>
 </tr>
 <tr>
@@ -49,7 +49,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>4</td>
 </tr>
 <!--Test server initiated push-->
@@ -60,7 +60,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>0</td>
 </tr>
 <tr>
@@ -70,7 +70,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>1</td>
 </tr>
 <tr>
@@ -80,7 +80,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>2</td>
 </tr>
 </tbody></table>
diff --git a/uitest/src/com/vaadin/tests/push/StreamingPush.html b/uitest/src/com/vaadin/tests/push/StreamingPush.html
index 533f571b9c..cf94a09c63 100644
--- a/uitest/src/com/vaadin/tests/push/StreamingPush.html
+++ b/uitest/src/com/vaadin/tests/push/StreamingPush.html
@@ -19,7 +19,7 @@
 <!--Test client initiated push -->
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>0</td>
 </tr>
 <tr>
@@ -29,7 +29,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>1</td>
 </tr>
 <tr>
@@ -49,7 +49,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-5</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VLabel[0]</td>
 	<td>4</td>
 </tr>
 <!--Test server initiated push-->
@@ -60,7 +60,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>0</td>
 </tr>
 <tr>
@@ -70,7 +70,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>1</td>
 </tr>
 <tr>
@@ -80,7 +80,7 @@
 </tr>
 <tr>
 	<td>assertText</td>
-	<td>id=gwt-uid-7</td>
+	<td>vaadin=runpushcomvaadintestspushBasicPush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VLabel[0]</td>
 	<td>2</td>
 </tr>
 </tbody></table>
-- 
cgit v1.2.3


From b6844e0985098ab7f9c741125382975d54465969 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 2 May 2013 08:38:59 +0300
Subject: Removed changing session id from test

Change-Id: I851df9f3b3743263267b4a434f846fcc789997e0
---
 uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html
index 3f48435526..642e31b22c 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html
+++ b/uitest/src/com/vaadin/tests/applicationcontext/RpcForClosedUI.html
@@ -32,14 +32,13 @@
 <tr>
 	<td>assertText</td>
 	<td>vaadin=runCloseUI::PID_SLog_row_0</td>
-	<td>2. Current WrappedSession id: qshk44c2q6bagnnl1k4mdqsh</td>
+	<td>2. Current WrappedSession id: *</td>
 </tr>
 <tr>
 	<td>assertTextNotPresent</td>
 	<td>Hello</td>
 	<td></td>
 </tr>
-
 </tbody></table>
 </body>
 </html>
-- 
cgit v1.2.3


From 9589abe8ee06a4fd04b98954a71cd0f5e8fc65c4 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 2 May 2013 09:17:25 +0300
Subject: Made test work also when current month is not April 2013

Change-Id: I4998dd4e146d5520c814e78e3456b2d37e446cef
---
 ...eCausesOutOfRangeExceptionIfImmediateField.html | 73 ++--------------------
 1 file changed, 4 insertions(+), 69 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
index e6b498c6f7..ca5c006e82 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldRanges_ChangingRangeSoValueFallsOutsideRangeCausesOutOfRangeExceptionIfImmediateField.html
@@ -21,26 +21,6 @@
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
 	<td>59,10</td>
 </tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
-	<td>4</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
-	<td>4</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
 <tr>
 	<td>type</td>
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[3]/VPopupCalendar[0]#field</td>
@@ -51,26 +31,6 @@
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
 	<td>36,13</td>
 </tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
-	<td>2</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
-	<td>2</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
 <tr>
 	<td>type</td>
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VPopupCalendar[0]#field</td>
@@ -81,26 +41,6 @@
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
 	<td>48,13</td>
 </tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
-	<td>5</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
-<tr>
-	<td>type</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
-	<td>5</td>
-</tr>
-<tr>
-	<td>pressSpecialKey</td>
-	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
-	<td>shift 7</td>
-</tr>
 <tr>
 	<td>type</td>
 	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[2]/VPopupCalendar[0]#field</td>
@@ -117,9 +57,9 @@
 	<td>12,14</td>
 </tr>
 <tr>
-	<td>assertTextPresent</td>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SinlineDynamicDateField/VCalendarPanel[0]#header</td>
 	<td>April 2013</td>
-	<td></td>
 </tr>
 <tr>
 	<td>mouseClick</td>
@@ -147,14 +87,9 @@
 	<td>v-errorindicator</td>
 </tr>
 <tr>
-	<td>assertTextPresent</td>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDateFieldRanges::PID_SinlineDynamicDateField/VCalendarPanel[0]#header</td>
 	<td>March 2013</td>
-	<td></td>
-</tr>
-<tr>
-	<td>assertTextPresent</td>
-	<td>April 2013</td>
-	<td></td>
 </tr>
 <tr>
 	<td>click</td>
-- 
cgit v1.2.3


From 80d96608dd9f2e0c067918065bfcdcfde0cb3414 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Thu, 2 May 2013 14:05:16 +0300
Subject: Rename runSafely() to access() (#11756)

Change-Id: I640244732fb561d9f55da58f8ba94fd02875c191
---
 server/src/com/vaadin/server/RequestHandler.java   |  3 +-
 server/src/com/vaadin/server/VaadinService.java    | 10 +++---
 server/src/com/vaadin/server/VaadinSession.java    | 40 ++++++++++++++--------
 .../server/communication/FileUploadHandler.java    |  2 +-
 server/src/com/vaadin/ui/LoginForm.java            |  2 +-
 server/src/com/vaadin/ui/UI.java                   | 32 +++++++++++++----
 .../vaadin/tests/applicationcontext/CloseUI.java   |  2 +-
 .../applicationcontext/UIRunSafelyThread.java      |  2 +-
 .../com/vaadin/tests/components/ui/UIPolling.java  |  2 +-
 .../broadcastingmessages/BroadcasterUI.java        |  2 +-
 uitest/src/com/vaadin/tests/push/BasicPush.java    |  2 +-
 uitest/src/com/vaadin/tests/push/PushFromInit.java |  2 +-
 uitest/src/com/vaadin/tests/push/TogglePush.java   |  2 +-
 13 files changed, 66 insertions(+), 37 deletions(-)

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/RequestHandler.java b/server/src/com/vaadin/server/RequestHandler.java
index e04b223904..873752c5f2 100644
--- a/server/src/com/vaadin/server/RequestHandler.java
+++ b/server/src/com/vaadin/server/RequestHandler.java
@@ -37,8 +37,7 @@ public interface RequestHandler extends Serializable {
      * using VaadinSession or anything inside the VaadinSession you must ensure
      * the session is locked. This can be done by extending
      * {@link SynchronizedRequestHandler} or by using
-     * {@link VaadinSession#runSafely(Runnable)} or
-     * {@link UI#runSafely(Runnable)}.
+     * {@link VaadinSession#access(Runnable)} or {@link UI#access(Runnable)}.
      * </p>
      * 
      * @param session
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index c6fdca35f0..f6b520d4b0 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -407,12 +407,12 @@ public abstract class VaadinService implements Serializable {
      */
     public void fireSessionDestroy(VaadinSession vaadinSession) {
         final VaadinSession session = vaadinSession;
-        session.runSafely(new Runnable() {
+        session.access(new Runnable() {
             @Override
             public void run() {
                 ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
                 for (final UI ui : uis) {
-                    ui.runSafely(new Runnable() {
+                    ui.access(new Runnable() {
                         @Override
                         public void run() {
                             /*
@@ -1087,7 +1087,7 @@ public abstract class VaadinService implements Serializable {
     private void removeClosedUIs(final VaadinSession session) {
         ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
         for (final UI ui : uis) {
-            ui.runSafely(new Runnable() {
+            ui.access(new Runnable() {
                 @Override
                 public void run() {
                     if (ui.isClosing()) {
@@ -1245,7 +1245,7 @@ public abstract class VaadinService implements Serializable {
         if (session != null) {
             final VaadinSession finalSession = session;
 
-            session.runSafely(new Runnable() {
+            session.access(new Runnable() {
                 @Override
                 public void run() {
                     cleanupSession(finalSession);
@@ -1254,7 +1254,7 @@ public abstract class VaadinService implements Serializable {
 
             final long duration = (System.nanoTime() - (Long) request
                     .getAttribute(REQUEST_START_TIME_ATTRIBUTE)) / 1000000;
-            session.runSafely(new Runnable() {
+            session.access(new Runnable() {
                 @Override
                 public void run() {
                     finalSession.setLastRequestDuration(duration);
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 57e9076342..fe786ad52b 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -766,13 +766,12 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      * Locks this session to protect its data from concurrent access. Accessing
      * the UI state from outside the normal request handling should always lock
      * the session and unlock it when done. The preferred way to ensure locking
-     * is done correctly is to wrap your code using
-     * {@link UI#runSafely(Runnable)} (or
-     * {@link VaadinSession#runSafely(Runnable)} if you are only touching the
+     * is done correctly is to wrap your code using {@link UI#access(Runnable)}
+     * (or {@link VaadinSession#access(Runnable)} if you are only touching the
      * session and not any UI), e.g.:
      * 
      * <pre>
-     * myUI.runSafely(new Runnable() {
+     * myUI.access(new Runnable() {
      *     &#064;Override
      *     public void run() {
      *         // Here it is safe to update the UI.
@@ -1064,23 +1063,27 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     }
 
     /**
-     * Performs a safe update of this VaadinSession.
+     * Provides exclusive access to this session from outside a request handling
+     * thread.
      * <p>
-     * This method runs the runnable code so that it is safe to update session
-     * variables. It also ensures that all thread locals are set correctly when
-     * executing the runnable.
+     * The given runnable is executed while holding the session lock to ensure
+     * exclusive access to this session. The session and related thread locals
+     * are set properly before executing the runnable.
      * </p>
      * <p>
-     * Note that using this method for a VaadinSession which has been detached
-     * from its underlying HTTP session is not necessarily safe. Exclusive
-     * access is provided through locking which is done using the underlying
-     * session.
+     * RPC handlers for components inside this session do not need this method
+     * as the session is automatically locked by the framework during request
+     * handling.
      * </p>
      * 
      * @param runnable
-     *            The runnable which updates the session
+     *            the runnable which accesses the session
+     * 
+     * @see #lock()
+     * @see #getCurrent()
+     * @see UI#access(Runnable)
      */
-    public void runSafely(Runnable runnable) {
+    public void access(Runnable runnable) {
         Map<Class<?>, CurrentInstance> old = null;
         lock();
         try {
@@ -1095,6 +1098,15 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
 
     }
 
+    /**
+     * @deprecated As of 7.1.0.beta1, use {@link #access(Runnable)} instead.
+     *             This method will be removed before the final 7.1.0 release.
+     */
+    @Deprecated
+    public void runSafely(Runnable runnable) {
+        access(runnable);
+    }
+
     /**
      * Gets the CSRF token (aka double submit cookie) that is used to protect
      * against Cross Site Request Forgery attacks.
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index 1f5011a42e..e875a4e861 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -632,7 +632,7 @@ public class FileUploadHandler implements RequestHandler {
 
     private void cleanStreamVariable(VaadinSession session,
             final ClientConnector owner, final String variableName) {
-        session.runSafely(new Runnable() {
+        session.access(new Runnable() {
             @Override
             public void run() {
                 owner.getUI()
diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java
index 20ad392679..d06882927e 100644
--- a/server/src/com/vaadin/ui/LoginForm.java
+++ b/server/src/com/vaadin/ui/LoginForm.java
@@ -68,7 +68,7 @@ public class LoginForm extends CustomComponent {
         }
         final StringBuilder responseBuilder = new StringBuilder();
 
-        getUI().runSafely(new Runnable() {
+        getUI().access(new Runnable() {
             @Override
             public void run() {
                 String method = VaadinServletService.getCurrentServletRequest()
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 442edfebb1..f260a6af79 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -1092,20 +1092,29 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     }
 
     /**
-     * Performs a safe update of this UI.
+     * Provides exclusive access to this UI from outside a request handling
+     * thread.
      * <p>
-     * This method runs the runnable code so that it is safe to update UI and
-     * session variables. It also ensures that all thread locals are set
-     * correctly when executing the runnable.
+     * The given runnable is executed while holding the session lock to ensure
+     * exclusive access to this UI and its session. The UI and related thread
+     * locals are set properly before executing the runnable.
+     * </p>
+     * <p>
+     * RPC handlers for components inside this UI do not need this method as the
+     * session is automatically locked by the framework during request handling.
      * </p>
      * 
      * @param runnable
-     *            The runnable which updates the UI
+     *            the runnable which accesses the UI
      * @throws UIDetachedException
      *             if the UI is not attached to a session (and locking can
      *             therefore not be done)
+     * 
+     * @see #getCurrent()
+     * @see VaadinSession#access(Runnable)
+     * @see VaadinSession#lock()
      */
-    public void runSafely(Runnable runnable) throws UIDetachedException {
+    public void access(Runnable runnable) throws UIDetachedException {
         Map<Class<?>, CurrentInstance> old = null;
 
         VaadinSession session = getSession();
@@ -1118,7 +1127,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
         try {
             if (getSession() == null) {
                 // UI was detached after fetching the session but before we
-                // acquiried the lock.
+                // acquired the lock.
                 throw new UIDetachedException();
             }
             old = CurrentInstance.setThreadLocals(this);
@@ -1132,6 +1141,15 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     }
 
+    /**
+     * @deprecated As of 7.1.0.beta1, use {@link #access(Runnable)} instead.
+     *             This method will be removed before the final 7.1.0 release.
+     */
+    @Deprecated
+    public void runSafely(Runnable runnable) throws UIDetachedException {
+        access(runnable);
+    }
+
     /**
      * Retrieves the object used for configuring tooltips.
      * 
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
index 47d53c8f52..bec8c0a10f 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
@@ -119,7 +119,7 @@ public class CloseUI extends AbstractTestUI {
 
         @Override
         public void run() {
-            ui.runSafely(new Runnable() {
+            ui.access(new Runnable() {
 
                 @Override
                 public void run() {
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
index 0048cbd741..ddc0f28664 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
@@ -11,7 +11,7 @@ public abstract class UIRunSafelyThread extends Thread {
 
     @Override
     public void run() {
-        ui.runSafely(new Runnable() {
+        ui.access(new Runnable() {
 
             @Override
             public void run() {
diff --git a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java
index a7add63801..48671191ca 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UIPolling.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UIPolling.java
@@ -39,7 +39,7 @@ public class UIPolling extends AbstractTestUIWithLog {
                 } catch (InterruptedException e) {
                 }
                 final int iteration = i;
-                runSafely(new Runnable() {
+                access(new Runnable() {
                     @Override
                     public void run() {
                         log.log((iteration * SLEEP_TIME) + "ms has passed");
diff --git a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
index 88ab4af967..06ead20db3 100644
--- a/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
+++ b/uitest/src/com/vaadin/tests/minitutorials/broadcastingmessages/BroadcasterUI.java
@@ -43,7 +43,7 @@ public class BroadcasterUI extends UI implements BroadcastListener {
 
     @Override
     public void receiveBroadcast(final String message) {
-        runSafely(new Runnable() {
+        access(new Runnable() {
             @Override
             public void run() {
                 Notification n = new Notification("Message received", message,
diff --git a/uitest/src/com/vaadin/tests/push/BasicPush.java b/uitest/src/com/vaadin/tests/push/BasicPush.java
index 43f8236999..b80d287a1d 100644
--- a/uitest/src/com/vaadin/tests/push/BasicPush.java
+++ b/uitest/src/com/vaadin/tests/push/BasicPush.java
@@ -27,7 +27,7 @@ public class BasicPush extends AbstractTestUI {
 
         @Override
         public void run() {
-            runSafely(new Runnable() {
+            access(new Runnable() {
                 @Override
                 public void run() {
                     counter2.setValue(counter2.getValue() + 1);
diff --git a/uitest/src/com/vaadin/tests/push/PushFromInit.java b/uitest/src/com/vaadin/tests/push/PushFromInit.java
index c43739ec04..4b442de499 100644
--- a/uitest/src/com/vaadin/tests/push/PushFromInit.java
+++ b/uitest/src/com/vaadin/tests/push/PushFromInit.java
@@ -11,7 +11,7 @@ public class PushFromInit extends AbstractTestUIWithLog {
         new Thread() {
             @Override
             public void run() {
-                runSafely(new Runnable() {
+                access(new Runnable() {
                     @Override
                     public void run() {
                         log("Logged from background thread started in init");
diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java
index 8e9eafeabb..24358e648a 100644
--- a/uitest/src/com/vaadin/tests/push/TogglePush.java
+++ b/uitest/src/com/vaadin/tests/push/TogglePush.java
@@ -52,7 +52,7 @@ public class TogglePush extends AbstractTestUI {
                         new Timer().schedule(new TimerTask() {
                             @Override
                             public void run() {
-                                runSafely(new Runnable() {
+                                access(new Runnable() {
                                     @Override
                                     public void run() {
                                         updateCounter();
-- 
cgit v1.2.3


From 087756f1a6472af100686fdfebd7aa273faa0059 Mon Sep 17 00:00:00 2001
From: Johannes Dahlström <johannesd@vaadin.com>
Date: Thu, 2 May 2013 13:58:36 +0300
Subject: Allow setting push mode in UI.init (#11739)

Change-Id: Ied24bc42a25800033351fcbacdc5fc5e0be8eda1
---
 .../vaadin/server/communication/UIInitHandler.java | 10 ++--
 uitest/src/com/vaadin/tests/push/TogglePush.java   |  3 +
 .../com/vaadin/tests/push/TogglePushInInit.html    | 69 ++++++++++++++++++++++
 3 files changed, 77 insertions(+), 5 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/push/TogglePushInInit.html

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/communication/UIInitHandler.java b/server/src/com/vaadin/server/communication/UIInitHandler.java
index 97aaa6bd74..e4b5360b49 100644
--- a/server/src/com/vaadin/server/communication/UIInitHandler.java
+++ b/server/src/com/vaadin/server/communication/UIInitHandler.java
@@ -204,11 +204,6 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
             ui.setSession(session);
         }
 
-        // Set thread local here so it is available in init
-        UI.setCurrent(ui);
-
-        ui.doInit(request, uiId.intValue());
-
         PushMode pushMode = provider.getPushMode(event);
         if (pushMode == null) {
             pushMode = session.getService().getDeploymentConfiguration()
@@ -216,6 +211,11 @@ public abstract class UIInitHandler extends SynchronizedRequestHandler {
         }
         ui.setPushMode(pushMode);
 
+        // Set thread local here so it is available in init
+        UI.setCurrent(ui);
+
+        ui.doInit(request, uiId.intValue());
+
         session.addUI(ui);
 
         // Remember if it should be remembered
diff --git a/uitest/src/com/vaadin/tests/push/TogglePush.java b/uitest/src/com/vaadin/tests/push/TogglePush.java
index 24358e648a..37687260dd 100644
--- a/uitest/src/com/vaadin/tests/push/TogglePush.java
+++ b/uitest/src/com/vaadin/tests/push/TogglePush.java
@@ -22,6 +22,9 @@ public class TogglePush extends AbstractTestUI {
         updateCounter();
         addComponent(counterLabel);
 
+        setPushMode("disabled".equals(request.getParameter("push")) ? PushMode.DISABLED
+                : PushMode.AUTOMATIC);
+
         CheckBox pushSetting = new CheckBox("Push enabled");
         pushSetting.setValue(Boolean.valueOf(getPushMode().isEnabled()));
         pushSetting.setImmediate(true);
diff --git a/uitest/src/com/vaadin/tests/push/TogglePushInInit.html b/uitest/src/com/vaadin/tests/push/TogglePushInInit.html
new file mode 100644
index 0000000000..c735f225e1
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/push/TogglePushInInit.html
@@ -0,0 +1,69 @@
+<?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:8071/" />
+<title>TogglePushInInit</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">TogglePushInInit</td></tr>
+</thead><tbody>
+<!--Open with push disabled-->
+<tr>
+	<td>open</td>
+	<td>/run-push/com.vaadin.tests.push.TogglePush?restartApplication&push=disabled</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>off</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 0 times</td>
+</tr>
+<!--Open with push enabled-->
+<tr>
+	<td>open</td>
+	<td>/run-push/com.vaadin.tests.push.TogglePush?restartApplication&amp;push=enabled</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>on</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>2000</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runpushcomvaadintestspushTogglePush::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>Counter has been updated 1 times</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From 9bd7c2bbec7f88e001e81811e02addcaca9fd1a4 Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Tue, 7 May 2013 13:01:46 +0300
Subject: Fixed order of tests in LayoutTesterApplication #11796

Change-Id: I9fc1224df33a66f065594de4ae09a027ddaaa895
---
 .../layouttester/LayoutTesterApplication.java      | 46 ++++++++++++++--------
 1 file changed, 30 insertions(+), 16 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java
index 2294b1909b..72863895a1 100644
--- a/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java
+++ b/uitest/src/com/vaadin/tests/layouts/layouttester/LayoutTesterApplication.java
@@ -19,9 +19,14 @@ import com.vaadin.ui.themes.Reindeer;
 public class LayoutTesterApplication extends AbstractTestCase {
     Button nextButton = new Button("Next");
     private int layoutIndex = -1;
-    private int layoutCount = 1;
 
-    private Method[] layoutGetters;
+    private static final String[] layoutGetters = new String[] {
+            "getCaptionsTests", "getIconsTests",
+            "getRequiredErrorIndicatorsTests", "getAlignmentTests",
+            "getExpandRatiosTests", "getMarginSpacingTests",
+            "getComponentAddReplaceMoveTests", "getComponentSizingTests",
+            "getLayoutSizingTests" };
+
     private LegacyWindow mainWindow;
     private NativeSelect layoutSelector;
 
@@ -29,33 +34,32 @@ public class LayoutTesterApplication extends AbstractTestCase {
     public void init() {
         mainWindow = new LegacyWindow("LayoutTesterApplication");
         setMainWindow(mainWindow);
-        loadLayoutGetters();
-        nextLaytout();
+        nextLayout();
 
         nextButton.addListener(new Button.ClickListener() {
             private static final long serialVersionUID = -1577298910202253538L;
 
             @Override
             public void buttonClick(ClickEvent event) {
-                nextLaytout();
+                nextLayout();
             }
         });
     }
 
-    private void nextLaytout() {
+    private void nextLayout() {
         try {
             mainWindow.removeAllComponents();
             HorizontalLayout vlo = new HorizontalLayout();
             vlo.setSpacing(true);
             ++layoutIndex;
-            if (layoutIndex >= layoutCount) {
+            if (layoutIndex >= layoutGetters.length) {
                 layoutIndex = 0;
             }
             mainWindow.addComponent(vlo);
             vlo.addComponent(nextButton);
             vlo.addComponent(getLayoutTypeSelect());
-            vlo.addComponent(new UndefWideLabel(layoutGetters[layoutIndex]
-                    .getName()));
+            vlo.addComponent(new UndefWideLabel(getLayoutGetterMethod(
+                    layoutGetters[layoutIndex]).getName()));
 
             Layout lo = null;
             if (layoutSelector.getValue() == VerticalLayout.class) {
@@ -75,24 +79,34 @@ public class LayoutTesterApplication extends AbstractTestCase {
         }
     }
 
-    public void loadLayoutGetters() {
-        layoutGetters = AbstractLayoutTests.class.getDeclaredMethods();
-        layoutCount = layoutGetters.length;
+    private Method getLayoutGetterMethod(String method) {
+        try {
+            return AbstractLayoutTests.class.getDeclaredMethod(method);
+        } catch (SecurityException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        } catch (NoSuchMethodException e) {
+            e.printStackTrace();
+            throw new RuntimeException(e);
+        }
     }
 
     public Layout getVerticalTestLayout(int index) throws Exception {
         VerticalLayoutTests vlotest = new VerticalLayoutTests(this);
-        return (Layout) layoutGetters[index].invoke(vlotest, (Object[]) null);
+        return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke(
+                vlotest, (Object[]) null);
     }
 
     public Layout getHorizontalTestLayout(int index) throws Exception {
         HorizontalLayoutTests hlotest = new HorizontalLayoutTests(this);
-        return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null);
+        return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke(
+                hlotest, (Object[]) null);
     }
 
     public Layout getGridTestLayout(int index) throws Exception {
         GridLayoutTests hlotest = new GridLayoutTests(this);
-        return (Layout) layoutGetters[index].invoke(hlotest, (Object[]) null);
+        return (Layout) getLayoutGetterMethod(layoutGetters[index]).invoke(
+                hlotest, (Object[]) null);
     }
 
     private NativeSelect getLayoutTypeSelect() {
@@ -110,7 +124,7 @@ public class LayoutTesterApplication extends AbstractTestCase {
                 @Override
                 public void valueChange(ValueChangeEvent event) {
                     layoutIndex = -1;
-                    nextLaytout();
+                    nextLayout();
                 }
             });
         }
-- 
cgit v1.2.3


From f2c2236cf8d0428f100e17586f7946095ffea158 Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Tue, 7 May 2013 14:55:27 +0300
Subject: Replaced css inject hack in TestUtils with Page.Styles.add() #11798

Change-Id: Ifb43fd1d2226756e104e2f5955e23151100e9357
---
 uitest/src/com/vaadin/tests/util/TestUtils.java | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java
index 5c6315a23a..dcd28c3413 100644
--- a/uitest/src/com/vaadin/tests/util/TestUtils.java
+++ b/uitest/src/com/vaadin/tests/util/TestUtils.java
@@ -99,22 +99,13 @@ public class TestUtils {
             "YE", "ZAMBIA", "ZM", "ZIMBABWE", "ZW" };
 
     /**
-     * Crossbrowser hack to dynamically add css current window. Can be used to
-     * keep tests css in source files.
+     * Injects css into the current window. Can be used to keep tests css in
+     * source files.
      * 
      * @param cssString
      */
     public static void injectCSS(UI w, String cssString) {
-        String script = "if ('\\v'=='v') /* ie only */ {\n"
-                + "        document.createStyleSheet().cssText = '"
-                + cssString
-                + "';\n"
-                + "    } else {var tag = document.createElement('style'); tag.type = 'text/css';"
-                + " document.getElementsByTagName('head')[0].appendChild(tag);tag[ (typeof "
-                + "document.body.style.WebkitAppearance=='string') /* webkit only */ ? 'innerText' "
-                + ": 'innerHTML'] = '" + cssString + "';}";
-
-        w.getPage().getJavaScript().execute(script);
+        w.getPage().getStyles().add(cssString);
     }
 
     public static void installPerformanceReporting(TextArea targetTextArea) {
-- 
cgit v1.2.3


From 571792ed9ddb00ae795bd785473c181f1aa102a2 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Tue, 7 May 2013 15:45:51 +0300
Subject: Remove old widget hierarchy hack that caused problems (#11752)

Change-Id: Icd66755512a2c1ab490e58f80389ed35966d3e3b
---
 client/src/com/vaadin/client/ui/VPopupView.java    | 29 ----------------------
 .../popupview/ClickingWhilePopupOpen.html          |  2 +-
 2 files changed, 1 insertion(+), 30 deletions(-)

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VPopupView.java b/client/src/com/vaadin/client/ui/VPopupView.java
index d983da2b62..05fbd2c073 100644
--- a/client/src/com/vaadin/client/ui/VPopupView.java
+++ b/client/src/com/vaadin/client/ui/VPopupView.java
@@ -202,7 +202,6 @@ public class VPopupView extends HTML implements Iterable<Widget> {
         private boolean hasHadMouseOver = false;
         private boolean hideOnMouseOut = true;
         private final Set<Element> activeChildren = new HashSet<Element>();
-        private boolean hiding = false;
 
         private ShortcutActionHandler shortcutActionHandler;
 
@@ -264,7 +263,6 @@ public class VPopupView extends HTML implements Iterable<Widget> {
         @Override
         public void hide(boolean autoClosed) {
             VConsole.log("Hiding popupview");
-            hiding = true;
             syncChildren();
             if (popupComponentWidget != null && popupComponentWidget != loading) {
                 remove(popupComponentWidget);
@@ -276,8 +274,6 @@ public class VPopupView extends HTML implements Iterable<Widget> {
 
         @Override
         public void show() {
-            hiding = false;
-
             // Find the shortcut action handler that should handle keyboard
             // events from the popup. The events do not propagate automatically
             // because the popup is directly attached to the RootPanel.
@@ -353,31 +349,6 @@ public class VPopupView extends HTML implements Iterable<Widget> {
             this.hideOnMouseOut = hideOnMouseOut;
         }
 
-        /*
-         * 
-         * We need a hack make popup act as a child of VPopupView in Vaadin's
-         * component tree, but work in default GWT manner when closing or
-         * opening.
-         * 
-         * (non-Javadoc)
-         * 
-         * @see com.google.gwt.user.client.ui.Widget#getParent()
-         */
-        @Override
-        public Widget getParent() {
-            if (!isAttached() || hiding) {
-                return super.getParent();
-            } else {
-                return VPopupView.this;
-            }
-        }
-
-        @Override
-        protected void onDetach() {
-            super.onDetach();
-            hiding = false;
-        }
-
         @Override
         public Element getContainerElement() {
             return super.getContainerElement();
diff --git a/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html b/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html
index 81676f6599..43f1c2e8ed 100644
--- a/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html
+++ b/uitest/src/com/vaadin/tests/components/popupview/ClickingWhilePopupOpen.html
@@ -28,7 +28,7 @@
 </tr>
 <tr>
 	<td>assertTextNotPresent</td>
-	<td>IllegalStateException: Cannot set a new parent without first clearing the old parent</td>
+	<td>Uncaught client side exception</td>
 	<td></td>
 </tr>
 
-- 
cgit v1.2.3


From 762c924a8bf05f57b8af7108d7bb6a9c59dcc6c6 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Wed, 8 May 2013 16:13:00 +0300
Subject: Update test to work with the new debug window

Change-Id: I9a1f7791faa3bbd8aae13c0d21c505570dfa131b
---
 .../vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html  | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html b/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html
index 03d8f34651..a0ebb3bf27 100644
--- a/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html
+++ b/uitest/src/com/vaadin/tests/debug/HierarchyAfterAnalyzeLayouts.html
@@ -17,14 +17,19 @@
 	<td></td>
 </tr>
 <tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugConsole[0]/FlowPanel[0]/HorizontalPanel[0]/domChild[0]/domChild[0]/domChild[3]/domChild[0]</td>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/FlowPanel[0]/FlowPanel[0]/domChild[1]</td>
 	<td>18,9</td>
 </tr>
 <tr>
-	<td>assertTextPresent</td>
-	<td>Layouts analyzed on server, total top level problems: 0</td>
-	<td></td>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/FlowPanel[0]/FlowPanel[2]/FlowPanel[0]/domChild[2]</td>
+	<td>18,9</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestsdebugHierarchyAfterAnalyzeLayouts::Root/VDebugWindow[0]/FlowPanel[0]/SimplePanel[0]/FlowPanel[0]/domChild[0]</td>
+	<td>Layouts analyzed, no top level problems</td>
 </tr>
 <tr>
 	<td>assertElementPresent</td>
-- 
cgit v1.2.3


From 0a437a54afe019f696bcd1c995cf2588d7337a2b Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Tue, 14 May 2013 12:22:39 +0000
Subject: Revert "Replaced css inject hack in TestUtils with Page.Styles.add()
 #11798"

Removing this change to make the tests behave more nicely until #11848 has been fixed.

This reverts commit f2c2236cf8d0428f100e17586f7946095ffea158

Change-Id: I776699f5082273e9c4d11248cc35e7ed6b665873
---
 uitest/src/com/vaadin/tests/util/TestUtils.java | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java
index dcd28c3413..5c6315a23a 100644
--- a/uitest/src/com/vaadin/tests/util/TestUtils.java
+++ b/uitest/src/com/vaadin/tests/util/TestUtils.java
@@ -99,13 +99,22 @@ public class TestUtils {
             "YE", "ZAMBIA", "ZM", "ZIMBABWE", "ZW" };
 
     /**
-     * Injects css into the current window. Can be used to keep tests css in
-     * source files.
+     * Crossbrowser hack to dynamically add css current window. Can be used to
+     * keep tests css in source files.
      * 
      * @param cssString
      */
     public static void injectCSS(UI w, String cssString) {
-        w.getPage().getStyles().add(cssString);
+        String script = "if ('\\v'=='v') /* ie only */ {\n"
+                + "        document.createStyleSheet().cssText = '"
+                + cssString
+                + "';\n"
+                + "    } else {var tag = document.createElement('style'); tag.type = 'text/css';"
+                + " document.getElementsByTagName('head')[0].appendChild(tag);tag[ (typeof "
+                + "document.body.style.WebkitAppearance=='string') /* webkit only */ ? 'innerText' "
+                + ": 'innerHTML'] = '" + cssString + "';}";
+
+        w.getPage().getJavaScript().execute(script);
     }
 
     public static void installPerformanceReporting(TextArea targetTextArea) {
-- 
cgit v1.2.3


From 656eaa59582c2d4ec7ae94457d6c6a542150bdc2 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Fri, 17 May 2013 12:44:17 +0300
Subject: Tweak TooltipConfiguration test to pass in IE9 and IE10

Intermediate mouse move events are needed to make IE realize the same
element is hovered again

Change-Id: I409722e5b450988b3709a58e34b2eefe79a2be3c
---
 .../com/vaadin/tests/components/ui/TooltipConfiguration.html   | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
index c1734481c6..e41cf5e176 100644
--- a/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
+++ b/uitest/src/com/vaadin/tests/components/ui/TooltipConfiguration.html
@@ -53,6 +53,11 @@
 	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SClose timeout</td>
 	<td>3000</td>
 </tr>
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td>
+	<td>0,0</td>
+</tr>
 <tr>
 	<td>mouseMoveAt</td>
 	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SshortTooltip</td>
@@ -115,6 +120,11 @@
 	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SMax width</td>
 	<td>100</td>
 </tr>
+<tr>
+	<td>mouseMoveAt</td>
+	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::</td>
+	<td>0,0</td>
+</tr>
 <tr>
 	<td>mouseMoveAt</td>
 	<td>vaadin=runcomvaadintestscomponentsuiTooltipConfiguration::PID_SlongTooltip</td>
-- 
cgit v1.2.3


From 53a9c1123a9bfbf73b9d46a58a38913845a319ed Mon Sep 17 00:00:00 2001
From: Johannes Dahlström <johannesd@vaadin.com>
Date: Wed, 22 May 2013 16:50:17 +0300
Subject: Fix TestingPushConnection.init signature (#11673)

Change-Id: I7f5736fd456c21878a0eabdbff46a648932d3516
---
 .../com/vaadin/tests/widgetset/client/TestingPushConnection.java    | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
index 8d00598907..e255a5f95a 100644
--- a/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
+++ b/uitest/src/com/vaadin/tests/widgetset/client/TestingPushConnection.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.widgetset.client;
 
 import com.google.gwt.user.client.Window;
 import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.ApplicationConnection.CommunicationErrorHandler;
 import com.vaadin.client.communication.AtmospherePushConnection;
 
 public class TestingPushConnection extends AtmospherePushConnection {
@@ -9,8 +10,9 @@ public class TestingPushConnection extends AtmospherePushConnection {
     private String transport;
 
     @Override
-    public void init(ApplicationConnection connection) {
-        super.init(connection);
+    public void init(ApplicationConnection connection,
+            CommunicationErrorHandler errorHandler) {
+        super.init(connection, errorHandler);
         transport = Window.Location.getParameter("transport");
     }
 
-- 
cgit v1.2.3


From 8a42394c6341f26066f41d3560f2419658a67a62 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Wed, 22 May 2013 10:54:20 +0300
Subject: Fixed locators in test (aria div conflict)

Change-Id: Iaeef438de48ef9bda33fb81b0bb7f71d134b17ca
---
 .../tests/components/datefield/DateFieldPrimaryStyleNames.html    | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html
index 31216ed1b0..38034fd0c8 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldPrimaryStyleNames.html
@@ -68,12 +68,12 @@
 </tr>
 <tr>
     <td>assertCSSClass</td>
-    <td>//body/div[last()]/div[last()]</td>
+    <td>//body/div[2]/div[last()]</td>
     <td>my-datefield-popup</td>
 </tr>
 <tr>
     <td>assertCSSClass</td>
-    <td>//body/div[last()]/div[last()]</td>
+    <td>//body/div[2]/div[last()]</td>
     <td>my-datefield-day</td>
 </tr>
 <tr>
@@ -188,12 +188,12 @@
 </tr>
 <tr>
     <td>assertCSSClass</td>
-    <td>//body/div[last()]/div[last()]</td>
+    <td>//body/div[2]/div[last()]</td>
     <td>my-second-datefield-popup</td>
 </tr>
 <tr>
     <td>assertCSSClass</td>
-    <td>//body/div[last()]/div[last()]</td>
+    <td>//body/div[2]/div[last()]</td>
     <td>my-second-datefield-day</td>
 </tr>
 <tr>
-- 
cgit v1.2.3


From f7f1e3ece5206c335487ce25f4e709370024109d Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Fri, 24 May 2013 13:48:09 +0300
Subject: Added Java Date to Sql Date converter to better support sql dates
 (#11224)

Change-Id: I83d8c96a6877ea33b270a1a4a2c6f360a8147518
---
 .../util/converter/DateToSqlDateConverter.java     |  59 +++++++++
 .../util/converter/DefaultConverterFactory.java    |   2 +
 .../tests/components/table/TableSqlContainer.html  |  72 +++++++++++
 .../tests/components/table/TableSqlContainer.java  | 142 +++++++++++++++++++++
 4 files changed, 275 insertions(+)
 create mode 100644 server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java
 create mode 100644 uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
 create mode 100644 uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java
new file mode 100644
index 0000000000..97027cc05b
--- /dev/null
+++ b/server/src/com/vaadin/data/util/converter/DateToSqlDateConverter.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * 
+ */
+package com.vaadin.data.util.converter;
+
+import java.util.Date;
+import java.util.Locale;
+
+/**
+ * Converter for handling conversion between {@link java.util.Date} and
+ * {@link java.sql.Date}. This is used when a PopupDateField or InlineDateField
+ * is connected to a java.sql.Date property, typically through a JPAContainer or
+ * SQLContainer. Note that information (time information) is lost when
+ * converting from {@link java.util.Date} to {@link java.sql.Date}.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class DateToSqlDateConverter implements Converter<Date, java.sql.Date> {
+
+    @Override
+    public java.sql.Date convertToModel(Date value, Locale locale)
+            throws ConversionException {
+        return new java.sql.Date(value.getTime());
+    }
+
+    @Override
+    public Date convertToPresentation(java.sql.Date value, Locale locale)
+            throws ConversionException {
+        return new Date(value.getTime());
+    }
+
+    @Override
+    public Class<java.sql.Date> getModelType() {
+        return java.sql.Date.class;
+    }
+
+    @Override
+    public Class<Date> getPresentationType() {
+        return Date.class;
+    }
+
+}
diff --git a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
index de183dd342..bbd3945a37 100644
--- a/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
+++ b/server/src/com/vaadin/data/util/converter/DefaultConverterFactory.java
@@ -87,6 +87,8 @@ public class DefaultConverterFactory implements ConverterFactory {
     protected Converter<Date, ?> createDateConverter(Class<?> sourceType) {
         if (Long.class.isAssignableFrom(sourceType)) {
             return new DateToLongConverter();
+        } else if (java.sql.Date.class.isAssignableFrom(sourceType)) {
+            return new DateToSqlDateConverter();
         } else {
             return null;
         }
diff --git a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
new file mode 100644
index 0000000000..96df94148c
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.html
@@ -0,0 +1,72 @@
+<?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.table.TableSqlContainer?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>May 24, 2013 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>12,7</td>
+</tr>
+<tr>
+	<td>assertValue</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#field</td>
+	<td>5/24/13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/FocusableScrollPanel[0]/VScrollTable$VScrollTableBody[0]/VScrollTable$VScrollTableBody$VScrollTableRow[0]/VPopupCalendar[0]#popupButton</td>
+	<td>9,7</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[5]/span</td>
+	<td>11,10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VCheckBox[0]/domChild[0]</td>
+	<td>9,12</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[0]</td>
+	<td>May 15, 2013 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td>
+	<td>Apr 26, 2013 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[1]/domChild[0]</td>
+	<td>May 27, 2013 12:00:00 AM</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentstableTableSqlContainer::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VVerticalLayout[0]/Slot[0]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[3]/domChild[1]/domChild[0]</td>
+	<td>Apr 28, 2013 12:00:00 AM</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java
new file mode 100644
index 0000000000..5191b1b86e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/table/TableSqlContainer.java
@@ -0,0 +1,142 @@
+package com.vaadin.tests.components.table;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Locale;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.data.Property.ValueChangeListener;
+import com.vaadin.data.util.sqlcontainer.SQLContainer;
+import com.vaadin.data.util.sqlcontainer.connection.JDBCConnectionPool;
+import com.vaadin.data.util.sqlcontainer.connection.SimpleJDBCConnectionPool;
+import com.vaadin.data.util.sqlcontainer.query.TableQuery;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.CheckBox;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+
+public class TableSqlContainer extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        setLocale(Locale.ENGLISH);
+        VerticalLayout layout = new VerticalLayout();
+        addComponent(layout);
+
+        final Table table = new Table("Table with SQLContainer");
+        layout.addComponent(table);
+
+        final Label selectedLabel = new Label("Selected: null");
+        layout.addComponent(selectedLabel);
+
+        try {
+            JDBCConnectionPool connectionPool = new SimpleJDBCConnectionPool(
+                    "org.hsqldb.jdbc.JDBCDriver",
+                    "jdbc:hsqldb:mem:sqlcontainer", "SA", "", 2, 20);
+
+            createTestTable(connectionPool);
+            insertTestData(connectionPool);
+
+            TableQuery q = new TableQuery("mytable", connectionPool);
+            q.setVersionColumn("version");
+            SQLContainer myContainer = new SQLContainer(q);
+
+            table.setContainerDataSource(myContainer);
+
+        } catch (SQLException e) {
+            e.printStackTrace();
+        }
+
+        table.setImmediate(true);
+        table.setSizeFull();
+        table.setSelectable(true);
+        table.addValueChangeListener(new Property.ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                selectedLabel.setValue("Selected: "
+                        + event.getProperty().getValue());
+            }
+        });
+
+        final CheckBox editMode = new CheckBox("Edit mode");
+        editMode.addValueChangeListener(new ValueChangeListener() {
+            @Override
+            public void valueChange(ValueChangeEvent event) {
+                table.setEditable(editMode.getValue());
+            }
+        });
+        addComponent(editMode);
+    }
+
+    /**
+     * (Re)creates the test table
+     * 
+     * @param connectionPool
+     */
+    private void createTestTable(JDBCConnectionPool connectionPool) {
+        Connection conn = null;
+        try {
+            conn = connectionPool.reserveConnection();
+            Statement statement = conn.createStatement();
+            try {
+                statement.executeUpdate("DROP TABLE mytable");
+            } catch (SQLException e) {
+            }
+            statement.execute("CREATE TABLE mytable "
+                    + "(id INTEGER GENERATED BY DEFAULT AS IDENTITY, D DATE,"
+                    + "MYFIELD VARCHAR(45), " + "PRIMARY KEY(ID))");
+            statement.close();
+            conn.commit();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            connectionPool.releaseConnection(conn);
+        }
+    }
+
+    /**
+     * Adds test data to the test table
+     * 
+     * @param connectionPool
+     * @throws SQLException
+     */
+    private void insertTestData(JDBCConnectionPool connectionPool)
+            throws SQLException {
+        Connection conn = null;
+        try {
+            conn = connectionPool.reserveConnection();
+            Statement statement = conn.createStatement();
+
+            statement
+                    .executeUpdate("INSERT INTO mytable VALUES(1, '2013-05-24', 'A0')");
+            statement
+                    .executeUpdate("INSERT INTO mytable VALUES(2, '2013-04-26', 'A1')");
+            statement
+                    .executeUpdate("INSERT INTO mytable VALUES(3, '2013-05-27', 'B0')");
+            statement
+                    .executeUpdate("INSERT INTO mytable VALUES(4, '2013-04-28', 'B1')");
+
+            statement.close();
+            conn.commit();
+        } catch (SQLException e) {
+            e.printStackTrace();
+        } finally {
+            connectionPool.releaseConnection(conn);
+        }
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "A test with Table connected to a SQLContainer using TableQuery";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11224;
+    }
+
+}
\ No newline at end of file
-- 
cgit v1.2.3


From 4d7f190b7f36a10b16e74b1dab8ed0a274841ae1 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Wed, 22 May 2013 15:56:29 +0300
Subject: Make access() enqueue the runnable if the session is locked (#11897)

Change-Id: If162e81a29bbc982857e2a165a983e161ea837ee
---
 server/src/com/vaadin/server/RequestHandler.java   |   3 +-
 server/src/com/vaadin/server/VaadinService.java    |  15 +-
 server/src/com/vaadin/server/VaadinSession.java    | 174 +++++++++++++--
 .../server/communication/FileUploadHandler.java    |   2 +-
 .../vaadin/server/communication/UidlWriter.java    |   7 +-
 server/src/com/vaadin/ui/LoginForm.java            |   2 +-
 server/src/com/vaadin/ui/UI.java                   | 118 +++++++++--
 .../vaadin/tests/applicationcontext/CloseUI.java   |   2 +-
 .../applicationcontext/UIRunSafelyThread.java      |   2 +-
 .../com/vaadin/tests/components/ui/UiAccess.html   | 127 +++++++++++
 .../com/vaadin/tests/components/ui/UiAccess.java   | 235 +++++++++++++++++++++
 11 files changed, 632 insertions(+), 55 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/UiAccess.html
 create mode 100644 uitest/src/com/vaadin/tests/components/ui/UiAccess.java

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/RequestHandler.java b/server/src/com/vaadin/server/RequestHandler.java
index 873752c5f2..097a3e034b 100644
--- a/server/src/com/vaadin/server/RequestHandler.java
+++ b/server/src/com/vaadin/server/RequestHandler.java
@@ -37,7 +37,8 @@ public interface RequestHandler extends Serializable {
      * using VaadinSession or anything inside the VaadinSession you must ensure
      * the session is locked. This can be done by extending
      * {@link SynchronizedRequestHandler} or by using
-     * {@link VaadinSession#access(Runnable)} or {@link UI#access(Runnable)}.
+     * {@link VaadinSession#accessSynchronously(Runnable)} or
+     * {@link UI#accessSynchronously(Runnable)}.
      * </p>
      * 
      * @param session
diff --git a/server/src/com/vaadin/server/VaadinService.java b/server/src/com/vaadin/server/VaadinService.java
index af0c280c19..2cb7f9059e 100644
--- a/server/src/com/vaadin/server/VaadinService.java
+++ b/server/src/com/vaadin/server/VaadinService.java
@@ -407,12 +407,12 @@ public abstract class VaadinService implements Serializable {
      */
     public void fireSessionDestroy(VaadinSession vaadinSession) {
         final VaadinSession session = vaadinSession;
-        session.access(new Runnable() {
+        session.accessSynchronously(new Runnable() {
             @Override
             public void run() {
                 ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
                 for (final UI ui : uis) {
-                    ui.access(new Runnable() {
+                    ui.accessSynchronously(new Runnable() {
                         @Override
                         public void run() {
                             /*
@@ -1087,7 +1087,7 @@ public abstract class VaadinService implements Serializable {
     private void removeClosedUIs(final VaadinSession session) {
         ArrayList<UI> uis = new ArrayList<UI>(session.getUIs());
         for (final UI ui : uis) {
-            ui.access(new Runnable() {
+            ui.accessSynchronously(new Runnable() {
                 @Override
                 public void run() {
                     if (ui.isClosing()) {
@@ -1245,7 +1245,7 @@ public abstract class VaadinService implements Serializable {
         if (session != null) {
             final VaadinSession finalSession = session;
 
-            session.access(new Runnable() {
+            session.accessSynchronously(new Runnable() {
                 @Override
                 public void run() {
                     cleanupSession(finalSession);
@@ -1254,7 +1254,7 @@ public abstract class VaadinService implements Serializable {
 
             final long duration = (System.nanoTime() - (Long) request
                     .getAttribute(REQUEST_START_TIME_ATTRIBUTE)) / 1000000;
-            session.access(new Runnable() {
+            session.accessSynchronously(new Runnable() {
                 @Override
                 public void run() {
                     finalSession.setLastRequestDuration(duration);
@@ -1542,8 +1542,9 @@ public abstract class VaadinService implements Serializable {
 
     /**
      * Checks that another {@link VaadinSession} instance is not locked. This is
-     * internally used by {@link VaadinSession#access(Runnable)} and
-     * {@link UI#access(Runnable)} to help avoid causing deadlocks.
+     * internally used by {@link VaadinSession#accessSynchronously(Runnable)}
+     * and {@link UI#accessSynchronously(Runnable)} to help avoid causing
+     * deadlocks.
      * 
      * @since 7.1
      * @param session
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 317ea6cf7b..9625a3f350 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -26,6 +26,11 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Logger;
@@ -130,6 +135,13 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
 
     private transient Lock lock;
 
+    /*
+     * Pending tasks can't be serialized and the queue should be empty when the
+     * session is serialized as long as it doesn't happen while some other
+     * thread has the lock.
+     */
+    private transient final ConcurrentLinkedQueue<FutureTask<Void>> pendingAccessQueue = new ConcurrentLinkedQueue<FutureTask<Void>>();
+
     /**
      * Create a new service session tied to a Vaadin service
      * 
@@ -820,9 +832,13 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     public void unlock() {
         assert hasLock();
         try {
+            /*
+             * Run pending tasks and push if the reentrant lock will actually be
+             * released by this unlock() invocation.
+             */
             if (((ReentrantLock) getLockInstance()).getHoldCount() == 1) {
-                // Only push if the reentrant lock will actually be released by
-                // this unlock() invocation.
+                runPendingAccessTasks();
+
                 for (UI ui : getUIs()) {
                     if (ui.getPushMode() == PushMode.AUTOMATIC) {
                         ui.push();
@@ -1063,23 +1079,30 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     }
 
     /**
-     * Provides exclusive access to this session from outside a request handling
-     * thread.
+     * Locks this session and runs the provided Runnable right away.
      * <p>
-     * The given runnable is executed while holding the session lock to ensure
-     * exclusive access to this session. The session and related thread locals
-     * are set properly before executing the runnable.
+     * It is generally recommended to use {@link #access(Runnable)} instead of
+     * this method for accessing a session from a different thread as
+     * {@link #access(Runnable)} can be used while holding the lock of another
+     * session. To avoid causing deadlocks, this methods throws an exception if
+     * it is detected than another session is also locked by the current thread.
      * </p>
      * <p>
-     * RPC handlers for components inside this session do not need this method
-     * as the session is automatically locked by the framework during request
-     * handling.
-     * </p>
-     * <p>
-     * Note that calling this method while another session is locked by the
-     * current thread will cause an exception. This is to prevent deadlock
-     * situations when two threads have locked one session each and are both
-     * waiting for the lock for the other session.
+     * This method behaves differently than {@link #access(Runnable)} in some
+     * situations:
+     * <ul>
+     * <li>If the current thread is currently holding the lock of this session,
+     * {@link #accessSynchronously(Runnable)} runs the task right away whereas
+     * {@link #access(Runnable)} defers the task to a later point in time.</li>
+     * <li>If some other thread is currently holding the lock for this session,
+     * {@link #accessSynchronously(Runnable)} blocks while waiting for the lock
+     * to be available whereas {@link #access(Runnable)} defers the task to a
+     * later point in time.</li>
+     * <li>If this session is currently not locked,
+     * {@link #accessSynchronously(Runnable)} runs the task right away whereas
+     * {@link #access(Runnable)} defers the task to a later point in time unless
+     * there are UIs with automatic push enabled.</li>
+     * </ul>
      * </p>
      * 
      * @param runnable
@@ -1088,12 +1111,14 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      * @throws IllegalStateException
      *             if the current thread holds the lock for another session
      * 
+     * @since 7.1
      * 
      * @see #lock()
      * @see #getCurrent()
-     * @see UI#access(Runnable)
+     * @see #access(Runnable)
+     * @see UI#accessSynchronously(Runnable)
      */
-    public void access(Runnable runnable) {
+    public void accessSynchronously(Runnable runnable) {
         VaadinService.verifyNoOtherSessionLocked(this);
 
         Map<Class<?>, CurrentInstance> old = null;
@@ -1111,12 +1136,119 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     }
 
     /**
-     * @deprecated As of 7.1.0.beta1, use {@link #access(Runnable)} instead.
-     *             This method will be removed before the final 7.1.0 release.
+     * Provides exclusive access to this session from outside a request handling
+     * thread.
+     * <p>
+     * The given runnable is executed while holding the session lock to ensure
+     * exclusive access to this session. If this session is not locked, the lock
+     * will be acquired and the runnable is run right away. If this session is
+     * currently locked, the runnable will be run before that lock is released.
+     * </p>
+     * <p>
+     * RPC handlers for components inside this session do not need to use this
+     * method as the session is automatically locked by the framework during RPC
+     * handling.
+     * </p>
+     * <p>
+     * Please note that the runnable might be invoked on a different thread or
+     * later on the current thread, which means that custom thread locals might
+     * not have the expected values when the runnable is executed. The session
+     * and other thread locals provided by Vaadin are set properly before
+     * executing the runnable.
+     * </p>
+     * <p>
+     * The returned future can be used to check for task completion and to
+     * cancel the task. To help avoiding deadlocks, {@link Future#get()} throws
+     * an exception if it is detected that the current thread holds the lock for
+     * some other session.
+     * </p>
+     * 
+     * @see #lock()
+     * @see #getCurrent()
+     * @see #accessSynchronously(Runnable)
+     * @see UI#access(Runnable)
+     * 
+     * @since 7.1
+     * 
+     * @param runnable
+     *            the runnable which accesses the session
+     * @return a future that can be used to check for task completion and to
+     *         cancel the task
+     */
+    public Future<Void> access(Runnable runnable) {
+        FutureTask<Void> future = new FutureTask<Void>(runnable, null) {
+            @Override
+            public Void get() throws InterruptedException, ExecutionException {
+                /*
+                 * Help the developer avoid programming patterns that cause
+                 * deadlocks unless implemented very carefully. get(long,
+                 * TimeUnit) does not have the same detection since a sensible
+                 * timeout should avoid completely locking up the application.
+                 * 
+                 * Even though no deadlock could occur after the runnable has
+                 * been run, the check is always done as the deterministic
+                 * behavior makes it easier to detect potential problems.
+                 */
+                VaadinService.verifyNoOtherSessionLocked(VaadinSession.this);
+                return super.get();
+            }
+        };
+        pendingAccessQueue.add(future);
+
+        /*
+         * If no thread is currently holding the lock, pending changes for UIs
+         * with automatic push would not be processed and pushed until the next
+         * time there is a request or someone does an explicit push call.
+         * 
+         * To remedy this, we try to get the lock at this point. If the lock is
+         * currently held by another thread, we just back out as the queue will
+         * get purged once it is released. If the lock is held by the current
+         * thread, we just release it knowing that the queue gets purged once
+         * the lock is ultimately released. If the lock is not held by any
+         * thread and we acquire it, we just release it again to purge the queue
+         * right away.
+         */
+        try {
+            // tryLock() would be shorter, but it does not guarantee fairness
+            if (getLockInstance().tryLock(0, TimeUnit.SECONDS)) {
+                // unlock triggers runPendingAccessTasks
+                unlock();
+            }
+        } catch (InterruptedException e) {
+            // Just ignore
+        }
+
+        return future;
+    }
+
+    /**
+     * Purges the queue of pending access invocations enqueued with
+     * {@link #access(Runnable)}.
+     * <p>
+     * This method is automatically run by the framework at appropriate
+     * situations and is not intended to be used by application developers.
+     * 
+     * @since 7.1
+     */
+    public void runPendingAccessTasks() {
+        assert hasLock();
+
+        FutureTask<Void> pendingAccess;
+        while ((pendingAccess = pendingAccessQueue.poll()) != null) {
+            if (!pendingAccess.isCancelled()) {
+                accessSynchronously(pendingAccess);
+            }
+        }
+    }
+
+    /**
+     * @deprecated As of 7.1.0.beta1, use {@link #accessSynchronously(Runnable)}
+     *             or {@link #access(Runnable)} instead. This method will be
+     *             removed before the final 7.1.0 release.
      */
     @Deprecated
     public void runSafely(Runnable runnable) {
-        access(runnable);
+        accessSynchronously(runnable);
     }
 
     /**
diff --git a/server/src/com/vaadin/server/communication/FileUploadHandler.java b/server/src/com/vaadin/server/communication/FileUploadHandler.java
index e875a4e861..e9569d45a1 100644
--- a/server/src/com/vaadin/server/communication/FileUploadHandler.java
+++ b/server/src/com/vaadin/server/communication/FileUploadHandler.java
@@ -632,7 +632,7 @@ public class FileUploadHandler implements RequestHandler {
 
     private void cleanStreamVariable(VaadinSession session,
             final ClientConnector owner, final String variableName) {
-        session.access(new Runnable() {
+        session.accessSynchronously(new Runnable() {
             @Override
             public void run() {
                 owner.getUI()
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index fbe2fb86d5..60a884a635 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -74,9 +74,14 @@ public class UidlWriter implements Serializable {
     public void write(UI ui, Writer writer, boolean repaintAll,
             boolean analyzeLayouts, boolean async) throws IOException,
             JSONException {
+        VaadinSession session = ui.getSession();
+
+        // Purge pending access calls as they might produce additional changes
+        // to write out
+        session.runPendingAccessTasks();
+
         ArrayList<ClientConnector> dirtyVisibleConnectors = ui
                 .getConnectorTracker().getDirtyVisibleConnectors();
-        VaadinSession session = ui.getSession();
         LegacyCommunicationManager manager = session.getCommunicationManager();
         // Paints components
         ConnectorTracker uiConnectorTracker = ui.getConnectorTracker();
diff --git a/server/src/com/vaadin/ui/LoginForm.java b/server/src/com/vaadin/ui/LoginForm.java
index d06882927e..67d7182ecb 100644
--- a/server/src/com/vaadin/ui/LoginForm.java
+++ b/server/src/com/vaadin/ui/LoginForm.java
@@ -68,7 +68,7 @@ public class LoginForm extends CustomComponent {
         }
         final StringBuilder responseBuilder = new StringBuilder();
 
-        getUI().access(new Runnable() {
+        getUI().accessSynchronously(new Runnable() {
             @Override
             public void run() {
                 String method = VaadinServletService.getCurrentServletRequest()
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index e077b003b8..234a309c06 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
+import java.util.concurrent.Future;
 
 import com.vaadin.event.Action;
 import com.vaadin.event.Action.Handler;
@@ -86,7 +87,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     /**
      * The application to which this UI belongs
      */
-    private VaadinSession session;
+    private volatile VaadinSession session;
 
     /**
      * List of windows in this UI.
@@ -1098,24 +1099,34 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     }
 
     /**
-     * Provides exclusive access to this UI from outside a request handling
-     * thread.
+     * Locks the session of this UI and runs the provided Runnable right away.
      * <p>
-     * The given runnable is executed while holding the session lock to ensure
-     * exclusive access to this UI and its session. The UI and related thread
-     * locals are set properly before executing the runnable.
+     * It is generally recommended to use {@link #access(Runnable)} instead of
+     * this method for accessing a session from a different thread as
+     * {@link #access(Runnable)} can be used while holding the lock of another
+     * session. To avoid causing deadlocks, this methods throws an exception if
+     * it is detected than another session is also locked by the current thread.
      * </p>
      * <p>
-     * RPC handlers for components inside this UI do not need this method as the
-     * session is automatically locked by the framework during request handling.
-     * </p>
-     * <p>
-     * Note that calling this method while another session is locked by the
-     * current thread will cause an exception. This is to prevent deadlock
-     * situations when two threads have locked one session each and are both
-     * waiting for the lock for the other session.
+     * This method behaves differently than {@link #access(Runnable)} in some
+     * situations:
+     * <ul>
+     * <li>If the current thread is currently holding the lock of the session,
+     * {@link #accessSynchronously(Runnable)} runs the task right away whereas
+     * {@link #access(Runnable)} defers the task to a later point in time.</li>
+     * <li>If some other thread is currently holding the lock for the session,
+     * {@link #accessSynchronously(Runnable)} blocks while waiting for the lock
+     * to be available whereas {@link #access(Runnable)} defers the task to a
+     * later point in time.</li>
+     * <li>If the session is currently not locked,
+     * {@link #accessSynchronously(Runnable)} runs the task right away whereas
+     * {@link #access(Runnable)} defers the task to a later point in time unless
+     * there are UIs with automatic push enabled.</li>
+     * </ul>
      * </p>
      * 
+     * @since 7.1
+     * 
      * @param runnable
      *            the runnable which accesses the UI
      * @throws UIDetachedException
@@ -1124,11 +1135,11 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * @throws IllegalStateException
      *             if the current thread holds the lock for another session
      * 
-     * @see #getCurrent()
-     * @see VaadinSession#access(Runnable)
-     * @see VaadinSession#lock()
+     * @see #access(Runnable)
+     * @see VaadinSession#accessSynchronously(Runnable)
      */
-    public void access(Runnable runnable) throws UIDetachedException {
+    public void accessSynchronously(Runnable runnable)
+            throws UIDetachedException {
         Map<Class<?>, CurrentInstance> old = null;
 
         VaadinSession session = getSession();
@@ -1158,12 +1169,69 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     }
 
     /**
-     * @deprecated As of 7.1.0.beta1, use {@link #access(Runnable)} instead.
-     *             This method will be removed before the final 7.1.0 release.
+     * Provides exclusive access to this UI from outside a request handling
+     * thread.
+     * <p>
+     * The given runnable is executed while holding the session lock to ensure
+     * exclusive access to this UI. If the session is not locked, the lock will
+     * be acquired and the runnable is run right away. If the session is
+     * currently locked, the runnable will be run before that lock is released.
+     * </p>
+     * <p>
+     * RPC handlers for components inside this UI do not need to use this method
+     * as the session is automatically locked by the framework during RPC
+     * handling.
+     * </p>
+     * <p>
+     * Please note that the runnable might be invoked on a different thread or
+     * later on the current thread, which means that custom thread locals might
+     * not have the expected values when the runnable is executed. The UI and
+     * other thread locals provided by Vaadin are set properly before executing
+     * the runnable.
+     * </p>
+     * <p>
+     * The returned future can be used to check for task completion and to
+     * cancel the task.
+     * </p>
+     * 
+     * @see #getCurrent()
+     * @see #accessSynchronously(Runnable)
+     * @see VaadinSession#access(Runnable)
+     * @see VaadinSession#lock()
+     * 
+     * @since 7.1
+     * 
+     * @param runnable
+     *            the runnable which accesses the UI
+     * @throws UIDetachedException
+     *             if the UI is not attached to a session (and locking can
+     *             therefore not be done)
+     * @return a future that can be used to check for task completion and to
+     *         cancel the task
+     */
+    public Future<Void> access(final Runnable runnable) {
+        VaadinSession session = getSession();
+
+        if (session == null) {
+            throw new UIDetachedException();
+        }
+
+        return session.access(new Runnable() {
+            @Override
+            public void run() {
+                accessSynchronously(runnable);
+            }
+        });
+    }
+
+    /**
+     * @deprecated As of 7.1.0.beta1, use {@link #accessSynchronously(Runnable)}
+     *             or {@link #access(Runnable)} instead. This method will be
+     *             removed before the final 7.1.0 release.
      */
     @Deprecated
     public void runSafely(Runnable runnable) throws UIDetachedException {
-        access(runnable);
+        accessSynchronously(runnable);
     }
 
     /**
@@ -1204,6 +1272,14 @@ public abstract class UI extends AbstractSingleComponentContainer implements
         VaadinSession session = getSession();
         if (session != null) {
             assert session.hasLock();
+
+            /*
+             * Purge the pending access queue as it might mark a connector as
+             * dirty when the push would otherwise be ignored because there are
+             * no changes to push.
+             */
+            session.runPendingAccessTasks();
+
             if (!getConnectorTracker().hasDirtyConnectors()) {
                 // Do not push if there is nothing to push
                 return;
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
index bec8c0a10f..c88f482a7b 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/CloseUI.java
@@ -119,7 +119,7 @@ public class CloseUI extends AbstractTestUI {
 
         @Override
         public void run() {
-            ui.access(new Runnable() {
+            ui.accessSynchronously(new Runnable() {
 
                 @Override
                 public void run() {
diff --git a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
index ddc0f28664..c9af2c000d 100644
--- a/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
+++ b/uitest/src/com/vaadin/tests/applicationcontext/UIRunSafelyThread.java
@@ -11,7 +11,7 @@ public abstract class UIRunSafelyThread extends Thread {
 
     @Override
     public void run() {
-        ui.access(new Runnable() {
+        ui.accessSynchronously(new Runnable() {
 
             @Override
             public void run() {
diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
new file mode 100644
index 0000000000..664b15c16f
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
@@ -0,0 +1,127 @@
+<?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="" />
+<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.ui.UiAccess?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[0]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>exact:0. Access from UI thread future is done? false</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>1. Access from UI thread is run</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>exact:2. beforeClientResponse future is done? true</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>0. Initial background message</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>exact:1. Thread has current response? false</td>
+</tr>
+<tr>
+	<td>waitForText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_4</td>
+	<td>0. Initial background message</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>exact:2. Thread got lock, inital future done? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>exact:3. Access has current response? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>exact:4. Thread is still alive? false</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>0. Throwing exception in access</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>exact:1. firstFuture is done? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>2. Got exception from firstFuture: java.lang.RuntimeException: Catch me if you can</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>0. future was cancled, should not start</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>0. Waiting for thread to start</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>1. Thread started, waiting for interruption</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>2. I was interrupted</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
new file mode 100644
index 0000000000..c68da6ee54
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.components.ui;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.locks.ReentrantLock;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.server.VaadinService;
+import com.vaadin.tests.components.AbstractTestUIWithLog;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+
+public class UiAccess extends AbstractTestUIWithLog {
+
+    private Future<Void> checkFromBeforeClientResponse;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        addComponent(new Button("Access from UI thread",
+                new Button.ClickListener() {
+
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        // Ensure beforeClientResponse is invoked
+                        markAsDirty();
+                        checkFromBeforeClientResponse = access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log("Access from UI thread is run");
+                            }
+                        });
+                        log("Access from UI thread future is done? "
+                                + checkFromBeforeClientResponse.isDone());
+                    }
+                }));
+        addComponent(new Button("Access from background thread",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        final CountDownLatch latch = new CountDownLatch(1);
+
+                        new Thread() {
+                            @Override
+                            public void run() {
+                                final boolean threadHasCurrentResponse = VaadinService
+                                        .getCurrentResponse() != null;
+                                // session is locked by request thread at this
+                                // point
+                                final Future<Void> initialFuture = access(new Runnable() {
+                                    @Override
+                                    public void run() {
+                                        log("Initial background message");
+                                        log("Thread has current response? "
+                                                + threadHasCurrentResponse);
+                                    }
+                                });
+
+                                // Let request thread continue
+                                latch.countDown();
+
+                                // Wait until thread can be locked
+                                while (!getSession().getLockInstance()
+                                        .tryLock()) {
+                                    try {
+                                        Thread.sleep(100);
+                                    } catch (InterruptedException e) {
+                                        throw new RuntimeException(e);
+                                    }
+                                }
+                                try {
+                                    log("Thread got lock, inital future done? "
+                                            + initialFuture.isDone());
+                                    setPollInterval(-1);
+                                } finally {
+                                    getSession().unlock();
+                                }
+                                final Thread thisThread = this;
+                                access(new Runnable() {
+                                    @Override
+                                    public void run() {
+                                        log("Access has current response? "
+                                                + (VaadinService
+                                                        .getCurrentResponse() != null));
+                                        log("Thread is still alive? "
+                                                + thisThread.isAlive());
+                                    }
+                                });
+                            }
+                        }.start();
+
+                        // Wait for thread to do initialize before continuing
+                        try {
+                            latch.await();
+                        } catch (InterruptedException e) {
+                            throw new RuntimeException(e);
+                        }
+
+                        setPollInterval(3000);
+                    }
+                }));
+        addComponent(new Button("Access throwing exception",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        final Future<Void> firstFuture = access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log("Throwing exception in access");
+                                throw new RuntimeException(
+                                        "Catch me if you can");
+                            }
+                        });
+                        access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log("firstFuture is done? "
+                                        + firstFuture.isDone());
+                                try {
+                                    firstFuture.get();
+                                    log("Should not get here");
+                                } catch (InterruptedException e) {
+                                    throw new RuntimeException(e);
+                                } catch (ExecutionException e) {
+                                    log("Got exception from firstFuture: "
+                                            + e.getMessage());
+                                }
+                            }
+                        });
+                    }
+                }));
+        addComponent(new Button("Cancel future before started",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        Future<Void> future = access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log("Should not get here");
+                            }
+                        });
+                        future.cancel(false);
+                        log("future was cancled, should not start");
+                    }
+                }));
+        addComponent(new Button("Cancel running future",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        final ReentrantLock interruptLock = new ReentrantLock();
+
+                        final Future<Void> future = access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log("Waiting for thread to start");
+                                while (!interruptLock.isLocked()) {
+                                    try {
+                                        Thread.sleep(100);
+                                    } catch (InterruptedException e) {
+                                        log("Premature interruption");
+                                        throw new RuntimeException(e);
+                                    }
+                                }
+
+                                log("Thread started, waiting for interruption");
+                                try {
+                                    interruptLock.lockInterruptibly();
+                                } catch (InterruptedException e) {
+                                    log("I was interrupted");
+                                }
+                            }
+                        });
+
+                        new Thread() {
+                            @Override
+                            public void run() {
+                                interruptLock.lock();
+                                // Wait until UI thread has started waiting for
+                                // the lock
+                                while (!interruptLock.hasQueuedThreads()) {
+                                    try {
+                                        Thread.sleep(100);
+                                    } catch (InterruptedException e) {
+                                        throw new RuntimeException(e);
+                                    }
+                                }
+
+                                future.cancel(true);
+                            }
+                        }.start();
+                    }
+                }));
+    }
+
+    @Override
+    public void beforeClientResponse(boolean initial) {
+        if (checkFromBeforeClientResponse != null) {
+            log("beforeClientResponse future is done? "
+                    + checkFromBeforeClientResponse.isDone());
+            checkFromBeforeClientResponse = null;
+        }
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "Test for various ways of using UI.access";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(11897);
+    }
+
+}
-- 
cgit v1.2.3


From cb1f63b8606ae23088a62f26dc8979885c5cd19c Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Wed, 22 May 2013 13:59:44 +0300
Subject: Send window mode changes to the server immediately (#11737)

Change-Id: Icfaa8f97824d8ed92eaee786cee8c92083dc1084
---
 .../vaadin/shared/ui/window/WindowServerRpc.java   |  2 --
 .../window/WindowMaximizeRestoreTest.html          | 42 ++++++++++++++++------
 2 files changed, 31 insertions(+), 13 deletions(-)

(limited to 'uitest/src')

diff --git a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
index cfb10ad86a..b43765274e 100644
--- a/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
+++ b/shared/src/com/vaadin/shared/ui/window/WindowServerRpc.java
@@ -15,13 +15,11 @@
  */
 package com.vaadin.shared.ui.window;
 
-import com.vaadin.shared.annotations.Delayed;
 import com.vaadin.shared.communication.ServerRpc;
 import com.vaadin.shared.ui.ClickRpc;
 
 public interface WindowServerRpc extends ClickRpc, ServerRpc {
 
-    @Delayed(lastOnly = true)
     public void windowModeChanged(WindowMode newState);
 
 }
\ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
index 945564f298..dcdfa05687 100644
--- a/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
+++ b/uitest/src/com/vaadin/tests/components/window/WindowMaximizeRestoreTest.html
@@ -162,17 +162,6 @@
 	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
 	<td>43,12</td>
 </tr>
-<!--Remove the following two commands once #11737 is fixed-->
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
-	<td>43,12</td>
-</tr>
-<tr>
-	<td>mouseClick</td>
-	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/FocusableScrollPanel[0]/VVerticalLayout[0]/Slot[0]/VNativeButton[0]</td>
-	<td>43,12</td>
-</tr>
 <!--maximize window 2 content-->
 <tr>
 	<td>mouseClick</td>
@@ -234,6 +223,37 @@
 	<td></td>
 	<td>window-1-maximized-with-doubleclick</td>
 </tr>
+<!--Test that size and position is preserved when maximizing and restoring-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>8,4</td>
+</tr>
+<tr>
+	<td>dragAndDrop</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]</td>
+	<td>-200,-200</td>
+</tr>
+<tr>
+	<td>dragAndDrop</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[4]/domChild[0]</td>
+	<td>+100,+100</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>6,5</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentswindowWindowMaximizeRestoreTest::/VWindow[0]/domChild[0]/domChild[0]/domChild[1]</td>
+	<td>5,8</td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>window-1-moved-maximized-restored</td>
+</tr>
 </tbody></table>
 </body>
 </html>
-- 
cgit v1.2.3


From 2b5ba963af81bb8a21f51ab29bd47ecd0054daa6 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Tue, 28 May 2013 14:55:35 +0300
Subject: Define how CurrentInstance works with access() (#11897)

Change-Id: I7ca62c5706fd37e7c44ed46703bcdce159b367f4
---
 server/src/com/vaadin/server/VaadinSession.java    | 82 +++++++++++++++-------
 server/src/com/vaadin/ui/UI.java                   | 11 ++-
 server/src/com/vaadin/util/CurrentInstance.java    | 46 ++++++++++--
 .../com/vaadin/tests/components/ui/UiAccess.html   | 51 +++++++++++++-
 .../com/vaadin/tests/components/ui/UiAccess.java   | 82 ++++++++++++++++++++++
 5 files changed, 236 insertions(+), 36 deletions(-)

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 9625a3f350..eaf611caad 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -67,6 +67,35 @@ import com.vaadin.util.ReflectTools;
 @SuppressWarnings("serial")
 public class VaadinSession implements HttpSessionBindingListener, Serializable {
 
+    private class FutureAccess extends FutureTask<Void> {
+        /**
+         * Snapshot of all non-inheritable current instances at the time this
+         * object was created.
+         */
+        private final Map<Class<?>, CurrentInstance> instances = CurrentInstance
+                .getInstances(true);
+
+        public FutureAccess(Runnable arg0) {
+            super(arg0, null);
+        }
+
+        @Override
+        public Void get() throws InterruptedException, ExecutionException {
+            /*
+             * Help the developer avoid programming patterns that cause
+             * deadlocks unless implemented very carefully. get(long, TimeUnit)
+             * does not have the same detection since a sensible timeout should
+             * avoid completely locking up the application.
+             * 
+             * Even though no deadlock could occur after the runnable has been
+             * run, the check is always done as the deterministic behavior makes
+             * it easier to detect potential problems.
+             */
+            VaadinService.verifyNoOtherSessionLocked(VaadinSession.this);
+            return super.get();
+        }
+    }
+
     /**
      * The name of the parameter that is by default used in e.g. web.xml to
      * define the name of the default {@link UI} class.
@@ -140,7 +169,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      * session is serialized as long as it doesn't happen while some other
      * thread has the lock.
      */
-    private transient final ConcurrentLinkedQueue<FutureTask<Void>> pendingAccessQueue = new ConcurrentLinkedQueue<FutureTask<Void>>();
+    private transient final ConcurrentLinkedQueue<FutureAccess> pendingAccessQueue = new ConcurrentLinkedQueue<FutureAccess>();
 
     /**
      * Create a new service session tied to a Vaadin service
@@ -1152,9 +1181,13 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      * <p>
      * Please note that the runnable might be invoked on a different thread or
      * later on the current thread, which means that custom thread locals might
-     * not have the expected values when the runnable is executed. The session
-     * and other thread locals provided by Vaadin are set properly before
-     * executing the runnable.
+     * not have the expected values when the runnable is executed. Inheritable
+     * values in {@link CurrentInstance} will have the same values as when this
+     * method was invoked. {@link VaadinSession#getCurrent()} and
+     * {@link VaadinService#getCurrent()} are set according to this session
+     * before executing the runnable. Non-inheritable CurrentInstance values
+     * including {@link VaadinService#getCurrentRequest()} and
+     * {@link VaadinService#getCurrentResponse()} will not be defined.
      * </p>
      * <p>
      * The returned future can be used to check for task completion and to
@@ -1176,23 +1209,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
      *         cancel the task
      */
     public Future<Void> access(Runnable runnable) {
-        FutureTask<Void> future = new FutureTask<Void>(runnable, null) {
-            @Override
-            public Void get() throws InterruptedException, ExecutionException {
-                /*
-                 * Help the developer avoid programming patterns that cause
-                 * deadlocks unless implemented very carefully. get(long,
-                 * TimeUnit) does not have the same detection since a sensible
-                 * timeout should avoid completely locking up the application.
-                 * 
-                 * Even though no deadlock could occur after the runnable has
-                 * been run, the check is always done as the deterministic
-                 * behavior makes it easier to detect potential problems.
-                 */
-                VaadinService.verifyNoOtherSessionLocked(VaadinSession.this);
-                return super.get();
-            }
-        };
+        FutureAccess future = new FutureAccess(runnable);
         pendingAccessQueue.add(future);
 
         /*
@@ -1233,11 +1250,26 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
     public void runPendingAccessTasks() {
         assert hasLock();
 
-        FutureTask<Void> pendingAccess;
-        while ((pendingAccess = pendingAccessQueue.poll()) != null) {
-            if (!pendingAccess.isCancelled()) {
-                accessSynchronously(pendingAccess);
+        if (pendingAccessQueue.isEmpty()) {
+            return;
+        }
+
+        Map<Class<?>, CurrentInstance> oldInstances = CurrentInstance
+                .getInstances(false);
+
+        FutureAccess pendingAccess;
+        try {
+            while ((pendingAccess = pendingAccessQueue.poll()) != null) {
+                if (!pendingAccess.isCancelled()) {
+                    CurrentInstance.clearAll();
+                    CurrentInstance
+                            .restoreThreadLocals(pendingAccess.instances);
+                    accessSynchronously(pendingAccess);
+                }
             }
+        } finally {
+            CurrentInstance.clearAll();
+            CurrentInstance.restoreThreadLocals(oldInstances);
         }
     }
 
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index bbc1d0cd33..0b21112c97 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -1185,9 +1185,14 @@ public abstract class UI extends AbstractSingleComponentContainer implements
      * <p>
      * Please note that the runnable might be invoked on a different thread or
      * later on the current thread, which means that custom thread locals might
-     * not have the expected values when the runnable is executed. The UI and
-     * other thread locals provided by Vaadin are set properly before executing
-     * the runnable.
+     * not have the expected values when the runnable is executed. Inheritable
+     * values in {@link CurrentInstance} will have the same values as when this
+     * method was invoked. {@link UI#getCurrent()},
+     * {@link VaadinSession#getCurrent()} and {@link VaadinService#getCurrent()}
+     * are set according to this UI before executing the runnable.
+     * Non-inheritable CurrentInstance values including
+     * {@link VaadinService#getCurrentRequest()} and
+     * {@link VaadinService#getCurrentResponse()} will not be defined.
      * </p>
      * <p>
      * The returned future can be used to check for task completion and to
diff --git a/server/src/com/vaadin/util/CurrentInstance.java b/server/src/com/vaadin/util/CurrentInstance.java
index 0854d422fd..8e6ef8266e 100644
--- a/server/src/com/vaadin/util/CurrentInstance.java
+++ b/server/src/com/vaadin/util/CurrentInstance.java
@@ -17,33 +17,35 @@
 package com.vaadin.util;
 
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
 
-import com.vaadin.server.VaadinPortlet;
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.server.VaadinResponse;
 import com.vaadin.server.VaadinService;
-import com.vaadin.server.VaadinServlet;
 import com.vaadin.server.VaadinSession;
 import com.vaadin.ui.UI;
 
 /**
- * Keeps track of various thread local instances used by the framework.
+ * Keeps track of various current instances for the current thread. All the
+ * instances are automatically cleared after handling a request from the client
+ * to avoid leaking memory. The inheritable values are also maintained when
+ * execution is moved to another thread, both when a new thread is created and
+ * when {@link VaadinSession#access(Runnable)} or {@link UI#access(Runnable)} is
+ * used.
  * <p>
  * Currently the framework uses the following instances:
  * </p>
  * <p>
- * Inheritable: {@link UI}, {@link VaadinPortlet}, {@link VaadinService},
- * {@link VaadinServlet}, {@link VaadinSession}.
+ * Inheritable: {@link UI}, {@link VaadinService}, {@link VaadinSession}.
  * </p>
  * <p>
  * Non-inheritable: {@link VaadinRequest}, {@link VaadinResponse}.
  * </p>
  * 
  * @author Vaadin Ltd
- * @version @VERSION@
  * @since 7.0.0
  */
 public class CurrentInstance implements Serializable {
@@ -115,7 +117,9 @@ public class CurrentInstance implements Serializable {
 
     /**
      * Sets the current inheritable instance of the given type. A current
-     * instance that is inheritable will be available for child threads.
+     * instance that is inheritable will be available for child threads and in
+     * code run by {@link VaadinSession#access(Runnable)} and
+     * {@link UI#access(Runnable)}.
      * 
      * @see #set(Class, Object)
      * @see InheritableThreadLocal
@@ -183,6 +187,34 @@ public class CurrentInstance implements Serializable {
         }
     }
 
+    /**
+     * Gets the currently set instances so that they can later be restored using
+     * {@link #restoreThreadLocals(Map)}.
+     * 
+     * @since 7.1
+     * 
+     * @param onlyInheritable
+     *            <code>true</code> if only the inheritable instances should be
+     *            included; <code>false</code> to get all instances.
+     * @return a map containing the current instances
+     */
+    public static Map<Class<?>, CurrentInstance> getInstances(
+            boolean onlyInheritable) {
+        Map<Class<?>, CurrentInstance> map = instances.get();
+        if (map == null) {
+            return Collections.emptyMap();
+        } else {
+            Map<Class<?>, CurrentInstance> copy = new HashMap<Class<?>, CurrentInstance>();
+            for (Class<?> c : map.keySet()) {
+                CurrentInstance ci = map.get(c);
+                if (ci.inheritable || !onlyInheritable) {
+                    copy.put(c, ci);
+                }
+            }
+            return copy;
+        }
+    }
+
     /**
      * Sets thread locals for the UI and all related classes
      * 
diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
index 664b15c16f..8ae2f2f48e 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
@@ -121,7 +121,56 @@
 	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
 	<td>2. I was interrupted</td>
 </tr>
-
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[5]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td>
+	<td>0. accessSynchronously has request? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>1. Test value in accessSynchronously: Set before accessSynchronosly</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>2. has request after accessSynchronously? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>3. Test value after accessSynchornously: Set in accessSynchronosly</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::/VVerticalLayout[0]/Slot[2]/VVerticalLayout[0]/Slot[6]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_3</td>
+	<td>0. access has request? false</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
+	<td>1. Test value in access: Set before access</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
+	<td>2. has request after access? true</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
+	<td>3. Test value after access: Set before run pending</td>
+</tr>
 </tbody></table>
 </body>
 </html>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
index c68da6ee54..c39f65243d 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
@@ -26,11 +26,25 @@ import com.vaadin.server.VaadinService;
 import com.vaadin.tests.components.AbstractTestUIWithLog;
 import com.vaadin.ui.Button;
 import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.util.CurrentInstance;
 
 public class UiAccess extends AbstractTestUIWithLog {
 
     private Future<Void> checkFromBeforeClientResponse;
 
+    private class CurrentInstanceTestType {
+        private String value;
+
+        public CurrentInstanceTestType(String value) {
+            this.value = value;
+        }
+
+        @Override
+        public String toString() {
+            return value;
+        }
+    }
+
     @Override
     protected void setup(VaadinRequest request) {
         addComponent(new Button("Access from UI thread",
@@ -211,6 +225,74 @@ public class UiAccess extends AbstractTestUIWithLog {
                         }.start();
                     }
                 }));
+        addComponent(new Button("CurrentInstance accessSynchronously values",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        // accessSynchronously should maintain values
+                        CurrentInstance.set(CurrentInstanceTestType.class,
+                                new CurrentInstanceTestType(
+                                        "Set before accessSynchronosly"));
+                        accessSynchronously(new Runnable() {
+                            @Override
+                            public void run() {
+                                log.log("accessSynchronously has request? "
+                                        + (VaadinService.getCurrentRequest() != null));
+                                log.log("Test value in accessSynchronously: "
+                                        + CurrentInstance
+                                                .get(CurrentInstanceTestType.class));
+                                CurrentInstance.set(
+                                        CurrentInstanceTestType.class,
+                                        new CurrentInstanceTestType(
+                                                "Set in accessSynchronosly"));
+                            }
+                        });
+                        log.log("has request after accessSynchronously? "
+                                + (VaadinService.getCurrentRequest() != null));
+                        log("Test value after accessSynchornously: "
+                                + CurrentInstance
+                                        .get(CurrentInstanceTestType.class));
+                    }
+                }));
+        addComponent(new Button("CurrentInstance access values",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        log.clear();
+                        // accessSynchronously should maintain values
+                        CurrentInstance
+                                .setInheritable(CurrentInstanceTestType.class,
+                                        new CurrentInstanceTestType(
+                                                "Set before access"));
+                        access(new Runnable() {
+                            @Override
+                            public void run() {
+                                log.log("access has request? "
+                                        + (VaadinService.getCurrentRequest() != null));
+                                log.log("Test value in access: "
+                                        + CurrentInstance
+                                                .get(CurrentInstanceTestType.class));
+                                CurrentInstance.setInheritable(
+                                        CurrentInstanceTestType.class,
+                                        new CurrentInstanceTestType(
+                                                "Set in access"));
+                            }
+                        });
+                        CurrentInstance.setInheritable(
+                                CurrentInstanceTestType.class,
+                                new CurrentInstanceTestType(
+                                        "Set before run pending"));
+
+                        getSession().runPendingAccessTasks();
+
+                        log.log("has request after access? "
+                                + (VaadinService.getCurrentRequest() != null));
+                        log("Test value after access: "
+                                + CurrentInstance
+                                        .get(CurrentInstanceTestType.class));
+                    }
+                }));
     }
 
     @Override
-- 
cgit v1.2.3


From bb7b40487f728f60e910b51d5c236f4fb699cb01 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Tue, 28 May 2013 15:36:16 +0300
Subject: Remove outdated testing (#11897)

* access is run right away instead of the next time there's a request
from the server.
* Non-inheritable CurrentInstance values are not carried over to access

Change-Id: I6a9f3f2a74647357fe02c43e96878d803cfaf207
---
 uitest/src/com/vaadin/tests/components/ui/UiAccess.html | 14 ++------------
 uitest/src/com/vaadin/tests/components/ui/UiAccess.java | 11 -----------
 2 files changed, 2 insertions(+), 23 deletions(-)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
index 8ae2f2f48e..613691623c 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.html
@@ -53,23 +53,13 @@
 </tr>
 <tr>
 	<td>waitForText</td>
-	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_4</td>
-	<td>0. Initial background message</td>
-</tr>
-<tr>
-	<td>assertText</td>
 	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_2</td>
-	<td>exact:2. Thread got lock, inital future done? true</td>
-</tr>
-<tr>
-	<td>assertText</td>
-	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_1</td>
-	<td>exact:3. Access has current response? true</td>
+	<td>0. Initial background message</td>
 </tr>
 <tr>
 	<td>assertText</td>
 	<td>vaadin=runcomvaadintestscomponentsuiUiAccess::PID_SLog_row_0</td>
-	<td>exact:4. Thread is still alive? false</td>
+	<td>exact:2. Thread got lock, inital future done? true</td>
 </tr>
 <tr>
 	<td>click</td>
diff --git a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
index c39f65243d..297a985778 100644
--- a/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
+++ b/uitest/src/com/vaadin/tests/components/ui/UiAccess.java
@@ -107,17 +107,6 @@ public class UiAccess extends AbstractTestUIWithLog {
                                 } finally {
                                     getSession().unlock();
                                 }
-                                final Thread thisThread = this;
-                                access(new Runnable() {
-                                    @Override
-                                    public void run() {
-                                        log("Access has current response? "
-                                                + (VaadinService
-                                                        .getCurrentResponse() != null));
-                                        log("Thread is still alive? "
-                                                + thisThread.isAlive());
-                                    }
-                                });
                             }
                         }.start();
 
-- 
cgit v1.2.3


From b2137f5d4bd00e11142f31f542b0f8d6ea98f518 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 28 May 2013 17:55:44 +0300
Subject: Ensure calendar panel is updated when range changes (#11940)

Change-Id: Ic270e5c0aa1b28947b735fcb258bc9629d53cc21
---
 .../src/com/vaadin/client/ui/VCalendarPanel.java   |  11 +-
 .../datefield/DynamicallyChangeDateRange.html      | 121 +++++++++++++++++++++
 .../datefield/DynamicallyChangeDateRange.java      |  91 ++++++++++++++++
 3 files changed, 222 insertions(+), 1 deletion(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html
 create mode 100644 uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VCalendarPanel.java b/client/src/com/vaadin/client/ui/VCalendarPanel.java
index 311932b819..1f40298760 100644
--- a/client/src/com/vaadin/client/ui/VCalendarPanel.java
+++ b/client/src/com/vaadin/client/ui/VCalendarPanel.java
@@ -2216,6 +2216,11 @@ public class VCalendarPanel extends FocusableFlexTable implements
      */
     public void setRangeStart(Date rangeStart) {
         this.rangeStart = rangeStart;
+        if (initialRenderDone) {
+            // Dynamic updates to the range needs to render the calendar to
+            // update the element stylenames
+            renderCalendar();
+        }
 
     }
 
@@ -2228,6 +2233,10 @@ public class VCalendarPanel extends FocusableFlexTable implements
      */
     public void setRangeEnd(Date rangeEnd) {
         this.rangeEnd = rangeEnd;
-
+        if (initialRenderDone) {
+            // Dynamic updates to the range needs to render the calendar to
+            // update the element stylenames
+            renderCalendar();
+        }
     }
 }
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html
new file mode 100644
index 0000000000..77c610f211
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.html
@@ -0,0 +1,121 @@
+<?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.DynamicallyChangeDateRange?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td>
+	<td>11,8</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[6]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[7]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::</td>
+	<td>201,401</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td>
+	<td>14,16</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[2]/td[4]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[2]/td[5]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[5]/td[4]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[5]/td[5]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::</td>
+	<td>237,338</td>
+</tr>
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsdatefieldDynamicallyChangeDateRange::/VVerticalLayout[0]/Slot[0]/VPopupCalendar[0]#popupButton</td>
+	<td>14,15</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[3]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[6]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[4]/td[7]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>//table[@id='PID_VAADIN_POPUPCAL']/tbody/tr[2]/td/table/tbody/tr[3]/td[2]/span</td>
+	<td>v-datefield-calendarpanel-day-outside-range</td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java
new file mode 100644
index 0000000000..9288b0428e
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java
@@ -0,0 +1,91 @@
+package com.vaadin.tests.components.datefield;
+
+import java.util.Date;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.DateField;
+import com.vaadin.ui.InlineDateField;
+import com.vaadin.ui.PopupDateField;
+import com.vaadin.ui.VerticalLayout;
+
+/**
+ * Main UI class
+ */
+@SuppressWarnings("serial")
+public class DynamicallyChangeDateRange extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        final VerticalLayout layout = new VerticalLayout();
+        layout.setMargin(true);
+        setContent(layout);
+
+        final PopupDateField df = new PopupDateField();
+        df.setValue(new Date(2012 - 1900, 5 - 1, 12));
+        setRange(df, 5);
+        layout.addComponent(df);
+
+        final InlineDateField df2 = new InlineDateField();
+        df2.setValue(new Date(2012 - 1900, 11 - 1, 16));
+
+        setRange(df2, 5);
+        // layout.addComponent(df2);
+
+        Button button1 = new Button("Set Range Now+/-5d");
+        button1.addClickListener(new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                setRange(df, 5);
+                setRange(df2, 5);
+            }
+        });
+        layout.addComponent(button1);
+
+        Button button2 = new Button("Set Range Now+/-10d");
+        button2.addClickListener(new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                setRange(df, 10);
+                setRange(df2, 10);
+            }
+        });
+        layout.addComponent(button2);
+    }
+
+    /**
+     * @since
+     * @param df
+     * @param i
+     */
+    private void setRange(DateField df, int days) {
+        df.setRangeStart(new Date(df.getValue().getTime() - days * 24 * 60 * 60
+                * 1000));
+        df.setRangeEnd(new Date(df.getValue().getTime() + days * 24 * 60 * 60
+                * 1000));
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.tests.components.AbstractTestUI#getTestDescription()
+     */
+    @Override
+    protected String getTestDescription() {
+        return "Verifies that the allowed date range can be updated dynamically";
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.tests.components.AbstractTestUI#getTicketNumber()
+     */
+    @Override
+    protected Integer getTicketNumber() {
+        return 11940;
+    }
+
+}
\ No newline at end of file
-- 
cgit v1.2.3


From 35f353274f2132086f8ee0bb6e6e73712a59b173 Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Tue, 28 May 2013 12:39:20 +0300
Subject: Fixes current text being overwritten in server update on RTA #11741

If the server happens to update the state of the RTA while a user is
typing then the users text will be replaced by the value on the server. To fix
this the RTA should not update if the value is the same as the one
cached on the client side.

Also moves blur handling and server<->client syncronization to the
connector.

Change-Id: Ia807b1e2aa210eb881e4b9cea0870c0c5a9254b2
---
 client/src/com/vaadin/client/ui/VPopupView.java    |   8 +-
 client/src/com/vaadin/client/ui/VRichTextArea.java | 165 ++++++++++++---------
 .../ui/richtextarea/RichTextAreaConnector.java     |  42 ++++--
 .../RichTextAreaUpdateWhileTyping.html             |  42 ++++++
 .../RichTextAreaUpdateWhileTyping.java             |  51 +++++++
 5 files changed, 229 insertions(+), 79 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html
 create mode 100644 uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VPopupView.java b/client/src/com/vaadin/client/ui/VPopupView.java
index 05fbd2c073..626780efee 100644
--- a/client/src/com/vaadin/client/ui/VPopupView.java
+++ b/client/src/com/vaadin/client/ui/VPopupView.java
@@ -40,6 +40,7 @@ import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.ComponentConnector;
+import com.vaadin.client.Util;
 import com.vaadin.client.VCaptionWrapper;
 import com.vaadin.client.VConsole;
 import com.vaadin.client.ui.ShortcutActionHandler.ShortcutActionHandlerOwner;
@@ -313,8 +314,11 @@ public class VPopupView extends HTML implements Iterable<Widget> {
 
         private void checkForRTE(Widget popupComponentWidget2) {
             if (popupComponentWidget2 instanceof VRichTextArea) {
-                ((VRichTextArea) popupComponentWidget2)
-                        .synchronizeContentToServer();
+                ComponentConnector rtaConnector = Util
+                        .findConnectorFor(popupComponentWidget2);
+                if (rtaConnector != null) {
+                    rtaConnector.flush();
+                }
             } else if (popupComponentWidget2 instanceof HasWidgets) {
                 HasWidgets hw = (HasWidgets) popupComponentWidget2;
                 Iterator<Widget> iterator = hw.iterator();
diff --git a/client/src/com/vaadin/client/ui/VRichTextArea.java b/client/src/com/vaadin/client/ui/VRichTextArea.java
index 1498c096ed..7ed6e7c78a 100644
--- a/client/src/com/vaadin/client/ui/VRichTextArea.java
+++ b/client/src/com/vaadin/client/ui/VRichTextArea.java
@@ -16,11 +16,12 @@
 
 package com.vaadin.client.ui;
 
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
 import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.event.dom.client.BlurEvent;
 import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
 import com.google.gwt.event.dom.client.KeyDownEvent;
 import com.google.gwt.event.dom.client.KeyDownHandler;
 import com.google.gwt.event.dom.client.KeyPressEvent;
@@ -49,8 +50,8 @@ import com.vaadin.client.ui.richtextarea.VRichTextToolbar;
  * @author Vaadin Ltd.
  * 
  */
-public class VRichTextArea extends Composite implements Field, ChangeHandler,
-        BlurHandler, KeyPressHandler, KeyDownHandler, Focusable {
+public class VRichTextArea extends Composite implements Field, KeyPressHandler,
+        KeyDownHandler, Focusable {
 
     /**
      * The input node CSS classname.
@@ -91,11 +92,10 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
 
     private ShortcutActionHandlerOwner hasShortcutActionHandler;
 
-    /** For internal use only. May be removed or replaced in the future. */
-    public String currentValue = "";
-
     private boolean readOnly = false;
 
+    private final Map<BlurHandler, HandlerRegistration> blurHandlers = new HashMap<BlurHandler, HandlerRegistration>();
+
     public VRichTextArea() {
         createRTAComponents();
         fp.add(formatter);
@@ -110,9 +110,19 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
     private void createRTAComponents() {
         rta = new RichTextArea();
         rta.setWidth("100%");
-        rta.addBlurHandler(this);
         rta.addKeyDownHandler(this);
         formatter = new VRichTextToolbar(rta);
+
+        // Add blur handlers
+        for (Entry<BlurHandler, HandlerRegistration> handler : blurHandlers
+                .entrySet()) {
+
+            // Remove old registration
+            handler.getValue().removeHandler();
+
+            // Add blur handlers
+            addBlurHandler(handler.getKey());
+        }
     }
 
     public void setEnabled(boolean enabled) {
@@ -127,6 +137,7 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
      * Swaps html to rta and visa versa.
      */
     private void swapEditableArea() {
+        String value = getValue();
         if (html.isAttached()) {
             fp.remove(html);
             if (BrowserInfo.get().isWebkit()) {
@@ -134,13 +145,12 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
                 createRTAComponents(); // recreate new RTA to bypass #5379
                 fp.add(formatter);
             }
-            rta.setHTML(currentValue);
             fp.add(rta);
         } else {
-            html.setHTML(currentValue);
             fp.remove(rta);
             fp.add(html);
         }
+        setValue(value);
     }
 
     /** For internal use only. May be removed or replaced in the future. */
@@ -180,62 +190,6 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
         return readOnly;
     }
 
-    // TODO is this really used, or does everything go via onBlur() only?
-    @Override
-    public void onChange(ChangeEvent event) {
-        synchronizeContentToServer();
-    }
-
-    /**
-     * Method is public to let popupview force synchronization on close.
-     */
-    public void synchronizeContentToServer() {
-        if (client != null && id != null) {
-            final String html = sanitizeRichTextAreaValue(rta.getHTML());
-            if (!html.equals(currentValue)) {
-                client.updateVariable(id, "text", html, immediate);
-                currentValue = html;
-            }
-        }
-    }
-
-    /**
-     * Browsers differ in what they return as the content of a visually empty
-     * rich text area. This method is used to normalize these to an empty
-     * string. See #8004.
-     * 
-     * @param html
-     * @return cleaned html string
-     */
-    private String sanitizeRichTextAreaValue(String html) {
-        BrowserInfo browser = BrowserInfo.get();
-        String result = html;
-        if (browser.isFirefox()) {
-            if ("<br>".equals(html)) {
-                result = "";
-            }
-        } else if (browser.isWebkit()) {
-            if ("<div><br></div>".equals(html)) {
-                result = "";
-            }
-        } else if (browser.isIE()) {
-            if ("<P>&nbsp;</P>".equals(html)) {
-                result = "";
-            }
-        } else if (browser.isOpera()) {
-            if ("<br>".equals(html) || "<p><br></p>".equals(html)) {
-                result = "";
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public void onBlur(BlurEvent event) {
-        synchronizeContentToServer();
-        // TODO notify possible server side blur/focus listeners
-    }
-
     /**
      * @return space used by components paddings and borders
      */
@@ -409,4 +363,81 @@ public class VRichTextArea extends Composite implements Field, ChangeHandler,
         rta.setTabIndex(index);
     }
 
+    /**
+     * Set the value of the text area
+     * 
+     * @param value
+     *            The text value. Can be html.
+     */
+    public void setValue(String value) {
+        if (rta.isAttached()) {
+            rta.setHTML(value);
+        } else {
+            html.setHTML(value);
+        }
+    }
+
+    /**
+     * Get the value the text area
+     */
+    public String getValue() {
+        if (rta.isAttached()) {
+            return rta.getHTML();
+        } else {
+            return html.getHTML();
+        }
+    }
+
+    /**
+     * Browsers differ in what they return as the content of a visually empty
+     * rich text area. This method is used to normalize these to an empty
+     * string. See #8004.
+     * 
+     * @return cleaned html string
+     */
+    public String getSanitazedValue() {
+        BrowserInfo browser = BrowserInfo.get();
+        String result = getValue();
+        if (browser.isFirefox()) {
+            if ("<br>".equals(html)) {
+                result = "";
+            }
+        } else if (browser.isWebkit()) {
+            if ("<div><br></div>".equals(html)) {
+                result = "";
+            }
+        } else if (browser.isIE()) {
+            if ("<P>&nbsp;</P>".equals(html)) {
+                result = "";
+            }
+        } else if (browser.isOpera()) {
+            if ("<br>".equals(html) || "<p><br></p>".equals(html)) {
+                result = "";
+            }
+        }
+        return result;
+    }
+
+    /**
+     * Adds a blur handler to the component.
+     * 
+     * @param blurHandler
+     *            the blur handler to add
+     */
+    public void addBlurHandler(BlurHandler blurHandler) {
+        blurHandlers.put(blurHandler, rta.addBlurHandler(blurHandler));
+    }
+
+    /**
+     * Removes a blur handler.
+     * 
+     * @param blurHandler
+     *            the handler to remove
+     */
+    public void removeBlurHandler(BlurHandler blurHandler) {
+        HandlerRegistration registration = blurHandlers.remove(blurHandler);
+        if (registration != null) {
+            registration.removeHandler();
+        }
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
index 36182464a3..8135777c0a 100644
--- a/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
+++ b/client/src/com/vaadin/client/ui/richtextarea/RichTextAreaConnector.java
@@ -15,6 +15,8 @@
  */
 package com.vaadin.client.ui.richtextarea;
 
+import com.google.gwt.event.dom.client.BlurEvent;
+import com.google.gwt.event.dom.client.BlurHandler;
 import com.google.gwt.user.client.Event;
 import com.vaadin.client.ApplicationConnection;
 import com.vaadin.client.Paintable;
@@ -24,33 +26,47 @@ import com.vaadin.client.ui.ShortcutActionHandler.BeforeShortcutActionListener;
 import com.vaadin.client.ui.VRichTextArea;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.Connect.LoadStyle;
+import com.vaadin.shared.util.SharedUtil;
 import com.vaadin.ui.RichTextArea;
 
 @Connect(value = RichTextArea.class, loadStyle = LoadStyle.LAZY)
 public class RichTextAreaConnector extends AbstractFieldConnector implements
         Paintable, BeforeShortcutActionListener {
 
+    /*
+     * Last value received from the server
+     */
+    private String cachedValue = "";
+
+    @Override
+    protected void init() {
+        getWidget().addBlurHandler(new BlurHandler() {
+
+            @Override
+            public void onBlur(BlurEvent event) {
+                flush();
+            }
+        });
+    }
+
     @Override
     public void updateFromUIDL(final UIDL uidl, ApplicationConnection client) {
         getWidget().client = client;
         getWidget().id = uidl.getId();
 
         if (uidl.hasVariable("text")) {
-            getWidget().currentValue = uidl.getStringVariable("text");
-            if (getWidget().rta.isAttached()) {
-                getWidget().rta.setHTML(getWidget().currentValue);
-            } else {
-                getWidget().html.setHTML(getWidget().currentValue);
+            String newValue = uidl.getStringVariable("text");
+            if (!SharedUtil.equals(newValue, cachedValue)) {
+                getWidget().setValue(newValue);
+                cachedValue = newValue;
             }
         }
-        if (isRealUpdate(uidl)) {
-            getWidget().setEnabled(isEnabled());
-        }
 
         if (!isRealUpdate(uidl)) {
             return;
         }
 
+        getWidget().setEnabled(isEnabled());
         getWidget().setReadOnly(isReadOnly());
         getWidget().immediate = getState().immediate;
         int newMaxLength = uidl.hasAttribute("maxLength") ? uidl
@@ -85,7 +101,13 @@ public class RichTextAreaConnector extends AbstractFieldConnector implements
 
     @Override
     public void flush() {
-        getWidget().synchronizeContentToServer();
+        if (getConnection() != null && getConnectorId() != null) {
+            final String html = getWidget().getSanitazedValue();
+            if (!html.equals(cachedValue)) {
+                getConnection().updateVariable(getConnectorId(), "text", html,
+                        getState().immediate);
+                getWidget().setValue(html);
+            }
+        }
     };
-
 }
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html
new file mode 100644
index 0000000000..6ddd1b4097
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.html
@@ -0,0 +1,42 @@
+<?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:7070/" />
+<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.richtextarea.RichTextAreaUpdateWhileTyping?restartApplication</td>
+    <td></td>
+</tr>
+<tr>
+    <td>selectFrame</td>
+    <td>xpath=//div[@id='rta']/iframe</td>
+    <td></td>
+</tr>
+<tr>
+    <td>type</td>
+    <td>//body</td>
+    <td>This text should be visible, even after an update while I type.</td>
+</tr>
+<tr>
+    <td>pause</td>
+    <td>2000</td>
+    <td></td>
+</tr>
+<tr>
+    <td>assertText</td>
+    <td>//body</td>
+    <td>This text should be visible, even after an update while I type.</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java
new file mode 100644
index 0000000000..df1d6df463
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/richtextarea/RichTextAreaUpdateWhileTyping.java
@@ -0,0 +1,51 @@
+package com.vaadin.tests.components.richtextarea;
+
+import com.vaadin.data.Property;
+import com.vaadin.data.Property.ValueChangeEvent;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
+import com.vaadin.tests.components.AbstractComponentTest;
+import com.vaadin.tests.components.AbstractTestCase;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.ProgressIndicator;
+import com.vaadin.ui.RichTextArea;
+
+public class RichTextAreaUpdateWhileTyping extends AbstractTestUI {
+
+    private RichTextArea rta;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+
+        // Progress indicator for changing the value of the RTA
+        ProgressIndicator pi = new ProgressIndicator() {
+            {
+                registerRpc(new ProgressIndicatorServerRpc() {
+
+                    @Override
+                    public void poll() {
+                        rta.markAsDirty();
+                    }
+                });
+            }
+        };
+        pi.setHeight("0px");
+        addComponent(pi);
+
+        rta = new RichTextArea();
+        rta.setId("rta");
+        rta.setImmediate(true);
+        addComponent(rta);
+    }
+
+    @Override
+    protected String getTestDescription() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11741;
+    }
+}
-- 
cgit v1.2.3


From 84edd1952c0ee8eb826d78483c96bf87678d7124 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 28 May 2013 20:18:25 +0300
Subject: Make test independent of browser language (#11940)

Change-Id: Ibcabe18581e4ad021ad1b58919c77fd97f2ad47c
---
 .../vaadin/tests/components/datefield/DynamicallyChangeDateRange.java   | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'uitest/src')

diff --git a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java
index 9288b0428e..fb0fb2a546 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DynamicallyChangeDateRange.java
@@ -1,6 +1,7 @@
 package com.vaadin.tests.components.datefield;
 
 import java.util.Date;
+import java.util.Locale;
 
 import com.vaadin.server.VaadinRequest;
 import com.vaadin.tests.components.AbstractTestUI;
@@ -19,6 +20,7 @@ public class DynamicallyChangeDateRange extends AbstractTestUI {
 
     @Override
     protected void setup(VaadinRequest request) {
+        setLocale(Locale.ENGLISH);
         final VerticalLayout layout = new VerticalLayout();
         layout.setMargin(true);
         setContent(layout);
-- 
cgit v1.2.3


From a9afca67ba942afa287be3507eb225e0a7b954e6 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 28 May 2013 12:00:15 +0300
Subject: Moved Locale data handling to LocaleService (#11378)

The locale data is now tracked per UI instance and no longer sent in every request.

Change-Id: I4bebd00327da6f8d812181fd76a85eb6196d0010
---
 .../com/vaadin/client/ApplicationConnection.java   |  21 +-
 client/src/com/vaadin/client/LocaleService.java    |  54 +++---
 server/src/com/vaadin/server/JsonPaintTarget.java  |   4 -
 .../vaadin/server/LegacyCommunicationManager.java  |  61 ------
 server/src/com/vaadin/server/LocaleService.java    | 211 +++++++++++++++++++++
 .../vaadin/server/communication/LocaleWriter.java  | 204 --------------------
 .../vaadin/server/communication/UidlWriter.java    |   4 -
 server/src/com/vaadin/ui/AbstractComponent.java    |   9 +-
 server/src/com/vaadin/ui/UI.java                   |  17 ++
 shared/src/com/vaadin/shared/ui/ui/UIState.java    |  28 +++
 .../components/datefield/DateFieldLocale.java      |   2 +-
 11 files changed, 300 insertions(+), 315 deletions(-)
 create mode 100644 server/src/com/vaadin/server/LocaleService.java
 delete mode 100644 server/src/com/vaadin/server/communication/LocaleWriter.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ApplicationConnection.java b/client/src/com/vaadin/client/ApplicationConnection.java
index 087ee87262..24275dadb9 100644
--- a/client/src/com/vaadin/client/ApplicationConnection.java
+++ b/client/src/com/vaadin/client/ApplicationConnection.java
@@ -1350,16 +1350,6 @@ public class ApplicationConnection {
                 handleUIDLDuration.logDuration(" * Loading widgets completed",
                         10);
 
-                Profiler.enter("Handling locales");
-                if (json.containsKey("locales")) {
-                    VConsole.log(" * Handling locales");
-                    // Store locale data
-                    JsArray<ValueMap> valueMapArray = json
-                            .getJSValueMapArray("locales");
-                    LocaleService.addLocales(valueMapArray);
-                }
-                Profiler.leave("Handling locales");
-
                 Profiler.enter("Handling meta information");
                 ValueMap meta = null;
                 if (json.containsKey("meta")) {
@@ -1399,6 +1389,17 @@ public class ApplicationConnection {
                 JsArrayObject<StateChangeEvent> pendingStateChangeEvents = updateConnectorState(
                         json, createdConnectorIds);
 
+                /*
+                 * Doing this here so that locales are available also to the
+                 * connectors which get a state change event before the UI.
+                 */
+                Profiler.enter("Handling locales");
+                VConsole.log(" * Handling locales");
+                // Store locale data
+                LocaleService
+                        .addLocales(getUIConnector().getState().localeServiceState.localeData);
+                Profiler.leave("Handling locales");
+
                 // Update hierarchy, do not fire events
                 ConnectorHierarchyUpdateResult connectorHierarchyUpdateResult = updateConnectorHierarchy(json);
 
diff --git a/client/src/com/vaadin/client/LocaleService.java b/client/src/com/vaadin/client/LocaleService.java
index 4009c95531..69345d7174 100644
--- a/client/src/com/vaadin/client/LocaleService.java
+++ b/client/src/com/vaadin/client/LocaleService.java
@@ -17,10 +17,12 @@
 package com.vaadin.client;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.logging.Logger;
 
-import com.google.gwt.core.client.JsArray;
+import com.vaadin.shared.ui.ui.UIState.LocaleData;
 
 /**
  * Date / time etc. localisation service for all widgets. Caches all loaded
@@ -31,16 +33,17 @@ import com.google.gwt.core.client.JsArray;
  */
 public class LocaleService {
 
-    private static Map<String, ValueMap> cache = new HashMap<String, ValueMap>();
-    private static String defaultLocale;
+    private static Map<String, LocaleData> cache = new HashMap<String, LocaleData>();
 
-    public static void addLocale(ValueMap valueMap) {
+    private static String defaultLocale;
 
-        final String key = valueMap.getString("name");
+    public static void addLocale(LocaleData localeData) {
+        final String key = localeData.name;
         if (cache.containsKey(key)) {
             cache.remove(key);
         }
-        cache.put(key, valueMap);
+        getLogger().fine("Received locale data for " + localeData.name);
+        cache.put(key, localeData);
         if (cache.size() == 1) {
             setDefaultLocale(key);
         }
@@ -61,8 +64,7 @@ public class LocaleService {
     public static String[] getMonthNames(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getStringArray("mn");
+            return cache.get(locale).monthNames;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -71,8 +73,7 @@ public class LocaleService {
     public static String[] getShortMonthNames(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getStringArray("smn");
+            return cache.get(locale).shortMonthNames;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -81,8 +82,7 @@ public class LocaleService {
     public static String[] getDayNames(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getStringArray("dn");
+            return cache.get(locale).dayNames;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -91,8 +91,7 @@ public class LocaleService {
     public static String[] getShortDayNames(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getStringArray("sdn");
+            return cache.get(locale).shortDayNames;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -101,8 +100,7 @@ public class LocaleService {
     public static int getFirstDayOfWeek(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getInt("fdow");
+            return cache.get(locale).firstDayOfWeek;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -111,8 +109,7 @@ public class LocaleService {
     public static String getDateFormat(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getString("df");
+            return cache.get(locale).dateFormat;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -121,8 +118,7 @@ public class LocaleService {
     public static boolean isTwelveHourClock(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getBoolean("thc");
+            return cache.get(locale).twelveHourClock;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -131,8 +127,7 @@ public class LocaleService {
     public static String getClockDelimiter(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getString("hmd");
+            return cache.get(locale).hourMinuteDelimiter;
         } else {
             throw new LocaleNotLoadedException(locale);
         }
@@ -141,20 +136,19 @@ public class LocaleService {
     public static String[] getAmPmStrings(String locale)
             throws LocaleNotLoadedException {
         if (cache.containsKey(locale)) {
-            final ValueMap l = cache.get(locale);
-            return l.getStringArray("ampm");
+            return new String[] { cache.get(locale).am, cache.get(locale).pm };
         } else {
             throw new LocaleNotLoadedException(locale);
         }
-
     }
 
-    public static void addLocales(JsArray<ValueMap> valueMapArray) {
-        for (int i = 0; i < valueMapArray.length(); i++) {
-            addLocale(valueMapArray.get(i));
-
+    public static void addLocales(List<LocaleData> localeDatas) {
+        for (LocaleData localeData : localeDatas) {
+            addLocale(localeData);
         }
-
     }
 
+    private static Logger getLogger() {
+        return Logger.getLogger(LocaleService.class.getName());
+    }
 }
diff --git a/server/src/com/vaadin/server/JsonPaintTarget.java b/server/src/com/vaadin/server/JsonPaintTarget.java
index ca70391f64..cd09b2a44b 100644
--- a/server/src/com/vaadin/server/JsonPaintTarget.java
+++ b/server/src/com/vaadin/server/JsonPaintTarget.java
@@ -388,10 +388,6 @@ public class JsonPaintTarget implements PaintTarget {
             getUsedResources().add("layouts/" + value + ".html");
         }
 
-        if (name.equals("locale")) {
-            manager.requireLocale(value);
-        }
-
     }
 
     @Override
diff --git a/server/src/com/vaadin/server/LegacyCommunicationManager.java b/server/src/com/vaadin/server/LegacyCommunicationManager.java
index c0194db243..ad662cf6df 100644
--- a/server/src/com/vaadin/server/LegacyCommunicationManager.java
+++ b/server/src/com/vaadin/server/LegacyCommunicationManager.java
@@ -16,18 +16,12 @@
 
 package com.vaadin.server;
 
-import java.io.IOException;
-import java.io.PrintWriter;
 import java.io.Serializable;
-import java.io.Writer;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.security.GeneralSecurityException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
 import java.util.Map;
 import java.util.Set;
 import java.util.logging.Level;
@@ -37,7 +31,6 @@ import org.json.JSONException;
 import org.json.JSONObject;
 
 import com.vaadin.server.ClientConnector.ConnectorErrorEvent;
-import com.vaadin.server.communication.LocaleWriter;
 import com.vaadin.shared.ApplicationConstants;
 import com.vaadin.shared.JavaScriptConnectorState;
 import com.vaadin.shared.communication.SharedState;
@@ -69,9 +62,6 @@ public class LegacyCommunicationManager implements Serializable {
      */
     private final VaadinSession session;
 
-    // TODO Refactor to UI shared state (#11378)
-    private List<String> locales;
-
     // TODO Move to VaadinSession (#11409)
     private DragAndDropService dragAndDropService;
 
@@ -88,7 +78,6 @@ public class LegacyCommunicationManager implements Serializable {
      */
     public LegacyCommunicationManager(VaadinSession session) {
         this.session = session;
-        requireLocale(session.getLocale().toString());
     }
 
     protected VaadinSession getSession() {
@@ -312,52 +301,6 @@ public class LegacyCommunicationManager implements Serializable {
         return dragAndDropService;
     }
 
-    /**
-     * Prints the queued (pending) locale definitions to a {@link PrintWriter}
-     * in a (UIDL) format that can be sent to the client and used there in
-     * formatting dates, times etc.
-     * 
-     * @deprecated As of 7.1. See #11378.
-     * 
-     * @param outWriter
-     */
-    @Deprecated
-    public void printLocaleDeclarations(Writer writer) throws IOException {
-        new LocaleWriter().write(locales, writer);
-    }
-
-    /**
-     * Queues a locale to be sent to the client (browser) for date and time
-     * entry etc. All locale specific information is derived from server-side
-     * {@link Locale} instances and sent to the client when needed, eliminating
-     * the need to use the {@link Locale} class and all the framework behind it
-     * on the client.
-     * 
-     * @deprecated As of 7.1. See #11378.
-     * 
-     * @see Locale#toString()
-     * 
-     * @param value
-     */
-    @Deprecated
-    public void requireLocale(String value) {
-        if (locales == null) {
-            locales = new ArrayList<String>();
-            locales.add(session.getLocale().toString());
-        }
-        if (!locales.contains(value)) {
-            locales.add(value);
-        }
-    }
-
-    /**
-     * @deprecated As of 7.1. See #11378.
-     */
-    @Deprecated
-    public void resetLocales() {
-        locales = null;
-    }
-
     /**
      * @deprecated As of 7.1. Will be removed in the future.
      */
@@ -486,10 +429,6 @@ public class LegacyCommunicationManager implements Serializable {
         getClientCache(ui).clear();
         ui.getConnectorTracker().markAllConnectorsDirty();
         ui.getConnectorTracker().markAllClientSidesUninitialized();
-
-        // Reset sent locales
-        resetLocales();
-        requireLocale(session.getLocale().toString());
     }
 
     private static final Logger getLogger() {
diff --git a/server/src/com/vaadin/server/LocaleService.java b/server/src/com/vaadin/server/LocaleService.java
new file mode 100644
index 0000000000..347c4da5c6
--- /dev/null
+++ b/server/src/com/vaadin/server/LocaleService.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * 
+ */
+package com.vaadin.server;
+
+import java.text.DateFormat;
+import java.text.DateFormatSymbols;
+import java.text.SimpleDateFormat;
+import java.util.GregorianCalendar;
+import java.util.Locale;
+import java.util.logging.Logger;
+
+import com.vaadin.shared.ui.ui.UIState.LocaleData;
+import com.vaadin.shared.ui.ui.UIState.LocaleServiceState;
+import com.vaadin.ui.UI;
+
+/**
+ * Server side service which handles locale and the transmission of locale date
+ * to the client side LocaleService.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class LocaleService {
+
+    private UI ui;
+
+    private LocaleServiceState state;
+
+    /**
+     * Creates a LocaleService bound to the given UI
+     * 
+     * @since 7.1
+     * @param ui
+     *            The UI which owns the LocaleService
+     */
+    public LocaleService(UI ui, LocaleServiceState state) {
+        this.ui = ui;
+        this.state = state;
+    }
+
+    /**
+     * Retrieves the UI this service is bound to
+     * 
+     * @since 7.1
+     * @return the UI for this service
+     */
+    public UI getUI() {
+        return ui;
+    }
+
+    /**
+     * Adds a locale to be sent to the client (browser) for date and time entry
+     * etc. All locale specific information is derived from server-side
+     * {@link Locale} instances and sent to the client when needed, eliminating
+     * the need to use the {@link Locale} class and all the framework behind it
+     * on the client.
+     * 
+     * @param locale
+     *            The locale which is required on the client side
+     */
+    public void addLocale(Locale locale) {
+        for (LocaleData data : getState(false).localeData) {
+            if (data.name.equals(locale.toString())) {
+                // Already there
+                return;
+            }
+        }
+
+        getState(true).localeData.add(createLocaleData(locale));
+    }
+
+    /**
+     * Returns the state for this service
+     * <p>
+     * The state is transmitted inside the UI state rather than as an individual
+     * entity.
+     * </p>
+     * 
+     * @since 7.1
+     * @param markAsDirty
+     *            true to mark the state as dirty
+     * @return a LocaleServiceState object that can be read in any case and
+     *         modified if markAsDirty is true
+     */
+    private LocaleServiceState getState(boolean markAsDirty) {
+        if (markAsDirty) {
+            getUI().markAsDirty();
+        }
+
+        return state;
+    }
+
+    /**
+     * Creates a LocaleData instance for transportation to the client
+     * 
+     * @since 7.1
+     * @param locale
+     *            The locale for which to create a LocaleData object
+     * @return A LocaleData object with information about the given locale
+     */
+    protected LocaleData createLocaleData(Locale locale) {
+        LocaleData localeData = new LocaleData();
+        localeData.name = locale.toString();
+
+        final DateFormatSymbols dfs = new DateFormatSymbols(locale);
+        localeData.shortMonthNames = dfs.getShortMonths();
+        localeData.monthNames = dfs.getMonths();
+        // Client expects 0 based indexing, DateFormatSymbols use 1 based
+        localeData.shortDayNames = new String[7];
+        localeData.dayNames = new String[7];
+        String[] sDayNames = dfs.getShortWeekdays();
+        String[] lDayNames = dfs.getWeekdays();
+        for (int i = 0; i < 7; i++) {
+            localeData.shortDayNames[i] = sDayNames[i + 1];
+            localeData.dayNames[i] = lDayNames[i + 1];
+        }
+
+        /*
+         * First day of week (0 = sunday, 1 = monday)
+         */
+        final java.util.Calendar cal = new GregorianCalendar(locale);
+        localeData.firstDayOfWeek = cal.getFirstDayOfWeek() - 1;
+
+        /*
+         * Date formatting (MM/DD/YYYY etc.)
+         */
+
+        DateFormat dateFormat = DateFormat.getDateTimeInstance(
+                DateFormat.SHORT, DateFormat.SHORT, locale);
+        if (!(dateFormat instanceof SimpleDateFormat)) {
+            getLogger().warning(
+                    "Unable to get default date pattern for locale "
+                            + locale.toString());
+            dateFormat = new SimpleDateFormat();
+        }
+        final String df = ((SimpleDateFormat) dateFormat).toPattern();
+
+        int timeStart = df.indexOf("H");
+        if (timeStart < 0) {
+            timeStart = df.indexOf("h");
+        }
+        final int ampm_first = df.indexOf("a");
+        // E.g. in Korean locale AM/PM is before h:mm
+        // TODO should take that into consideration on client-side as well,
+        // now always h:mm a
+        if (ampm_first > 0 && ampm_first < timeStart) {
+            timeStart = ampm_first;
+        }
+        // Hebrew locale has time before the date
+        final boolean timeFirst = timeStart == 0;
+        String dateformat;
+        if (timeFirst) {
+            int dateStart = df.indexOf(' ');
+            if (ampm_first > dateStart) {
+                dateStart = df.indexOf(' ', ampm_first);
+            }
+            dateformat = df.substring(dateStart + 1);
+        } else {
+            dateformat = df.substring(0, timeStart - 1);
+        }
+
+        localeData.dateFormat = dateformat.trim();
+
+        /*
+         * Time formatting (24 or 12 hour clock and AM/PM suffixes)
+         */
+        final String timeformat = df.substring(timeStart, df.length());
+        /*
+         * Doesn't return second or milliseconds.
+         * 
+         * We use timeformat to determine 12/24-hour clock
+         */
+        final boolean twelve_hour_clock = timeformat.indexOf("a") > -1;
+        // TODO there are other possibilities as well, like 'h' in french
+        // (ignore them, too complicated)
+        final String hour_min_delimiter = timeformat.indexOf(".") > -1 ? "."
+                : ":";
+        // outWriter.print("\"tf\":\"" + timeformat + "\",");
+        localeData.twelveHourClock = twelve_hour_clock;
+        localeData.hourMinuteDelimiter = hour_min_delimiter;
+        if (twelve_hour_clock) {
+            final String[] ampm = dfs.getAmPmStrings();
+            localeData.am = ampm[0];
+            localeData.pm = ampm[1];
+        }
+
+        return localeData;
+    }
+
+    private static Logger getLogger() {
+        return Logger.getLogger(LocaleService.class.getName());
+    }
+
+}
diff --git a/server/src/com/vaadin/server/communication/LocaleWriter.java b/server/src/com/vaadin/server/communication/LocaleWriter.java
deleted file mode 100644
index c05649da19..0000000000
--- a/server/src/com/vaadin/server/communication/LocaleWriter.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * Copyright 2000-2013 Vaadin Ltd.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package com.vaadin.server.communication;
-
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.Writer;
-import java.text.DateFormat;
-import java.text.DateFormatSymbols;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.List;
-import java.util.Locale;
-import java.util.logging.Logger;
-
-/**
- * Serializes locale information to JSON.
- * 
- * @author Vaadin Ltd
- * @since 7.1
- * @deprecated See <a href="http://dev.vaadin.com/ticket/11378">ticket
- *             #11378</a>.
- */
-@Deprecated
-public class LocaleWriter implements Serializable {
-
-    /**
-     * Writes a JSON object containing localized strings of the given locales.
-     * 
-     * @param locales
-     *            The list of {@link Locale}s to write.
-     * @param writer
-     *            The {@link Writer} used to write the JSON.
-     * @throws IOException
-     *             If the serialization fails.
-     * 
-     */
-    public void write(List<String> locales, Writer writer) throws IOException {
-
-        // Send locale informations to client
-        writer.write("[");
-        // TODO locales are currently sent on each request; this will be fixed
-        // by implementing #11378.
-        for (int pendingLocalesIndex = 0; pendingLocalesIndex < locales.size(); pendingLocalesIndex++) {
-
-            final Locale l = generateLocale(locales.get(pendingLocalesIndex));
-            // Locale name
-            writer.write("{\"name\":\"" + l.toString() + "\",");
-
-            /*
-             * Month names (both short and full)
-             */
-            final DateFormatSymbols dfs = new DateFormatSymbols(l);
-            final String[] short_months = dfs.getShortMonths();
-            final String[] months = dfs.getMonths();
-            writer.write("\"smn\":[\""
-                    + // ShortMonthNames
-                    short_months[0] + "\",\"" + short_months[1] + "\",\""
-                    + short_months[2] + "\",\"" + short_months[3] + "\",\""
-                    + short_months[4] + "\",\"" + short_months[5] + "\",\""
-                    + short_months[6] + "\",\"" + short_months[7] + "\",\""
-                    + short_months[8] + "\",\"" + short_months[9] + "\",\""
-                    + short_months[10] + "\",\"" + short_months[11] + "\""
-                    + "],");
-            writer.write("\"mn\":[\""
-                    + // MonthNames
-                    months[0] + "\",\"" + months[1] + "\",\"" + months[2]
-                    + "\",\"" + months[3] + "\",\"" + months[4] + "\",\""
-                    + months[5] + "\",\"" + months[6] + "\",\"" + months[7]
-                    + "\",\"" + months[8] + "\",\"" + months[9] + "\",\""
-                    + months[10] + "\",\"" + months[11] + "\"" + "],");
-
-            /*
-             * Weekday names (both short and full)
-             */
-            final String[] short_days = dfs.getShortWeekdays();
-            final String[] days = dfs.getWeekdays();
-            writer.write("\"sdn\":[\""
-                    + // ShortDayNames
-                    short_days[1] + "\",\"" + short_days[2] + "\",\""
-                    + short_days[3] + "\",\"" + short_days[4] + "\",\""
-                    + short_days[5] + "\",\"" + short_days[6] + "\",\""
-                    + short_days[7] + "\"" + "],");
-            writer.write("\"dn\":[\""
-                    + // DayNames
-                    days[1] + "\",\"" + days[2] + "\",\"" + days[3] + "\",\""
-                    + days[4] + "\",\"" + days[5] + "\",\"" + days[6] + "\",\""
-                    + days[7] + "\"" + "],");
-
-            /*
-             * First day of week (0 = sunday, 1 = monday)
-             */
-            final Calendar cal = new GregorianCalendar(l);
-            writer.write("\"fdow\":" + (cal.getFirstDayOfWeek() - 1) + ",");
-
-            /*
-             * Date formatting (MM/DD/YYYY etc.)
-             */
-
-            DateFormat dateFormat = DateFormat.getDateTimeInstance(
-                    DateFormat.SHORT, DateFormat.SHORT, l);
-            if (!(dateFormat instanceof SimpleDateFormat)) {
-                getLogger().warning(
-                        "Unable to get default date pattern for locale "
-                                + l.toString());
-                dateFormat = new SimpleDateFormat();
-            }
-            final String df = ((SimpleDateFormat) dateFormat).toPattern();
-
-            int timeStart = df.indexOf("H");
-            if (timeStart < 0) {
-                timeStart = df.indexOf("h");
-            }
-            final int ampm_first = df.indexOf("a");
-            // E.g. in Korean locale AM/PM is before h:mm
-            // TODO should take that into consideration on client-side as well,
-            // now always h:mm a
-            if (ampm_first > 0 && ampm_first < timeStart) {
-                timeStart = ampm_first;
-            }
-            // Hebrew locale has time before the date
-            final boolean timeFirst = timeStart == 0;
-            String dateformat;
-            if (timeFirst) {
-                int dateStart = df.indexOf(' ');
-                if (ampm_first > dateStart) {
-                    dateStart = df.indexOf(' ', ampm_first);
-                }
-                dateformat = df.substring(dateStart + 1);
-            } else {
-                dateformat = df.substring(0, timeStart - 1);
-            }
-
-            writer.write("\"df\":\"" + dateformat.trim() + "\",");
-
-            /*
-             * Time formatting (24 or 12 hour clock and AM/PM suffixes)
-             */
-            final String timeformat = df.substring(timeStart, df.length());
-            /*
-             * Doesn't return second or milliseconds.
-             * 
-             * We use timeformat to determine 12/24-hour clock
-             */
-            final boolean twelve_hour_clock = timeformat.indexOf("a") > -1;
-            // TODO there are other possibilities as well, like 'h' in french
-            // (ignore them, too complicated)
-            final String hour_min_delimiter = timeformat.indexOf(".") > -1 ? "."
-                    : ":";
-            // outWriter.print("\"tf\":\"" + timeformat + "\",");
-            writer.write("\"thc\":" + twelve_hour_clock + ",");
-            writer.write("\"hmd\":\"" + hour_min_delimiter + "\"");
-            if (twelve_hour_clock) {
-                final String[] ampm = dfs.getAmPmStrings();
-                writer.write(",\"ampm\":[\"" + ampm[0] + "\",\"" + ampm[1]
-                        + "\"]");
-            }
-            writer.write("}");
-            if (pendingLocalesIndex < locales.size() - 1) {
-                writer.write(",");
-            }
-        }
-        writer.write("]"); // Close locales
-    }
-
-    /**
-     * Constructs a {@link Locale} instance to be sent to the client based on a
-     * short locale description string.
-     * 
-     * @see #requireLocale(String)
-     * 
-     * @param value
-     * @return
-     */
-    private Locale generateLocale(String value) {
-        final String[] temp = value.split("_");
-        if (temp.length == 1) {
-            return new Locale(temp[0]);
-        } else if (temp.length == 2) {
-            return new Locale(temp[0], temp[1]);
-        } else {
-            return new Locale(temp[0], temp[1], temp[2]);
-        }
-    }
-
-    private static final Logger getLogger() {
-        return Logger.getLogger(LocaleWriter.class.getName());
-    }
-}
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index 60a884a635..f715569424 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -283,10 +283,6 @@ public class UidlWriter implements Serializable {
                         + new JSONArray(styleDependencies).toString());
             }
 
-            // add any pending locale definitions requested by the client
-            writer.write(", \"locales\": ");
-            manager.printLocaleDeclarations(writer);
-
             if (manager.getDragAndDropService() != null) {
                 manager.getDragAndDropService().printJSONResponse(writer);
             }
diff --git a/server/src/com/vaadin/ui/AbstractComponent.java b/server/src/com/vaadin/ui/AbstractComponent.java
index 06060dbf91..9ff36a42d2 100644
--- a/server/src/com/vaadin/ui/AbstractComponent.java
+++ b/server/src/com/vaadin/ui/AbstractComponent.java
@@ -291,7 +291,10 @@ public abstract class AbstractComponent extends AbstractClientConnector
     public void setLocale(Locale locale) {
         this.locale = locale;
 
-        // FIXME: Reload value if there is a converter
+        if (locale != null && isAttached()) {
+            getUI().getLocaleService().addLocale(locale);
+        }
+
         markAsDirty();
     }
 
@@ -556,6 +559,10 @@ public abstract class AbstractComponent extends AbstractClientConnector
             focus();
         }
         setActionManagerViewer();
+        if (locale != null) {
+            getUI().getLocaleService().addLocale(locale);
+        }
+
     }
 
     /*
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index 545c2c7365..706f7c436b 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -30,6 +30,7 @@ import com.vaadin.event.ActionManager;
 import com.vaadin.event.MouseEvents.ClickEvent;
 import com.vaadin.event.MouseEvents.ClickListener;
 import com.vaadin.navigator.Navigator;
+import com.vaadin.server.LocaleService;
 import com.vaadin.server.Page;
 import com.vaadin.server.PaintException;
 import com.vaadin.server.PaintTarget;
@@ -494,6 +495,9 @@ public abstract class UI extends AbstractSingleComponentContainer implements
 
     private boolean hasPendingPush = false;
 
+    private LocaleService localeService = new LocaleService(this,
+            getState(false).localeServiceState);
+
     /**
      * This method is used by Component.Focusable objects to request focus to
      * themselves. Focus renders must be handled at window level (instead of
@@ -1052,6 +1056,7 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     @Override
     public void attach() {
         super.attach();
+        getLocaleService().addLocale(getLocale());
     }
 
     /**
@@ -1428,4 +1433,16 @@ public abstract class UI extends AbstractSingleComponentContainer implements
     public void setOverlayContainerLabel(String overlayContainerLabel) {
         getState().overlayContainerLabel = overlayContainerLabel;
     }
+
+    /**
+     * Returns the locale service which handles transmission of Locale data to
+     * the client.
+     * 
+     * @since 7.1
+     * @return The LocaleService for this UI
+     */
+    public LocaleService getLocaleService() {
+        return localeService;
+    }
+
 }
diff --git a/shared/src/com/vaadin/shared/ui/ui/UIState.java b/shared/src/com/vaadin/shared/ui/ui/UIState.java
index 16c1ed16c7..f01d5d8100 100644
--- a/shared/src/com/vaadin/shared/ui/ui/UIState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/UIState.java
@@ -16,7 +16,11 @@
 package com.vaadin.shared.ui.ui;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
+import com.vaadin.server.LocaleService;
+import com.vaadin.server.Page;
 import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.TabIndexState;
 
@@ -50,10 +54,34 @@ public class UIState extends TabIndexState {
      * State related to the {@link Page} class.
      */
     public PageState pageState = new PageState();
+    /**
+     * State related to the {@link LocaleService} class.
+     */
+    public LocaleServiceState localeServiceState = new LocaleServiceState();
 
     {
         primaryStyleName = "v-ui";
         // Default is 1 for legacy reasons
         tabIndex = 1;
     }
+
+    public static class LocaleServiceState implements Serializable {
+        public List<LocaleData> localeData = new ArrayList<LocaleData>();
+    }
+
+    public static class LocaleData implements Serializable {
+        public String name;
+        public String[] monthNames;
+        public String[] shortMonthNames;
+        public String[] shortDayNames;
+        public String[] dayNames;
+        public int firstDayOfWeek;
+        public String dateFormat;
+        public boolean twelveHourClock;
+        public String hourMinuteDelimiter;
+        public String am;
+        public String pm;
+
+    }
+
 }
diff --git a/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java b/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java
index 5d06895d11..a4fe2b0285 100644
--- a/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java
+++ b/uitest/src/com/vaadin/tests/components/datefield/DateFieldLocale.java
@@ -16,7 +16,7 @@ public class DateFieldLocale extends TestBase {
         final DateField dateField = new DateField("DateField");
         dateField.setLocale(new Locale("fi", "FI"));
         dateField.setCaption(dateField.getLocale().toString());
-        dateField.setValue(new Date());
+        dateField.setValue(new Date(2013 - 1900, 7 - 1, 27));
         dateField.setResolution(DateField.RESOLUTION_DAY);
 
         addComponent(new Button("Change locale", new ClickListener() {
-- 
cgit v1.2.3


From 91182e237f2f4f8784582887970c32b5be3ad7c5 Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Tue, 28 May 2013 11:01:31 +0300
Subject: Extract ProgressBar and deprecate ProgressIndicator (#11925)

Change-Id: Id9eaee65762b0dadd59f3e730d3ff11712ab87fe
---
 client/src/com/vaadin/client/ui/VProgressBar.java  |  85 ++++++++++++
 .../com/vaadin/client/ui/VProgressIndicator.java   |  62 ++-------
 .../ui/progressindicator/ProgressBarConnector.java |  56 ++++++++
 .../ProgressIndicatorConnector.java                |  21 +--
 server/src/com/vaadin/ui/ProgressBar.java          | 152 +++++++++++++++++++++
 server/src/com/vaadin/ui/ProgressIndicator.java    | 105 +++-----------
 .../ui/progressindicator/ProgressBarState.java     |  33 +++++
 .../progressindicator/ProgressIndicatorState.java  |   7 +-
 .../progressindicator/ProgressBarTest.html         |  62 +++++++++
 .../progressindicator/ProgressBarTest.java         | 125 +++++++++++++++++
 10 files changed, 552 insertions(+), 156 deletions(-)
 create mode 100644 client/src/com/vaadin/client/ui/VProgressBar.java
 create mode 100644 client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
 create mode 100644 server/src/com/vaadin/ui/ProgressBar.java
 create mode 100644 shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
 create mode 100644 uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html
 create mode 100644 uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VProgressBar.java b/client/src/com/vaadin/client/ui/VProgressBar.java
new file mode 100644
index 0000000000..3eb8725520
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/VProgressBar.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.client.ui;
+
+import com.google.gwt.dom.client.Style.Unit;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
+import com.google.gwt.user.client.ui.HasEnabled;
+import com.google.gwt.user.client.ui.Widget;
+
+/**
+ * Widget for showing the current progress of a long running task.
+ * <p>
+ * The default mode is to show the current progress internally represented by a
+ * floating point value between 0 and 1 (inclusive). The progress bar can also
+ * be in an indeterminate mode showing an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class VProgressBar extends Widget implements HasEnabled {
+
+    public static final String CLASSNAME = "v-progressindicator";
+    Element wrapper = DOM.createDiv();
+    Element indicator = DOM.createDiv();
+
+    protected boolean indeterminate = false;
+    protected float state = 0.0f;
+    private boolean enabled;
+
+    public VProgressBar() {
+        setElement(DOM.createDiv());
+        getElement().appendChild(wrapper);
+        setStyleName(CLASSNAME);
+        wrapper.appendChild(indicator);
+        indicator.setClassName(CLASSNAME + "-indicator");
+        wrapper.setClassName(CLASSNAME + "-wrapper");
+    }
+
+    public void setIndeterminate(boolean indeterminate) {
+        this.indeterminate = indeterminate;
+        setStyleName(CLASSNAME + "-indeterminate", indeterminate);
+    }
+
+    public void setState(float state) {
+        final int size = Math.round(100 * state);
+        indicator.getStyle().setWidth(size, Unit.PCT);
+    }
+
+    public boolean isIndeterminate() {
+        return indeterminate;
+    }
+
+    public float getState() {
+        return state;
+    }
+
+    @Override
+    public boolean isEnabled() {
+        return enabled;
+    }
+
+    @Override
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+        setStyleName("v-disabled", !enabled);
+
+    }
+
+}
diff --git a/client/src/com/vaadin/client/ui/VProgressIndicator.java b/client/src/com/vaadin/client/ui/VProgressIndicator.java
index d6b25cb016..500a5def30 100644
--- a/client/src/com/vaadin/client/ui/VProgressIndicator.java
+++ b/client/src/com/vaadin/client/ui/VProgressIndicator.java
@@ -16,59 +16,13 @@
 
 package com.vaadin.client.ui;
 
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Element;
-import com.google.gwt.user.client.ui.HasEnabled;
-import com.google.gwt.user.client.ui.Widget;
-
-public class VProgressIndicator extends Widget implements HasEnabled {
-
-    public static final String CLASSNAME = "v-progressindicator";
-    Element wrapper = DOM.createDiv();
-    Element indicator = DOM.createDiv();
-
-    protected boolean indeterminate = false;
-    protected float state = 0.0f;
-    private boolean enabled;
-
-    public VProgressIndicator() {
-        setElement(DOM.createDiv());
-        getElement().appendChild(wrapper);
-        setStyleName(CLASSNAME);
-        wrapper.appendChild(indicator);
-        indicator.setClassName(CLASSNAME + "-indicator");
-        wrapper.setClassName(CLASSNAME + "-wrapper");
-    }
-
-    public void setIndeterminate(boolean indeterminate) {
-        this.indeterminate = indeterminate;
-        setStyleName(CLASSNAME + "-indeterminate", indeterminate);
-    }
-
-    public void setState(float state) {
-        final int size = Math.round(100 * state);
-        indicator.getStyle().setWidth(size, Unit.PCT);
-    }
-
-    public boolean isIndeterminate() {
-        return indeterminate;
-    }
-
-    public float getState() {
-        return state;
-    }
-
-    @Override
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    @Override
-    public void setEnabled(boolean enabled) {
-        this.enabled = enabled;
-        setStyleName("v-disabled", !enabled);
-
-    }
+/**
+ * 
+ * @author Vaadin Ltd
+ * 
+ * @deprecated as of 7.1, renamed to VProgressBar
+ */
+@Deprecated
+public class VProgressIndicator extends VProgressBar {
 
 }
diff --git a/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java b/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
new file mode 100644
index 0000000000..91f3da5323
--- /dev/null
+++ b/client/src/com/vaadin/client/ui/progressindicator/ProgressBarConnector.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.client.ui.progressindicator;
+
+import com.vaadin.client.communication.StateChangeEvent;
+import com.vaadin.client.ui.AbstractFieldConnector;
+import com.vaadin.client.ui.VProgressBar;
+import com.vaadin.shared.ui.Connect;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
+import com.vaadin.ui.ProgressBar;
+
+/**
+ * Connector for {@link VProgressBar}.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+@Connect(ProgressBar.class)
+public class ProgressBarConnector extends AbstractFieldConnector {
+
+    public ProgressBarConnector() {
+        super();
+    }
+
+    @Override
+    public void onStateChanged(StateChangeEvent stateChangeEvent) {
+        super.onStateChanged(stateChangeEvent);
+        getWidget().setIndeterminate(getState().indeterminate);
+        getWidget().setState(getState().state);
+    }
+
+    @Override
+    public ProgressBarState getState() {
+        return (ProgressBarState) super.getState();
+    }
+
+    @Override
+    public VProgressBar getWidget() {
+        return (VProgressBar) super.getWidget();
+    }
+
+}
\ No newline at end of file
diff --git a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
index ac5c3f5f6b..9e14f082e0 100644
--- a/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
+++ b/client/src/com/vaadin/client/ui/progressindicator/ProgressIndicatorConnector.java
@@ -18,15 +18,23 @@ package com.vaadin.client.ui.progressindicator;
 
 import com.google.gwt.user.client.Timer;
 import com.vaadin.client.communication.StateChangeEvent;
-import com.vaadin.client.ui.AbstractFieldConnector;
-import com.vaadin.client.ui.VProgressIndicator;
+import com.vaadin.client.ui.VProgressBar;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
 import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
 import com.vaadin.ui.ProgressIndicator;
 
+/**
+ * Connector for {@link VProgressBar} with polling support.
+ * 
+ * @since 7.0
+ * @author Vaadin Ltd
+ * @deprecated as of 7.1, use {@link ProgressBarConnector} combined with server
+ *             push or UI polling.
+ */
 @Connect(ProgressIndicator.class)
-public class ProgressIndicatorConnector extends AbstractFieldConnector {
+@Deprecated
+public class ProgressIndicatorConnector extends ProgressBarConnector {
 
     @Override
     public ProgressIndicatorState getState() {
@@ -45,8 +53,6 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
     @Override
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
-        getWidget().setIndeterminate(getState().indeterminate);
-        getWidget().setState(getState().state);
 
         if (isEnabled()) {
             poller.scheduleRepeating(getState().pollingInterval);
@@ -60,9 +66,4 @@ public class ProgressIndicatorConnector extends AbstractFieldConnector {
         super.onUnregister();
         poller.cancel();
     }
-
-    @Override
-    public VProgressIndicator getWidget() {
-        return (VProgressIndicator) super.getWidget();
-    }
 }
diff --git a/server/src/com/vaadin/ui/ProgressBar.java b/server/src/com/vaadin/ui/ProgressBar.java
new file mode 100644
index 0000000000..3f8aab6d7c
--- /dev/null
+++ b/server/src/com/vaadin/ui/ProgressBar.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.ui;
+
+import com.vaadin.data.Property;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
+
+/**
+ * Shows the current progress of a long running task.
+ * <p>
+ * The default mode is to show the current progress internally represented by a
+ * floating point value between 0 and 1 (inclusive). The progress bar can also
+ * be in an indeterminate mode showing an animation indicating that the task is
+ * running but without providing any information about the current progress.
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class ProgressBar extends AbstractField<Float> implements
+        Property.Viewer, Property.ValueChangeListener {
+
+    /**
+     * Creates a new progress bar initially set to 0% progress.
+     */
+    public ProgressBar() {
+        this(0);
+    }
+
+    /**
+     * Creates a new progress bar with the given initial value.
+     * 
+     * @param progress
+     *            the initial progress value
+     */
+    public ProgressBar(float progress) {
+        setValue(Float.valueOf(progress));
+    }
+
+    /**
+     * Creates a new progress bar bound to the given data source.
+     * 
+     * @param dataSource
+     *            the property to bind this progress bar to
+     */
+    public ProgressBar(Property<?> dataSource) {
+        setPropertyDataSource(dataSource);
+    }
+
+    @Override
+    public void beforeClientResponse(boolean initial) {
+        super.beforeClientResponse(initial);
+
+        // Update value in state even if the property hasn't fired any event
+        getState().state = getValue();
+    }
+
+    /**
+     * Gets the value of this progress bar. The value is a <code>float</code>
+     * between 0 and 1 where 0 represents no progress at all and 1 represents
+     * fully completed.
+     * 
+     * @return the current progress value
+     */
+    @Override
+    public Float getValue() {
+        return super.getValue();
+    }
+
+    /**
+     * Sets the value of this progress bar. The value is a <code>float</code>
+     * between 0 and 1 where 0 represents no progress at all and 1 represents
+     * fully completed.
+     * 
+     * @param newValue
+     *            the current progress value
+     */
+    @Override
+    public void setValue(Float newValue) {
+        super.setValue(newValue);
+    }
+
+    @Override
+    public Class<Float> getType() {
+        return Float.class;
+    }
+
+    @Override
+    protected ProgressBarState getState() {
+        return (ProgressBarState) super.getState();
+    }
+
+    @Override
+    protected ProgressBarState getState(boolean markAsDirty) {
+        return (ProgressBarState) super.getState(markAsDirty);
+    }
+
+    /**
+     * Sets whether or not this progress indicator is indeterminate. In
+     * indeterminate mode there is an animation indicating that the task is
+     * running but without providing any information about the current progress.
+     * 
+     * @param indeterminate
+     *            <code>true</code> to set to indeterminate mode; otherwise
+     *            <code>false</code>
+     */
+    public void setIndeterminate(boolean indeterminate) {
+        getState().indeterminate = indeterminate;
+    }
+
+    /**
+     * Gets whether or not this progress indicator is indeterminate. In
+     * indeterminate mode there is an animation indicating that the task is
+     * running but without providing any information about the current progress.
+     * 
+     * @return <code>true</code> if set to indeterminate mode; otherwise
+     *         <code>false</code>
+     */
+    public boolean isIndeterminate() {
+        return getState(false).indeterminate;
+    }
+
+    /*
+     * Overridden to keep the shared state in sync with the AbstractField
+     * internal value. Should be removed once AbstractField is refactored to use
+     * shared state.
+     * 
+     * See tickets #10921 and #11064.
+     */
+    @Override
+    protected void setInternalValue(Float newValue) {
+        super.setInternalValue(newValue);
+        if (newValue == null) {
+            newValue = Float.valueOf(0);
+        }
+        getState().state = newValue;
+    }
+
+}
\ No newline at end of file
diff --git a/server/src/com/vaadin/ui/ProgressIndicator.java b/server/src/com/vaadin/ui/ProgressIndicator.java
index c481aa1e8f..6da18fc29d 100644
--- a/server/src/com/vaadin/ui/ProgressIndicator.java
+++ b/server/src/com/vaadin/ui/ProgressIndicator.java
@@ -17,24 +17,27 @@
 package com.vaadin.ui;
 
 import com.vaadin.data.Property;
+import com.vaadin.shared.communication.PushMode;
 import com.vaadin.shared.ui.progressindicator.ProgressIndicatorServerRpc;
 import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
 
 /**
- * <code>ProgressIndicator</code> is component that shows user state of a
- * process (like long computing or file upload)
- * 
- * <code>ProgressIndicator</code> has two main modes. One for indeterminate
- * processes and other (default) for processes which progress can be measured
- * 
- * May view an other property that indicates progress 0...1
+ * A {@link ProgressBar} which polls the server for updates.
+ * <p>
+ * Polling in this way is generally not recommended since there is no
+ * centralized management of when messages are sent to the server. Furthermore,
+ * polling might not be needed at all if {@link UI#setPushMode(PushMode)} or
+ * {@link UI#setPollInterval(int)} is used.
  * 
  * @author Vaadin Ltd.
  * @since 4
+ * @deprecated as of 7.1, use {@link ProgressBar} combined with
+ *             {@link UI#setPushMode(PushMode)} or
+ *             {@link UI#setPollInterval(int)} instead.
  */
+@Deprecated
 @SuppressWarnings("serial")
-public class ProgressIndicator extends AbstractField<Float> implements
-        Property.Viewer, Property.ValueChangeListener {
+public class ProgressIndicator extends ProgressBar {
 
     private ProgressIndicatorServerRpc rpc = new ProgressIndicatorServerRpc() {
 
@@ -57,7 +60,7 @@ public class ProgressIndicator extends AbstractField<Float> implements
      * @param value
      */
     public ProgressIndicator(float value) {
-        setValue(value);
+        super(value);
         registerRpc(rpc);
     }
 
@@ -68,74 +71,18 @@ public class ProgressIndicator extends AbstractField<Float> implements
      * @param contentSource
      */
     public ProgressIndicator(Property contentSource) {
-        setPropertyDataSource(contentSource);
+        super(contentSource);
         registerRpc(rpc);
     }
 
-    @Override
-    public void beforeClientResponse(boolean initial) {
-        super.beforeClientResponse(initial);
-
-        getState().state = getValue();
-    }
-
-    /**
-     * Gets the value of the ProgressIndicator. Value of the ProgressIndicator
-     * is Float between 0 and 1.
-     * 
-     * @return the Value of the ProgressIndicator.
-     * @see com.vaadin.ui.AbstractField#getValue()
-     */
-    @Override
-    public Float getValue() {
-        return super.getValue();
-    }
-
-    /**
-     * Sets the value of the ProgressIndicator. Value of the ProgressIndicator
-     * is the Float between 0 and 1.
-     * 
-     * @param newValue
-     *            the New value of the ProgressIndicator.
-     * @see com.vaadin.ui.AbstractField#setValue()
-     */
-    @Override
-    public void setValue(Float newValue) {
-        super.setValue(newValue);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see com.vaadin.ui.AbstractField#getType()
-     */
-    @Override
-    public Class<Float> getType() {
-        return Float.class;
-    }
-
     @Override
     protected ProgressIndicatorState getState() {
         return (ProgressIndicatorState) super.getState();
     }
 
-    /**
-     * Sets whether or not the ProgressIndicator is indeterminate.
-     * 
-     * @param indeterminate
-     *            true to set to indeterminate mode.
-     */
-    public void setIndeterminate(boolean indeterminate) {
-        getState().indeterminate = indeterminate;
-    }
-
-    /**
-     * Gets whether or not the ProgressIndicator is indeterminate.
-     * 
-     * @return true to set to indeterminate mode.
-     */
-    public boolean isIndeterminate() {
-        return getState().indeterminate;
+    @Override
+    protected ProgressIndicatorState getState(boolean markAsDirty) {
+        return (ProgressIndicatorState) super.getState(markAsDirty);
     }
 
     /**
@@ -154,22 +101,6 @@ public class ProgressIndicator extends AbstractField<Float> implements
      * @return the interval in milliseconds.
      */
     public int getPollingInterval() {
-        return getState().pollingInterval;
-    }
-
-    /*
-     * Overridden to keep the shared state in sync with the AbstractField
-     * internal value. Should be removed once AbstractField is refactored to use
-     * shared state.
-     * 
-     * See tickets #10921 and #11064.
-     */
-    @Override
-    protected void setInternalValue(Float newValue) {
-        super.setInternalValue(newValue);
-        if (newValue == null) {
-            newValue = 0.0f;
-        }
-        getState().state = newValue;
+        return getState(false).pollingInterval;
     }
 }
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
new file mode 100644
index 0000000000..fef1030c63
--- /dev/null
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.shared.ui.progressindicator;
+
+import com.vaadin.shared.AbstractFieldState;
+import com.vaadin.shared.communication.SharedState;
+
+/**
+ * {@link SharedState} for {@link com.vaadin.ui.ProgressBar}
+ * 
+ * @since 7.1
+ * @author Vaadin Ltd
+ */
+public class ProgressBarState extends AbstractFieldState {
+
+    public boolean indeterminate = false;
+    public Float state = 0.0f;
+
+}
\ No newline at end of file
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
index 4126b994d8..f555476be8 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
@@ -15,10 +15,7 @@
  */
 package com.vaadin.shared.ui.progressindicator;
 
-import com.vaadin.shared.AbstractFieldState;
-
-public class ProgressIndicatorState extends AbstractFieldState {
-    public boolean indeterminate = false;
+@Deprecated
+public class ProgressIndicatorState extends ProgressBarState {
     public int pollingInterval = 1000;
-    public Float state = 0.0f;
 }
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html
new file mode 100644
index 0000000000..b7add101f9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.html
@@ -0,0 +1,62 @@
+<?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="" />
+<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.progressindicator.ProgressBarTest?restartApplication</td>
+	<td></td>
+</tr>
+<!--Add ProgressBar and wait-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>1000</td>
+	<td></td>
+</tr>
+<!--Text should not have changed-->
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>0</td>
+</tr>
+<!--Add ProgressIndicator and wait-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>pause</td>
+	<td>1000</td>
+	<td></td>
+</tr>
+<!--Text should have changed-->
+<tr>
+	<td>assertNotText</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VLabel[0]</td>
+	<td>0</td>
+</tr>
+<!--Stop thread right away if we get this far (would otherwise continue running until the UI is detached)-->
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java
new file mode 100644
index 0000000000..5afa874220
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarTest.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.vaadin.tests.components.progressindicator;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.ProgressBar;
+import com.vaadin.ui.ProgressIndicator;
+
+public class ProgressBarTest extends AbstractTestUI {
+
+    private Label updatedFromBackround;
+    private Thread updateThread = new Thread() {
+        @Override
+        public void run() {
+            Runnable updateTask = new Runnable() {
+                @Override
+                public void run() {
+                    counter++;
+                    updateLabel();
+                }
+            };
+
+            while (true) {
+                access(updateTask);
+                try {
+                    Thread.sleep(500);
+                } catch (InterruptedException e) {
+                    break;
+                }
+            }
+        }
+    };
+    private ProgressBar progressBar;
+    private int counter = 0;
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        updatedFromBackround = new Label();
+        updatedFromBackround.setCaption("Updated from background thread");
+        updateLabel();
+        addComponent(updatedFromBackround);
+
+        addComponent(new Button("Use ProgressBar", new Button.ClickListener() {
+            @Override
+            public void buttonClick(ClickEvent event) {
+                useComponent(new ProgressBar());
+            }
+        }));
+
+        addComponent(new Button("Use ProgressIndicator",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        useComponent(new ProgressIndicator());
+                    }
+                }));
+
+        addComponent(new Button("Stop background thread",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        stopUpdateThread();
+                    }
+                }));
+        updateThread.setDaemon(true);
+        updateThread.start();
+    }
+
+    private void useComponent(ProgressBar progressBar) {
+        if (this.progressBar != null) {
+            removeComponent(this.progressBar);
+        }
+        this.progressBar = progressBar;
+        addComponent(progressBar);
+
+        counter = 0;
+        updateLabel();
+    }
+
+    @Override
+    public void detach() {
+        super.detach();
+        stopUpdateThread();
+    }
+
+    private void stopUpdateThread() {
+        if (updateThread != null) {
+            updateThread.interrupt();
+            updateThread = null;
+        }
+    }
+
+    private void updateLabel() {
+        updatedFromBackround.setValue(String.valueOf(counter));
+    }
+
+    @Override
+    protected String getTestDescription() {
+        return "ProgressBar should work just as ProgressIndicator, just without the polling";
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return Integer.valueOf(11925);
+    }
+
+}
-- 
cgit v1.2.3


From a5b8209d928815aab9eee2151bdd00686a2b0ff7 Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Tue, 28 May 2013 19:52:21 +0300
Subject: Add primary style name support for ProgressBar/Indicator (#9913)

Change-Id: I3d773640d2f1c8cd1b71c673685afd7059811d16
---
 WebContent/VAADIN/themes/base/base.scss            |   5 +-
 .../themes/chameleon/components/components.scss    |   6 +-
 WebContent/VAADIN/themes/liferay/liferay.scss      |   4 +-
 WebContent/VAADIN/themes/reindeer/reindeer.scss    |   5 +-
 WebContent/VAADIN/themes/runo/runo.scss            |   6 +-
 client/src/com/vaadin/client/ui/VProgressBar.java  |  32 ++++--
 .../com/vaadin/client/ui/VProgressIndicator.java   |   6 +
 .../ui/progressindicator/ProgressBarState.java     |   4 +
 .../progressindicator/ProgressIndicatorState.java  |   6 +
 .../components/AbstractComponentTestCase.java      |   7 ++
 .../progressindicator/ProgressBarGenericTest.java  |  55 ++++++++++
 .../ProgressBarPrimaryStyleName.html               | 121 +++++++++++++++++++++
 12 files changed, 243 insertions(+), 14 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java
 create mode 100644 uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html

(limited to 'uitest/src')

diff --git a/WebContent/VAADIN/themes/base/base.scss b/WebContent/VAADIN/themes/base/base.scss
index 83e463fa00..514579830d 100644
--- a/WebContent/VAADIN/themes/base/base.scss
+++ b/WebContent/VAADIN/themes/base/base.scss
@@ -88,7 +88,10 @@ $line-height: normal;
 	@include base-orderedlayout;
 	@include base-panel;
 	@include base-popupview;
-	@include base-progressindicator;
+	@include base-progressindicator(v-progressbar);
+	/* For legacy ProgressIndicator component */
+	@include base-progressindicator(v-progressindicator);
+	
 	@include base-select;
 	@include base-shadow;
 	@include base-slider;
diff --git a/WebContent/VAADIN/themes/chameleon/components/components.scss b/WebContent/VAADIN/themes/chameleon/components/components.scss
index 9f29827de0..9c8a56b33d 100644
--- a/WebContent/VAADIN/themes/chameleon/components/components.scss
+++ b/WebContent/VAADIN/themes/chameleon/components/components.scss
@@ -29,7 +29,11 @@
 	@include chameleon-notification;
 	@include chameleon-panel;
 	@include chameleon-popupview;
-	@include chameleon-progressindicator;
+	
+	@include chameleon-progressindicator(v-progressbar);
+	/* For legacy ProgressIndicator component */
+	@include chameleon-progressindicator(v-progressindicator);
+	
 	@include chameleon-slider;
 	@include chameleon-splitpanel;
 	@include chameleon-table;
diff --git a/WebContent/VAADIN/themes/liferay/liferay.scss b/WebContent/VAADIN/themes/liferay/liferay.scss
index 7d7665ad86..273c065772 100644
--- a/WebContent/VAADIN/themes/liferay/liferay.scss
+++ b/WebContent/VAADIN/themes/liferay/liferay.scss
@@ -42,7 +42,9 @@
 	@include liferay-notification;
 	@include liferay-panel;
 	@include liferay-popupview;
-	@include liferay-progressindicator;
+	@include liferay-progressindicator(v-progressbar);
+	/* For legacy ProgressIndicator component */
+	@include liferay-progressindicator(v-progressindicator);
 	@include liferay-select;
 	@include liferay-slider;
 	@include liferay-splitpanel;
diff --git a/WebContent/VAADIN/themes/reindeer/reindeer.scss b/WebContent/VAADIN/themes/reindeer/reindeer.scss
index 3cf1c392e3..485839ecc7 100644
--- a/WebContent/VAADIN/themes/reindeer/reindeer.scss
+++ b/WebContent/VAADIN/themes/reindeer/reindeer.scss
@@ -56,7 +56,10 @@ $line-height: normal;
 	@include reindeer-notification;
 	@include reindeer-panel;
 	@include reindeer-popupview;
-	@include reindeer-progressindicator;
+	@include reindeer-progressindicator(v-progressbar);
+	/* For legacy ProgressIndicator component */
+	@include reindeer-progressindicator(v-progressindicator);
+	
 	@include reindeer-select;
 	@include reindeer-slider;
 	@include reindeer-splitpanel;
diff --git a/WebContent/VAADIN/themes/runo/runo.scss b/WebContent/VAADIN/themes/runo/runo.scss
index 6e88b14eb4..33ad35a8af 100644
--- a/WebContent/VAADIN/themes/runo/runo.scss
+++ b/WebContent/VAADIN/themes/runo/runo.scss
@@ -58,7 +58,11 @@ $line-height: 18px;
 	@include runo-orderedlayout;
 	@include runo-panel;
 	@include runo-popupview;
-	@include runo-progressindicator;
+	
+	@include runo-progressindicator(v-progressbar);
+	/* For legacy ProgressIndicator component */
+	@include runo-progressindicator(v-progressindicator);
+	
 	@include runo-select;
 	@include runo-shadow;
 	@include runo-slider;
diff --git a/client/src/com/vaadin/client/ui/VProgressBar.java b/client/src/com/vaadin/client/ui/VProgressBar.java
index 3eb8725520..8cfc28005c 100644
--- a/client/src/com/vaadin/client/ui/VProgressBar.java
+++ b/client/src/com/vaadin/client/ui/VProgressBar.java
@@ -21,6 +21,8 @@ import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.ui.HasEnabled;
 import com.google.gwt.user.client.ui.Widget;
+import com.vaadin.client.ApplicationConnection;
+import com.vaadin.shared.ui.progressindicator.ProgressBarState;
 
 /**
  * Widget for showing the current progress of a long running task.
@@ -35,26 +37,39 @@ import com.google.gwt.user.client.ui.Widget;
  */
 public class VProgressBar extends Widget implements HasEnabled {
 
-    public static final String CLASSNAME = "v-progressindicator";
     Element wrapper = DOM.createDiv();
     Element indicator = DOM.createDiv();
 
-    protected boolean indeterminate = false;
-    protected float state = 0.0f;
+    private boolean indeterminate = false;
+    private float state = 0.0f;
     private boolean enabled;
 
     public VProgressBar() {
         setElement(DOM.createDiv());
         getElement().appendChild(wrapper);
-        setStyleName(CLASSNAME);
         wrapper.appendChild(indicator);
-        indicator.setClassName(CLASSNAME + "-indicator");
-        wrapper.setClassName(CLASSNAME + "-wrapper");
+
+        setStylePrimaryName(ProgressBarState.PRIMARY_STYLE_NAME);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.google.gwt.user.client.ui.UIObject#setStylePrimaryName(java.lang.
+     * String)
+     */
+    @Override
+    public void setStylePrimaryName(String style) {
+        super.setStylePrimaryName(style);
+        indicator.setClassName(getStylePrimaryName() + "-indicator");
+        wrapper.setClassName(getStylePrimaryName() + "-wrapper");
+
     }
 
     public void setIndeterminate(boolean indeterminate) {
         this.indeterminate = indeterminate;
-        setStyleName(CLASSNAME + "-indeterminate", indeterminate);
+        setStyleName(getStylePrimaryName() + "-indeterminate", indeterminate);
     }
 
     public void setState(float state) {
@@ -78,8 +93,7 @@ public class VProgressBar extends Widget implements HasEnabled {
     @Override
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
-        setStyleName("v-disabled", !enabled);
-
+        setStyleName(ApplicationConnection.DISABLED_CLASSNAME, !enabled);
     }
 
 }
diff --git a/client/src/com/vaadin/client/ui/VProgressIndicator.java b/client/src/com/vaadin/client/ui/VProgressIndicator.java
index 500a5def30..c75113b5f4 100644
--- a/client/src/com/vaadin/client/ui/VProgressIndicator.java
+++ b/client/src/com/vaadin/client/ui/VProgressIndicator.java
@@ -16,6 +16,8 @@
 
 package com.vaadin.client.ui;
 
+import com.vaadin.shared.ui.progressindicator.ProgressIndicatorState;
+
 /**
  * 
  * @author Vaadin Ltd
@@ -25,4 +27,8 @@ package com.vaadin.client.ui;
 @Deprecated
 public class VProgressIndicator extends VProgressBar {
 
+    public VProgressIndicator() {
+        super();
+        setStylePrimaryName(ProgressIndicatorState.PRIMARY_STYLE_NAME);
+    }
 }
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
index fef1030c63..1cc8d7d9ae 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressBarState.java
@@ -26,7 +26,11 @@ import com.vaadin.shared.communication.SharedState;
  * @author Vaadin Ltd
  */
 public class ProgressBarState extends AbstractFieldState {
+    public static final String PRIMARY_STYLE_NAME = "v-progressbar";
 
+    {
+        primaryStyleName = PRIMARY_STYLE_NAME;
+    }
     public boolean indeterminate = false;
     public Float state = 0.0f;
 
diff --git a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
index f555476be8..2ca7627f4f 100644
--- a/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
+++ b/shared/src/com/vaadin/shared/ui/progressindicator/ProgressIndicatorState.java
@@ -17,5 +17,11 @@ package com.vaadin.shared.ui.progressindicator;
 
 @Deprecated
 public class ProgressIndicatorState extends ProgressBarState {
+    public static final String PRIMARY_STYLE_NAME = "v-progressindicator";
+
+    {
+        primaryStyleName = PRIMARY_STYLE_NAME;
+    }
+
     public int pollingInterval = 1000;
 }
diff --git a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java
index 81ec4a9da4..8666956bdb 100644
--- a/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java
+++ b/uitest/src/com/vaadin/tests/components/AbstractComponentTestCase.java
@@ -226,6 +226,13 @@ public abstract class AbstractComponentTestCase<T extends AbstractComponent>
         }
     };
 
+    protected Command<T, String> primaryStyleNameCommand = new Command<T, String>() {
+        @Override
+        public void execute(T c, String value, Object data) {
+            c.setPrimaryStyleName(value);
+        }
+    };
+
     @Override
     protected String getDescription() {
         return "Generic test case for " + getTestClass().getSimpleName();
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java
new file mode 100644
index 0000000000..79797c60a2
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarGenericTest.java
@@ -0,0 +1,55 @@
+package com.vaadin.tests.components.progressindicator;
+
+import java.util.LinkedHashMap;
+
+import com.vaadin.tests.components.abstractfield.AbstractFieldTest;
+import com.vaadin.ui.ProgressBar;
+
+public class ProgressBarGenericTest extends AbstractFieldTest<ProgressBar> {
+
+    private Command<ProgressBar, Boolean> indeterminate = new Command<ProgressBar, Boolean>() {
+
+        @Override
+        public void execute(ProgressBar c, Boolean value, Object data) {
+            c.setIndeterminate(value);
+        }
+    };
+
+    @Override
+    protected Class<ProgressBar> getTestClass() {
+        return ProgressBar.class;
+    }
+
+    @Override
+    protected void createActions() {
+        super.createActions();
+        createBooleanAction("Indeterminate", CATEGORY_FEATURES, false,
+                indeterminate, null);
+        createValueSelection(CATEGORY_FEATURES);
+        createPrimaryStyleNameSelect();
+    }
+
+    /**
+     * @since
+     */
+    protected void createPrimaryStyleNameSelect() {
+        LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
+        String primaryStyle = getComponent().getPrimaryStyleName();
+        options.put(primaryStyle, primaryStyle);
+        options.put(primaryStyle + "-foo", primaryStyle + "-foo");
+        options.put("foo", "foo");
+        createSelectAction("Primary style name", CATEGORY_DECORATIONS, options,
+                primaryStyle, primaryStyleNameCommand);
+
+    }
+
+    private void createValueSelection(String categorySelection) {
+        LinkedHashMap<String, Object> options = new LinkedHashMap<String, Object>();
+        options.put("null", null);
+        for (float f = 0; f <= 1; f += 0.1) {
+            options.put("" + f, f);
+        }
+        createSelectAction("Value", categorySelection, options, null,
+                setValueCommand);
+    }
+}
diff --git a/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html
new file mode 100644
index 0000000000..92f678947a
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/progressindicator/ProgressBarPrimaryStyleName.html
@@ -0,0 +1,121 @@
+<?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.progressindicator.ProgressBarGenericTest?restartApplication</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td>
+	<td>v-progressbar</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td>
+	<td>v-progressbar-wrapper</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td>
+	<td>v-progressbar-indicator</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td>
+	<td>36,8</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td>
+	<td>45,4</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td>
+	<td>67,10</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item2</td>
+	<td>37,7</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td>
+	<td>v-progressbar</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td>
+	<td>foo</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td>
+	<td>v-progressbar-wrapper</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td>
+	<td>foo-wrapper</td>
+</tr>
+<tr>
+	<td>assertNotCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td>
+	<td>v-progressbar-indicator</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td>
+	<td>foo-indicator</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_Smenu#item0</td>
+	<td>20,13</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[0]/VMenuBar[0]#item1</td>
+	<td>34,11</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[1]/VMenuBar[0]#item6</td>
+	<td>51,4</td>
+</tr>
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::Root/VOverlay[2]/VMenuBar[0]#item0</td>
+	<td>38,6</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent</td>
+	<td>v-progressbar</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]</td>
+	<td>v-progressbar-wrapper</td>
+</tr>
+<tr>
+	<td>assertCSSClass</td>
+	<td>vaadin=runcomvaadintestscomponentsprogressindicatorProgressBarGenericTest::PID_StestComponent/domChild[0]/domChild[0]</td>
+	<td>v-progressbar-indicator</td>
+</tr>
+</tbody></table>
+</body>
+</html>
-- 
cgit v1.2.3


From 9a3dc4e99c7a417778342db83cd6e7c05558e5fb Mon Sep 17 00:00:00 2001
From: Artur Signell <artur@vaadin.com>
Date: Thu, 30 May 2013 17:06:30 +0300
Subject: Formatted XML files using defined rules (#11956)

Change-Id: Iecd621321fdde29d2d89d910ba46e9dadee58995
---
 WebContent/WEB-INF/liferay-display.xml             |    2 +-
 WebContent/WEB-INF/liferay-portlet.xml             |    6 +-
 WebContent/WEB-INF/portlet.xml                     |  116 +-
 WebContent/WEB-INF/web.xml                         |  232 ++--
 all/build.xml                                      |  249 +++--
 all/ivy.xml                                        |   17 +-
 build.xml                                          |  131 +--
 build/common.xml                                   |   80 +-
 build/ide.xml                                      |  311 +++---
 buildhelpers/build.xml                             |   93 +-
 buildhelpers/ivy.xml                               |    2 +-
 client-compiled/build.xml                          |  280 ++---
 client-compiled/ivy.xml                            |    4 +-
 client-compiler/build.xml                          |  108 +-
 client-compiler/ivy.xml                            |  106 +-
 client/build.xml                                   |  117 +-
 client/src/com/vaadin/DefaultWidgetSet.gwt.xml     |   14 +-
 client/src/com/vaadin/Vaadin.gwt.xml               |   25 +-
 .../vaadin/VaadinBrowserSpecificOverrides.gwt.xml  |  101 +-
 common.xml                                         |  875 ++++++++-------
 gwt-files.xml                                      |  370 ++++---
 ivy-taskdefs.xml                                   |   38 +-
 ivysettings.xml                                    |    3 +-
 publish.xml                                        |  127 ++-
 push/build.xml                                     |  131 ++-
 push/ivy.xml                                       |   17 +-
 server/build.xml                                   |  113 +-
 server/ivy.xml                                     |   12 +-
 shared/build.xml                                   |  106 +-
 theme-compiler/build.xml                           |  114 +-
 themes/build.xml                                   |  214 ++--
 themes/ivy.xml                                     |    4 +-
 uitest/build.xml                                   |  301 ++---
 uitest/integration_base_files/base.xml             |  253 ++---
 uitest/integration_tests.xml                       | 1169 +++++++++++---------
 uitest/ivy.xml                                     |   10 +-
 .../tests/widgetset/TestingWidgetSet.gwt.xml       |   15 +-
 uitest/test.xml                                    |  412 +++----
 uitest/vaadin-server.xml                           |   58 +-
 39 files changed, 3327 insertions(+), 3009 deletions(-)

(limited to 'uitest/src')

diff --git a/WebContent/WEB-INF/liferay-display.xml b/WebContent/WEB-INF/liferay-display.xml
index 12a8e4315b..014ed31b47 100644
--- a/WebContent/WEB-INF/liferay-display.xml
+++ b/WebContent/WEB-INF/liferay-display.xml
@@ -4,6 +4,6 @@
 <display>
     <category name="Vaadin">
         <portlet id="JSR286TestPortlet" />
-        <portlet id="Vaadin Liferay Theme Portlet"/>
+        <portlet id="Vaadin Liferay Theme Portlet" />
     </category>
 </display>
\ No newline at end of file
diff --git a/WebContent/WEB-INF/liferay-portlet.xml b/WebContent/WEB-INF/liferay-portlet.xml
index 5a8d6fac8e..ea060ce44a 100644
--- a/WebContent/WEB-INF/liferay-portlet.xml
+++ b/WebContent/WEB-INF/liferay-portlet.xml
@@ -4,7 +4,7 @@
 <liferay-portlet-app>
     <portlet>
         <portlet-name>JSR286TestPortlet</portlet-name>
-        <instanceable>false</instanceable>       
+        <instanceable>false</instanceable>
         <ajaxable>false</ajaxable>
     </portlet>
     <portlet>
@@ -12,7 +12,7 @@
         <instanceable>false</instanceable>
         <ajaxable>false</ajaxable>
     </portlet>
-    
+
     <role-mapper>
         <role-name>administrator</role-name>
         <role-link>Administrator</role-link>
@@ -29,5 +29,5 @@
         <role-name>user</role-name>
         <role-link>User</role-link>
     </role-mapper>
-    
+
 </liferay-portlet-app>
\ No newline at end of file
diff --git a/WebContent/WEB-INF/portlet.xml b/WebContent/WEB-INF/portlet.xml
index 45ce1eee83..3a603c43ae 100644
--- a/WebContent/WEB-INF/portlet.xml
+++ b/WebContent/WEB-INF/portlet.xml
@@ -1,85 +1,79 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
-	version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
+    version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
 
-	<portlet>
-		<portlet-name>JSR286TestPortlet</portlet-name>
-		<display-name>Vaadin Portlet 2.0 Test</display-name>
-		<portlet-class>com.vaadin.server.VaadinPortlet</portlet-class>
-		<init-param>
-			<name>ui</name>
-			<value>com.vaadin.tests.integration.JSR286Portlet</value>
-		</init-param>
-		<init-param>
-			<name>widgetset</name>
-			<value>com.vaadin.DefaultWidgetSet</value>
-		</init-param>
-		<supports>
-			<mime-type>text/html</mime-type>
-			<portlet-mode>view</portlet-mode>
-			<portlet-mode>edit</portlet-mode>
-			<portlet-mode>help</portlet-mode>
-		</supports>
-		<portlet-info>
-			<title>Vaadin Portlet 2.0 Test</title>
-			<short-title>Vaadin Portlet 2.0 Test</short-title>
-		</portlet-info>
+    <portlet>
+        <portlet-name>JSR286TestPortlet</portlet-name>
+        <display-name>Vaadin Portlet 2.0 Test</display-name>
+        <portlet-class>com.vaadin.server.VaadinPortlet</portlet-class>
+        <init-param>
+            <name>ui</name>
+            <value>com.vaadin.tests.integration.JSR286Portlet</value>
+        </init-param>
+        <init-param>
+            <name>widgetset</name>
+            <value>com.vaadin.DefaultWidgetSet</value>
+        </init-param>
+        <supports>
+            <mime-type>text/html</mime-type>
+            <portlet-mode>view</portlet-mode>
+            <portlet-mode>edit</portlet-mode>
+            <portlet-mode>help</portlet-mode>
+        </supports>
+        <portlet-info>
+            <title>Vaadin Portlet 2.0 Test</title>
+            <short-title>Vaadin Portlet 2.0 Test</short-title>
+        </portlet-info>
 
-		<security-role-ref>
-			<role-name>administrator</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>guest</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>power-user</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>user</role-name>
-		</security-role-ref>
-	</portlet>
+        <security-role-ref>
+            <role-name>administrator</role-name>
+        </security-role-ref>
+        <security-role-ref>
+            <role-name>guest</role-name>
+        </security-role-ref>
+        <security-role-ref>
+            <role-name>power-user</role-name>
+        </security-role-ref>
+        <security-role-ref>
+            <role-name>user</role-name>
+        </security-role-ref>
+    </portlet>
 
-	<portlet>
+    <portlet>
         <portlet-name>Vaadin Liferay Theme Portlet</portlet-name>
         <display-name>Vaadin Liferay Theme</display-name>
-        
+
         <portlet-class>com.vaadin.server.LegacyVaadinPortlet</portlet-class>
         <init-param>
             <name>application</name>
             <value>com.vaadin.tests.integration.LiferayThemeDemo</value>
         </init-param>
-        
+
         <supports>
             <mime-type>text/html</mime-type>
             <portlet-mode>view</portlet-mode>
         </supports>
-        
+
         <portlet-info>
             <title>Vaadin Liferay Theme</title>
             <short-title>Vaadin Liferay Theme</short-title>
         </portlet-info>
-        
+
+        <security-role-ref>
+            <role-name>administrator</role-name>
+        </security-role-ref>
+        <security-role-ref>
+            <role-name>guest</role-name>
+        </security-role-ref>
         <security-role-ref>
-			<role-name>administrator</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>guest</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>power-user</role-name>
-		</security-role-ref>
-		<security-role-ref>
-			<role-name>user</role-name>
-		</security-role-ref>
+            <role-name>power-user</role-name>
+        </security-role-ref>
+        <security-role-ref>
+            <role-name>user</role-name>
+        </security-role-ref>
     </portlet>
 
-	<!--
-		This can be used to work around an issue in liferay 5.0-5.1.1
-
-		<container-runtime-option>
-			<name>javax.portlet.escapeXml</name>
-			<value>false</value>
-		</container-runtime-option>
-	-->
+    <!-- This can be used to work around an issue in liferay 5.0-5.1.1 <container-runtime-option> 
+        <name>javax.portlet.escapeXml</name> <value>false</value> </container-runtime-option> -->
 </portlet-app>
\ No newline at end of file
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 848baea318..ba948968e2 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -1,134 +1,134 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <web-app id="vaadin-uitest" version="3.0"
-	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 
-	<!-- THIS IS A DEVELOPMENT AND TESTING web.xml . -->
+    <!-- THIS IS A DEVELOPMENT AND TESTING web.xml . -->
 
-	<display-name>Vaadin</display-name>
-	<description>Vaadin examples</description>
+    <display-name>Vaadin</display-name>
+    <description>Vaadin examples</description>
 
-	<context-param>
-		<param-name>productionMode</param-name>
-		<param-value>false</param-value>
-	</context-param>
+    <context-param>
+        <param-name>productionMode</param-name>
+        <param-value>false</param-value>
+    </context-param>
 
-	<context-param>
-		<param-name>resourceCacheTime</param-name>
-		<param-value>3600</param-value>
-	</context-param>
-	<servlet>
-		<servlet-name>Embed App 1</servlet-name>
-		<servlet-class>com.vaadin.server.LegacyVaadinServlet</servlet-class>
-		<init-param>
-			<param-name>application</param-name>
-			<param-value>com.vaadin.tests.components.button.Buttons</param-value>
-		</init-param>
-	</servlet>
-	<servlet>
-		<servlet-name>Embed App 2</servlet-name>
-		<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
-		<init-param>
-			<param-name>UI</param-name>
-			<param-value>com.vaadin.tests.components.label.MarginsInLabels</param-value>
-		</init-param>
-	</servlet>
-	<servlet>
-		<servlet-name>UI provider app</servlet-name>
-		<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
-		<init-param>
-			<param-name>UIProvider</param-name>
-			<param-value>com.vaadin.tests.applicationservlet.InitParamUIProvider</param-value>
-		</init-param>
-		<init-param>
-			<param-name>UI</param-name>
-			<param-value>com.vaadin.tests.VerifyAssertionsEnabled</param-value>
-		</init-param>
-	</servlet>
+    <context-param>
+        <param-name>resourceCacheTime</param-name>
+        <param-value>3600</param-value>
+    </context-param>
+    <servlet>
+        <servlet-name>Embed App 1</servlet-name>
+        <servlet-class>com.vaadin.server.LegacyVaadinServlet</servlet-class>
+        <init-param>
+            <param-name>application</param-name>
+            <param-value>com.vaadin.tests.components.button.Buttons</param-value>
+        </init-param>
+    </servlet>
+    <servlet>
+        <servlet-name>Embed App 2</servlet-name>
+        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
+        <init-param>
+            <param-name>UI</param-name>
+            <param-value>com.vaadin.tests.components.label.MarginsInLabels</param-value>
+        </init-param>
+    </servlet>
+    <servlet>
+        <servlet-name>UI provider app</servlet-name>
+        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
+        <init-param>
+            <param-name>UIProvider</param-name>
+            <param-value>com.vaadin.tests.applicationservlet.InitParamUIProvider</param-value>
+        </init-param>
+        <init-param>
+            <param-name>UI</param-name>
+            <param-value>com.vaadin.tests.VerifyAssertionsEnabled</param-value>
+        </init-param>
+    </servlet>
 
-	<servlet>
-		<servlet-name>VaadinApplicationRunner</servlet-name>
-		<servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
-		<!-- Non-default values for testing purposes -->
-		<init-param>
-			<param-name>legacyPropertyToString</param-name>
-			<param-value>false</param-value>
-		</init-param>
-		<init-param>
-			<param-name>heartbeatInterval</param-name>
-			<param-value>301</param-value>
-		</init-param>
-		<init-param>
-			<param-name>resourceCacheTime</param-name>
-			<param-value>3601</param-value>
-		</init-param>
-		<init-param>
-			<param-name>closeIdleSessions</param-name>
-			<param-value>true</param-value>
-		</init-param>
-		<init-param>
-			<param-name>testParam</param-name>
-			<param-value>42</param-value>
-		</init-param>
-	</servlet>
+    <servlet>
+        <servlet-name>VaadinApplicationRunner</servlet-name>
+        <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
+        <!-- Non-default values for testing purposes -->
+        <init-param>
+            <param-name>legacyPropertyToString</param-name>
+            <param-value>false</param-value>
+        </init-param>
+        <init-param>
+            <param-name>heartbeatInterval</param-name>
+            <param-value>301</param-value>
+        </init-param>
+        <init-param>
+            <param-name>resourceCacheTime</param-name>
+            <param-value>3601</param-value>
+        </init-param>
+        <init-param>
+            <param-name>closeIdleSessions</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <init-param>
+            <param-name>testParam</param-name>
+            <param-value>42</param-value>
+        </init-param>
+    </servlet>
 
-	<servlet>
-		<servlet-name>VaadinApplicationRunnerWithPush</servlet-name>
-		<servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
-		<init-param>
-			<param-name>pushmode</param-name>
-			<param-value>automatic</param-value>
-		</init-param>
-		<async-supported>true</async-supported>
-	</servlet>
+    <servlet>
+        <servlet-name>VaadinApplicationRunnerWithPush</servlet-name>
+        <servlet-class>com.vaadin.launcher.ApplicationRunnerServlet</servlet-class>
+        <init-param>
+            <param-name>pushmode</param-name>
+            <param-value>automatic</param-value>
+        </init-param>
+        <async-supported>true</async-supported>
+    </servlet>
 
-	<!-- For testing GAE - the deployment script changes this to use GAEVaadinServlet -->
-	<servlet>
-		<servlet-name>IntegrationTest</servlet-name>
-		<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
-		<init-param>
-			<param-name>UI</param-name>
-			<param-value>com.vaadin.tests.integration.IntegrationTestUI</param-value>
-		</init-param>
-		<async-supported>true</async-supported>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>Embed App 1</servlet-name>
-		<url-pattern>/embed1/*</url-pattern>
-	</servlet-mapping>
+    <!-- For testing GAE - the deployment script changes this to use GAEVaadinServlet -->
+    <servlet>
+        <servlet-name>IntegrationTest</servlet-name>
+        <servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
+        <init-param>
+            <param-name>UI</param-name>
+            <param-value>com.vaadin.tests.integration.IntegrationTestUI</param-value>
+        </init-param>
+        <async-supported>true</async-supported>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Embed App 1</servlet-name>
+        <url-pattern>/embed1/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>Embed App 2</servlet-name>
-		<url-pattern>/embed2/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>Embed App 2</servlet-name>
+        <url-pattern>/embed2/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>UI provider app</servlet-name>
-		<url-pattern>/uiprovider/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>UI provider app</servlet-name>
+        <url-pattern>/uiprovider/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>VaadinApplicationRunner</servlet-name>
-		<url-pattern>/run/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>VaadinApplicationRunner</servlet-name>
+        <url-pattern>/run/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>VaadinApplicationRunnerWithPush</servlet-name>
-		<url-pattern>/run-push/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>VaadinApplicationRunnerWithPush</servlet-name>
+        <url-pattern>/run-push/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>IntegrationTest</servlet-name>
-		<url-pattern>/integration/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>IntegrationTest</servlet-name>
+        <url-pattern>/integration/*</url-pattern>
+    </servlet-mapping>
 
-	<servlet-mapping>
-		<servlet-name>IntegrationTest</servlet-name>
-		<url-pattern>/VAADIN/*</url-pattern>
-	</servlet-mapping>
+    <servlet-mapping>
+        <servlet-name>IntegrationTest</servlet-name>
+        <url-pattern>/VAADIN/*</url-pattern>
+    </servlet-mapping>
 
-	<welcome-file-list>
-		<welcome-file>index.html</welcome-file>
-	</welcome-file-list>
+    <welcome-file-list>
+        <welcome-file>index.html</welcome-file>
+    </welcome-file-list>
 
 </web-app>
diff --git a/all/build.xml b/all/build.xml
index 4e1a557e53..a83d60b382 100644
--- a/all/build.xml
+++ b/all/build.xml
@@ -1,120 +1,137 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-all" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib">
-	<description>
-		Compiles a zip containing all jars + dependencies
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-all" />
-	<property name="result.dir" value="result" />
-	<property name="javadoc.jar" location="${result.dir}/lib/vaadin-all-${vaadin.version}-javadoc.jar" />
-	<property name="temp.dir" location="${result.dir}/temp" />
-	<property name="temp.deps.dir" value="${temp.dir}/lib" />
-	<property name="javadoc.temp.dir" location="${result.dir}/javadoc-temp" />
-	<property name="zip.file" location="${result.dir}/lib/${module.name}-${vaadin.version}.zip" />
-
-	<path id="classpath.javadoc">
-		<fileset dir="${temp.deps.dir}" includes="*.jar">
-		</fileset>
-	</path>
-	<target name="fetch.module.and.dependencies">
-		<fail unless="module" message="No 'module' parameter given" />
-
-		<ivy:cachepath pathid="module.and.deps" inline="true" organisation="com.vaadin" module="vaadin-${module}" revision="${vaadin.version}" />
-		<copy todir="${temp.dir}" flatten="true">
-			<path refid="module.and.deps" />
-		</copy>
-	</target>
-
-	<target name="unzip.to.javadoctemp">
-		<property name="file" location="${temp.dir}/vaadin-${module}-${vaadin.version}.jar" />
-		<unzip src="${file}" dest="${javadoc.temp.dir}" />
-	</target>
-
-	<target name="javadoc" depends="copy-jars">
-		<!-- Ensure filtered webcontent files are available -->
-		<antcall target="common.filter.webcontent" />
-
-		<!-- Unpack all source files to javadoc.temp.dir-->
-		<antcontrib:foreach list="${modules.to.publish.to.maven}" target="unzip.to.javadoctemp" param="module" />
-
-		<property name="javadoc.dir" location="${result.dir}/javadoc" />
-		<property name="title" value="Vaadin ${vaadin.version} API" />
-		<javadoc maxmemory="1024m" destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${title}" encoding="utf-8">
-			<packageset dir="${javadoc.temp.dir}">
-				<!-- TODO Javadoc throws ClassCastException if this is included (#9660)-->
-				<exclude name="com/google/gwt/uibinder/elementparsers" />
-			</packageset>
-			<doctitle>&lt;h1>${title}&lt;/h1></doctitle>
-			<!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
-			<bottom>${javadoc.bottom}</bottom>
-			<link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" />
-			<link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
-			<classpath refid="classpath.javadoc" />
-		</javadoc>
-
-		<!-- Create a javadoc jar -->
-		<jar file="${javadoc.jar}" compress="true">
-			<fileset dir="${javadoc.dir}" />
-			<fileset refid="common.files.for.all.jars" />
-		</jar>
-
-
-	</target>
-
-	<target name="copy-jars">
-		<delete dir="${temp.dir}" />
-		<antcontrib:foreach list="${modules.to.publish.to.maven}" target="fetch.module.and.dependencies" param="module" />
-		<!-- All jars are now in temp.dir. Still need to separate vaadin and deps -->
-		<move todir="${temp.deps.dir}">
-			<fileset dir="${temp.dir}">
-				<exclude name="vaadin-*-${vaadin.version}.*" />
-				<exclude name="vaadin-*-${vaadin.version}-*.*" />
-			</fileset>
-		</move>
-
-
-	</target>
-	<target name="zip" depends="copy-jars, javadoc">
-		<!-- Ensure filtered webcontent files are available -->
-		<antcall target="common.filter.webcontent" />
-
-		<zip destfile="${zip.file}">
-			<fileset dir="${temp.dir}">
-				<!-- Avoid conflicts with servlet and portlet API. They are provided by the container -->
-				<exclude name="**/servlet-api*" />
-				<exclude name="**/portlet-api*" />
-				<!-- Buildhelpers should not even get here ... -->
-				<exclude name="*buildhelpers*" />
-				<!-- Zip users should not need javadoc, sources or pom files -->
-				<exclude name="*.pom" />
-				<exclude name="*-javadoc.jar" />
-				<exclude name="*-sources.jar" />
-
-			</fileset>
-			<fileset refid="common.files.for.all.jars" />
-			<fileset dir="${result.dir}/..">
-				<include name="README.TXT" />
-			</fileset>
-			<!-- Do not include javadoc jar in zip as it is huge (> 40MB) and most people do not need it. -->
-		</zip>
-	</target>
-
-	<target name="publish-local" depends="zip">
-		<antcall target="common.publish-local" />
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-	<target name="checkstyle">
-		<!-- Checkstyle is handled by all separate modules -->
-	</target>
-	<target name="test" depends="checkstyle">
-		<!-- No tests for this zip.. -->
-	</target>
+<project name="vaadin-all" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib">
+    <description>
+        Compiles a zip containing all jars + dependencies
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-all" />
+    <property name="result.dir" value="result" />
+    <property name="javadoc.jar"
+        location="${result.dir}/lib/vaadin-all-${vaadin.version}-javadoc.jar" />
+    <property name="temp.dir" location="${result.dir}/temp" />
+    <property name="temp.deps.dir" value="${temp.dir}/lib" />
+    <property name="javadoc.temp.dir" location="${result.dir}/javadoc-temp" />
+    <property name="zip.file"
+        location="${result.dir}/lib/${module.name}-${vaadin.version}.zip" />
+
+    <path id="classpath.javadoc">
+        <fileset dir="${temp.deps.dir}" includes="*.jar">
+        </fileset>
+    </path>
+    <target name="fetch.module.and.dependencies">
+        <fail unless="module" message="No 'module' parameter given" />
+
+        <ivy:cachepath pathid="module.and.deps" inline="true"
+            organisation="com.vaadin" module="vaadin-${module}"
+            revision="${vaadin.version}" />
+        <copy todir="${temp.dir}" flatten="true">
+            <path refid="module.and.deps" />
+        </copy>
+    </target>
+
+    <target name="unzip.to.javadoctemp">
+        <property name="file"
+            location="${temp.dir}/vaadin-${module}-${vaadin.version}.jar" />
+        <unzip src="${file}" dest="${javadoc.temp.dir}" />
+    </target>
+
+    <target name="javadoc" depends="copy-jars">
+        <!-- Ensure filtered webcontent files are available -->
+        <antcall target="common.filter.webcontent" />
+
+        <!-- Unpack all source files to javadoc.temp.dir -->
+        <antcontrib:foreach list="${modules.to.publish.to.maven}"
+            target="unzip.to.javadoctemp" param="module" />
+
+        <property name="javadoc.dir" location="${result.dir}/javadoc" />
+        <property name="title" value="Vaadin ${vaadin.version} API" />
+        <javadoc maxmemory="1024m" destdir="${javadoc.dir}"
+            author="true" version="true" use="true" windowtitle="${title}"
+            encoding="utf-8">
+            <packageset dir="${javadoc.temp.dir}">
+                <!-- TODO Javadoc throws ClassCastException if this is included 
+                    (#9660) -->
+                <exclude name="com/google/gwt/uibinder/elementparsers" />
+            </packageset>
+            <doctitle>&lt;h1>${title}&lt;/h1></doctitle>
+            <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
+            <bottom>${javadoc.bottom}</bottom>
+            <link offline="true"
+                href="http://docs.oracle.com/javase/6/docs/api/"
+                packagelistLoc="build/javadoc/j2se-1.6.0" />
+            <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/"
+                packagelistLoc="build/javadoc/j2ee-1.4" />
+            <classpath refid="classpath.javadoc" />
+        </javadoc>
+
+        <!-- Create a javadoc jar -->
+        <jar file="${javadoc.jar}" compress="true">
+            <fileset dir="${javadoc.dir}" />
+            <fileset refid="common.files.for.all.jars" />
+        </jar>
+
+
+    </target>
+
+    <target name="copy-jars">
+        <delete dir="${temp.dir}" />
+        <antcontrib:foreach list="${modules.to.publish.to.maven}"
+            target="fetch.module.and.dependencies" param="module" />
+        <!-- All jars are now in temp.dir. Still need to separate vaadin 
+            and deps -->
+        <move todir="${temp.deps.dir}">
+            <fileset dir="${temp.dir}">
+                <exclude name="vaadin-*-${vaadin.version}.*" />
+                <exclude name="vaadin-*-${vaadin.version}-*.*" />
+            </fileset>
+        </move>
+
+
+    </target>
+    <target name="zip" depends="copy-jars, javadoc">
+        <!-- Ensure filtered webcontent files are available -->
+        <antcall target="common.filter.webcontent" />
+
+        <zip destfile="${zip.file}">
+            <fileset dir="${temp.dir}">
+                <!-- Avoid conflicts with servlet and portlet API. They are 
+                    provided by the container -->
+                <exclude name="**/servlet-api*" />
+                <exclude name="**/portlet-api*" />
+                <!-- Buildhelpers should not even get here ... -->
+                <exclude name="*buildhelpers*" />
+                <!-- Zip users should not need javadoc, sources or pom files -->
+                <exclude name="*.pom" />
+                <exclude name="*-javadoc.jar" />
+                <exclude name="*-sources.jar" />
+
+            </fileset>
+            <fileset refid="common.files.for.all.jars" />
+            <fileset dir="${result.dir}/..">
+                <include name="README.TXT" />
+            </fileset>
+            <!-- Do not include javadoc jar in zip as it is huge (> 40MB) 
+                and most people do not need it. -->
+        </zip>
+    </target>
+
+    <target name="publish-local" depends="zip">
+        <antcall target="common.publish-local" />
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+    <target name="checkstyle">
+        <!-- Checkstyle is handled by all separate modules -->
+    </target>
+    <target name="test" depends="checkstyle">
+        <!-- No tests for this zip.. -->
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/all/ivy.xml b/all/ivy.xml
index 2b212f6675..3c49e9a884 100644
--- a/all/ivy.xml
+++ b/all/ivy.xml
@@ -19,21 +19,20 @@
         <!-- LIBRARY DEPENDENCIES (compile time) -->
         <!-- Project modules -->
         <dependency org="com.vaadin" name="vaadin-shared"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-server"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-client"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-client-compiler"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-theme-compiler"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-themes"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
         <dependency org="com.vaadin" name="vaadin-client-compiled"
-            rev="${vaadin.version}"/>
-        <dependency org="com.vaadin" name="vaadin-push"
-            rev="${vaadin.version}"/>
+            rev="${vaadin.version}" />
+        <dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}" />
 
     </dependencies>
 
diff --git a/build.xml b/build.xml
index 37e4afd03b..192d034b9b 100644
--- a/build.xml
+++ b/build.xml
@@ -1,71 +1,78 @@
 <?xml version="1.0"?>
 
-<project name="vaadin" basedir="." default="package" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<include file="common.xml" as="common" />
+<project name="vaadin" basedir="." default="package"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <include file="common.xml" as="common" />
 
-	<path id="vaadin.buildhelpers.classpath" location="${vaadin.basedir}/buildhelpers/result/classes" />
+    <path id="vaadin.buildhelpers.classpath" location="${vaadin.basedir}/buildhelpers/result/classes" />
 
-	<!-- ================================= 
-          target: all              
-         ================================= -->
-	<!--<target name="all" description="Compiles all parts of the project" depends="buildhelpers,theme-compiler,shared,server,client">-->
-	<target name="package" description="Compiles and packages all modules in the project" depends="buildorder">
-		<subant buildpathref="build-path" target="publish-local">
-		</subant>
-	</target>
+    <!-- ================================= target: all ================================= -->
+    <!--<target name="all" description="Compiles all parts of the project" 
+        depends="buildhelpers,theme-compiler,shared,server,client"> -->
+    <target name="package"
+        description="Compiles and packages all modules in the project"
+        depends="buildorder">
+        <subant buildpathref="build-path" target="publish-local">
+        </subant>
+    </target>
 
-	<target name="buildorder" depends="official.build.checks">
-		<!-- Find out a good build order -->
-		<ivy:buildlist reference="ivy.build.path">
-			<fileset dir="." includes="**/build.xml">
-				<exclude name="build.xml" />
-				<exclude name="build/**" />
-				<exclude name="buildhelpers/**" />
-			</fileset>
-		</ivy:buildlist>
-		<path id="build-path">
-			<path location="buildhelpers/build.xml"/>
-			<path refid="ivy.build.path" />
-		</path>
-	</target>
-	<target name="clean" depends="buildorder">
-		<subant buildpathref="build-path" target="clean">
-		</subant>
-		<delete dir="result" />
-		<!-- Clean IVY cache (~/.ivy2) so no old artifacts are fetched from there (leave everything but Vaadin artifacts) -->
-		<delete dir="${ivy.cache.dir}/com.vaadin" />
-		<delete dir="${ivy.cache.dir}/com.carrotsearch" />
+    <target name="buildorder" depends="official.build.checks">
+        <!-- Find out a good build order -->
+        <ivy:buildlist reference="ivy.build.path">
+            <fileset dir="." includes="**/build.xml">
+                <exclude name="build.xml" />
+                <exclude name="build/**" />
+                <exclude name="buildhelpers/**" />
+            </fileset>
+        </ivy:buildlist>
+        <path id="build-path">
+            <path location="buildhelpers/build.xml" />
+            <path refid="ivy.build.path" />
+        </path>
+    </target>
+    <target name="clean" depends="buildorder">
+        <subant buildpathref="build-path" target="clean">
+        </subant>
+        <delete dir="result" />
+        <!-- Clean IVY cache (~/.ivy2) so no old artifacts are fetched from 
+            there (leave everything but Vaadin artifacts) -->
+        <delete dir="${ivy.cache.dir}/com.vaadin" />
+        <delete dir="${ivy.cache.dir}/com.carrotsearch" />
 
-	</target>
-	<target name="checkstyle" depends="buildorder">
-		<subant buildpathref="build-path" target="checkstyle"/>
-	</target>
-	<target name="test" depends="buildorder">
-		<subant buildpathref="build-path" target="test" />
-	</target>
-	<target name="test-all" depends="buildorder">
-		<property name="war.file" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
-		<parallel>
-			<sequential>
-				<!-- Sleep before running integration tests so testbench tests have time to compile and start -->
-				<sleep minutes="4" />
-				<ant antfile="uitest/integration_tests.xml" target="integration-test-all" inheritall="false" inheritrefs="false">
-					<property name="demo.war" value="${war.file}" />
-				</ant>
-			</sequential>
-			<subant buildpathref="build-path" target="test" />
-			<ant antfile="uitest/test.xml" target="test-package">
-				<property name="war.file" location="${war.file}" />
-			</ant>
-		</parallel>
-	</target>
+    </target>
+    <target name="checkstyle" depends="buildorder">
+        <subant buildpathref="build-path" target="checkstyle" />
+    </target>
+    <target name="test" depends="buildorder">
+        <subant buildpathref="build-path" target="test" />
+    </target>
+    <target name="test-all" depends="buildorder">
+        <property name="war.file"
+            location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${vaadin.version}.war" />
+        <parallel>
+            <sequential>
+                <!-- Sleep before running integration tests so testbench 
+                    tests have time to compile and start -->
+                <sleep minutes="4" />
+                <ant antfile="uitest/integration_tests.xml" target="integration-test-all"
+                    inheritall="false" inheritrefs="false">
+                    <property name="demo.war" value="${war.file}" />
+                </ant>
+            </sequential>
+            <subant buildpathref="build-path" target="test" />
+            <ant antfile="uitest/test.xml" target="test-package">
+                <property name="war.file" location="${war.file}" />
+            </ant>
+        </parallel>
+    </target>
 
-	<target name="official.build.checks" if="build.release">
-		<condition property="java.version.matches">
-			<equals arg1="${ant.java.version}" arg2="${vaadin.java.version}" />
-		</condition>
-		<fail unless="java.version.matches" message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java ${vaadin.java.version} compiler." />
-		<echo>Java version is ${ant.java.version} as required.</echo>
-	</target>
+    <target name="official.build.checks" if="build.release">
+        <condition property="java.version.matches">
+            <equals arg1="${ant.java.version}" arg2="${vaadin.java.version}" />
+        </condition>
+        <fail unless="java.version.matches"
+            message="Java version is ${ant.java.version}, but Vaadin must be compiled with genuine Java ${vaadin.java.version} compiler." />
+        <echo>Java version is ${ant.java.version} as required.</echo>
+    </target>
 
 </project>
diff --git a/build/common.xml b/build/common.xml
index 1fc6349a46..ee60c1ff42 100644
--- a/build/common.xml
+++ b/build/common.xml
@@ -1,59 +1,65 @@
 <?xml version="1.0"?>
 
 <project xmlns:antcontrib="antlib:net.sf.antcontrib"
-         xmlns:artifact="antlib:org.apache.maven.artifact.ant"
-         xmlns:ivy="antlib:org.apache.ivy.ant"
-    name="common" 
-	basedir="../"
-	default="init-deps" >
-
-    <property name="ivy.install.version" value="2.2.0"/>
-    <property name="ivy.jar.name" value="ivy-${ivy.install.version}.jar"/>
+    xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant"
+    name="common" basedir="../" default="init-deps">
+
+    <property name="ivy.install.version" value="2.2.0" />
+    <property name="ivy.jar.name" value="ivy-${ivy.install.version}.jar" />
     <property name="ivy.jar.dir" value="${user.home}/.ant/lib" />
     <property name="ivy.jar.file" value="${ivy.jar.dir}/${ivy.jar.name}" />
-    
-	<target name="init-deps" description="Configure Ivy dependency management and load common task definitions" 
-		depends="init-taskdefs" unless="deps.initialized">
+
+    <target name="init-deps"
+        description="Configure Ivy dependency management and load common task definitions"
+        depends="init-taskdefs" unless="deps.initialized">
         <property name="deps.initialized" value="1" />
     </target>
-	
+
     <target name="check-ivy-installed">
-   	    <available property="ivy.installed" file="${ivy.jar.file}"/>
-   	    <available property="ivy.installed" classname="org.apache.ivy.ant.IvyConfigure"  /> 
-   	    <antcall target="common.ivy-download" />
-   	</target>
+        <available property="ivy.installed" file="${ivy.jar.file}" />
+        <available property="ivy.installed" classname="org.apache.ivy.ant.IvyConfigure" />
+        <antcall target="common.ivy-download" />
+    </target>
 
     <target name="ivy-download" unless="ivy.installed">
-        <mkdir dir="${ivy.jar.dir}"/>
-        <get src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar" dest="${ivy.jar.file}" usetimestamp="true"/>
+        <mkdir dir="${ivy.jar.dir}" />
+        <get
+            src="http://repo2.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
+            dest="${ivy.jar.file}" usetimestamp="true" />
+    </target>
+
+    <target name="ivy-configure" depends="check-ivy-installed"
+        unless="deps.initialized">
+        <!-- Ivy task definitions -->
+        <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant"
+            classpath="${ivy.jar.file}" />
+        <!-- Ivy settings -->
+        <property name="ivy.settings.file"
+            value="${project.root}/build/ivy/ivysettings.xml" />
+        <ivy:configure />
     </target>
 
-    <target name="ivy-configure" depends="check-ivy-installed" unless="deps.initialized">
-    	<!-- Ivy task definitions -->
-    	<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}" />
-    	<!-- Ivy settings -->
-	    <property name="ivy.settings.file" value="${project.root}/build/ivy/ivysettings.xml" />
-	    <ivy:configure/>
-	</target>
-	    	
     <target name="init-taskdefs" depends="ivy-configure" unless="deps.initialized">
         <echo>Loading Ant tasks</echo>
-        <ivy:resolve file="${project.root}/build/ivy/ivy.xml" conf="taskdefs" />
+        <ivy:resolve file="${project.root}/build/ivy/ivy.xml"
+            conf="taskdefs" />
         <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
-        <taskdef resource="emma_ant.properties" classpathref="taskdefs.classpath" />    
-        
-        <!-- ant contrib required for flow control (for loop, if, property override)   -->
-        <!-- Note that we have to use a namespace to avoid clash when running sub-ant. -->
+        <taskdef resource="emma_ant.properties" classpathref="taskdefs.classpath" />
+
+        <!-- ant contrib required for flow control (for loop, if, property 
+            override) -->
+        <!-- Note that we have to use a namespace to avoid clash when running 
+            sub-ant. -->
         <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml"
             classpathref="taskdefs.classpath" />
-        
-        <!-- ant contrib for Maven integration -->    
+
+        <!-- ant contrib for Maven integration -->
         <taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
-                 uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" />
-    	
-    	<!-- jarjar -->
+            uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" />
+
+        <!-- jarjar -->
         <taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask"
-        	classpathref="taskdefs.classpath"/>
+            classpathref="taskdefs.classpath" />
 
     </target>
 
diff --git a/build/ide.xml b/build/ide.xml
index b1845020f3..5380536e2e 100755
--- a/build/ide.xml
+++ b/build/ide.xml
@@ -1,152 +1,165 @@
 <?xml version="1.0"?>
 
-<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant" name="Build script for IDE users" basedir=".." default="theme-and-default-widgetset">
-	<include file="${basedir}/gwt-files.xml" />
-
-	<property name="gwt.dev.classes" location="${gwt.eclipse.basedir}/dev/bin" />
-	<property name="gwt.user.classes" location="${gwt.eclipse.basedir}/user/bin" />
-	<property name="gwt.dev.src" location="${gwt.basedir}/dev/core/src" />
-	<property name="gwt.dev.super.src" location="${gwt.basedir}/dev/core/super" />
-	<property name="gwt.user.src" location="${gwt.basedir}/user/src" />
-	<property name="gwt.user.super.src" location="${gwt.basedir}/user/super" />
-
-	<property name="work.dir" location="work" />
-	<property name="theme-version" location="9.9.9.INTERNAL-DEBUG-BUILD" />
-	<echo>Using gwt files from ${gwt.user.classes} and ${gwt.dev.classes}</echo>
-
-	<ivy:resolve file="client-compiler/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="client-compiler.deps" conf="ide" />
-	<ivy:resolve file="server/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="server.deps" conf="ide" />
-	<ivy:resolve file="client/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="client.deps" conf="ide" />
-	<ivy:resolve file="shared/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="shared.deps" conf="ide" />
-	<ivy:resolve file="uitest/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="uitest.deps" conf="ide" />
-	<ivy:resolve file="theme-compiler/ivy.xml" conf="ide" />
-	<ivy:cachepath pathid="theme-compiler.deps" conf="ide" />
-
-	<path id="classpath">
-		<path location="bin" />
-		<path location="build/classes" />
-		<path location="${gwt.user.classes}" />
-		<path location="${gwt.user.src}" />
-		<path location="${gwt.user.super.src}" />
-		<path location="${gwt.dev.classes}" />
-		<path location="${gwt.dev.super.src}" />
-		<path location="${gwt.dev.src}" />
-		<path refid="client-compiler.deps" />
-		<path refid="theme-compiler.deps" />
-		<path refid="server.deps" />
-		<path refid="shared.deps" />
-		<path refid="uitest.deps" />
-		<path refid="client.deps" />
-		<path location="theme-compiler/src" />
-		<path location="server/src" />
-		<path location="shared/src" />
-		<path location="uitest/src" />
-		<path location="client/src" />
-	</path>
-
-	<target name="theme-and-default-widgetset" depends="default-widgetset, themes, vaadinPush.js">
-	</target>
-	<target name="themes">
-		<antcall target="compile-theme">
-			<param name="theme" value="base" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="runo" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="reindeer" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="chameleon" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="liferay" />
-		</antcall>
-	</target>
-
-	<target name="compile-theme">
-		<java classname="com.vaadin.buildhelpers.CompileTheme" failonerror="yes" fork="yes">
-			<classpath refid="classpath" />
-			<jvmarg value="-Djava.awt.headless=true" />
-			<arg value="--theme" />
-			<arg value="${theme}" />
-			<arg value="--theme-version" />
-			<arg value="${theme-version}" />
-			<arg value="--theme-folder" />
-			<arg value="WebContent/VAADIN/themes" />
-		</java>
-
-	</target>
-
-
-	<target name="default-widgetset">
-		<antcall target="compile-widgetset">
-			<param name="widgetset" value="com.vaadin.DefaultWidgetSet" />
-		</antcall>
-	</target>
-
-	<target name="testing-widgetset">
-		<antcall target="compile-widgetset">
-			<param name="widgetset" value="com.vaadin.tests.widgetset.TestingWidgetSet" />
-		</antcall>
-	</target>
-
-	<target name="compile-widgetset">
-		<property name="module" value="${widgetset}" />
-		<property name="module.output.dir" location="WebContent/VAADIN/widgetsets" />
-		<property name="style" value="PRETTY" />
-		<property name="localWorkers" value="2" />
-		<property name="extraParams" value="" />
-
-		<mkdir dir="${module.output.dir}" />
-
-		<echo>Compiling ${module} to ${module.output.dir} with parameters -logLevel TRACE -style ${style} -localWorkers ${localWorkers} -strict ${extraParams}</echo>
-
-		<!--<ivy:resolve inline="true" organisation="javax.validation" module="validation-api" revision="1.0.0.GA"/>-->
-
-		<!-- compile the module -->
-		<java classname="com.google.gwt.dev.Compiler" classpathref="classpath" failonerror="yes" fork="yes" maxmemory="512m">
-			<arg value="-workDir" />
-			<arg value="${work.dir}" />
-			<arg value="-logLevel" />
-			<arg value="TRACE" />
-			<arg value="-war" />
-			<arg value="${module.output.dir}" />
-			<arg value="-style" />
-			<arg value="${style}" />
-
-			<arg value="-localWorkers" />
-			<arg value="${localWorkers}" />
-			<arg value="-strict" />
-			<arg line="${extraParams}" />
-			<arg value="${module}" />
-
-			<sysproperty key="vFailIfNotSerializable" value="true" />
-
-			<jvmarg value="-Xss8M" />
-			<jvmarg value="-XX:MaxPermSize=256M" />
-			<jvmarg value="-Djava.awt.headless=true" />
-			<jvmarg value="-Dgwt.usearchives=false" />
-		</java>
-	</target>
-	<target name="vaadinPush.js">
-		<property name="vaadinPush.js.output" location="WebContent/VAADIN/vaadinPush.js" />
-
-		<loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js" property="jquery.js.contents" />
-		<loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
-		<loadfile srcfile="WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents">
-			<filterchain>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="jquery.js" value="${jquery.js.contents}" />
-					<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
-				</replacetokens>
-			</filterchain>
-		</loadfile>
-		<echo file="${vaadinPush.js.output}">${vaadinPush.js.contents}</echo>
-	</target>
+<project xmlns:antcontrib="antlib:net.sf.antcontrib"
+    xmlns:artifact="antlib:org.apache.maven.artifact.ant" xmlns:ivy="antlib:org.apache.ivy.ant"
+    name="Build script for IDE users" basedir=".."
+    default="theme-and-default-widgetset">
+    <include file="${basedir}/gwt-files.xml" />
+
+    <property name="gwt.dev.classes" location="${gwt.eclipse.basedir}/dev/bin" />
+    <property name="gwt.user.classes" location="${gwt.eclipse.basedir}/user/bin" />
+    <property name="gwt.dev.src" location="${gwt.basedir}/dev/core/src" />
+    <property name="gwt.dev.super.src" location="${gwt.basedir}/dev/core/super" />
+    <property name="gwt.user.src" location="${gwt.basedir}/user/src" />
+    <property name="gwt.user.super.src" location="${gwt.basedir}/user/super" />
+
+    <property name="work.dir" location="work" />
+    <property name="theme-version" location="9.9.9.INTERNAL-DEBUG-BUILD" />
+    <echo>Using gwt files from ${gwt.user.classes} and
+        ${gwt.dev.classes}</echo>
+
+    <ivy:resolve file="client-compiler/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="client-compiler.deps" conf="ide" />
+    <ivy:resolve file="server/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="server.deps" conf="ide" />
+    <ivy:resolve file="client/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="client.deps" conf="ide" />
+    <ivy:resolve file="shared/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="shared.deps" conf="ide" />
+    <ivy:resolve file="uitest/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="uitest.deps" conf="ide" />
+    <ivy:resolve file="theme-compiler/ivy.xml" conf="ide" />
+    <ivy:cachepath pathid="theme-compiler.deps" conf="ide" />
+
+    <path id="classpath">
+        <path location="bin" />
+        <path location="build/classes" />
+        <path location="${gwt.user.classes}" />
+        <path location="${gwt.user.src}" />
+        <path location="${gwt.user.super.src}" />
+        <path location="${gwt.dev.classes}" />
+        <path location="${gwt.dev.super.src}" />
+        <path location="${gwt.dev.src}" />
+        <path refid="client-compiler.deps" />
+        <path refid="theme-compiler.deps" />
+        <path refid="server.deps" />
+        <path refid="shared.deps" />
+        <path refid="uitest.deps" />
+        <path refid="client.deps" />
+        <path location="theme-compiler/src" />
+        <path location="server/src" />
+        <path location="shared/src" />
+        <path location="uitest/src" />
+        <path location="client/src" />
+    </path>
+
+    <target name="theme-and-default-widgetset" depends="default-widgetset, themes, vaadinPush.js">
+    </target>
+    <target name="themes">
+        <antcall target="compile-theme">
+            <param name="theme" value="base" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="runo" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="reindeer" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="chameleon" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="liferay" />
+        </antcall>
+    </target>
+
+    <target name="compile-theme">
+        <java classname="com.vaadin.buildhelpers.CompileTheme"
+            failonerror="yes" fork="yes">
+            <classpath refid="classpath" />
+            <jvmarg value="-Djava.awt.headless=true" />
+            <arg value="--theme" />
+            <arg value="${theme}" />
+            <arg value="--theme-version" />
+            <arg value="${theme-version}" />
+            <arg value="--theme-folder" />
+            <arg value="WebContent/VAADIN/themes" />
+        </java>
+
+    </target>
+
+
+    <target name="default-widgetset">
+        <antcall target="compile-widgetset">
+            <param name="widgetset" value="com.vaadin.DefaultWidgetSet" />
+        </antcall>
+    </target>
+
+    <target name="testing-widgetset">
+        <antcall target="compile-widgetset">
+            <param name="widgetset"
+                value="com.vaadin.tests.widgetset.TestingWidgetSet" />
+        </antcall>
+    </target>
+
+    <target name="compile-widgetset">
+        <property name="module" value="${widgetset}" />
+        <property name="module.output.dir" location="WebContent/VAADIN/widgetsets" />
+        <property name="style" value="PRETTY" />
+        <property name="localWorkers" value="2" />
+        <property name="extraParams" value="" />
+
+        <mkdir dir="${module.output.dir}" />
+
+        <echo>Compiling ${module} to ${module.output.dir} with
+            parameters -logLevel TRACE -style ${style} -localWorkers
+            ${localWorkers} -strict ${extraParams}</echo>
+
+        <!--<ivy:resolve inline="true" organisation="javax.validation" module="validation-api" 
+            revision="1.0.0.GA"/> -->
+
+        <!-- compile the module -->
+        <java classname="com.google.gwt.dev.Compiler" classpathref="classpath"
+            failonerror="yes" fork="yes" maxmemory="512m">
+            <arg value="-workDir" />
+            <arg value="${work.dir}" />
+            <arg value="-logLevel" />
+            <arg value="TRACE" />
+            <arg value="-war" />
+            <arg value="${module.output.dir}" />
+            <arg value="-style" />
+            <arg value="${style}" />
+
+            <arg value="-localWorkers" />
+            <arg value="${localWorkers}" />
+            <arg value="-strict" />
+            <arg line="${extraParams}" />
+            <arg value="${module}" />
+
+            <sysproperty key="vFailIfNotSerializable" value="true" />
+
+            <jvmarg value="-Xss8M" />
+            <jvmarg value="-XX:MaxPermSize=256M" />
+            <jvmarg value="-Djava.awt.headless=true" />
+            <jvmarg value="-Dgwt.usearchives=false" />
+        </java>
+    </target>
+    <target name="vaadinPush.js">
+        <property name="vaadinPush.js.output" location="WebContent/VAADIN/vaadinPush.js" />
+
+        <loadfile srcfile="WebContent/VAADIN/jquery-1.7.2.js"
+            property="jquery.js.contents" />
+        <loadfile srcfile="WebContent/VAADIN/jquery.atmosphere.js"
+            property="jquery.atmosphere.js.contents" />
+        <loadfile srcfile="WebContent/VAADIN/vaadinPush.js.tpl"
+            property="vaadinPush.js.contents">
+            <filterchain>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="jquery.js" value="${jquery.js.contents}" />
+                    <token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
+                </replacetokens>
+            </filterchain>
+        </loadfile>
+        <echo file="${vaadinPush.js.output}">${vaadinPush.js.contents}</echo>
+    </target>
 </project>
\ No newline at end of file
diff --git a/buildhelpers/build.xml b/buildhelpers/build.xml
index a101bff191..aa1eb8cb0d 100644
--- a/buildhelpers/build.xml
+++ b/buildhelpers/build.xml
@@ -1,50 +1,51 @@
 <?xml version="1.0"?>
 
 <project name="vaadin-buildhelpers" basedir="." default="publish-local">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../build.xml" as="vaadin" />
-	<include file="../common.xml" as="common" />
-
-	<property name="module.name" value="vaadin-buildhelpers" />
-	<property name="module.symbolic" value="com.vaadin.buildhelpers" />
-	<property name="result.dir" location="result" />
-	<path id="classpath.compile.custom" />
-
-	<target name="jar">
-		<antcall target="common.jar">
-			<reference torefid="extra.jar.includes" refid="empty.reference" />
-		</antcall>
-	</target>
-
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="empty.reference" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
-		<antcall target="common.publish-local" />
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
-
-	<target name="fetch-release-notes-tickets">
-		<antcall target="common.exec-buildhelper">
-			<param name="main.class" value="com.vaadin.buildhelpers.FetchReleaseNotesTickets" />
-			<param name="output" value="${output}" />
-		</antcall>
-	</target>
-
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No JUnit tests for ${module.name}!</echo>
-	</target>
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../build.xml" as="vaadin" />
+    <include file="../common.xml" as="common" />
+
+    <property name="module.name" value="vaadin-buildhelpers" />
+    <property name="module.symbolic" value="com.vaadin.buildhelpers" />
+    <property name="result.dir" location="result" />
+    <path id="classpath.compile.custom" />
+
+    <target name="jar">
+        <antcall target="common.jar">
+            <reference torefid="extra.jar.includes" refid="empty.reference" />
+        </antcall>
+    </target>
+
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="empty.reference" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
+        <antcall target="common.publish-local" />
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
+
+    <target name="fetch-release-notes-tickets">
+        <antcall target="common.exec-buildhelper">
+            <param name="main.class"
+                value="com.vaadin.buildhelpers.FetchReleaseNotesTickets" />
+            <param name="output" value="${output}" />
+        </antcall>
+    </target>
+
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No JUnit tests for ${module.name}!</echo>
+    </target>
 </project>
\ No newline at end of file
diff --git a/buildhelpers/ivy.xml b/buildhelpers/ivy.xml
index 7c0a7b82a7..21c2a808cc 100644
--- a/buildhelpers/ivy.xml
+++ b/buildhelpers/ivy.xml
@@ -28,7 +28,7 @@
 
     </publications>
     <dependencies>
-            <dependency org="commons-io" name="commons-io" rev="2.2" />
+        <dependency org="commons-io" name="commons-io" rev="2.2" />
     </dependencies>
 
 </ivy-module>
diff --git a/client-compiled/build.xml b/client-compiled/build.xml
index c9c3244c0e..01bf2fa15e 100644
--- a/client-compiled/build.xml
+++ b/client-compiled/build.xml
@@ -1,139 +1,149 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-client-compiled" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiled (JS+HTML) version of client side 
-	</description>
-
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-client-compiled" />
-	<property name="module.symbolic" value="com.vaadin.client-compiled" />
-	<property name="result.dir" value="result" />
-	<property name="gwtar.dir" location="${result.dir}/gwtar" />
-	<property name="work.dir" location="${result.dir}/work" />
-	<property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
-	<property name="compiled.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
-	<property name="compiled-cache.jar" location="${result.dir}/lib/${module.name}-cache-${vaadin.version}.jar" />
-
-	<union id="jar.includes">
-		<fileset dir="${result.dir}">
-			<include name="VAADIN/widgetsets/com.vaadin*/**" />
-		</fileset>
-	</union>
-	
-	<target name="default-widgetset-cache">
-		<antcall target="compile-module-cache">
-			<param name="module" value="com.vaadin.DefaultWidgetSet" />
-		</antcall>
-	</target>
-
-	<target name="default-widgetset">
-		<antcall target="compile-module">
-			<param name="module" value="com.vaadin.DefaultWidgetSet" />
-		</antcall>
-	</target>
-
-
-	<target name="compile-module-cache">
-		<fail unless="module" message="You must give the module to compile in the 'module' parameter" />
-		<ivy:resolve resolveid="common" conf="compile-module" />
-		<ivy:cachepath pathid="classpath.compile.widgetset" conf="compile-module" />
-		<echo>Creating gwtar files for ${module} in ${gwtar.dir}</echo>
-
-		<!-- Produce gwtar files for the separate JAR -->
-		<java classname="com.google.gwt.dev.CompileModule" classpathref="classpath.compile.widgetset" failonerror="yes" fork="yes" maxmemory="512m">
-			<arg value="-out" />
-			<arg value="${gwtar.dir}" />
-			<arg value="-strict" />
-			<arg value="${module}" />
-
-			<jvmarg value="-Xss8M" />
-			<jvmarg value="-XX:MaxPermSize=256M" />
-			<jvmarg value="-Djava.awt.headless=true" />
-		</java>
-	</target>
-
-	<target name="compile-module">
-		<fail unless="module" message="You must give the module to compile in the 'module' parameter" />
-		<property name="style" value="OBF" />
-		<property name="localWorkers" value="2" />
-		<property name="extraParams" value="" />
-
-		<ivy:resolve resolveid="common" conf="compile-module" />
-		<ivy:cachepath pathid="classpath.compile.widgetset" conf="compile-module" />
-
-		<mkdir dir="${module.output.dir}" />
-
-		<echo>Compiling ${module} to ${module.output.dir}</echo>
-
-		<!-- compile the module -->
-		<java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.widgetset" failonerror="yes" fork="yes" maxmemory="512m">
-			<classpath location="${compiled-cache.jar}" />
-			<arg value="-workDir" />
-			<arg value="${work.dir}" />
-			<arg value="-logLevel" />
-			<arg value="TRACE" />
-			<arg value="-war" />
-			<arg value="${module.output.dir}" />
-			<arg value="-style" />
-			<arg value="${style}" />
-
-			<arg value="-localWorkers" />
-			<arg value="${localWorkers}" />
-			<arg value="-strict" />
-			<arg value="-XenableClosureCompiler" />
-			<arg line="${extraParams}" />
-			<arg value="${module}" />
-
-			<sysproperty key="vFailIfNotSerializable" value="true" />
-
-			<jvmarg value="-Xss8M" />
-			<jvmarg value="-XX:MaxPermSize=256M" />
-			<jvmarg value="-Djava.awt.headless=true" />
-		</java>
-
-	</target>
-
-	<target name="client-compiled-cache.jar" depends="default-widgetset-cache">
-		<!-- Ensure filtered webcontent files are available -->
-		<antcall target="common.filter.webcontent" />
-
-		<jar file="${compiled-cache.jar}" compress="true">
-			<fileset dir="${gwtar.dir}">
-				<include name="**/*.gwtar" />
-			</fileset>
-			<union refid="client-compiled-cache.gwt.includes" />
-			<fileset refid="common.files.for.all.jars" />
-		</jar>
-	</target>
-
-	<target name="jar" depends="default-widgetset">
-		<antcall target="common.jar">
-			<param name="osgi.extra.package.prefixes" value="VAADIN/widgetsets/" />
-			<reference torefid="extra.jar.includes" refid="jar.includes" />
-		</antcall>
-	</target>
-	
-	<target name="publish-local" depends="jar">
-		<antcall target="common.publish-local">
-			<param name="conf" value="build" />
-		</antcall>
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-
-	<target name="checkstyle">
-		<echo>No java files in module</echo>
-	</target>
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No tests for ${module.name}!</echo>
-	</target>
+<project name="vaadin-client-compiled" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiled (JS+HTML) version of client side
+    </description>
+
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-client-compiled" />
+    <property name="module.symbolic" value="com.vaadin.client-compiled" />
+    <property name="result.dir" value="result" />
+    <property name="gwtar.dir" location="${result.dir}/gwtar" />
+    <property name="work.dir" location="${result.dir}/work" />
+    <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
+    <property name="compiled.jar"
+        location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
+    <property name="compiled-cache.jar"
+        location="${result.dir}/lib/${module.name}-cache-${vaadin.version}.jar" />
+
+    <union id="jar.includes">
+        <fileset dir="${result.dir}">
+            <include name="VAADIN/widgetsets/com.vaadin*/**" />
+        </fileset>
+    </union>
+
+    <target name="default-widgetset-cache">
+        <antcall target="compile-module-cache">
+            <param name="module" value="com.vaadin.DefaultWidgetSet" />
+        </antcall>
+    </target>
+
+    <target name="default-widgetset">
+        <antcall target="compile-module">
+            <param name="module" value="com.vaadin.DefaultWidgetSet" />
+        </antcall>
+    </target>
+
+
+    <target name="compile-module-cache">
+        <fail unless="module"
+            message="You must give the module to compile in the 'module' parameter" />
+        <ivy:resolve resolveid="common" conf="compile-module" />
+        <ivy:cachepath pathid="classpath.compile.widgetset"
+            conf="compile-module" />
+        <echo>Creating gwtar files for ${module} in ${gwtar.dir}</echo>
+
+        <!-- Produce gwtar files for the separate JAR -->
+        <java classname="com.google.gwt.dev.CompileModule"
+            classpathref="classpath.compile.widgetset" failonerror="yes"
+            fork="yes" maxmemory="512m">
+            <arg value="-out" />
+            <arg value="${gwtar.dir}" />
+            <arg value="-strict" />
+            <arg value="${module}" />
+
+            <jvmarg value="-Xss8M" />
+            <jvmarg value="-XX:MaxPermSize=256M" />
+            <jvmarg value="-Djava.awt.headless=true" />
+        </java>
+    </target>
+
+    <target name="compile-module">
+        <fail unless="module"
+            message="You must give the module to compile in the 'module' parameter" />
+        <property name="style" value="OBF" />
+        <property name="localWorkers" value="2" />
+        <property name="extraParams" value="" />
+
+        <ivy:resolve resolveid="common" conf="compile-module" />
+        <ivy:cachepath pathid="classpath.compile.widgetset"
+            conf="compile-module" />
+
+        <mkdir dir="${module.output.dir}" />
+
+        <echo>Compiling ${module} to ${module.output.dir}</echo>
+
+        <!-- compile the module -->
+        <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.widgetset"
+            failonerror="yes" fork="yes" maxmemory="512m">
+            <classpath location="${compiled-cache.jar}" />
+            <arg value="-workDir" />
+            <arg value="${work.dir}" />
+            <arg value="-logLevel" />
+            <arg value="TRACE" />
+            <arg value="-war" />
+            <arg value="${module.output.dir}" />
+            <arg value="-style" />
+            <arg value="${style}" />
+
+            <arg value="-localWorkers" />
+            <arg value="${localWorkers}" />
+            <arg value="-strict" />
+            <arg value="-XenableClosureCompiler" />
+            <arg line="${extraParams}" />
+            <arg value="${module}" />
+
+            <sysproperty key="vFailIfNotSerializable" value="true" />
+
+            <jvmarg value="-Xss8M" />
+            <jvmarg value="-XX:MaxPermSize=256M" />
+            <jvmarg value="-Djava.awt.headless=true" />
+        </java>
+
+    </target>
+
+    <target name="client-compiled-cache.jar" depends="default-widgetset-cache">
+        <!-- Ensure filtered webcontent files are available -->
+        <antcall target="common.filter.webcontent" />
+
+        <jar file="${compiled-cache.jar}" compress="true">
+            <fileset dir="${gwtar.dir}">
+                <include name="**/*.gwtar" />
+            </fileset>
+            <union refid="client-compiled-cache.gwt.includes" />
+            <fileset refid="common.files.for.all.jars" />
+        </jar>
+    </target>
+
+    <target name="jar" depends="default-widgetset">
+        <antcall target="common.jar">
+            <param name="osgi.extra.package.prefixes" value="VAADIN/widgetsets/" />
+            <reference torefid="extra.jar.includes" refid="jar.includes" />
+        </antcall>
+    </target>
+
+    <target name="publish-local" depends="jar">
+        <antcall target="common.publish-local">
+            <param name="conf" value="build" />
+        </antcall>
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+
+    <target name="checkstyle">
+        <echo>No java files in module</echo>
+    </target>
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No tests for ${module.name}!</echo>
+    </target>
 
 </project>
diff --git a/client-compiled/ivy.xml b/client-compiled/ivy.xml
index 7802775f70..2f1dcfd22f 100644
--- a/client-compiled/ivy.xml
+++ b/client-compiled/ivy.xml
@@ -14,8 +14,8 @@
     </configurations>
     <publications>
         <artifact type="jar" ext="jar" />
-<!--         <artifact type="source" ext="jar" m:classifier="sources" /> -->
-<!--         <artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
+        <!-- <artifact type="source" ext="jar" m:classifier="sources" /> -->
+        <!-- <artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
         <artifact type="pom" ext="pom" />
         <!-- cache must be a separate artifact, not within vaadin-client-compiled -->
         <!-- <artifact type="jar" name="vaadin-client-compiled-cache"/> -->
diff --git a/client-compiler/build.xml b/client-compiler/build.xml
index cd8433f1cf..0ed4d7b0e3 100644
--- a/client-compiler/build.xml
+++ b/client-compiler/build.xml
@@ -1,68 +1,70 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-client-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
+<project name="vaadin-client-compiler" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
 
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-client-compiler" />
-	<property name="module.symbolic" value="com.vaadin.client-compiler" />
-	<property name="result.dir" value="result" />
-	<path id="classpath.compile.custom">
-		<fileset file="${gwt.dev.jar}" />
-	</path>
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-client-compiler" />
+    <property name="module.symbolic" value="com.vaadin.client-compiler" />
+    <property name="result.dir" value="result" />
+    <path id="classpath.compile.custom">
+        <fileset file="${gwt.dev.jar}" />
+    </path>
 
-	<union id="compiler.includes">
-		<union refid="client-compiler.gwt.includes" />
-		<fileset dir="${result.dir}">
-			<include name="com/google/gwt/dev/About.properties" />
-		</fileset>
-	</union>
+    <union id="compiler.includes">
+        <union refid="client-compiler.gwt.includes" />
+        <fileset dir="${result.dir}">
+            <include name="com/google/gwt/dev/About.properties" />
+        </fileset>
+    </union>
 
-	<target name="jar">
-		<!-- Get Git revision -->
-		<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
-			<arg value="describe" />
-			<arg value="--tags" />
-			<arg value="--always" />
-			<arg value="HEAD" />
-		</exec>
+    <target name="jar">
+        <!-- Get Git revision -->
+        <exec executable="git" outputproperty="git.revision"
+            failifexecutionfails="false" errorproperty="">
+            <arg value="describe" />
+            <arg value="--tags" />
+            <arg value="--always" />
+            <arg value="HEAD" />
+        </exec>
 
-		<echo file="${result.dir}/com/google/gwt/dev/About.properties">gwt.version=${vaadin.version}
-gwt.svnrev=${git.revision}</echo>
+        <echo file="${result.dir}/com/google/gwt/dev/About.properties">gwt.version=${vaadin.version}
+            gwt.svnrev=${git.revision}</echo>
 
-		<antcall target="common.jar">
-			<reference refid="compiler.includes" torefid="extra.jar.includes" />
-		</antcall>
+        <antcall target="common.jar">
+            <reference refid="compiler.includes" torefid="extra.jar.includes" />
+        </antcall>
 
-	</target>
+    </target>
 
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="compiler.includes" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="compiler.includes" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
 
-		<antcall target="common.publish-local" />
-	</target>
+        <antcall target="common.publish-local" />
+    </target>
 
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
 
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
 
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No tests for ${module.name}!</echo>
-	</target>
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No tests for ${module.name}!</echo>
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/client-compiler/ivy.xml b/client-compiler/ivy.xml
index 64c0de2830..f66a2e0255 100644
--- a/client-compiler/ivy.xml
+++ b/client-compiler/ivy.xml
@@ -1,62 +1,64 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <ivy-module version="2.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
-	xmlns:m="http://ant.apache.org/ivy/maven">
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
+    xmlns:m="http://ant.apache.org/ivy/maven">
 
-	<info organisation="com.vaadin" module="vaadin-client-compiler"
-		revision="${vaadin.version}" />
+    <info organisation="com.vaadin" module="vaadin-client-compiler"
+        revision="${vaadin.version}" />
 
-	<configurations>
-		<conf name="build" />
-		<conf name="build-provided" />
-		<conf name="ide" visibility="private" />
-	</configurations>
-	<publications>
-		<artifact type="jar" ext="jar" />
-		<artifact type="source" ext="jar" m:classifier="sources" />
-		<artifact type="javadoc" ext="jar" m:classifier="javadoc" />
-		<artifact type="pom" ext="pom" />
-	</publications>
-	<dependencies>
-		<dependency org="com.vaadin" name="vaadin-shared" rev="${vaadin.version}"
-			conf="build" />
-		<dependency org="com.vaadin" name="vaadin-server" rev="${vaadin.version}"
-			conf="build" />
-		<dependency org="com.vaadin" name="vaadin-client" rev="${vaadin.version}"
-			conf="build" />
-		<dependency org="com.vaadin" name="vaadin-theme-compiler"
-			rev="${vaadin.version}" conf="build" />
+    <configurations>
+        <conf name="build" />
+        <conf name="build-provided" />
+        <conf name="ide" visibility="private" />
+    </configurations>
+    <publications>
+        <artifact type="jar" ext="jar" />
+        <artifact type="source" ext="jar" m:classifier="sources" />
+        <artifact type="javadoc" ext="jar" m:classifier="javadoc" />
+        <artifact type="pom" ext="pom" />
+    </publications>
+    <dependencies>
+        <dependency org="com.vaadin" name="vaadin-shared"
+            rev="${vaadin.version}" conf="build" />
+        <dependency org="com.vaadin" name="vaadin-server"
+            rev="${vaadin.version}" conf="build" />
+        <dependency org="com.vaadin" name="vaadin-client"
+            rev="${vaadin.version}" conf="build" />
+        <dependency org="com.vaadin" name="vaadin-theme-compiler"
+            rev="${vaadin.version}" conf="build" />
 
-		<dependency org="commons-collections" name="commons-collections"
-			rev="3.1" conf="build,ide -> default" />
-		<dependency org="commons-logging" name="commons-logging"
-			rev="1.1.1" conf="build,ide -> default" />
+        <dependency org="commons-collections" name="commons-collections"
+            rev="3.1" conf="build,ide -> default" />
+        <dependency org="commons-logging" name="commons-logging"
+            rev="1.1.1" conf="build,ide -> default" />
 
-		<dependency org="ant" name="ant" rev="1.6.5" conf="build,ide -> default" />
-		<dependency org="net.sourceforge.cssparser" name="cssparser"
-			rev="0.9.5" conf="build,ide -> default" />
-		<dependency org="ant" name="ant" rev="1.6.5" conf="build,ide -> default" />
-		<dependency org="ant" name="ant-launcher" rev="1.6.5"
-			conf="build,ide -> default" />
-		<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11"
-			conf="build,ide -> default" />
-		<dependency org="org.mortbay.jetty" name="jetty-util" rev="6.1.11"
-			conf="build,ide -> default" />
-		<dependency org="org.jdesktop" name="swing-worker" rev="1.1"
-			conf="build,ide -> default" />
-		<dependency org="commons-codec" name="commons-codec" rev="1.3"
-			conf="build,ide -> default" />
-		<dependency org="commons-io" name="commons-io" rev="2.2"
-			conf="build,ide -> default" />
-		<dependency org="commons-lang" name="commons-lang" rev="2.6"
-			conf="build,ide -> default" />
-		<dependency org="org.apache.james" name="apache-mime4j"
-			rev="0.6" conf="build,ide -> default" />
+        <dependency org="ant" name="ant" rev="1.6.5"
+            conf="build,ide -> default" />
+        <dependency org="net.sourceforge.cssparser" name="cssparser"
+            rev="0.9.5" conf="build,ide -> default" />
+        <dependency org="ant" name="ant" rev="1.6.5"
+            conf="build,ide -> default" />
+        <dependency org="ant" name="ant-launcher" rev="1.6.5"
+            conf="build,ide -> default" />
+        <dependency org="org.mortbay.jetty" name="jetty" rev="6.1.11"
+            conf="build,ide -> default" />
+        <dependency org="org.mortbay.jetty" name="jetty-util"
+            rev="6.1.11" conf="build,ide -> default" />
+        <dependency org="org.jdesktop" name="swing-worker"
+            rev="1.1" conf="build,ide -> default" />
+        <dependency org="commons-codec" name="commons-codec"
+            rev="1.3" conf="build,ide -> default" />
+        <dependency org="commons-io" name="commons-io" rev="2.2"
+            conf="build,ide -> default" />
+        <dependency org="commons-lang" name="commons-lang"
+            rev="2.6" conf="build,ide -> default" />
+        <dependency org="org.apache.james" name="apache-mime4j"
+            rev="0.6" conf="build,ide -> default" />
 
-		<dependency org="com.vaadin" name="vaadin-client-compiler-deps"
-			rev="1.0.2" conf="build,ide -> default" />
+        <dependency org="com.vaadin" name="vaadin-client-compiler-deps"
+            rev="1.0.2" conf="build,ide -> default" />
 
-	</dependencies>
+    </dependencies>
 
 </ivy-module>
diff --git a/client/build.xml b/client/build.xml
index a2262eed7d..a027d00f60 100644
--- a/client/build.xml
+++ b/client/build.xml
@@ -1,43 +1,46 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-client" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
+<project name="vaadin-client" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
 
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-client" />
-	<property name="module.symbolic" value="com.vaadin.client" />
-	<property name="result.dir" value="result" />
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-client" />
+    <property name="module.symbolic" value="com.vaadin.client" />
+    <property name="result.dir" value="result" />
 
-	<path id="classpath.compile.custom">
-		<!-- Could possibly compile GWT files also here to verify that
-		a) the same dependencies are used and
-		b) all dependencies have been declared
-		-->
-		<fileset file="${gwt.user.jar}" />
-	</path>
-	<path id="classpath.test.custom" />
+    <path id="classpath.compile.custom">
+        <!-- Could possibly compile GWT files also here to verify that a) 
+            the same dependencies are used and b) all dependencies have been declared -->
+        <fileset file="${gwt.user.jar}" />
+    </path>
+    <path id="classpath.test.custom" />
 
-	<target name="jar">
-		<property name="jar.file" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
-		<antcall target="common.jar">
-			<reference refid="client.gwt.includes" torefid="extra.jar.includes" />
-		</antcall>
-		<jar destfile="${jar.file}" update="true">
-			<manifest>
-				<attribute name="Vaadin-Package-Version" value="1" />
-				<attribute name="Vaadin-Widgetsets" value="com.vaadin.DefaultWidgetSet" />
-			</manifest>
-		</jar>
-		<!-- Hack to add validation dependency with source classifier -->
-		<property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
-		<copy file="${pom.xml}" tofile="${temp.pom}">
-			<filterchain>
-				<replacestring from="  &lt;/dependencies&gt;" to="    &lt;dependency&gt;
+    <target name="jar">
+        <property name="jar.file"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
+        <antcall target="common.jar">
+            <reference refid="client.gwt.includes" torefid="extra.jar.includes" />
+        </antcall>
+        <jar destfile="${jar.file}" update="true">
+            <manifest>
+                <attribute name="Vaadin-Package-Version"
+                    value="1" />
+                <attribute name="Vaadin-Widgetsets" value="com.vaadin.DefaultWidgetSet" />
+            </manifest>
+        </jar>
+        <!-- Hack to add validation dependency with source classifier -->
+        <property name="pom.xml"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
+        <copy file="${pom.xml}" tofile="${temp.pom}">
+            <filterchain>
+                <replacestring from="  &lt;/dependencies&gt;"
+                    to="    &lt;dependency&gt;
                &lt;groupId&gt;javax.validation&lt;/groupId&gt;
                &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                &lt;version&gt;1.0.0.GA&lt;/version&gt;
@@ -45,32 +48,32 @@
                &lt;classifier&gt;sources&lt;/classifier&gt;
              &lt;/dependency&gt;
   &lt;/dependencies&gt;" />
-			</filterchain>
-		</copy>
-		<move file="${temp.pom}" tofile="${pom.xml}" />
-	</target>
+            </filterchain>
+        </copy>
+        <move file="${temp.pom}" tofile="${pom.xml}" />
+    </target>
 
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="client.gwt.includes" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="client.gwt.includes" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
 
-		<antcall target="common.publish-local" />
-	</target>
+        <antcall target="common.publish-local" />
+    </target>
 
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
 
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
 
-	<target name="test" depends="checkstyle">
-		<antcall target="common.test.run" />
-	</target>
+    <target name="test" depends="checkstyle">
+        <antcall target="common.test.run" />
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/client/src/com/vaadin/DefaultWidgetSet.gwt.xml b/client/src/com/vaadin/DefaultWidgetSet.gwt.xml
index 26ab7478e0..3aba1f6fee 100755
--- a/client/src/com/vaadin/DefaultWidgetSet.gwt.xml
+++ b/client/src/com/vaadin/DefaultWidgetSet.gwt.xml
@@ -1,13 +1,13 @@
 <module>
-	<!-- This GWT module defines the Vaadin DefaultWidgetSet. This is the module 
-		you want to extend when creating an extended widget set, or when creating 
-		a specialized widget set with a subset of the components. -->
+    <!-- This GWT module defines the Vaadin DefaultWidgetSet. This is the 
+        module you want to extend when creating an extended widget set, or when creating 
+        a specialized widget set with a subset of the components. -->
 
-	<!-- Hint for WidgetSetBuilder not to automatically update the file -->
-	<!-- WS Compiler: manually edited -->
+    <!-- Hint for WidgetSetBuilder not to automatically update the file -->
+    <!-- WS Compiler: manually edited -->
 
-	<inherits name="com.vaadin.Vaadin" />
+    <inherits name="com.vaadin.Vaadin" />
 
-	<entry-point class="com.vaadin.client.ApplicationConfiguration" />
+    <entry-point class="com.vaadin.client.ApplicationConfiguration" />
 
 </module>
diff --git a/client/src/com/vaadin/Vaadin.gwt.xml b/client/src/com/vaadin/Vaadin.gwt.xml
index a4eb88d9b4..31eb703e3c 100644
--- a/client/src/com/vaadin/Vaadin.gwt.xml
+++ b/client/src/com/vaadin/Vaadin.gwt.xml
@@ -12,13 +12,14 @@
     <inherits name="com.google.gwt.http.HTTP" />
 
     <inherits name="com.google.gwt.json.JSON" />
-    
+
     <inherits name="com.google.gwt.logging.Logging" />
-    <!-- Firebug handler is deprecated but for some reason still enabled by default -->
+    <!-- Firebug handler is deprecated but for some reason still enabled 
+        by default -->
     <set-property name="gwt.logging.firebugHandler" value="DISABLED" />
     <!-- Disable popup logging as we have our own popup logger -->
     <set-property name="gwt.logging.popupHandler" value="DISABLED" />
-    
+
     <inherits name="com.vaadin.VaadinBrowserSpecificOverrides" />
 
     <source path="client" />
@@ -40,19 +41,21 @@
         <when-type-assignable
             class="com.vaadin.client.metadata.ConnectorBundleLoader" />
     </generate-with>
-    
-    <replace-with class="com.vaadin.client.communication.AtmospherePushConnection">
+
+    <replace-with
+        class="com.vaadin.client.communication.AtmospherePushConnection">
         <when-type-is class="com.vaadin.client.communication.PushConnection" />
-    </replace-with>    
-    
-    <!-- Set vaadin.profiler to true to include profiling support in the module -->
+    </replace-with>
+
+    <!-- Set vaadin.profiler to true to include profiling support in the 
+        module -->
     <define-property name="vaadin.profiler" values="true,false" />
-    <set-property name="vaadin.profiler" value="false" />    
-    
+    <set-property name="vaadin.profiler" value="false" />
+
     <replace-with class="com.vaadin.client.Profiler.EnabledProfiler">
         <when-type-is class="com.vaadin.client.Profiler" />
         <when-property-is name="vaadin.profiler" value="true" />
-    </replace-with>    
+    </replace-with>
 
     <!-- Use the new cross site linker to get a nocache.js without document.write -->
     <add-linker name="xsiframe" />
diff --git a/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml b/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml
index ba6c171a7d..45ede928f5 100644
--- a/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml
+++ b/client/src/com/vaadin/VaadinBrowserSpecificOverrides.gwt.xml
@@ -1,54 +1,55 @@
 <module>
-	<!-- This GWT module defines the browser specific overrides used by Vaadin -->
-
-	<!-- Hint for WidgetSetBuilder not to automatically update the file -->
-	<!-- WS Compiler: manually edited -->
-
-	<!-- Fall through to this rule for everything but IE -->
-	<replace-with
-		class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy">
-		<when-type-is
-			class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" />
-	</replace-with>
-
-	<replace-with
-		class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategyIE">
-		<when-type-is
-			class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" />
-		<any>
-			<when-property-is name="user.agent" value="ie8" />
-		</any>
-	</replace-with>
-
-	<!-- Fall through to this rule for everything but IE -->
-	<replace-with class="com.vaadin.client.ui.VDragAndDropWrapper">
-		<when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" />
-	</replace-with>
-
-	<replace-with class="com.vaadin.client.ui.VDragAndDropWrapperIE">
-		<when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" />
-		<any>
-			<when-property-is name="user.agent" value="ie8" />
-		</any>
-	</replace-with>
-
-	<!-- Fall through to this rule for everything but IE -->
-	<replace-with class="com.vaadin.client.LayoutManager">
-		<when-type-is class="com.vaadin.client.LayoutManager" />
-	</replace-with>
-
-	<replace-with class="com.vaadin.client.LayoutManagerIE8">
-		<when-type-is class="com.vaadin.client.LayoutManager" />
-		<any>
-			<when-property-is name="user.agent" value="ie8" />
-		</any>
-	</replace-with>
-	
-	<replace-with class="com.vaadin.client.ui.VPopupImpl">
-    	<when-type-is class="com.google.gwt.user.client.ui.impl.PopupImplMozilla" />
-    	<when-property-is name="user.agent" value="gecko1_8"/>
-    </replace-with>
-    
+    <!-- This GWT module defines the browser specific overrides used by Vaadin -->
+
+    <!-- Hint for WidgetSetBuilder not to automatically update the file -->
+    <!-- WS Compiler: manually edited -->
+
+    <!-- Fall through to this rule for everything but IE -->
+    <replace-with
+        class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy">
+        <when-type-is
+            class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" />
+    </replace-with>
+
+    <replace-with
+        class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategyIE">
+        <when-type-is
+            class="com.vaadin.client.ui.upload.UploadIFrameOnloadStrategy" />
+        <any>
+            <when-property-is name="user.agent" value="ie8" />
+        </any>
+    </replace-with>
+
+    <!-- Fall through to this rule for everything but IE -->
+    <replace-with class="com.vaadin.client.ui.VDragAndDropWrapper">
+        <when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" />
+    </replace-with>
+
+    <replace-with class="com.vaadin.client.ui.VDragAndDropWrapperIE">
+        <when-type-is class="com.vaadin.client.ui.VDragAndDropWrapper" />
+        <any>
+            <when-property-is name="user.agent" value="ie8" />
+        </any>
+    </replace-with>
+
+    <!-- Fall through to this rule for everything but IE -->
+    <replace-with class="com.vaadin.client.LayoutManager">
+        <when-type-is class="com.vaadin.client.LayoutManager" />
+    </replace-with>
+
+    <replace-with class="com.vaadin.client.LayoutManagerIE8">
+        <when-type-is class="com.vaadin.client.LayoutManager" />
+        <any>
+            <when-property-is name="user.agent" value="ie8" />
+        </any>
+    </replace-with>
+
+    <replace-with class="com.vaadin.client.ui.VPopupImpl">
+        <when-type-is
+            class="com.google.gwt.user.client.ui.impl.PopupImplMozilla" />
+        <when-property-is name="user.agent" value="gecko1_8" />
+    </replace-with>
+
     <replace-with class="com.vaadin.client.ui.VPopupImpl">
         <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl" />
     </replace-with>
diff --git a/common.xml b/common.xml
index c0c5ca5eb5..e46cefd895 100644
--- a/common.xml
+++ b/common.xml
@@ -1,407 +1,472 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="common" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
-
-	<tstamp>
-		<format property="build.date" pattern="yyyy-MM-dd" />
-	</tstamp>
-
-	<dirname property="vaadin.basedir" file="${ant.file.common}" />
-	<property name="gwt.basedir" location="${vaadin.basedir}/../gwt" />
-	<property file="${vaadin.basedir}/build.properties" />
-
-	<property name="modules.to.publish.to.maven" value="shared,server,client,client-compiler,client-compiled,theme-compiler,themes,push" />
-	<property name="modules.to.publish.to.download" value="${modules.to.publish.to.maven},all" />
-
-	<ivy:settings file="${vaadin.basedir}/ivysettings.xml" />
-	<ivy:settings file="${vaadin.basedir}/ivysettings.xml" id="ivysettings" />
-	<ivy:resolve file="${vaadin.basedir}/ivy-taskdefs.xml" conf="taskdefs" log="quiet" />
-	<ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
-	<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpathref="taskdefs.classpath" />
-	<!-- ant contrib for Maven integration -->
-	<taskdef resource="org/apache/maven/artifact/ant/antlib.xml" uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" />
-
-	<!-- FIXME These are not available in other files -->
-	<antcontrib:propertyregex property="vaadin.version.major" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\1" />
-	<antcontrib:propertyregex property="vaadin.version.minor" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\2" />
-	<antcontrib:propertyregex property="vaadin.version.revision" input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)" select="\3" />
-
-	<union id="empty.reference" />
-
-	<property name="filtered.webcontent.dir" location="${vaadin.basedir}/result/filteredWebContent" />
-	<property name="release-notes-tickets-file" location="${vaadin.basedir}/result/release-notes-tickets.html" />
-
-	<target name="filter.webcontent" unless="webcontent.filtered" depends="fetch-release-notes-tickets">
-		<property name="webcontent.filtered" value="true" />
-		<!-- Running without build.release-notes will cause an error, which is ignored -->
-		<loadfile property="release-notes-tickets" srcFile="${release-notes-tickets-file}" failonerror="false" />
-
-		<delete dir="${filtered.webcontent.dir}" />
-		<copy todir="${filtered.webcontent.dir}">
-			<fileset dir="${vaadin.basedir}/WebContent">
-				<include name="img/**" />
-			</fileset>
-		</copy>
-		<copy todir="${filtered.webcontent.dir}">
-			<fileset dir="${vaadin.basedir}/WebContent">
-				<patternset>
-					<include name="release-notes.html" />
-					<include name="license.html" />
-					<include name="licenses/**" />
-					<include name="css/**" />
-				</patternset>
-			</fileset>
-			<filterchain>
-				<expandproperties />
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="version" value="${vaadin.version}" />
-				</replacetokens>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="version-minor" value="${vaadin.version.major}.${vaadin.version.minor}" />
-				</replacetokens>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="builddate" value="${build.date}" />
-				</replacetokens>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="release-notes-tickets" value="${release-notes-tickets}" />
-				</replacetokens>
-			</filterchain>
-		</copy>
-	</target>
-
-	<target name="fetch-release-notes-tickets" unless="built.release-notes" if="build.release-notes">
-		<mkdir dir="${vaadin.basedir}/result" />
-		<subant buildpath="${vaadin.basedir}/buildhelpers" target="fetch-release-notes-tickets" antfile="build.xml" inheritall="true">
-			<property name="output" location="${release-notes-tickets-file}" />
-		</subant>
-		<property name="built.release-notes" value="1" />
-	</target>
-
-	<fileset dir="${filtered.webcontent.dir}" id="common.files.for.all.jars">
-		<patternset>
-			<include name="release-notes.html" />
-			<include name="license.html" />
-			<include name="licenses/**" />
-			<include name="css/**" />
-			<include name="img/**" />
-		</patternset>
-	</fileset>
-
-
-	<target name="pom.xml" description="Generates a pom.xml based on the Ivy configuration. Either for a snapshot or a release version" depends="pom.xml.release,pom.xml.snapshot">
-	</target>
-
-	<target name="pom.xml.release" if="build.release">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<property name="ivy.xml" location="${result.dir}/../ivy.xml" />
-		<property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
-		<property name="conf" value="build, build-provided" />
-		<property name="vaadin.maven.version" value="${vaadin.version}" />
-
-		<ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" ivyfile="${ivy.xml}" pomfile="${pom.xml}" conf="${conf}">
-			<mapping conf="build" scope="compile" />
-			<mapping conf="build-provided" scope="provided" />
-		</ivy:makepom>
-	</target>
-
-	<target name="pom.xml.snapshot" unless="build.release">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<property name="ivy.xml" location="${result.dir}/../ivy.xml" />
-		<property name="pom.xml" location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
-		<property name="temp.pom.xml" location="${pom.xml}.temp" />
-		<property name="conf" value="build, build-provided" />
-		<property name="vaadin.maven.version" value="${vaadin.version.major}.${vaadin.version.minor}-SNAPSHOT" />
-
-		<ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml" ivyfile="${ivy.xml}" pomfile="${temp.pom.xml}" conf="${conf}">
-			<mapping conf="build" scope="compile" />
-			<mapping conf="build-provided" scope="provided" />
-		</ivy:makepom>
-		<copy file="${temp.pom.xml}" tofile="${pom.xml}">
-			<filterchain>
-				<replacestring from="${vaadin.version}" to="${vaadin.maven.version}" />
-			</filterchain>
-		</copy>
-		<delete file="${temp.pom.xml}" />
-	</target>
-
-
-	<target name="sources.jar" depends="compile, filter.webcontent">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<fail unless="module.name" message="No module.name parameter given" />
-		<fail unless="src" message="No src directory parameter given" />
-
-		<property name="sources.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}-sources.jar" />
-
-		<jar file="${sources.jar}" compress="true">
-			<fileset dir="${src}">
-				<patternset>
-					<include name="**/*.java" />
-				</patternset>
-			</fileset>
-			<fileset refid="common.files.for.all.jars" />
-			<restrict>
-				<union refid="extra.jar.includes" />
-				<name name="*.java" />
-			</restrict>
-		</jar>
-
-	</target>
-
-	<target name="javadoc.jar" depends="dependencies, filter.webcontent">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<fail unless="module.name" message="No module.name parameter given" />
-		<property name="src" location="{$result.dir}/../src" />
-		<property name="javadoc.dir" value="${result.dir}/javadoc" />
-		<property name="javadoc.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}-javadoc.jar" />
-
-		<javadoc destdir="${javadoc.dir}" author="true" version="true" use="true" windowtitle="${module.name}">
-			<packageset dir="${src}" excludes="${classes.exclude}" />
-			<doctitle>&lt;h1>${module.name}&lt;/h1></doctitle>
-			<!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
-			<bottom>${javadoc.bottom}</bottom>
-			<link offline="true" href="http://docs.oracle.com/javase/6/docs/api/" packagelistLoc="build/javadoc/j2se-1.6.0" />
-			<link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/" packagelistLoc="build/javadoc/j2ee-1.4" />
-			<classpath refid="classpath.compile.dependencies" />
-		</javadoc>
-
-		<!-- Create a javadoc jar -->
-		<jar file="${javadoc.jar}" compress="true">
-			<fileset dir="${javadoc.dir}" />
-			<fileset refid="common.files.for.all.jars" />
-		</jar>
-
-	</target>
-
-	<target name="jar" depends="compile, pom.xml, filter.webcontent">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<fail unless="module.name" message="No module.name parameter given" />
-
-		<property name="result.jar" location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
-		<property name="classes" location="{$result.dir}/classes" />
-		<property name="src" location="{$result.dir}/../src" />
-
-		<union id="jar.files">
-			<fileset dir="${classes}" excludes="${classes.exclude}" erroronmissingdir="false" />
-			<fileset dir="${src}" excludes="${jar.exclude}" erroronmissingdir="false" />
-			<fileset refid="common.files.for.all.jars" />
-			<union refid="extra.jar.includes" />
-		</union>
-
-		<jar destfile="${result.jar}" duplicate="fail" index="true">
-			<manifest>
-				<attribute name="Implementation-Vendor" value="${vaadin.vendor}" />
-				<attribute name="Implementation-URL" value="${vaadin.url}" />
-				<attribute name="Implementation-Version" value="${vaadin.version}" />
-			</manifest>
-			<union refid="jar.files" />
-		</jar>
-
-		<antcall target="common.make-osgi-bundle">
-			<param name="jar" value="${result.jar}" />
-			<param name="bundle-version" value="${vaadin.version}" />
-			<param name="bundle-name" value="${module.name}" />
-			<param name="bundle-symbolic" value="${module.symbolic}" />
-			<param name="bundle-vendor" value="${vaadin.vendor}" />
-		</antcall>
-
-	</target>
-
-	<!-- Add OSGi attributes to the manifest of the given jar -->
-	<target name="make-osgi-bundle">
-		<fail unless="jar" message="No jar parameter given" />
-		<fail unless="bundle-name" message="No bundle-name parameter given" />
-		<fail unless="bundle-symbolic" message="No bundle-symbolic parameter given" />
-		<fail unless="bundle-version" message="No bundle-version parameter given" />
-		<fail unless="bundle-vendor" message="No bundle-vendor parameter given" />
-
-		<property name="bundle-manifestversion" value="2" />
-
-		<jar file="${jar}" update="true">
-			<manifest>
-				<attribute name="Bundle-Version" value="${bundle-version}" />
-				<attribute name="Bundle-ManifestVersion" value="${bundle-manifestversion}" />
-				<attribute name="Bundle-Name" value="${bundle-name}" />
-				<attribute name="Bundle-SymbolicName" value="${bundle-symbolic}" />
-				<attribute name="Bundle-Vendor" value="${bundle-vendor}" />
-				<attribute name="Bundle-RequiredExecutionEnvironment" value="JavaSE-${vaadin.java.version}" />
-			</manifest>
-		</jar>
-
-		<antcontrib:if>
-			<isset property="import-package" />
-			<then>
-				<jar file="${result.jar}" update="true">
-					<manifest>
-						<attribute name="Import-Package" value="${import-package}" />
-					</manifest>
-				</jar>
-			</then>
-		</antcontrib:if>
-		<antcontrib:if>
-			<isset property="require-bundle" />
-			<then>
-				<jar file="${result.jar}" update="true">
-					<manifest>
-						<attribute name="Require-Bundle" value="${require-bundle}" />
-					</manifest>
-				</jar>
-			</then>
-		</antcontrib:if>
-		<antcontrib:if>
-			<isset property="export-package" />
-			<then>
-				<jar file="${result.jar}" update="true">
-					<manifest>
-						<attribute name="Export-Package" value="${export-package}" />
-					</manifest>
-				</jar>
-			</then>
-		</antcontrib:if>
-
-		<!-- Generate the Export-Package attribute in the manifest -->
-		<java classname="com.vaadin.buildhelpers.GeneratePackageExports" failonerror="true" fork="yes">
-			<arg value="${jar}" />
-			<arg line="com/vaadin com/google ${osgi.extra.package.prefixes}" />
-			<classpath refid="vaadin.buildhelpers.classpath" />
-			<jvmarg value="-Dvaadin.version=${vaadin.version}" />
-		</java>
-	</target>
-
-	<target name="compile" description="Compiles the module" depends="dependencies, directories" if="src-exists">
-		<fail unless="module.name" message="No module name given" />
-
-		<javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
-			<classpath refid="classpath.compile.dependencies" />
-			<classpath refid="classpath.compile.custom" />
-		</javac>
-	</target>
-
-	<target name="exec-buildhelper" depends="compile">
-		<fail unless="main.class" message="No main class given in 'main.class'" />
-		<fail unless="output" message="No output file given in 'output'" />
-		<java classname="${main.class}" output="${output}" failonerror="true" fork="yes">
-			<classpath refid="vaadin.buildhelpers.classpath" />
-			<classpath refid="classpath.compile.dependencies" />
-			<jvmarg value="-Dvaadin.version=${vaadin.version}" />
-		</java>
-	</target>
-
-	<target name="directories">
-		<property name="result.dir" location="result" />
-		<property name="src" location="${result.dir}/../src" />
-		<property name="classes" location="${result.dir}/classes" />
-		<available file="${src}" type="dir" property="src-exists" />
-		<mkdir dir="${classes}" />
-	</target>
-
-	<target name="test.run" depends="test.compile">
-		<fail unless="module.name" message="No module name given" />
-
-		<property name="result.dir" location="result" />
-		<property name="classes" location="${result.dir}/classes" />
-		<property name="test.src" location="${result.dir}/../tests/src" />
-		<property name="test.classes" location="${result.dir}/tests/classes" />
-
-
-		<junit printsummary="withOutAndErr" fork="yes">
-			<formatter usefile="false" type="plain" />
-			<jvmarg value="-ea" />
-			<classpath location="${test.classes}" />
-			<classpath location="${classes}" />
-			<classpath refid="classpath.compile.custom" />
-			<classpath refid="classpath.test.dependencies" />
-
-			<batchtest fork="yes">
-				<fileset dir="${test.src}">
-					<exclude name="**/Abstract*" />
-					<exclude name="com/vaadin/tests/data/bean/*" />
-					<exclude name="com/vaadin/tests/util/*" />
-					<exclude name="**/VaadinClasses.java" />
-					<exclude name="**/*TestRunner.java" />
-					<exclude name="**/SQLTestsConstants.java" />
-				</fileset>
-			</batchtest>
-		</junit>
-	</target>
-
-	<target name="test.compile" description="Compiles tests" depends="compile, dependencies.test">
-		<fail unless="module.name" message="No module name given" />
-		<property name="result.dir" location="result" />
-		<property name="base.dir" location="${result.dir}/.." />
-		<property name="test.src" location="${base.dir}/tests/src" />
-		<property name="test.resources" location="${base.dir}/tests/resources" />
-		<property name="test.classes" location="${result.dir}/tests/classes" />
-		<property name="classes" location="${result.dir}/classes" />
-
-		<mkdir dir="${test.classes}" />
-
-		<javac srcdir="${test.src}" destdir="${test.classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
-			<classpath refid="classpath.test.dependencies" />
-			<classpath location="${classes}" />
-			<classpath refid="classpath.test.custom" />
-		</javac>
-
-		<!-- Copy resources -->
-		<copy todir="${test.classes}" failonerror="false">
-			<fileset dir="${test.resources}" />
-		</copy>
-	</target>
-
-	<target name="dependencies" description="Resolves dependencies needed by this module">
-		<property name='conf' value="build, build-provided" />
-		<ivy:resolve resolveid="common" conf="${conf}" />
-		<ivy:cachepath pathid="classpath.compile.dependencies" conf="${conf}" />
-	</target>
-
-	<target name="dependencies.test" description="Resolves dependencies needed by test">
-		<ivy:resolve resolveid="common" conf="test" />
-		<ivy:cachepath pathid="classpath.test.dependencies" conf="test" />
-	</target>
-
-	<target name="clean">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<delete dir="${result.dir}" />
-	</target>
-
-	<target name="publish-local" description="Publishes the given module to the local repository">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<property name="conf" value="*(public)" />
-
-		<ivy:resolve conf="${conf}" />
-		<ivy:publish settingsref="ivysettings" conf="${conf}" resolver="build-temp" overwrite="true" forcedeliver="true">
-			<!--			<artifacts pattern="${result.dir}/[artifact]-[revision].[ext]" />-->
-			<artifacts pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" />
-
-		</ivy:publish>
-	</target>
-
-	<target name="publish.to.local.maven">
-		<property name="conf" value="*(public)" />
-
-		<ivy:resolve conf="${conf}" />
-		<ivy:publish conf="${conf}" resolver="local-maven" overwrite="true">
-		</ivy:publish>
-	</target>
-
-	<!-- Checkstyle conf -->
-	<property name="cs.dir" location="${vaadin.basedir}/checkstyle" />
-	<property name="cs.xml" location="${cs.dir}/vaadin-checkstyle.xml" />
-	<property name="cs.header-file" location="${cs.dir}/header" />
-	<taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle" classpathref="taskdefs.classpath" />
-
-	<target name="checkstyle">
-		<fail unless="result.dir" message="No result.dir parameter given" />
-		<fail unless="cs.src" message="No cs.src parameter given" />
-		<property name="result.dir.full" location="${result.dir}" />
-		<mkdir dir="${result.dir}" />
-		<echo>##teamcity[importData type='checkstyle' path='${result.dir.full}/checkstyle-errors.xml']</echo>
-		<cs:checkstyle config="${cs.xml}" failOnViolation="false">
-			<fileset dir="${cs.src}" includes="**/*.java">
-				<exclude name="com/vaadin/sass/internal/parser/Parser.java" />
-				<exclude name="com/vaadin/sass/internal/parser/ParserConstants.java" />
-				<exclude name="com/vaadin/sass/internal/parser/ParserTokenManager.java" />
-			</fileset>
-			<formatter type="xml" toFile="${result.dir}/checkstyle-errors.xml" />
-			<property key="checkstyle.header.file" file="${cs.header-file}" />
-		</cs:checkstyle>
-	</target>
+<project name="common" basedir="." default=""
+    xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib"
+    xmlns:cs="antlib:com.puppycrawl.tools.checkstyle">
+
+    <tstamp>
+        <format property="build.date" pattern="yyyy-MM-dd" />
+    </tstamp>
+
+    <dirname property="vaadin.basedir" file="${ant.file.common}" />
+    <property name="gwt.basedir" location="${vaadin.basedir}/../gwt" />
+    <property file="${vaadin.basedir}/build.properties" />
+
+    <property name="modules.to.publish.to.maven"
+        value="shared,server,client,client-compiler,client-compiled,theme-compiler,themes,push" />
+    <property name="modules.to.publish.to.download" value="${modules.to.publish.to.maven},all" />
+
+    <ivy:settings file="${vaadin.basedir}/ivysettings.xml" />
+    <ivy:settings file="${vaadin.basedir}/ivysettings.xml"
+        id="ivysettings" />
+    <ivy:resolve file="${vaadin.basedir}/ivy-taskdefs.xml"
+        conf="taskdefs" log="quiet" />
+    <ivy:cachepath pathid="taskdefs.classpath" conf="taskdefs" />
+    <taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml"
+        classpathref="taskdefs.classpath" />
+    <!-- ant contrib for Maven integration -->
+    <taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
+        uri="antlib:org.apache.maven.artifact.ant" classpathref="taskdefs.classpath" />
+
+    <!-- FIXME These are not available in other files -->
+    <antcontrib:propertyregex property="vaadin.version.major"
+        input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)"
+        select="\1" />
+    <antcontrib:propertyregex property="vaadin.version.minor"
+        input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)"
+        select="\2" />
+    <antcontrib:propertyregex property="vaadin.version.revision"
+        input="${vaadin.version}" regexp="([^\.]*)\.([^\.]*)\.([^\.]*)"
+        select="\3" />
+
+    <union id="empty.reference" />
+
+    <property name="filtered.webcontent.dir"
+        location="${vaadin.basedir}/result/filteredWebContent" />
+    <property name="release-notes-tickets-file"
+        location="${vaadin.basedir}/result/release-notes-tickets.html" />
+
+    <target name="filter.webcontent" unless="webcontent.filtered"
+        depends="fetch-release-notes-tickets">
+        <property name="webcontent.filtered" value="true" />
+        <!-- Running without build.release-notes will cause an error, which 
+            is ignored -->
+        <loadfile property="release-notes-tickets" srcFile="${release-notes-tickets-file}"
+            failonerror="false" />
+
+        <delete dir="${filtered.webcontent.dir}" />
+        <copy todir="${filtered.webcontent.dir}">
+            <fileset dir="${vaadin.basedir}/WebContent">
+                <include name="img/**" />
+            </fileset>
+        </copy>
+        <copy todir="${filtered.webcontent.dir}">
+            <fileset dir="${vaadin.basedir}/WebContent">
+                <patternset>
+                    <include name="release-notes.html" />
+                    <include name="license.html" />
+                    <include name="licenses/**" />
+                    <include name="css/**" />
+                </patternset>
+            </fileset>
+            <filterchain>
+                <expandproperties />
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="version" value="${vaadin.version}" />
+                </replacetokens>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="version-minor"
+                        value="${vaadin.version.major}.${vaadin.version.minor}" />
+                </replacetokens>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="builddate" value="${build.date}" />
+                </replacetokens>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="release-notes-tickets" value="${release-notes-tickets}" />
+                </replacetokens>
+            </filterchain>
+        </copy>
+    </target>
+
+    <target name="fetch-release-notes-tickets" unless="built.release-notes"
+        if="build.release-notes">
+        <mkdir dir="${vaadin.basedir}/result" />
+        <subant buildpath="${vaadin.basedir}/buildhelpers"
+            target="fetch-release-notes-tickets" antfile="build.xml"
+            inheritall="true">
+            <property name="output" location="${release-notes-tickets-file}" />
+        </subant>
+        <property name="built.release-notes" value="1" />
+    </target>
+
+    <fileset dir="${filtered.webcontent.dir}" id="common.files.for.all.jars">
+        <patternset>
+            <include name="release-notes.html" />
+            <include name="license.html" />
+            <include name="licenses/**" />
+            <include name="css/**" />
+            <include name="img/**" />
+        </patternset>
+    </fileset>
+
+
+    <target name="pom.xml"
+        description="Generates a pom.xml based on the Ivy configuration. Either for a snapshot or a release version"
+        depends="pom.xml.release,pom.xml.snapshot">
+    </target>
+
+    <target name="pom.xml.release" if="build.release">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <property name="ivy.xml" location="${result.dir}/../ivy.xml" />
+        <property name="pom.xml"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
+        <property name="conf" value="build, build-provided" />
+        <property name="vaadin.maven.version" value="${vaadin.version}" />
+
+        <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml"
+            ivyfile="${ivy.xml}" pomfile="${pom.xml}" conf="${conf}">
+            <mapping conf="build" scope="compile" />
+            <mapping conf="build-provided" scope="provided" />
+        </ivy:makepom>
+    </target>
+
+    <target name="pom.xml.snapshot" unless="build.release">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <property name="ivy.xml" location="${result.dir}/../ivy.xml" />
+        <property name="pom.xml"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}.pom" />
+        <property name="temp.pom.xml" location="${pom.xml}.temp" />
+        <property name="conf" value="build, build-provided" />
+        <property name="vaadin.maven.version"
+            value="${vaadin.version.major}.${vaadin.version.minor}-SNAPSHOT" />
+
+        <ivy:makepom templatefile="${vaadin.basedir}/pom-template.xml"
+            ivyfile="${ivy.xml}" pomfile="${temp.pom.xml}" conf="${conf}">
+            <mapping conf="build" scope="compile" />
+            <mapping conf="build-provided" scope="provided" />
+        </ivy:makepom>
+        <copy file="${temp.pom.xml}" tofile="${pom.xml}">
+            <filterchain>
+                <replacestring from="${vaadin.version}"
+                    to="${vaadin.maven.version}" />
+            </filterchain>
+        </copy>
+        <delete file="${temp.pom.xml}" />
+    </target>
+
+
+    <target name="sources.jar" depends="compile, filter.webcontent">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <fail unless="module.name" message="No module.name parameter given" />
+        <fail unless="src" message="No src directory parameter given" />
+
+        <property name="sources.jar"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}-sources.jar" />
+
+        <jar file="${sources.jar}" compress="true">
+            <fileset dir="${src}">
+                <patternset>
+                    <include name="**/*.java" />
+                </patternset>
+            </fileset>
+            <fileset refid="common.files.for.all.jars" />
+            <restrict>
+                <union refid="extra.jar.includes" />
+                <name name="*.java" />
+            </restrict>
+        </jar>
+
+    </target>
+
+    <target name="javadoc.jar" depends="dependencies, filter.webcontent">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <fail unless="module.name" message="No module.name parameter given" />
+        <property name="src" location="{$result.dir}/../src" />
+        <property name="javadoc.dir" value="${result.dir}/javadoc" />
+        <property name="javadoc.jar"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}-javadoc.jar" />
+
+        <javadoc destdir="${javadoc.dir}" author="true" version="true"
+            use="true" windowtitle="${module.name}">
+            <packageset dir="${src}" excludes="${classes.exclude}" />
+            <doctitle>&lt;h1>${module.name}&lt;/h1></doctitle>
+            <!-- <header><![CDATA[<script type="text/javascript" src=".html-style/style.js"></script>]]></header> -->
+            <bottom>${javadoc.bottom}</bottom>
+            <link offline="true"
+                href="http://docs.oracle.com/javase/6/docs/api/"
+                packagelistLoc="build/javadoc/j2se-1.6.0" />
+            <link offline="true" href="http://java.sun.com/j2ee/1.4/docs/api/"
+                packagelistLoc="build/javadoc/j2ee-1.4" />
+            <classpath refid="classpath.compile.dependencies" />
+        </javadoc>
+
+        <!-- Create a javadoc jar -->
+        <jar file="${javadoc.jar}" compress="true">
+            <fileset dir="${javadoc.dir}" />
+            <fileset refid="common.files.for.all.jars" />
+        </jar>
+
+    </target>
+
+    <target name="jar" depends="compile, pom.xml, filter.webcontent">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <fail unless="module.name" message="No module.name parameter given" />
+
+        <property name="result.jar"
+            location="${result.dir}/lib/${module.name}-${vaadin.version}.jar" />
+        <property name="classes" location="{$result.dir}/classes" />
+        <property name="src" location="{$result.dir}/../src" />
+
+        <union id="jar.files">
+            <fileset dir="${classes}" excludes="${classes.exclude}"
+                erroronmissingdir="false" />
+            <fileset dir="${src}" excludes="${jar.exclude}"
+                erroronmissingdir="false" />
+            <fileset refid="common.files.for.all.jars" />
+            <union refid="extra.jar.includes" />
+        </union>
+
+        <jar destfile="${result.jar}" duplicate="fail" index="true">
+            <manifest>
+                <attribute name="Implementation-Vendor" value="${vaadin.vendor}" />
+                <attribute name="Implementation-URL" value="${vaadin.url}" />
+                <attribute name="Implementation-Version"
+                    value="${vaadin.version}" />
+            </manifest>
+            <union refid="jar.files" />
+        </jar>
+
+        <antcall target="common.make-osgi-bundle">
+            <param name="jar" value="${result.jar}" />
+            <param name="bundle-version" value="${vaadin.version}" />
+            <param name="bundle-name" value="${module.name}" />
+            <param name="bundle-symbolic" value="${module.symbolic}" />
+            <param name="bundle-vendor" value="${vaadin.vendor}" />
+        </antcall>
+
+    </target>
+
+    <!-- Add OSGi attributes to the manifest of the given jar -->
+    <target name="make-osgi-bundle">
+        <fail unless="jar" message="No jar parameter given" />
+        <fail unless="bundle-name" message="No bundle-name parameter given" />
+        <fail unless="bundle-symbolic" message="No bundle-symbolic parameter given" />
+        <fail unless="bundle-version" message="No bundle-version parameter given" />
+        <fail unless="bundle-vendor" message="No bundle-vendor parameter given" />
+
+        <property name="bundle-manifestversion" value="2" />
+
+        <jar file="${jar}" update="true">
+            <manifest>
+                <attribute name="Bundle-Version" value="${bundle-version}" />
+                <attribute name="Bundle-ManifestVersion"
+                    value="${bundle-manifestversion}" />
+                <attribute name="Bundle-Name" value="${bundle-name}" />
+                <attribute name="Bundle-SymbolicName" value="${bundle-symbolic}" />
+                <attribute name="Bundle-Vendor" value="${bundle-vendor}" />
+                <attribute name="Bundle-RequiredExecutionEnvironment"
+                    value="JavaSE-${vaadin.java.version}" />
+            </manifest>
+        </jar>
+
+        <antcontrib:if>
+            <isset property="import-package" />
+            <then>
+                <jar file="${result.jar}" update="true">
+                    <manifest>
+                        <attribute name="Import-Package"
+                            value="${import-package}" />
+                    </manifest>
+                </jar>
+            </then>
+        </antcontrib:if>
+        <antcontrib:if>
+            <isset property="require-bundle" />
+            <then>
+                <jar file="${result.jar}" update="true">
+                    <manifest>
+                        <attribute name="Require-Bundle"
+                            value="${require-bundle}" />
+                    </manifest>
+                </jar>
+            </then>
+        </antcontrib:if>
+        <antcontrib:if>
+            <isset property="export-package" />
+            <then>
+                <jar file="${result.jar}" update="true">
+                    <manifest>
+                        <attribute name="Export-Package"
+                            value="${export-package}" />
+                    </manifest>
+                </jar>
+            </then>
+        </antcontrib:if>
+
+        <!-- Generate the Export-Package attribute in the manifest -->
+        <java classname="com.vaadin.buildhelpers.GeneratePackageExports"
+            failonerror="true" fork="yes">
+            <arg value="${jar}" />
+            <arg line="com/vaadin com/google ${osgi.extra.package.prefixes}" />
+            <classpath refid="vaadin.buildhelpers.classpath" />
+            <jvmarg value="-Dvaadin.version=${vaadin.version}" />
+        </java>
+    </target>
+
+    <target name="compile" description="Compiles the module"
+        depends="dependencies, directories" if="src-exists">
+        <fail unless="module.name" message="No module name given" />
+
+        <javac srcdir="${src}" destdir="${classes}" source="${vaadin.java.version}"
+            target="${vaadin.java.version}" debug="true" encoding="UTF-8"
+            includeantruntime="false">
+            <classpath refid="classpath.compile.dependencies" />
+            <classpath refid="classpath.compile.custom" />
+        </javac>
+    </target>
+
+    <target name="exec-buildhelper" depends="compile">
+        <fail unless="main.class" message="No main class given in 'main.class'" />
+        <fail unless="output" message="No output file given in 'output'" />
+        <java classname="${main.class}" output="${output}"
+            failonerror="true" fork="yes">
+            <classpath refid="vaadin.buildhelpers.classpath" />
+            <classpath refid="classpath.compile.dependencies" />
+            <jvmarg value="-Dvaadin.version=${vaadin.version}" />
+        </java>
+    </target>
+
+    <target name="directories">
+        <property name="result.dir" location="result" />
+        <property name="src" location="${result.dir}/../src" />
+        <property name="classes" location="${result.dir}/classes" />
+        <available file="${src}" type="dir" property="src-exists" />
+        <mkdir dir="${classes}" />
+    </target>
+
+    <target name="test.run" depends="test.compile">
+        <fail unless="module.name" message="No module name given" />
+
+        <property name="result.dir" location="result" />
+        <property name="classes" location="${result.dir}/classes" />
+        <property name="test.src" location="${result.dir}/../tests/src" />
+        <property name="test.classes" location="${result.dir}/tests/classes" />
+
+
+        <junit printsummary="withOutAndErr" fork="yes">
+            <formatter usefile="false" type="plain" />
+            <jvmarg value="-ea" />
+            <classpath location="${test.classes}" />
+            <classpath location="${classes}" />
+            <classpath refid="classpath.compile.custom" />
+            <classpath refid="classpath.test.dependencies" />
+
+            <batchtest fork="yes">
+                <fileset dir="${test.src}">
+                    <exclude name="**/Abstract*" />
+                    <exclude name="com/vaadin/tests/data/bean/*" />
+                    <exclude name="com/vaadin/tests/util/*" />
+                    <exclude name="**/VaadinClasses.java" />
+                    <exclude name="**/*TestRunner.java" />
+                    <exclude name="**/SQLTestsConstants.java" />
+                </fileset>
+            </batchtest>
+        </junit>
+    </target>
+
+    <target name="test.compile" description="Compiles tests"
+        depends="compile, dependencies.test">
+        <fail unless="module.name" message="No module name given" />
+        <property name="result.dir" location="result" />
+        <property name="base.dir" location="${result.dir}/.." />
+        <property name="test.src" location="${base.dir}/tests/src" />
+        <property name="test.resources" location="${base.dir}/tests/resources" />
+        <property name="test.classes" location="${result.dir}/tests/classes" />
+        <property name="classes" location="${result.dir}/classes" />
+
+        <mkdir dir="${test.classes}" />
+
+        <javac srcdir="${test.src}" destdir="${test.classes}"
+            source="${vaadin.java.version}" target="${vaadin.java.version}"
+            debug="true" encoding="UTF-8" includeantruntime="false">
+            <classpath refid="classpath.test.dependencies" />
+            <classpath location="${classes}" />
+            <classpath refid="classpath.test.custom" />
+        </javac>
+
+        <!-- Copy resources -->
+        <copy todir="${test.classes}" failonerror="false">
+            <fileset dir="${test.resources}" />
+        </copy>
+    </target>
+
+    <target name="dependencies" description="Resolves dependencies needed by this module">
+        <property name='conf' value="build, build-provided" />
+        <ivy:resolve resolveid="common" conf="${conf}" />
+        <ivy:cachepath pathid="classpath.compile.dependencies"
+            conf="${conf}" />
+    </target>
+
+    <target name="dependencies.test" description="Resolves dependencies needed by test">
+        <ivy:resolve resolveid="common" conf="test" />
+        <ivy:cachepath pathid="classpath.test.dependencies"
+            conf="test" />
+    </target>
+
+    <target name="clean">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <delete dir="${result.dir}" />
+    </target>
+
+    <target name="publish-local"
+        description="Publishes the given module to the local repository">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <property name="conf" value="*(public)" />
+
+        <ivy:resolve conf="${conf}" />
+        <ivy:publish settingsref="ivysettings" conf="${conf}"
+            resolver="build-temp" overwrite="true" forcedeliver="true">
+            <!-- <artifacts pattern="${result.dir}/[artifact]-[revision].[ext]" 
+                /> -->
+            <artifacts
+                pattern="${result.dir}/lib/[artifact]-[revision](-[classifier]).[ext]" />
+
+        </ivy:publish>
+    </target>
+
+    <target name="publish.to.local.maven">
+        <property name="conf" value="*(public)" />
+
+        <ivy:resolve conf="${conf}" />
+        <ivy:publish conf="${conf}" resolver="local-maven"
+            overwrite="true">
+        </ivy:publish>
+    </target>
+
+    <!-- Checkstyle conf -->
+    <property name="cs.dir" location="${vaadin.basedir}/checkstyle" />
+    <property name="cs.xml" location="${cs.dir}/vaadin-checkstyle.xml" />
+    <property name="cs.header-file" location="${cs.dir}/header" />
+    <taskdef resource="checkstyletask.properties" uri="antlib:com.puppycrawl.tools.checkstyle"
+        classpathref="taskdefs.classpath" />
+
+    <target name="checkstyle">
+        <fail unless="result.dir" message="No result.dir parameter given" />
+        <fail unless="cs.src" message="No cs.src parameter given" />
+        <property name="result.dir.full" location="${result.dir}" />
+        <mkdir dir="${result.dir}" />
+        <echo>##teamcity[importData type='checkstyle'
+            path='${result.dir.full}/checkstyle-errors.xml']</echo>
+        <cs:checkstyle config="${cs.xml}" failOnViolation="false">
+            <fileset dir="${cs.src}" includes="**/*.java">
+                <exclude name="com/vaadin/sass/internal/parser/Parser.java" />
+                <exclude
+                    name="com/vaadin/sass/internal/parser/ParserConstants.java" />
+                <exclude
+                    name="com/vaadin/sass/internal/parser/ParserTokenManager.java" />
+            </fileset>
+            <formatter type="xml"
+                toFile="${result.dir}/checkstyle-errors.xml" />
+            <property key="checkstyle.header.file" file="${cs.header-file}" />
+        </cs:checkstyle>
+    </target>
 </project>
diff --git a/gwt-files.xml b/gwt-files.xml
index cc4b4a1e96..4f9f746c99 100644
--- a/gwt-files.xml
+++ b/gwt-files.xml
@@ -1,189 +1,191 @@
 <?xml version="1.0"?>
 
 <project name="GWT files for Vaadin" basedir=".">
-	<include file="common.xml" as="common" />
-
-	<property name="gwt.lib.dir" location="${gwt.basedir}/build/lib" />
-	<property name="gwt.eclipse.basedir" location="${gwt.basedir}/eclipse" />
-
-	<property name="gwt.user.jar" location="${gwt.lib.dir}/gwt-user.jar" />
-	<property name="gwt.dev.jar" location="${gwt.lib.dir}/gwt-dev.jar" />
-	<property name="gwt.elemental.jar" location="${gwt.lib.dir}/gwt-elemental.jar" />
-	<property name="gwt.codeserver.jar" location="${gwt.lib.dir}/gwt-codeserver.jar" />
-
-	<available file="${gwt.dev.jar}" property="gwt.dev.jar.found" />
-	<available file="${gwt.user.jar}" property="gwt.user.jar.found" />
-	<available file="${gwt.elemental.jar}" property="gwt.elemental.jar.found" />
-	<available file="${gwt.codeserver.jar}" property="gwt.codeserver.jar.found" />
-
-	<property name="gwt.unpack.dir" location="${vaadin.basedir}/build/gwt" />
-
-	<property name="gwt.user.jar.files" location="${gwt.unpack.dir}/gwt-user.jar" />
-	<property name="gwt.dev.jar.files" location="${gwt.unpack.dir}/gwt-dev.jar" />
-	<property name="gwt.elemental.jar.files" location="${gwt.unpack.dir}/gwt-elemental.jar" />
-	<property name="gwt.codeserver.jar.files" location="${gwt.unpack.dir}/gwt-codeserver.jar" />
-
-	<target name="unpack.gwt">
-		<fail unless="gwt.dev.jar.found" message="Could not find gwt-dev.jar at ${gwt.dev.jar}" />
-		<fail unless="gwt.user.jar.found" message="Could not find gwt-user.jar at ${gwt.user.jar}" />
-		<fail unless="gwt.elemental.jar.found" message="Could not find gwt-elemental.jar at ${gwt.elemental.jar}" />
-		<fail unless="gwt.codeserver.jar.found" message="Could not find gwt-codeserver.jar at ${gwt.codeserver.jar}" />
-
-		<delete dir="${gwt.unpack.dir}" />
-
-		<mkdir dir="${gwt.user.jar.files}" />
-		<mkdir dir="${gwt.dev.jar.files}" />
-		<mkdir dir="${gwt.elemental.jar.files}" />
-		<mkdir dir="${gwt.codeserver.jar.files}" />
-
-		<unzip dest="${gwt.user.jar.files}" src="${gwt.user.jar}" />
-		<unzip dest="${gwt.dev.jar.files}" src="${gwt.dev.jar}" />
-		<unzip dest="${gwt.elemental.jar.files}" src="${gwt.elemental.jar}" />
-		<unzip dest="${gwt.codeserver.jar.files}" src="${gwt.codeserver.jar}" />
-	</target>
-
-	<union id="client-compiler.gwt.includes">
-		<!-- GWT development JAR contents including many external dependencies 
+    <include file="common.xml" as="common" />
+
+    <property name="gwt.lib.dir" location="${gwt.basedir}/build/lib" />
+    <property name="gwt.eclipse.basedir" location="${gwt.basedir}/eclipse" />
+
+    <property name="gwt.user.jar" location="${gwt.lib.dir}/gwt-user.jar" />
+    <property name="gwt.dev.jar" location="${gwt.lib.dir}/gwt-dev.jar" />
+    <property name="gwt.elemental.jar" location="${gwt.lib.dir}/gwt-elemental.jar" />
+    <property name="gwt.codeserver.jar" location="${gwt.lib.dir}/gwt-codeserver.jar" />
+
+    <available file="${gwt.dev.jar}" property="gwt.dev.jar.found" />
+    <available file="${gwt.user.jar}" property="gwt.user.jar.found" />
+    <available file="${gwt.elemental.jar}" property="gwt.elemental.jar.found" />
+    <available file="${gwt.codeserver.jar}" property="gwt.codeserver.jar.found" />
+
+    <property name="gwt.unpack.dir" location="${vaadin.basedir}/build/gwt" />
+
+    <property name="gwt.user.jar.files" location="${gwt.unpack.dir}/gwt-user.jar" />
+    <property name="gwt.dev.jar.files" location="${gwt.unpack.dir}/gwt-dev.jar" />
+    <property name="gwt.elemental.jar.files" location="${gwt.unpack.dir}/gwt-elemental.jar" />
+    <property name="gwt.codeserver.jar.files" location="${gwt.unpack.dir}/gwt-codeserver.jar" />
+
+    <target name="unpack.gwt">
+        <fail unless="gwt.dev.jar.found" message="Could not find gwt-dev.jar at ${gwt.dev.jar}" />
+        <fail unless="gwt.user.jar.found"
+            message="Could not find gwt-user.jar at ${gwt.user.jar}" />
+        <fail unless="gwt.elemental.jar.found"
+            message="Could not find gwt-elemental.jar at ${gwt.elemental.jar}" />
+        <fail unless="gwt.codeserver.jar.found"
+            message="Could not find gwt-codeserver.jar at ${gwt.codeserver.jar}" />
+
+        <delete dir="${gwt.unpack.dir}" />
+
+        <mkdir dir="${gwt.user.jar.files}" />
+        <mkdir dir="${gwt.dev.jar.files}" />
+        <mkdir dir="${gwt.elemental.jar.files}" />
+        <mkdir dir="${gwt.codeserver.jar.files}" />
+
+        <unzip dest="${gwt.user.jar.files}" src="${gwt.user.jar}" />
+        <unzip dest="${gwt.dev.jar.files}" src="${gwt.dev.jar}" />
+        <unzip dest="${gwt.elemental.jar.files}" src="${gwt.elemental.jar}" />
+        <unzip dest="${gwt.codeserver.jar.files}" src="${gwt.codeserver.jar}" />
+    </target>
+
+    <union id="client-compiler.gwt.includes">
+        <!-- GWT development JAR contents including many external dependencies 
             (for now) -->
-		<fileset dir="${gwt.dev.jar.files}">
-			<exclude name="META-INF/**" />
-			<exclude name="license*" />
-			<exclude name="LICENSE*" />
-
-			<!-- Packages in vaadin-shared-deps.jar or declared
-			as dependencies -->
-			<exclude name="com/google/gwt/thirdparty/guava/**" />
-			<exclude name="javax/servlet/**" />
-			<exclude name="javax/xml/**" />
-			<!-- cssparser -->
-			<exclude name="com/steadystate/css/**" />
-			<!-- Ant & AntLauncher -->
-			<exclude name="org/apache/tools/**" />
-			<!-- Jetty & jetty-util -->
-			<exclude name="org/mortbay/**" />
-			<!-- Swing Worker-->
-			<exclude name="org/jdesktop/swingworker/**" />
-			<!-- Apache commons codec & io & lang & collections & logging -->
-			<exclude name="org/apache/commons/codec/**" />
-			<exclude name="org/apache/commons/io/**" />
-			<exclude name="org/apache/commons/lang/**" />
-			<exclude name="org/apache/commons/collections/**" />
-			<exclude name="org/apache/commons/logging/**" />
-			<!-- apache mime4j -->
-			<exclude name="org/apache/james/mime4j/**" />
-
-			<!-- client-compiler-deps -->
-			<exclude name="com/gargoylesoftware/" />
-			<exclude name="com/google/common/" />
-			<exclude name="com/google/debugging/" />
-			<exclude name="com/google/gwt/dev/protobuf/" />
-			<exclude name="com/google/gwt/thirdparty/debugging/" />
-			<exclude name="com/google/gwt/thirdparty/javascript/" />
-			<exclude name="com/google/gwt/thirdparty/mozilla/" />
-			<exclude name="com/ibm/" />
-			<exclude name="externs.zip" />
-			<exclude name="java_cup/" />
-			<exclude name="javax/annotation/" />
-			<exclude name="net/sourceforge/htmlunit/" />
-			<exclude name="org/apache/bcel/" />
-			<exclude name="org/apache/html/" />
-			<exclude name="org/apache/http/" />
-			<exclude name="org/apache/NOTICE" />
-			<exclude name="org/apache/regexp/" />
-			<exclude name="org/apache/tapestry/" />
-			<exclude name="org/apache/wml/" />
-			<exclude name="org/apache/xalan/" />
-			<exclude name="org/apache/xerces/" />
-			<exclude name="org/apache/xml/" />
-			<exclude name="org/apache/xmlcommons/" />
-			<exclude name="org/apache/xpath/" />
-			<exclude name="org/cyberneko/" />
-			<exclude name="org/eclipse/" />
-			<exclude name="org/kohsuke/" />
-			<exclude name="org/w3c/" />
-			<exclude name="org/xml/" />
-			<exclude name="rhino_ast/" />
-			<exclude name="rhinoDiff.txt" />
-			<exclude name="trax/" />
-			<exclude name="unicode-license.txt" />
-			<exclude name="org/json" />
-
-			<exclude name="license/NOTICE" />
-			<exclude name="license/LICENSE.dom-documentation.txt" />
-			<exclude name="license/LICENSE.dom-software.txt" />
-			<exclude name="license/LICENSE" />
-			<exclude name="license/README.dom.txt" />
-			<exclude name="license/README.sax.txt" />
-
-			<!-- Overridden in Vaadin -->
-			<exclude name="com/google/gwt/dev/About.properties" />
-
-		</fileset>
-
-		<!-- GWT SuperDevMode -->
-		<fileset dir="${gwt.codeserver.jar.files}">
-			<exclude name="META-INF/**" />
-		</fileset>
-	</union>
-
-	<union id="client-compiled-cache.gwt.includes">
-		<!-- Precompiled GWT modules (.gwtar file) -->
-		<fileset dir="${gwt.user.jar.files}">
-			<exclude name="META-INF/**" />
-
-			<!-- precompiled GWT modules (.gwtar) -->
-			<include name="**/*.gwtar" />
-			<!-- external dependencies -->
-			<exclude name="javax/servlet/**" />
-			<exclude name="org/w3c/css/sac/**" />
-
-		</fileset>
-	</union>
-
-	<union id="client.gwt.includes">
-		<fileset dir="${gwt.user.jar.files}">
-			<exclude name="META-INF/**" />
-			<!-- precompiled GWT modules (.gwtar) goes into client-compiled -->
-			<exclude name="**/*.gwtar" />
-			<!-- These go into server -->
-			<exclude name="com/google/gwt/*/server/**" />
-			<!-- These go into shared -->
-			<exclude name="com/google/gwt/*/shared/**" />
-			<exclude name="com/google/gwt/*/*/shared/**" />
-			<exclude name="com/google/web/bindery/*/shared/**" />
-
-			<!-- Used by the server, in wrong package in GWT -->
-			<exclude name="com/google/gwt/user/client/rpc/IsSerializable.*" />
-
-			<!-- These are in vaadin-shared-deps -->
-			<exclude name="com/google/gwt/thirdparty/streamhtmlparser/**" />
-			<exclude name="org/w3c/flute/**" />
-
-			<!-- external dependencies -->
-			<exclude name="javax/servlet/**" />
-			<exclude name="org/w3c/css/sac/**" />
-		</fileset>
-		<!-- GWT Elemental -->
-		<fileset dir="${gwt.elemental.jar.files}">
-			<exclude name="META-INF/**" />
-		</fileset>
-	</union>
-
-	<union id="shared.gwt.includes">
-		<fileset dir="${gwt.user.jar.files}">
-			<!-- Shared files from user -->
-			<include name="com/google/gwt/*/shared/**" />
-			<include name="com/google/gwt/*/*/shared/**" />
-			<include name="com/google/web/bindery/*/shared/**" />
-			<include name="com/google/gwt/user/client/rpc/IsSerializable.*" />
-
-		</fileset>
-	</union>
-
-	<union id="server.gwt.includes">
-		<fileset dir="${gwt.user.jar.files}">
-			<!-- Server files from gwt-user -->
-			<include name="com/google/gwt/*/server/**" />
-		</fileset>
-	</union>
+        <fileset dir="${gwt.dev.jar.files}">
+            <exclude name="META-INF/**" />
+            <exclude name="license*" />
+            <exclude name="LICENSE*" />
+
+            <!-- Packages in vaadin-shared-deps.jar or declared as dependencies -->
+            <exclude name="com/google/gwt/thirdparty/guava/**" />
+            <exclude name="javax/servlet/**" />
+            <exclude name="javax/xml/**" />
+            <!-- cssparser -->
+            <exclude name="com/steadystate/css/**" />
+            <!-- Ant & AntLauncher -->
+            <exclude name="org/apache/tools/**" />
+            <!-- Jetty & jetty-util -->
+            <exclude name="org/mortbay/**" />
+            <!-- Swing Worker -->
+            <exclude name="org/jdesktop/swingworker/**" />
+            <!-- Apache commons codec & io & lang & collections & logging -->
+            <exclude name="org/apache/commons/codec/**" />
+            <exclude name="org/apache/commons/io/**" />
+            <exclude name="org/apache/commons/lang/**" />
+            <exclude name="org/apache/commons/collections/**" />
+            <exclude name="org/apache/commons/logging/**" />
+            <!-- apache mime4j -->
+            <exclude name="org/apache/james/mime4j/**" />
+
+            <!-- client-compiler-deps -->
+            <exclude name="com/gargoylesoftware/" />
+            <exclude name="com/google/common/" />
+            <exclude name="com/google/debugging/" />
+            <exclude name="com/google/gwt/dev/protobuf/" />
+            <exclude name="com/google/gwt/thirdparty/debugging/" />
+            <exclude name="com/google/gwt/thirdparty/javascript/" />
+            <exclude name="com/google/gwt/thirdparty/mozilla/" />
+            <exclude name="com/ibm/" />
+            <exclude name="externs.zip" />
+            <exclude name="java_cup/" />
+            <exclude name="javax/annotation/" />
+            <exclude name="net/sourceforge/htmlunit/" />
+            <exclude name="org/apache/bcel/" />
+            <exclude name="org/apache/html/" />
+            <exclude name="org/apache/http/" />
+            <exclude name="org/apache/NOTICE" />
+            <exclude name="org/apache/regexp/" />
+            <exclude name="org/apache/tapestry/" />
+            <exclude name="org/apache/wml/" />
+            <exclude name="org/apache/xalan/" />
+            <exclude name="org/apache/xerces/" />
+            <exclude name="org/apache/xml/" />
+            <exclude name="org/apache/xmlcommons/" />
+            <exclude name="org/apache/xpath/" />
+            <exclude name="org/cyberneko/" />
+            <exclude name="org/eclipse/" />
+            <exclude name="org/kohsuke/" />
+            <exclude name="org/w3c/" />
+            <exclude name="org/xml/" />
+            <exclude name="rhino_ast/" />
+            <exclude name="rhinoDiff.txt" />
+            <exclude name="trax/" />
+            <exclude name="unicode-license.txt" />
+            <exclude name="org/json" />
+
+            <exclude name="license/NOTICE" />
+            <exclude name="license/LICENSE.dom-documentation.txt" />
+            <exclude name="license/LICENSE.dom-software.txt" />
+            <exclude name="license/LICENSE" />
+            <exclude name="license/README.dom.txt" />
+            <exclude name="license/README.sax.txt" />
+
+            <!-- Overridden in Vaadin -->
+            <exclude name="com/google/gwt/dev/About.properties" />
+
+        </fileset>
+
+        <!-- GWT SuperDevMode -->
+        <fileset dir="${gwt.codeserver.jar.files}">
+            <exclude name="META-INF/**" />
+        </fileset>
+    </union>
+
+    <union id="client-compiled-cache.gwt.includes">
+        <!-- Precompiled GWT modules (.gwtar file) -->
+        <fileset dir="${gwt.user.jar.files}">
+            <exclude name="META-INF/**" />
+
+            <!-- precompiled GWT modules (.gwtar) -->
+            <include name="**/*.gwtar" />
+            <!-- external dependencies -->
+            <exclude name="javax/servlet/**" />
+            <exclude name="org/w3c/css/sac/**" />
+
+        </fileset>
+    </union>
+
+    <union id="client.gwt.includes">
+        <fileset dir="${gwt.user.jar.files}">
+            <exclude name="META-INF/**" />
+            <!-- precompiled GWT modules (.gwtar) goes into client-compiled -->
+            <exclude name="**/*.gwtar" />
+            <!-- These go into server -->
+            <exclude name="com/google/gwt/*/server/**" />
+            <!-- These go into shared -->
+            <exclude name="com/google/gwt/*/shared/**" />
+            <exclude name="com/google/gwt/*/*/shared/**" />
+            <exclude name="com/google/web/bindery/*/shared/**" />
+
+            <!-- Used by the server, in wrong package in GWT -->
+            <exclude name="com/google/gwt/user/client/rpc/IsSerializable.*" />
+
+            <!-- These are in vaadin-shared-deps -->
+            <exclude name="com/google/gwt/thirdparty/streamhtmlparser/**" />
+            <exclude name="org/w3c/flute/**" />
+
+            <!-- external dependencies -->
+            <exclude name="javax/servlet/**" />
+            <exclude name="org/w3c/css/sac/**" />
+        </fileset>
+        <!-- GWT Elemental -->
+        <fileset dir="${gwt.elemental.jar.files}">
+            <exclude name="META-INF/**" />
+        </fileset>
+    </union>
+
+    <union id="shared.gwt.includes">
+        <fileset dir="${gwt.user.jar.files}">
+            <!-- Shared files from user -->
+            <include name="com/google/gwt/*/shared/**" />
+            <include name="com/google/gwt/*/*/shared/**" />
+            <include name="com/google/web/bindery/*/shared/**" />
+            <include name="com/google/gwt/user/client/rpc/IsSerializable.*" />
+
+        </fileset>
+    </union>
+
+    <union id="server.gwt.includes">
+        <fileset dir="${gwt.user.jar.files}">
+            <!-- Server files from gwt-user -->
+            <include name="com/google/gwt/*/server/**" />
+        </fileset>
+    </union>
 </project>
diff --git a/ivy-taskdefs.xml b/ivy-taskdefs.xml
index 64d5ec1be1..3c04e5a051 100644
--- a/ivy-taskdefs.xml
+++ b/ivy-taskdefs.xml
@@ -1,24 +1,24 @@
 
 <ivy-module version="2.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
 
-	<info organisation="com.vaadin" module="vaadin" />
-	<configurations>
-		<conf name="taskdefs" description="Ant task definitions"
-			visibility="private" />
-	</configurations>
-	<publications />
-	<dependencies>
-		<!-- Ant tasks -->
-		<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"
-			conf="taskdefs ->master" />
-		<dependency org="org.apache.maven" name="maven-ant-tasks"
-			rev="2.0.10" conf="taskdefs ->master" />
-		<dependency org="com.googlecode.jarjar" name="jarjar" rev="1.3"
-			conf="taskdefs ->master" />
-		<dependency org="com.puppycrawl.tools" name="checkstyle"
-			rev="5.6" />
-	</dependencies>
+    <info organisation="com.vaadin" module="vaadin" />
+    <configurations>
+        <conf name="taskdefs" description="Ant task definitions"
+            visibility="private" />
+    </configurations>
+    <publications />
+    <dependencies>
+        <!-- Ant tasks -->
+        <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3"
+            conf="taskdefs ->master" />
+        <dependency org="org.apache.maven" name="maven-ant-tasks"
+            rev="2.0.10" conf="taskdefs ->master" />
+        <dependency org="com.googlecode.jarjar" name="jarjar"
+            rev="1.3" conf="taskdefs ->master" />
+        <dependency org="com.puppycrawl.tools" name="checkstyle"
+            rev="5.6" />
+    </dependencies>
 
 </ivy-module>
diff --git a/ivysettings.xml b/ivysettings.xml
index 88c38ff33e..6c230b9fd8 100644
--- a/ivysettings.xml
+++ b/ivysettings.xml
@@ -17,7 +17,8 @@
         </filesystem>
         <dual name="custom-smartsprites">
             <url name="smartsprites-ivy">
-                <ivy pattern="http://vaadin.com/download/external/[module]-ivy-[revision].xml" />
+                <ivy
+                    pattern="http://vaadin.com/download/external/[module]-ivy-[revision].xml" />
             </url>
             <url name="smartsprites-artifact">
                 <artifact
diff --git a/publish.xml b/publish.xml
index 61638851cd..e979ec1ca9 100644
--- a/publish.xml
+++ b/publish.xml
@@ -1,74 +1,87 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project name="publish" basedir="." default="" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
-	<include file="common.xml" as="common" />
-	<include file="build.xml" as="vaadin" />
+<project name="publish" basedir="." default=""
+    xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:antcontrib="antlib:net.sf.antcontrib"
+    xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+    <include file="common.xml" as="common" />
+    <include file="build.xml" as="vaadin" />
 
-	<!-- Dummy value as ivysettings-publish require a value  -->
-	<property name="publish.sftp.keyfile" value="/dummy" />
-	<property name="publish.sftp.ivy.pattern" value="dummy" />
+    <!-- Dummy value as ivysettings-publish require a value -->
+    <property name="publish.sftp.keyfile" value="/dummy" />
+    <property name="publish.sftp.ivy.pattern" value="dummy" />
 
-	<ivy:settings file="ivysettings.xml" />
-	<ivy:settings file="ivysettings-publish.xml" id="publish.settings" />
-	<property file="publish.properties" />
+    <ivy:settings file="ivysettings.xml" />
+    <ivy:settings file="ivysettings-publish.xml" id="publish.settings" />
+    <property file="publish.properties" />
 
-	<available property="ant-jsch.present" file="${ant.home}/lib/ant-jsch.jar" />
-	<available property="jsch.present" file="${ant.home}/lib/jsch-0.1.48.jar" />
-	<fail unless="ant-jsch.present" message="Please install ant-jsch.jar into ANT_HOME/lib" />
-	<fail unless="jsch.present" message="Please install jsch.jar into ANT_HOME/lib" />
+    <available property="ant-jsch.present" file="${ant.home}/lib/ant-jsch.jar" />
+    <available property="jsch.present" file="${ant.home}/lib/jsch-0.1.48.jar" />
+    <fail unless="ant-jsch.present" message="Please install ant-jsch.jar into ANT_HOME/lib" />
+    <fail unless="jsch.present" message="Please install jsch.jar into ANT_HOME/lib" />
 
-	<target name="nightly.publish" depends="nightly.download.publish, nightly.maven.publish">
+    <target name="nightly.publish"
+        depends="nightly.download.publish, nightly.maven.publish">
 
-	</target>
+    </target>
 
-	<!-- Copies the nightly build artifacts to the download server. -->
-	<target name="nightly.tests.publish" if="nightly.tests.publish">
-		<property name="file.war" location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${version}.war" />
-		<property name="target" value="${nightly.tests.publish}/${vaadin.version.major}.${vaadin.version.minor}-${build.tag}.war" />
+    <!-- Copies the nightly build artifacts to the download server. -->
+    <target name="nightly.tests.publish" if="nightly.tests.publish">
+        <property name="file.war"
+            location="result/artifacts/${vaadin.version}/vaadin-uitest/vaadin-uitest-${version}.war" />
+        <property name="target"
+            value="${nightly.tests.publish}/${vaadin.version.major}.${vaadin.version.minor}-${build.tag}.war" />
 
-		<echo>Installing ${src} to ${target}</echo>
+        <echo>Installing ${src} to ${target}</echo>
 
-		<scp todir="${nightly.tests.publish}" file="${file.war}">
-		</scp>
-	</target>
+        <scp todir="${nightly.tests.publish}" file="${file.war}">
+        </scp>
+    </target>
 
-	<target name="nightly.download.publish">
-		<antcontrib:foreach list="${modules.to.publish.to.download}" target="publish.module.to.download.site" param="module" />
-	</target>
+    <target name="nightly.download.publish">
+        <antcontrib:foreach list="${modules.to.publish.to.download}"
+            target="publish.module.to.download.site" param="module" />
+    </target>
 
-	<target name="nightly.maven.publish">
-		<antcontrib:foreach list="${modules.to.publish.to.maven}" target="publish.module.to.maven" param="module" />
-	</target>
+    <target name="nightly.maven.publish">
+        <antcontrib:foreach list="${modules.to.publish.to.maven}"
+            target="publish.module.to.maven" param="module" />
+    </target>
 
-	<target name="publish.module.to.download.site">
-		<fail unless="module" message="No module to publish defined" />
-		<ivy:resolve file="${module}/ivy.xml" />
-		<ivy:publish publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sftp-publish">
-			<artifacts pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision](-[classifier]).[ext]" />
-		</ivy:publish>
-	</target>
+    <target name="publish.module.to.download.site">
+        <fail unless="module" message="No module to publish defined" />
+        <ivy:resolve file="${module}/ivy.xml" />
+        <ivy:publish publishivy="false" settingsref="publish.settings"
+            conf="*(public)" resolver="sftp-publish">
+            <artifacts
+                pattern="${ivy.settings.dir}/result/artifacts/[revision]/[module]/[artifact]-[revision](-[classifier]).[ext]" />
+        </ivy:publish>
+    </target>
 
-	<target name="publish.module.to.maven">
-		<fail unless="module" message="No module to publish defined" />
-		<property file="${gpg.passphrase.file}" />
+    <target name="publish.module.to.maven">
+        <fail unless="module" message="No module to publish defined" />
+        <property file="${gpg.passphrase.file}" />
 
-		<!-- Ivy should be able to handle this but this does not work at the moment
-				<ivy:resolve file="${module}/ivy.xml" />
-		<ivy:publish pubrevision="7.0-SNAPSHOT" publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sonatype">
-			<artifacts pattern="${ivy.settings.dir}/result/artifacts/${vaadin.version}/[module]/[artifact]-${vaadin.version}(-[classifier]).[ext]" />
-		</ivy:publish>
--->
-		<property name="jar.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" />
-		<property name="pom.file" location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" />
+        <!-- Ivy should be able to handle this but this does not work at 
+            the moment <ivy:resolve file="${module}/ivy.xml" /> <ivy:publish pubrevision="7.0-SNAPSHOT" 
+            publishivy="false" settingsref="publish.settings" conf="*(public)" resolver="sonatype"> 
+            <artifacts pattern="${ivy.settings.dir}/result/artifacts/${vaadin.version}/[module]/[artifact]-${vaadin.version}(-[classifier]).[ext]" 
+            /> </ivy:publish> -->
+        <property name="jar.file"
+            location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.jar" />
+        <property name="pom.file"
+            location="result/artifacts/${vaadin.version}/vaadin-${module}/vaadin-${module}-${vaadin.version}.pom" />
 
-		<artifact:mvn failonerror="true">
-			<arg value="gpg:sign-and-deploy-file" />
-			<sysproperty key="file" value="${jar.file}" />
-			<sysproperty key="pomFile" value="${pom.file}" />
-			<sysproperty key="repositoryId" value="${maven.snapshot.repository.id}" />
-			<sysproperty key="url" value="${maven.snapshot.repository.url}" />
-			<sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
-			<sysproperty key="retryFailedDeploymentCount" value="10" />
-		</artifact:mvn>
-	</target>
+        <artifact:mvn failonerror="true">
+            <arg value="gpg:sign-and-deploy-file" />
+            <sysproperty key="file" value="${jar.file}" />
+            <sysproperty key="pomFile" value="${pom.file}" />
+            <sysproperty key="repositoryId"
+                value="${maven.snapshot.repository.id}" />
+            <sysproperty key="url"
+                value="${maven.snapshot.repository.url}" />
+            <sysproperty key="gpg.passphrase" value="${gpg.passphrase}" />
+            <sysproperty key="retryFailedDeploymentCount"
+                value="10" />
+        </artifact:mvn>
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/push/build.xml b/push/build.xml
index 3e750b67cd..ad27599d36 100644
--- a/push/build.xml
+++ b/push/build.xml
@@ -1,73 +1,84 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-push" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Meta package which defines dependencies needed for push
-	</description>
-	<include file="../build.xml" as="vaadin" />
-	<include file="../common.xml" as="common" />
+<project name="vaadin-push" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Meta package which defines dependencies needed for push
+    </description>
+    <include file="../build.xml" as="vaadin" />
+    <include file="../common.xml" as="common" />
 
-	<property name="module.name" value="vaadin-push" />
-	<property name="module.symbolic" value="com.vaadin.push" />
-	<property name="result.dir" location="result" />
-	<property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
+    <property name="module.name" value="vaadin-push" />
+    <property name="module.symbolic" value="com.vaadin.push" />
+    <property name="result.dir" location="result" />
+    <property name="vaadinPush.js" location="${result.dir}/js/VAADIN/vaadinPush.js" />
 
-	<!-- Keep the version number in sync with ivy.xml -->
-	<property name="atmosphere.version" value="1.0.13" />
-	<property name="jquery.version" value="1.7.2" />
+    <!-- Keep the version number in sync with ivy.xml -->
+    <property name="atmosphere.version" value="1.0.13" />
+    <property name="jquery.version" value="1.7.2" />
 
-	<path id="classpath.compile.custom" />
+    <path id="classpath.compile.custom" />
 
-	<union id="jar.includes">
-		<fileset dir="${result.dir}/js">
-			<include name="VAADIN/vaadinPush.js" />
-		</fileset>
-	</union>
+    <union id="jar.includes">
+        <fileset dir="${result.dir}/js">
+            <include name="VAADIN/vaadinPush.js" />
+        </fileset>
+    </union>
 
-	<target name="vaadinPush.js">
-		<mkdir dir="${result.dir}/js/VAADIN" />
-		<property name="vaadinPush.js.output" location="${result.dir}/js/VAADIN/vaadinPush.js" />
-		<property name="vaadinPush.js.combined.output" location="${result.dir}/js/VAADIN/push.combined.js" />
+    <target name="vaadinPush.js">
+        <mkdir dir="${result.dir}/js/VAADIN" />
+        <property name="vaadinPush.js.output" location="${result.dir}/js/VAADIN/vaadinPush.js" />
+        <property name="vaadinPush.js.combined.output"
+            location="${result.dir}/js/VAADIN/push.combined.js" />
 
-		<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-${jquery.version}.js" property="jquery.js.contents" />
-		<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js" property="jquery.atmosphere.js.contents" />
-		<loadfile srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl" property="vaadinPush.js.contents">
-			<filterchain>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="jquery.js" value="${jquery.js.contents}" />
-					<token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
-				</replacetokens>
-			</filterchain>
-		</loadfile>
-		<echo file="${vaadinPush.js.combined.output}">${vaadinPush.js.contents}</echo>
+        <loadfile
+            srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery-${jquery.version}.js"
+            property="jquery.js.contents" />
+        <loadfile
+            srcfile="${vaadin.basedir}/WebContent/VAADIN/jquery.atmosphere.js"
+            property="jquery.atmosphere.js.contents" />
+        <loadfile
+            srcfile="${vaadin.basedir}/WebContent/VAADIN/vaadinPush.js.tpl"
+            property="vaadinPush.js.contents">
+            <filterchain>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="jquery.js" value="${jquery.js.contents}" />
+                    <token key="jquery.atmosphere.js" value="${jquery.atmosphere.js.contents}" />
+                </replacetokens>
+            </filterchain>
+        </loadfile>
+        <echo file="${vaadinPush.js.combined.output}">${vaadinPush.js.contents}</echo>
 
-		<!-- Minify -->
-		<ivy:retrieve organisation="com.yahoo.platform.yui" module="yuicompressor" revision="2.4.7" inline="true" type="jar" pattern="${result.dir}/compressor.jar" />
-		<java jar="${result.dir}/compressor.jar" fork="true">
-			<arg value="-v"/>
-			<arg value="-o"/>
-			<arg file="${vaadinPush.js.output}"/>
-			<arg file="${vaadinPush.js.combined.output}"/>
-		</java>
-	</target>
-		
-	<target name="jar" depends="vaadinPush.js">
-		<antcall target="common.jar">
-			<param name="require-bundle" value="org.atmosphere.atmosphere-runtime;bundle-version=&quot;${atmosphere.version}&quot;;visibility:=reexport" />
-			<reference torefid="extra.jar.includes" refid="jar.includes" />
-		</antcall>
-	</target>
+        <!-- Minify -->
+        <ivy:retrieve organisation="com.yahoo.platform.yui"
+            module="yuicompressor" revision="2.4.7" inline="true" type="jar"
+            pattern="${result.dir}/compressor.jar" />
+        <java jar="${result.dir}/compressor.jar" fork="true">
+            <arg value="-v" />
+            <arg value="-o" />
+            <arg file="${vaadinPush.js.output}" />
+            <arg file="${vaadinPush.js.combined.output}" />
+        </java>
+    </target>
 
-	<target name="publish-local" depends="jar">
-		<antcall target="common.publish-local" />
-	</target>
+    <target name="jar" depends="vaadinPush.js">
+        <antcall target="common.jar">
+            <param name="require-bundle"
+                value="org.atmosphere.atmosphere-runtime;bundle-version=&quot;${atmosphere.version}&quot;;visibility:=reexport" />
+            <reference torefid="extra.jar.includes" refid="jar.includes" />
+        </antcall>
+    </target>
 
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-	<target name="checkstyle">
-	</target>
+    <target name="publish-local" depends="jar">
+        <antcall target="common.publish-local" />
+    </target>
 
-	<target name="test" depends="checkstyle">
-	</target>
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+    <target name="checkstyle">
+    </target>
+
+    <target name="test" depends="checkstyle">
+    </target>
 </project>
\ No newline at end of file
diff --git a/push/ivy.xml b/push/ivy.xml
index 69b7661fca..e2ba3a63f7 100644
--- a/push/ivy.xml
+++ b/push/ivy.xml
@@ -4,8 +4,7 @@
     xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
     xmlns:m="http://ant.apache.org/ivy/maven">
 
-    <info organisation="com.vaadin" module="vaadin-push"
-        revision="${vaadin.version}" />
+    <info organisation="com.vaadin" module="vaadin-push" revision="${vaadin.version}" />
 
     <configurations>
         <conf name="build" />
@@ -15,23 +14,21 @@
     </configurations>
     <publications>
         <artifact type="jar" ext="jar" />
-<!-- 
-        <artifact type="source" ext="jar" m:classifier="sources" />
-        <artifact type="javadoc" ext="jar" m:classifier="javadoc" />
--->        
+        <!-- <artifact type="source" ext="jar" m:classifier="sources" /> 
+            <artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
         <artifact type="pom" ext="pom" />
     </publications>
     <dependencies>
         <!-- API DEPENDENCIES -->
-        
+
         <!--Servlet API version 2.4 -->
         <dependency org="javax.servlet" name="servlet-api"
             rev="2.4" conf="build-provided,ide,test -> default" />
-                       
+
         <!-- Atmosphere -->
         <!-- Keep the version number in sync with build.xml -->
-        <dependency org="org.atmosphere" name="atmosphere-runtime" rev="1.0.13"
-        	conf="build,ide,test -> default">
+        <dependency org="org.atmosphere" name="atmosphere-runtime"
+            rev="1.0.13" conf="build,ide,test -> default">
         </dependency>
     </dependencies>
 
diff --git a/server/build.xml b/server/build.xml
index 1c84c7e6f5..a812404862 100644
--- a/server/build.xml
+++ b/server/build.xml
@@ -1,60 +1,63 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-server" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-server" />
-	<property name="module.symbolic" value="com.vaadin.server" />
-	<property name="result.dir" value="result" />
-	<path id="classpath.compile.custom" />
-	<path id="classpath.test.custom" />
-
-	<union id="jar.includes">
-		<union refid="server.gwt.includes" />
-		<fileset dir="${vaadin.basedir}/WebContent">
-			<include name="VAADIN/vaadinBootstrap.js" />
-		</fileset>
-	</union>
-
-	<target name="jar">
-		<property name="server.osgi.import" value="javax.servlet;version=&quot;2.4.0&quot;,javax.servlet.http;version=&quot;2.4.0&quot;,org.jsoup;version=&quot;1.6.3&quot;,org.jsoup.parser;version=&quot;1.6.3&quot;,org.jsoup.nodes;version=&quot;1.6.3&quot;,org.jsoup.helper;version=&quot;1.6.3&quot;,org.jsoup.safety;version=&quot;1.6.3&quot;,org.json;version=&quot;0.0.20080701&quot;" />
-		<property name="server.osgi.require" value="com.vaadin.shared;bundle-version=&quot;${vaadin.version}&quot;,com.vaadin.push;bundle-version=&quot;${vaadin.version}&quot;;resolution:=optional" />
-		<antcall target="common.jar">
-			<param name="require-bundle" value="${server.osgi.require}" />
-			<param name="import-package" value="${server.osgi.import}" />
-			<param name="osgi.extra.package.prefixes" value="VAADIN" />
-			<reference torefid="extra.jar.includes" refid="jar.includes" />
-		</antcall>
-	</target>
-
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="server.gwt.includes" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
-
-		<antcall target="common.publish-local" />
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
-
-	<target name="test" depends="checkstyle">
-		<antcall target="common.test.run" />
-	</target>
+<project name="vaadin-server" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-server" />
+    <property name="module.symbolic" value="com.vaadin.server" />
+    <property name="result.dir" value="result" />
+    <path id="classpath.compile.custom" />
+    <path id="classpath.test.custom" />
+
+    <union id="jar.includes">
+        <union refid="server.gwt.includes" />
+        <fileset dir="${vaadin.basedir}/WebContent">
+            <include name="VAADIN/vaadinBootstrap.js" />
+        </fileset>
+    </union>
+
+    <target name="jar">
+        <property name="server.osgi.import"
+            value="javax.servlet;version=&quot;2.4.0&quot;,javax.servlet.http;version=&quot;2.4.0&quot;,org.jsoup;version=&quot;1.6.3&quot;,org.jsoup.parser;version=&quot;1.6.3&quot;,org.jsoup.nodes;version=&quot;1.6.3&quot;,org.jsoup.helper;version=&quot;1.6.3&quot;,org.jsoup.safety;version=&quot;1.6.3&quot;,org.json;version=&quot;0.0.20080701&quot;" />
+        <property name="server.osgi.require"
+            value="com.vaadin.shared;bundle-version=&quot;${vaadin.version}&quot;,com.vaadin.push;bundle-version=&quot;${vaadin.version}&quot;;resolution:=optional" />
+        <antcall target="common.jar">
+            <param name="require-bundle" value="${server.osgi.require}" />
+            <param name="import-package" value="${server.osgi.import}" />
+            <param name="osgi.extra.package.prefixes" value="VAADIN" />
+            <reference torefid="extra.jar.includes" refid="jar.includes" />
+        </antcall>
+    </target>
+
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="server.gwt.includes" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
+
+        <antcall target="common.publish-local" />
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
+
+    <target name="test" depends="checkstyle">
+        <antcall target="common.test.run" />
+    </target>
 
 
 </project>
diff --git a/server/ivy.xml b/server/ivy.xml
index 46d9e4c9f5..db7e953371 100644
--- a/server/ivy.xml
+++ b/server/ivy.xml
@@ -45,8 +45,8 @@
             rev="${vaadin.version}" conf="build,test->build" />
         <dependency org="com.vaadin" name="vaadin-theme-compiler"
             rev="${vaadin.version}" conf="build,test->build" />
-        <dependency org="com.vaadin" name="vaadin-push"
-            rev="${vaadin.version}" conf="build-provided,test->build" />
+        <dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}"
+            conf="build-provided,test->build" />
 
         <!-- Jsoup for BootstrapHandler -->
         <dependency org="org.jsoup" name="jsoup" rev="1.6.3"
@@ -70,12 +70,10 @@
             conf="test -> default" />
         <dependency org="org.hibernate" name="hibernate-validator"
             rev="4.2.0.Final" conf="test -> default" />
-        
+
         <!-- For manual testing with PostgreSQL (see SQLTestConstants) -->
-        <!--
-        <dependency org="postgresql" name="postgresql"
-            rev="9.1-901.jdbc3" conf="test,ide->default" />
-        -->
+        <!-- <dependency org="postgresql" name="postgresql" rev="9.1-901.jdbc3" 
+            conf="test,ide->default" /> -->
 
     </dependencies>
 
diff --git a/shared/build.xml b/shared/build.xml
index 8520ee6eba..67dd3e9843 100644
--- a/shared/build.xml
+++ b/shared/build.xml
@@ -1,64 +1,66 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-shared" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
+<project name="vaadin-shared" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
 
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-shared" />
-	<property name="module.symbolic" value="com.vaadin.shared" />
-	<property name="result.dir" location="result" />
-	<property name="src.filtered" location="${result.dir}/filtered-src" />
-	<property name="src" location="${src.filtered}" />
-	<path id="classpath.compile.custom" />
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-shared" />
+    <property name="module.symbolic" value="com.vaadin.shared" />
+    <property name="result.dir" location="result" />
+    <property name="src.filtered" location="${result.dir}/filtered-src" />
+    <property name="src" location="${src.filtered}" />
+    <path id="classpath.compile.custom" />
 
 
-	<target name="jar">
-		<property name="shared.osgi.import" value="org.json;version=&quot;0.0.20080701&quot;, com.google.gwt.thirdparty.guava.common.annotations;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.base;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.base.internal;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.cache;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.collect;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.eventbus;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.io;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.net;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.primitives;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.util.concurrent;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser;version=&quot;0.1.5.r10-rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser.impl;version=&quot;0.1.5.r10-rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser.util;version=&quot;0.1.5.r10-rebased&quot;, org.w3c.flute.parser;version=&quot;1.3.0.gg2&quot;, org.w3c.flute.parser.selectors;version=&quot;1.3.0.gg2&quot;, org.w3c.flute.util;version=&quot;1.3.0.gg2&quot;" />
-		<delete dir="${src.filtered}" />
-		<!-- Update version in Version.java -->
-		<copy todir="${src.filtered}">
-			<fileset dir="src">
-			</fileset>
-			<filterchain>
-				<replacetokens begintoken="@" endtoken="@">
-					<token key="VERSION" value="${vaadin.version}" />
-				</replacetokens>
-			</filterchain>
-		</copy>
+    <target name="jar">
+        <property name="shared.osgi.import"
+            value="org.json;version=&quot;0.0.20080701&quot;, com.google.gwt.thirdparty.guava.common.annotations;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.base;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.base.internal;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.cache;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.collect;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.eventbus;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.io;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.net;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.primitives;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.guava.common.util.concurrent;version=&quot;10.0.1.rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser;version=&quot;0.1.5.r10-rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser.impl;version=&quot;0.1.5.r10-rebased&quot;, com.google.gwt.thirdparty.streamhtmlparser.util;version=&quot;0.1.5.r10-rebased&quot;, org.w3c.flute.parser;version=&quot;1.3.0.gg2&quot;, org.w3c.flute.parser.selectors;version=&quot;1.3.0.gg2&quot;, org.w3c.flute.util;version=&quot;1.3.0.gg2&quot;" />
+        <delete dir="${src.filtered}" />
+        <!-- Update version in Version.java -->
+        <copy todir="${src.filtered}">
+            <fileset dir="src">
+            </fileset>
+            <filterchain>
+                <replacetokens begintoken="@" endtoken="@">
+                    <token key="VERSION" value="${vaadin.version}" />
+                </replacetokens>
+            </filterchain>
+        </copy>
 
-		<antcall target="common.jar">
-			<param name="import-package" value="${shared.osgi.import}" />
-			<reference refid="shared.gwt.includes" torefid="extra.jar.includes" />
-		</antcall>
-	</target>
+        <antcall target="common.jar">
+            <param name="import-package" value="${shared.osgi.import}" />
+            <reference refid="shared.gwt.includes" torefid="extra.jar.includes" />
+        </antcall>
+    </target>
 
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="shared.gwt.includes" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="shared.gwt.includes" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
 
-		<antcall target="common.publish-local" />
-	</target>
+        <antcall target="common.publish-local" />
+    </target>
 
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-	
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
 
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No tests for ${module.name}!</echo>
-	</target>
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
+
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No tests for ${module.name}!</echo>
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/theme-compiler/build.xml b/theme-compiler/build.xml
index 277929d160..b28eca8cf7 100644
--- a/theme-compiler/build.xml
+++ b/theme-compiler/build.xml
@@ -1,58 +1,64 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-theme-compiler" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Compiles build helpers used when building other modules.
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-theme-compiler" />
-	<property name="module.symbolic" value="com.vaadin.theme-compiler" />
-	<property name="result.dir" value="result" />
-	<property name="sass.parser.jj" location="src/com/vaadin/sass/internal/parser/Parser.jj" />
-	<path id="classpath.compile.custom">
-	</path>
-	<path id="classpath.test.custom" />
-
-	<!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**" />-->
-
-	<target name="parser">
-		<!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the javacc task requires the jar to be named javacc.jar -->
-		<property name="javacc.home" location="${result.dir}/javacc" />
-		<ivy:retrieve organisation="net.java.dev.javacc" module="javacc" revision="5.0" inline="true" type="jar" pattern="${javacc.home}/[artifact].[ext]" />
-		<javacc target="${sass.parser.jj}" javacchome="${javacc.home}">
-		</javacc>
-	</target>
-
-	<target name="jar" depends="parser">
-		<antcall target="common.jar">
-			<reference torefid="extra.jar.includes" refid="empty.reference" />
-		</antcall>
-	</target>
-	<target name="publish-local" depends="jar">
-		<antcall target="common.sources.jar">
-			<reference torefid="extra.jar.includes" refid="empty.reference" />
-		</antcall>
-		<antcall target="common.javadoc.jar" />
-
-		<antcall target="common.publish-local" />
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-
-	<target name="checkstyle">
-		<antcall target="common.checkstyle">
-			<param name="cs.src" location="src" />
-		</antcall>
-	</target>
-
-	<target name="test" depends="checkstyle">
-		<antcall target="common.test.run" />
-	</target>
+<project name="vaadin-theme-compiler" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Compiles build helpers used when building other modules.
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-theme-compiler" />
+    <property name="module.symbolic" value="com.vaadin.theme-compiler" />
+    <property name="result.dir" value="result" />
+    <property name="sass.parser.jj"
+        location="src/com/vaadin/sass/internal/parser/Parser.jj" />
+    <path id="classpath.compile.custom">
+    </path>
+    <path id="classpath.test.custom" />
+
+    <!--<property name="classes.exclude" value="com/vaadin/buildhelpers/**" 
+        /> -->
+
+    <target name="parser">
+        <!-- Copy javacc-5.0.jar to ${result.dir}/javacc/javacc.jar as the 
+            javacc task requires the jar to be named javacc.jar -->
+        <property name="javacc.home" location="${result.dir}/javacc" />
+        <ivy:retrieve organisation="net.java.dev.javacc"
+            module="javacc" revision="5.0" inline="true" type="jar"
+            pattern="${javacc.home}/[artifact].[ext]" />
+        <javacc target="${sass.parser.jj}" javacchome="${javacc.home}">
+        </javacc>
+    </target>
+
+    <target name="jar" depends="parser">
+        <antcall target="common.jar">
+            <reference torefid="extra.jar.includes" refid="empty.reference" />
+        </antcall>
+    </target>
+    <target name="publish-local" depends="jar">
+        <antcall target="common.sources.jar">
+            <reference torefid="extra.jar.includes" refid="empty.reference" />
+        </antcall>
+        <antcall target="common.javadoc.jar" />
+
+        <antcall target="common.publish-local" />
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+
+    <target name="checkstyle">
+        <antcall target="common.checkstyle">
+            <param name="cs.src" location="src" />
+        </antcall>
+    </target>
+
+    <target name="test" depends="checkstyle">
+        <antcall target="common.test.run" />
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/themes/build.xml b/themes/build.xml
index 75b3e5a903..5bca50e5f5 100644
--- a/themes/build.xml
+++ b/themes/build.xml
@@ -1,107 +1,115 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-themes" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Themes compiled to CSS 
-	</description>
-
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-	<include file="../gwt-files.xml" as="gwtfiles" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-themes" />
-	<property name="module.symbolic" value="com.vaadin.themes" />
-	<property name="result.dir" value="result" />
-	<property name="theme.result.dir" value="${result.dir}/VAADIN/themes/" />
-
-	<union id="jar.includes">
-		<fileset dir="${result.dir}">
-			<include name="VAADIN/themes/**" />
-		</fileset>
-	</union>
-
-	<target name="compile-themes">
-		<ivy:resolve resolveid="common" conf="build" />
-		<ivy:cachepath pathid="classpath.compile.theme" conf="build" />
-
-		<antcall target="compile-theme">
-			<param name="theme" value="base" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="runo" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="reindeer" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="chameleon" />
-		</antcall>
-		<antcall target="compile-theme">
-			<param name="theme" value="liferay" />
-		</antcall>
-	</target>
-	
-	<target name="jar" depends="compile-themes">
-		<antcall target="common.jar">
-			<param name="osgi.extra.package.prefixes" value="VAADIN/themes" />
-			<reference torefid="extra.jar.includes" refid="jar.includes" />
-		</antcall>
-	</target>
-
-	<target name="copy-theme">
-		<fail unless="theme" message="You must give the theme name to copy n the 'theme' parameter" />
-		<property name="theme.source.dir" location="../WebContent/VAADIN/themes" />
-
-		<copy todir="${theme.result.dir}">
-			<fileset dir="${theme.source.dir}">
-				<include name="${theme}/**" />
-			</fileset>
-		</copy>
-	</target>
-
-	<target name="compile-theme" depends="copy-theme">
-		<fail unless="theme" message="You must give the theme name to compile in the 'theme' parameter" />
-
-		<ivy:resolve resolveid="common" conf="compile-theme" />
-		<ivy:cachepath pathid="classpath.compile.theme" conf="compile-theme" />
-		<ivy:cachepath pathid="classpath.runtime.theme" conf="build" />
-
-		<echo>Compiling ${theme}</echo>
-		<mkdir dir="${theme.result.dir}" />
-
-		<!-- compile the theme -->
-		<java classname="com.vaadin.buildhelpers.CompileTheme" classpathref="classpath.compile.theme" failonerror="yes" fork="yes" maxmemory="512m">
-			<arg value="--theme" />
-			<arg value="${theme}" />
-			<arg value="--theme-folder" />
-			<arg value="${theme.result.dir}" />
-			<arg value="--theme-version" />
-			<arg value="${vaadin.version}" />
-			<jvmarg value="-Xss8M" />
-			<jvmarg value="-XX:MaxPermSize=256M" />
-			<jvmarg value="-Djava.awt.headless=true" />
-		</java>
-
-	</target>
-
-
-	<target name="publish-local" depends="jar">
-		<antcall target="common.publish-local">
-
-		</antcall>
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-
-	<target name="checkstyle">
-		<echo>No java files in module</echo>
-	</target>
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No tests for ${module.name}!</echo>
-	</target>
+<project name="vaadin-themes" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Themes compiled to CSS
+    </description>
+
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+    <include file="../gwt-files.xml" as="gwtfiles" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-themes" />
+    <property name="module.symbolic" value="com.vaadin.themes" />
+    <property name="result.dir" value="result" />
+    <property name="theme.result.dir" value="${result.dir}/VAADIN/themes/" />
+
+    <union id="jar.includes">
+        <fileset dir="${result.dir}">
+            <include name="VAADIN/themes/**" />
+        </fileset>
+    </union>
+
+    <target name="compile-themes">
+        <ivy:resolve resolveid="common" conf="build" />
+        <ivy:cachepath pathid="classpath.compile.theme"
+            conf="build" />
+
+        <antcall target="compile-theme">
+            <param name="theme" value="base" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="runo" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="reindeer" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="chameleon" />
+        </antcall>
+        <antcall target="compile-theme">
+            <param name="theme" value="liferay" />
+        </antcall>
+    </target>
+
+    <target name="jar" depends="compile-themes">
+        <antcall target="common.jar">
+            <param name="osgi.extra.package.prefixes" value="VAADIN/themes" />
+            <reference torefid="extra.jar.includes" refid="jar.includes" />
+        </antcall>
+    </target>
+
+    <target name="copy-theme">
+        <fail unless="theme"
+            message="You must give the theme name to copy n the 'theme' parameter" />
+        <property name="theme.source.dir" location="../WebContent/VAADIN/themes" />
+
+        <copy todir="${theme.result.dir}">
+            <fileset dir="${theme.source.dir}">
+                <include name="${theme}/**" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="compile-theme" depends="copy-theme">
+        <fail unless="theme"
+            message="You must give the theme name to compile in the 'theme' parameter" />
+
+        <ivy:resolve resolveid="common" conf="compile-theme" />
+        <ivy:cachepath pathid="classpath.compile.theme"
+            conf="compile-theme" />
+        <ivy:cachepath pathid="classpath.runtime.theme"
+            conf="build" />
+
+        <echo>Compiling ${theme}</echo>
+        <mkdir dir="${theme.result.dir}" />
+
+        <!-- compile the theme -->
+        <java classname="com.vaadin.buildhelpers.CompileTheme"
+            classpathref="classpath.compile.theme" failonerror="yes"
+            fork="yes" maxmemory="512m">
+            <arg value="--theme" />
+            <arg value="${theme}" />
+            <arg value="--theme-folder" />
+            <arg value="${theme.result.dir}" />
+            <arg value="--theme-version" />
+            <arg value="${vaadin.version}" />
+            <jvmarg value="-Xss8M" />
+            <jvmarg value="-XX:MaxPermSize=256M" />
+            <jvmarg value="-Djava.awt.headless=true" />
+        </java>
+
+    </target>
+
+
+    <target name="publish-local" depends="jar">
+        <antcall target="common.publish-local">
+
+        </antcall>
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+
+    <target name="checkstyle">
+        <echo>No java files in module</echo>
+    </target>
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No tests for ${module.name}!</echo>
+    </target>
 
 </project>
diff --git a/themes/ivy.xml b/themes/ivy.xml
index e0e22429ab..beb1b16a00 100644
--- a/themes/ivy.xml
+++ b/themes/ivy.xml
@@ -14,8 +14,8 @@
     </configurations>
     <publications>
         <artifact type="jar" ext="jar" />
-<!--         <artifact type="source" ext="jar" m:classifier="sources" /> -->
-<!--         <artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
+        <!-- <artifact type="source" ext="jar" m:classifier="sources" /> -->
+        <!-- <artifact type="javadoc" ext="jar" m:classifier="javadoc" /> -->
         <artifact type="pom" ext="pom" />
     </publications>
     <dependencies>
diff --git a/uitest/build.xml b/uitest/build.xml
index 453fc26ea5..dc9258a807 100644
--- a/uitest/build.xml
+++ b/uitest/build.xml
@@ -1,148 +1,161 @@
 <?xml version="1.0"?>
 
-<project name="vaadin-uitest" basedir="." default="publish-local" xmlns:ivy="antlib:org.apache.ivy.ant">
-	<description>
-		Provides a uitest WAR containing Vaadin UI tests
-	</description>
-	<include file="../common.xml" as="common" />
-	<include file="../build.xml" as="vaadin" />
-
-	<!-- global properties -->
-	<property name="module.name" value="vaadin-uitest" />
-	<property name="result.dir" value="result" />
-	<property name="result.war" location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
-
-	<path id="classpath.compile.custom">
-	</path>
-
-	<target name="dependencies">
-		<!-- This is copied from common.xml to be able to add server.test.source to the source path -->
-
-		<ivy:resolve resolveid="common" conf="build, build-provided" />
-		<ivy:cachepath pathid="classpath.compile.dependencies" conf="build, build-provided" />
-	</target>
-
-	<target name="compile" description="Compiles the module" depends="dependencies">
-
-		<fail unless="module.name" message="No module name given" />
-		<property name="result.dir" location="result" />
-		<property name="src" location="${result.dir}/../src" />
-		<property name="classes" location="${result.dir}/classes" />
-		<property name="server.test.sources" location="${result.dir}/../../server/tests/src" />
-		<mkdir dir="${classes}" />
-
-		<!-- TODO: Get rid of this -->
-		<javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
-			<src path="${server.test.sources}" />
-			<include name="com/vaadin/tests/data/bean/**" />
-			<include name="com/vaadin/tests/VaadinClasses.java" />
-			<include name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" />
-			<classpath refid="classpath.compile.dependencies" />
-			<classpath refid="classpath.compile.custom" />
-		</javac>
-
-		<javac destdir="${classes}" source="${vaadin.java.version}" target="${vaadin.java.version}" debug="true" encoding="UTF-8" includeantruntime="false">
-			<src path="${src}" />
-			<classpath location="${classes}" />
-			<classpath refid="classpath.compile.dependencies" />
-			<classpath refid="classpath.compile.custom" />
-		</javac>
-	</target>
-
-	<target name="testing-widgetset" depends="dependencies,compile">
-		<property name="module" value="com.vaadin.tests.widgetset.TestingWidgetSet" />
-		<property name="style" value="OBF" />
-		<property name="localWorkers" value="2" />
-		<property name="extraParams" value="" />
-		<property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
-		<property name="work.dir" location="${result.dir}/work" />
-
-		<mkdir dir="${module.output.dir}" />
-
-		<echo>Compiling ${module} to ${module.output.dir}</echo>
-
-		<!-- compile the module -->
-		<java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies" failonerror="yes" fork="yes" maxmemory="512m">
-			<classpath location="src" />
-			<classpath location="${classes}" />
-			<arg value="-workDir" />
-			<arg value="${work.dir}" />
-			<arg value="-logLevel" />
-			<arg value="TRACE" />
-			<arg value="-war" />
-			<arg value="${module.output.dir}" />
-			<arg value="-style" />
-			<arg value="${style}" />
-
-			<arg value="-localWorkers" />
-			<arg value="${localWorkers}" />
-			<arg value="-strict" />
-			<arg line="${extraParams}" />
-			<arg value="${module}" />
-
-			<sysproperty key="vFailIfNotSerializable" value="true" />
-
-			<jvmarg value="-Xss8M" />
-			<jvmarg value="-XX:MaxPermSize=256M" />
-			<jvmarg value="-Djava.awt.headless=true" />
-		</java>
-
-	</target>
-
-	<target name="war" depends="dependencies, compile, testing-widgetset">
-		<property name="result.dir" location="result" />
-		<property name="classes" location="${result.dir}/classes" />
-		<property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
-		<property name="deps.dir" location="${result.dir}/deps" />
-		<property name="src" location="${result.dir}/../src" />
-
-		<ivy:resolve resolveid="common" conf="build" />
-		<ivy:cachepath pathid="classpath.runtime.dependencies" conf="build" />
-
-		<delete dir="${deps.dir}" />
-		<mkdir dir="${deps.dir}" />
-
-		<copy todir="${deps.dir}" flatten="true">
-			<path refid="classpath.runtime.dependencies" />
-		</copy>
-
-
-		<!-- Ensure filtered webcontent files are available -->
-		<antcall target="common.filter.webcontent" />
-
-		<war destfile="${result.war}" duplicate="fail" index="true">
-			<fileset refid="common.files.for.all.jars" />
-			<fileset dir="${result.dir}">
-				<include name="VAADIN/widgetsets/**/*"/>
-			</fileset>
-			<fileset dir="${WebContent.dir}">
-				<include name="statictestfiles/**" />
-				<include name="VAADIN/themes/tests-*/**" />
-				<include name="VAADIN/themes/reindeer-tests/**" />
-				<include name="WEB-INF/*.xml" />
-			</fileset>
-			<classes dir="${classes}" />
-			<classes dir="${src}" />
-			<lib dir="${deps.dir}" />
-		</war>
-
-	</target>
-
-	<target name="publish-local" depends="war">
-		<antcall target="common.publish-local">
-			<param name="conf" value="build" />
-		</antcall>
-	</target>
-
-	<target name="clean">
-		<antcall target="common.clean" />
-	</target>
-	<target name="checkstyle">
-		<echo>Checkstyle is disabled for uitest for now</echo>
-	</target>
-	<target name="test" depends="checkstyle">
-		<!--<antcall target="common.test.run" />-->
-		<echo>WHAT? No JUnit tests for ${module.name}!</echo>
-	</target>
+<project name="vaadin-uitest" basedir="." default="publish-local"
+    xmlns:ivy="antlib:org.apache.ivy.ant">
+    <description>
+        Provides a uitest WAR containing Vaadin UI tests
+    </description>
+    <include file="../common.xml" as="common" />
+    <include file="../build.xml" as="vaadin" />
+
+    <!-- global properties -->
+    <property name="module.name" value="vaadin-uitest" />
+    <property name="result.dir" value="result" />
+    <property name="result.war"
+        location="${result.dir}/lib/${module.name}-${vaadin.version}.war" />
+
+    <path id="classpath.compile.custom">
+    </path>
+
+    <target name="dependencies">
+        <!-- This is copied from common.xml to be able to add server.test.source 
+            to the source path -->
+
+        <ivy:resolve resolveid="common" conf="build, build-provided" />
+        <ivy:cachepath pathid="classpath.compile.dependencies"
+            conf="build, build-provided" />
+    </target>
+
+    <target name="compile" description="Compiles the module"
+        depends="dependencies">
+
+        <fail unless="module.name" message="No module name given" />
+        <property name="result.dir" location="result" />
+        <property name="src" location="${result.dir}/../src" />
+        <property name="classes" location="${result.dir}/classes" />
+        <property name="server.test.sources" location="${result.dir}/../../server/tests/src" />
+        <mkdir dir="${classes}" />
+
+        <!-- TODO: Get rid of this -->
+        <javac destdir="${classes}" source="${vaadin.java.version}"
+            target="${vaadin.java.version}" debug="true" encoding="UTF-8"
+            includeantruntime="false">
+            <src path="${server.test.sources}" />
+            <include name="com/vaadin/tests/data/bean/**" />
+            <include name="com/vaadin/tests/VaadinClasses.java" />
+            <include
+                name="com/vaadin/data/util/sqlcontainer/SQLTestsConstants.java" />
+            <classpath refid="classpath.compile.dependencies" />
+            <classpath refid="classpath.compile.custom" />
+        </javac>
+
+        <javac destdir="${classes}" source="${vaadin.java.version}"
+            target="${vaadin.java.version}" debug="true" encoding="UTF-8"
+            includeantruntime="false">
+            <src path="${src}" />
+            <classpath location="${classes}" />
+            <classpath refid="classpath.compile.dependencies" />
+            <classpath refid="classpath.compile.custom" />
+        </javac>
+    </target>
+
+    <target name="testing-widgetset" depends="dependencies,compile">
+        <property name="module"
+            value="com.vaadin.tests.widgetset.TestingWidgetSet" />
+        <property name="style" value="OBF" />
+        <property name="localWorkers" value="2" />
+        <property name="extraParams" value="" />
+        <property name="module.output.dir" location="${result.dir}/VAADIN/widgetsets" />
+        <property name="work.dir" location="${result.dir}/work" />
+
+        <mkdir dir="${module.output.dir}" />
+
+        <echo>Compiling ${module} to ${module.output.dir}</echo>
+
+        <!-- compile the module -->
+        <java classname="com.google.gwt.dev.Compiler" classpathref="classpath.compile.dependencies"
+            failonerror="yes" fork="yes" maxmemory="512m">
+            <classpath location="src" />
+            <classpath location="${classes}" />
+            <arg value="-workDir" />
+            <arg value="${work.dir}" />
+            <arg value="-logLevel" />
+            <arg value="TRACE" />
+            <arg value="-war" />
+            <arg value="${module.output.dir}" />
+            <arg value="-style" />
+            <arg value="${style}" />
+
+            <arg value="-localWorkers" />
+            <arg value="${localWorkers}" />
+            <arg value="-strict" />
+            <arg line="${extraParams}" />
+            <arg value="${module}" />
+
+            <sysproperty key="vFailIfNotSerializable" value="true" />
+
+            <jvmarg value="-Xss8M" />
+            <jvmarg value="-XX:MaxPermSize=256M" />
+            <jvmarg value="-Djava.awt.headless=true" />
+        </java>
+
+    </target>
+
+    <target name="war" depends="dependencies, compile, testing-widgetset">
+        <property name="result.dir" location="result" />
+        <property name="classes" location="${result.dir}/classes" />
+        <property name="WebContent.dir" location="${vaadin.basedir}/WebContent" />
+        <property name="deps.dir" location="${result.dir}/deps" />
+        <property name="src" location="${result.dir}/../src" />
+
+        <ivy:resolve resolveid="common" conf="build" />
+        <ivy:cachepath pathid="classpath.runtime.dependencies"
+            conf="build" />
+
+        <delete dir="${deps.dir}" />
+        <mkdir dir="${deps.dir}" />
+
+        <copy todir="${deps.dir}" flatten="true">
+            <path refid="classpath.runtime.dependencies" />
+        </copy>
+
+
+        <!-- Ensure filtered webcontent files are available -->
+        <antcall target="common.filter.webcontent" />
+
+        <war destfile="${result.war}" duplicate="fail" index="true">
+            <fileset refid="common.files.for.all.jars" />
+            <fileset dir="${result.dir}">
+                <include name="VAADIN/widgetsets/**/*" />
+            </fileset>
+            <fileset dir="${WebContent.dir}">
+                <include name="statictestfiles/**" />
+                <include name="VAADIN/themes/tests-*/**" />
+                <include name="VAADIN/themes/reindeer-tests/**" />
+                <include name="WEB-INF/*.xml" />
+            </fileset>
+            <classes dir="${classes}" />
+            <classes dir="${src}" />
+            <lib dir="${deps.dir}" />
+        </war>
+
+    </target>
+
+    <target name="publish-local" depends="war">
+        <antcall target="common.publish-local">
+            <param name="conf" value="build" />
+        </antcall>
+    </target>
+
+    <target name="clean">
+        <antcall target="common.clean" />
+    </target>
+    <target name="checkstyle">
+        <echo>Checkstyle is disabled for uitest for now</echo>
+    </target>
+    <target name="test" depends="checkstyle">
+        <!--<antcall target="common.test.run" /> -->
+        <echo>WHAT? No JUnit tests for ${module.name}!</echo>
+    </target>
 
 </project>
\ No newline at end of file
diff --git a/uitest/integration_base_files/base.xml b/uitest/integration_base_files/base.xml
index 5196aecfa9..d8ba018b75 100644
--- a/uitest/integration_base_files/base.xml
+++ b/uitest/integration_base_files/base.xml
@@ -1,138 +1,143 @@
 <?xml version="1.0"?>
 <project name="test" basedir=".">
-	<property file="deploy.properties" />
+    <property file="deploy.properties" />
     <property name="lock" value="deploy/lock.file" />
     <property name="deployDir" value="deploy/${server}" />
     <property name="serverPort" value="8080" />
     <property name="war" value="demo.war" />
     <property name="startupSpawn" value="false" />
     <property name="JAVA_HOME" value="/usr/lib/jvm/default-java" />
-	<property name="waitMinutes" value="3" />
-    <property name="waitUrl" value="http://localhost:${serverPort}/demo/VAADIN/themes/reindeer/styles.css" />
-	<property name="shutdownWait" value="10" />
+    <property name="waitMinutes" value="3" />
+    <property name="waitUrl"
+        value="http://localhost:${serverPort}/demo/VAADIN/themes/reindeer/styles.css" />
+    <property name="shutdownWait" value="10" />
+
 
-    
     <target name="afterDeploy">
-    	<!-- Empty default -->
+        <!-- Empty default -->
     </target>
-    
+
     <target name="beforeDeploy">
-    	<!-- Empty default -->
+        <!-- Empty default -->
+    </target>
+
+    <target name="deploy">
+        <antcall target="beforeDeploy" />
+        <echo
+            message="${server}: Deploying ${war} to ${deployDir}/${autodeployDir}" />
+        <copy file="${war}" todir="${deployDir}/${autodeployDir}" />
+        <antcall target="afterDeploy" />
+    </target>
+
+    <target name="deployStatic">
+        <unzip src="${war}" dest="${staticDeployDir}/tmp-unpack-jar/">
+            <patternset>
+                <include name="WEB-INF/lib/*.jar" />
+            </patternset>
+        </unzip>
+        <unzip dest="${staticDeployDir}">
+            <fileset dir="${staticDeployDir}/tmp-unpack-jar/WEB-INF/lib"
+                includes="*.jar" />
+
+            <patternset>
+                <include name="VAADIN/**" />
+            </patternset>
+        </unzip>
+        <delete dir="${staticDeployDir}/tmp-unpack-jar/" />
+
+        <unzip src="${war}" dest="${staticDeployDir}">
+            <patternset>
+                <include name="VAADIN/**" />
+            </patternset>
+        </unzip>
+    </target>
+
+    <target name="unpack-server">
+        <echo message="${server}: Unpacking ${server}.tar.gz" />
+        <delete dir="${server}" />
+        <exec executable="tar">
+            <arg value="-xf" />
+            <arg value="${server}.tar.gz" />
+        </exec>
+        <move file="${server}" tofile="${deployDir}" />
+        <echo message="Done." />
+    </target>
+
+    <target name="doStartup">
+        <exec executable="./run.sh" spawn="${startupSpawn}">
+            <env key="JAVA_HOME" value="${JAVA_HOME}" />
+        </exec>
+    </target>
+
+    <target name="startup">
+        <antcall target="doStartup" />
+        <echo message="${server}: Waiting for ${waitUrl} to become available." />
+        <waitfor maxwait="${waitMinutes}" maxwaitunit="minute"
+            checkevery="10000" timeoutproperty="timeout">
+            <http url="${waitUrl}" />
+        </waitfor>
+        <!-- Print load averages to get an indicator on whether the server 
+            still attempts to start up -->
+        <exec executable="uptime" />
+        <fail if="timeout" message="${server} failed to deploy" />
+
+        <echo message="${server}: Demo deployed successfully." />
+    </target>
+
+    <target name="shutdown">
+        <exec executable="./stop.sh">
+            <env key="JAVA_HOME" value="${JAVA_HOME}" />
+        </exec>
+        <sleep seconds="${shutdownWait}" />
+    </target>
+
+    <target name="force-shutdown">
+        <exec executable="./cleanup.sh" />
+    </target>
+
+    <target name="check-port">
+        <fail
+            message="${server}: Something is still listening on port ${serverPort}">
+            <condition>
+                <socket server="localhost" port="${serverPort}" />
+            </condition>
+        </fail>
+    </target>
+
+    <target name="check-lock">
+        <available file="${lock}" property="lockAvailable" />
+        <fail unless="lockAvailable" message="Instance is not locked!" />
+    </target>
+
+    <target name="get-lock">
+        <mkdir dir="deploy" />
+        <echo>${server}: Getting the lock</echo>
+        <exec executable="lockfile" failonerror="true">
+            <!-- Check every 10 seconds -->
+            <arg value="-10" />
+            <!-- Retry for 55 minutes (build server gives up after 60 minutes) -->
+            <arg value="-r330" />
+            <arg value="${lock}" />
+        </exec>
+        <echo>${server}: Got the lock</echo>
+    </target>
+
+    <target name="clean">
+        <delete dir="${deployDir}" failonerror="false" />
+    </target>
+
+    <target name="release-lock">
+        <!-- <exec executable="rm"> <arg value="-f" /> <arg value="${lock}" 
+            /> </exec> -->
+        <delete>
+            <fileset dir="." includes="${lock}" />
+        </delete>
+        <echo>${server}: Released the lock</echo>
     </target>
-    
-	<target name="deploy">
-		<antcall target="beforeDeploy" />
-	 	<echo message="${server}: Deploying ${war} to ${deployDir}/${autodeployDir}" />
-		<copy file="${war}" todir="${deployDir}/${autodeployDir}"/>
-		<antcall target="afterDeploy" />
-	</target>
-
-	<target name="deployStatic">
-		<unzip src="${war}" dest="${staticDeployDir}/tmp-unpack-jar/">
-			<patternset>
-				<include name="WEB-INF/lib/*.jar" />
-			</patternset>
-		</unzip>
-		<unzip dest="${staticDeployDir}">
-			<fileset dir="${staticDeployDir}/tmp-unpack-jar/WEB-INF/lib" includes="*.jar" />
-
-			<patternset>
-				<include name="VAADIN/**" />
-			</patternset>
-		</unzip>
-		<delete dir="${staticDeployDir}/tmp-unpack-jar/" />
-
-		<unzip src="${war}" dest="${staticDeployDir}">
-			<patternset>
-				<include name="VAADIN/**" />
-			</patternset>
-		</unzip>
-	</target>    
-    
-	 <target name="unpack-server">
-	 	<echo message="${server}: Unpacking ${server}.tar.gz" />
-	 	<delete dir="${server}" />
-		<exec executable="tar">
-		      <arg value="-xf"/>
-		      <arg value="${server}.tar.gz"/>
-		</exec>
-		<move file="${server}" tofile="${deployDir}" />
-		<echo message="Done." />
-	</target>
-	
-	<target name="doStartup">
-		<exec executable="./run.sh" spawn="${startupSpawn}">
-			<env key="JAVA_HOME" value="${JAVA_HOME}" />
-		</exec>
-	</target>
-	
-	<target name="startup">
-		<antcall target="doStartup" />
-		<echo message="${server}: Waiting for ${waitUrl} to become available." />
-		<waitfor maxwait="${waitMinutes}" maxwaitunit="minute" checkevery="10000" timeoutproperty="timeout">
-			 <http url="${waitUrl}" />
-		</waitfor>
-		<!-- Print load averages to get an indicator on whether the server still attempts to start up -->
-		<exec executable="uptime" />
-		<fail if="timeout" message="${server} failed to deploy" />
-
-		<echo message="${server}: Demo deployed successfully." />
-	</target>
-	
-	<target name="shutdown">
-		<exec executable="./stop.sh" >
-			<env key="JAVA_HOME" value="${JAVA_HOME}" />
-		</exec>
-		<sleep seconds="${shutdownWait}" />
-	</target>
-	
-	<target name="force-shutdown">
-		<exec executable="./cleanup.sh" />
-	</target>
-	
-	<target name="check-port">
-		<fail message="${server}: Something is still listening on port ${serverPort}">
-			<condition>
-				<socket server="localhost" port="${serverPort}" />
-			</condition>
-		</fail>
-	</target>
-	
-	<target name="check-lock">
-	  <available file="${lock}" property="lockAvailable" />
-	  <fail unless="lockAvailable" message="Instance is not locked!" />
-  	</target>
-	 
-	 <target name="get-lock">
-	 	<mkdir dir="deploy" /> 
-	 	<echo>${server}: Getting the lock</echo>
-	 	<exec executable="lockfile" failonerror="true">
-	 		<!-- Check every 10 seconds -->
-	 		<arg value="-10" />
-	 		<!--  Retry for 55 minutes (build server gives up after 60 minutes) -->
-	 		<arg value="-r330" />
-	 		<arg value="${lock}" />
-	 	</exec>
-	 	<echo>${server}: Got the lock</echo>
-	 </target>
-	 
-	 <target name="clean">
-		<delete dir="${deployDir}" failonerror="false" />
-	 </target>
-	 
-	 <target name="release-lock">
-<!--	 	<exec executable="rm">
-	 		<arg value="-f" />
-	 		<arg value="${lock}" />
-	 	</exec> -->
-	 	 <delete>
-		 	 <fileset dir="." includes="${lock}" />
-		 </delete>
-	 	<echo>${server}: Released the lock</echo>
-	 </target>
-	 
-	<target name="startup-and-deploy" depends="check-lock,check-port,unpack-server,deploy,startup" />
-	
-	<target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock,force-shutdown" />
-	 
+
+    <target name="startup-and-deploy"
+        depends="check-lock,check-port,unpack-server,deploy,startup" />
+
+    <target name="shutdown-and-cleanup" depends="shutdown,clean,release-lock,force-shutdown" />
+
 </project>
diff --git a/uitest/integration_tests.xml b/uitest/integration_tests.xml
index cb96834307..ba353dbdbb 100644
--- a/uitest/integration_tests.xml
+++ b/uitest/integration_tests.xml
@@ -1,541 +1,634 @@
 <?xml version="1.0"?>
 
-<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests" basedir="." default="integration-test-all">
-
-	<!-- Import common targets  -->
-	<import file="../common.xml" />
-	<dirname file="${ant.file.Vaadin Integration Tests}" property="integration_test.dir" />
-
-	<!-- Target deploying demo.war -->
-	<fail unless="test.integration.server" message="test.integration.server must be set for integration tests to run" />
-
-	<fail unless="test.integration.user" message="test.integration.user must be set for integration tests to run" />
-	<fail unless="test.integration.antfile" message="test.integration.antfile must be set for integration tests to run" />
-
-	<!-- Test with these browsers -->
-	<property name="test_browsers" value="winxp-firefox17-esr" />
-
-	<!-- Path to key file. Default value -->
-	<property name="sshkey.file" value="id_dsa" />
-
-	<!-- path and name for demo.war to be deployed -->
-	<property name="demo.war" value="demo.war" />
-
-	<!-- Host running Testbench RC or Testbench Hub. Default value -->
-	<property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />
-
-	<!-- Base url where the testable application is deployed -->
-	<property name="deployment.url" value="http://${test.integration.server}:8080" />
-
-	<!-- ssh host values -->
-	<property name="ant.hub" value="${test.integration.antfile}" />
-	<property name="user" value="${test.integration.user}" />
-	<property name="passphrase" value="" />
-
-	<!-- Upload war to deploy to ssh host -->
-	<target name="integration-test-upload-demo">
-		<scp file="${demo.war}" todir="${user}@${test.integration.server}:integration-tests/servers/demo.war" keyfile="${sshkey.file}" passphrase="${passphrase}" />
-	</target>
-
-	<!-- Run basic integration test test -->
-	<target name="integration-test-servlet">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-servlet.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		<subant target="run-tests" failonerror="false" antfile="test.xml">
-			<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
-			<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
-			<property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
-			<property name="server.start.succeeded" value="1" />
-			<property name="browsers" value="${test_browsers}" />
-			<property name="testfiles" value="${testfiles}" />
-			<property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
-			<property name="retries" value="0" />
-
-			<fileset dir="." includes="test.xml" />
-		</subant>
-	</target>
-	
-	<target name="integration-test-push-servlet">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="integration-test-${server-name}-push-servlet.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		<subant target="run-tests" failonerror="false" antfile="test.xml">
-			<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
-			<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
-			<property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
-			<property name="server.start.succeeded" value="1" />
-			<property name="browsers" value="${test_browsers}" />
-			<property name="testfiles" value="${testfiles}" />
-			<property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
-			<property name="retries" value="0" />
-
-			<fileset dir="." includes="test.xml" />
-		</subant>
-	</target>
-
-	<target name="integration-test-theme">
-		<subant target="run-tests" failonerror="false" antfile="test.xml">
-			<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
-			<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
-			<property name="com.vaadin.testbench.deployment.url" value="${deployment.url}" />
-			<property name="server.start.succeeded" value="1" />
-			<property name="testfiles" value="${testfiles-theme}" />
-			<property name="test-output-dir" value="${integration_test.dir}/result/integration-test-output/${server-name}" />
-
-			<fileset dir="." includes="test.xml" />
-		</subant>
-	</target>
-
-	<!-- Run integration test on GAE -->
-	<target name="integration-test-test-GAE">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="GoogleAppEngine/integration-test-GAE.html" />
-		<pathconvert pathsep=" " property="test-GAE" refid="html-test-files" />
-
-		<subant target="run-tests" failonerror="false" antfile="test.xml">
-			<property name="com.vaadin.testbench.lib.dir" value="${com.vaadin.testbench.lib.dir}" />
-			<property name="com.vaadin.testbench.tester.host" value="${com.vaadin.testbench.tester.host}" />
-			<property name="com.vaadin.testbench.deployment.url" value="http://vaadin-integration-test.appspot.com/" />
-			<property name="server.start.succeeded" value="1" />
-			<property name="browsers" value="${test_browsers}" />
-			<property name="testfiles" value="${test-GAE}" />
-			<property name="test-output-dir" value="../build/integration-test-gae-output" />
-
-			<fileset dir="." includes="test.xml" />
-		</subant>
-	</target>
-
-	<target name="integration-test-deploy-to-GAE">
-		<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
-	</target>
-
-
-	<target name="integration-test-tomcat7">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="tomcat7" />
-		</antcall>
-	</target>
-	<target name="integration-test-tomcat5">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="tomcat5" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-tomcat6">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="tomcat6" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jetty5">
-		<antcall target="run-generic-integration-test">
-			<param name="target-server" value="jetty5" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jetty6">
-		<antcall target="run-generic-integration-test">
-			<param name="target-server" value="jetty6" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jetty7">
-		<antcall target="run-generic-integration-test">
-			<param name="target-server" value="jetty7" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jetty8">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="300" />
-			<param name="target-server" value="jetty8" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jboss4">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="jboss4" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jboss5">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="jboss5" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jboss6">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="jboss6" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-jboss7">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="jboss7" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-glassfish2">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="glassfish2" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-glassfish3">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="10" />
-			<param name="target-server" value="glassfish3" />
-		</antcall>
-	</target>
-
-
-	<target name="integration-test-liferay6">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/integration-test-liferay-6.0.5.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="liferay6" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-liferay6-theme">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-	
-		<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6/Liferay6-theme.html" />
-		<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
-
-
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="liferay6" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-liferay5">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="liferay5" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-liferay6ee">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6EE/integration-test-liferay-6ee.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="liferay6ee" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-liferay6ee-theme">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		
-		<fileset dir="integration-testscripts" id="html-theme-files" includes="Liferay-6EE/Liferay6EE-theme.html" />
-		<pathconvert pathsep=" " property="testfiles-theme" refid="html-theme-files" />
-
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="liferay6ee" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-gatein3">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-googlechrome21" />
-			<param name="target-server" value="gatein3" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-exo3">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="test_browsers" value="winxp-firefox17-esr" />
-			<param name="target-server" value="exo3" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-websphere8">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="target-port" value="9080" />
-			<param name="target-server" value="websphere8" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-weblogic10">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="target-port" value="7001" />
-			<param name="target-server" value="weblogic10" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-weblogic12">
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="target-port" value="7001" />
-			<param name="target-server" value="weblogic12" />
-		</antcall>
-	</target>
-
-
-	<target name="integration-test-weblogicPortal">
-		<fileset dir="integration-testscripts" id="html-test-files" includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-		<antcall target="run-generic-integration-test">
-			<param name="startDelay" value="600" />
-			<param name="target-port" value="7001" />
-			<param name="target-server" value="weblogicportal" />
-		</antcall>
-	</target>
-
-	<target name="integration-test-GAE">
-		<antcall target="integration-test-deploy-to-GAE" />
-		<antcall target="integration-test-test-GAE" />
-	</target>
-
-	<!-- Upload demo, clean error screenshots and test deployment on all servers -->
-	<target name="integration-test-all">
-		<property name="passphrase" value="${passphrase}" />
-		<fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
-		<fail unless="com.vaadin.testbench.screenshot.directory" message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
-		<parallel>
-			<antcontrib:trycatch property="tried">
-				<try>
-					<!-- Still running GAE test from the old server which requires its own lock -->
-					<echo message="Getting lock" />
-					<antcall target="integration-test-get-lock" />
-					<echo message="Got lock" />
-					<antcall target="integration-test-upload-demo" />
-
-					<antcall target="run-integration-test">
-						<param name="target-server" value="GAE" />
-					</antcall>
-
-					<antcall target="integration-test-clean" />
-					<echo message="Getting lock" />
-					<antcall target="integration-test-release-lock" />
-					<echo message="Lock released" />
-					
-				</try>
-				<catch>
-					<echo message="Uploading of demo.war failed. ${tried}" />
-				</catch>
-			</antcontrib:trycatch>
-			<antcall target="integration-test-liferay6" />
-			<antcall target="integration-test-liferay6ee" />
-			<antcall target="integration-test-liferay6-theme" />
-			<antcall target="integration-test-liferay6ee-theme" />
-			<antcall target="integration-test-exo3" />
-			<antcall target="integration-test-weblogicPortal" />
-			<antcall target="integration-test-liferay5" />
-			<antcall target="integration-test-weblogic10" />
-			<antcall target="integration-test-weblogic12" />
-			<antcall target="integration-test-gatein3" />
-			<antcall target="integration-test-glassfish2" />
-			<antcall target="integration-test-glassfish3" />
-			<antcall target="integration-test-jboss4" />
-			<antcall target="integration-test-jboss5" />
-			<antcall target="integration-test-jboss6" />
-			<antcall target="integration-test-jboss7" />
-			<antcall target="integration-test-jetty5" />
-			<antcall target="integration-test-jetty6" />
-			<antcall target="integration-test-jetty7" />
-			<antcall target="integration-test-jetty8" />
-			<antcall target="integration-test-tomcat5" />
-			<antcall target="integration-test-tomcat6" />
-			<antcall target="integration-test-tomcat7" />
-			<antcall target="integration-test-websphere8" />
-			
-		</parallel>
-
-	</target>
-
-	<target name="do-run-generic-test">
-		<property name="target-host" value="${target-server}.devnet.vaadin.com" />
-		<property name="target-port" value="8080" />
-		<antcontrib:if>
-			<isset property="startDelay" />
-			<then>
-				<antcontrib:math result="sleepTime" datatype="int">
-					<op op="rint">
-						<op op="*">
-							<num value="${startDelay}" />
-							<op op="random" />
-						</op>
-					</op>
-				</antcontrib:math>
-				<echo>Delaying startup of ${target-server} with ${sleepTime} seconds</echo>
-				<sleep seconds="${sleepTime}" />
-			</then>
-		</antcontrib:if>
-
-		<scp todir="${user}@${target-host}:." keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}">
-			<fileset dir="integration_base_files">
-				<include name="*" />
-			</fileset>
-		</scp>
-
-		<!-- trycatch probably not needed any more as it just fails with the original message and doesn't do anything in the finally block -->
-		<antcontrib:trycatch property="error_message">
-			<try>
-				<!-- timeout in one hour (remote end should timeout in 55 minutes) -->
-				<sshexec host="${target-host}" outputproperty="lock-output" timeout="3600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" />
-				<antcall target="echo-prefix">
-					<param name="prefix" value="${target-server}: " />
-					<param name="message" value="${lock-output}" />
-				</antcall>
-
-				<scp file="${demo.war}" todir="${user}@${target-host}:demo.war" keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
-
-				<!-- timeout in 15 minutes -->
-				<sshexec host="${target-host}" outputproperty="start-output" timeout="900000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml startup-and-deploy" failonerror="false" />
-				<antcall target="echo-prefix">
-					<param name="prefix" value="${target-server}: " />
-					<param name="message" value="${start-output}" />
-				</antcall>
-
-				<fail message="${start-output}">
-					<condition>
-						<not>
-							<contains string="${start-output}" substring="Demo deployed successfully" />
-						</not>
-					</condition>
-				</fail>
-
-				<copy file="integration-testscripts/common/integration_test.tpl" tofile="integration-testscripts/integration-test-${target-server}-servlet.html" overwrite="true" />
-				<antcall target="integration-test-servlet">
-					<param name="server-name" value="${target-server}" />
-					<param name="deployment.url" value="http://${target-host}:${target-port}" />
-				</antcall>
-
-				<!-- Run theme tests in all browsers if there's a property with the test files -->
-				<antcontrib:if>
-					<isset property="testfiles-theme" />
-					<antcontrib:then>
-						<antcall target="integration-test-theme">
-							<param name="server-name" value="${target-server}" />
-							<param name="deployment.url" value="http://${target-host}:${target-port}" />
-						</antcall>
-					</antcontrib:then>
-				</antcontrib:if>
-
-				<!-- Run integration tests with push -->
-				<copy file="integration-testscripts/common/integration_push_test.tpl" tofile="integration-testscripts/integration-test-${target-server}-push-servlet.html" overwrite="true" />
-				<antcall target="integration-test-push-servlet">
-					<param name="server-name" value="${target-server}" />
-					<param name="deployment.url" value="http://${target-host}:${target-port}" />
-				</antcall>
-
-				<!-- Run theme tests in all browsers if there's a property with the test files -->
-				<antcontrib:if>
-					<isset property="testfiles-theme" />
-					<antcontrib:then>
-						<antcall target="integration-test-theme">
-							<param name="server-name" value="${target-server}" />
-							<param name="deployment.url" value="http://${target-host}:${target-port}" />
-						</antcall>
-					</antcontrib:then>
-				</antcontrib:if>
-
-				<!-- timeout in five minutes -->
-				<sshexec host="${target-host}" outputproperty="stop-output" timeout="600000" username="${user}" keyfile="${sshkey.file}" trust="yes" command="ant -f deploy.xml shutdown-and-cleanup" failonerror="false" />
-				<antcall target="echo-prefix">
-					<param name="prefix" value="${target-server}: " />
-					<param name="message" value="${stop-output}" />
-				</antcall>
-			</try>
-			<catch>
-				<fail message="${error_message}" />
-			</catch>
-		</antcontrib:trycatch>
-	</target>
-
-	<target name="echo-prefix">
-		<antcontrib:propertyregex property="message-prefixed" input="${prefix}${message}" regexp="\n" replace="\0${prefix}" global="true" defaultValue="${prefix}${message}" />
-		<echo message="${message-prefixed}" />
-	</target>
-
-	<target name="run-generic-integration-test">
-		<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
-		<antcontrib:trycatch property="tried">
-			<try>
-				<antcall target="do-run-generic-test" />
-			</try>
-			<catch>
-				<antcontrib:antcallback target="teamcity-escape" return="tried-escaped">
-					<param name="returnTo" value="tried-escaped" />
-					<param name="message" value="${tried}" />
-				</antcontrib:antcallback>
-				<concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']</concat>
-			</catch>
-		</antcontrib:trycatch>
-		<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
-	</target>
-
-	<target name="teamcity-escape">
-		<property name="returnTo" value="return" />
-
-		<!-- Should also perform other escaping (\u0085, \u2028 and \u2029) - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
-		<!-- Immutable properties -> needs to create a new one every time -->
-		<antcontrib:propertyregex property="details-escaped1" input="${message}" regexp="['|\[\]]" replace="|\0" global="true" defaultValue="${message}" />
-		<antcontrib:propertyregex property="details-escaped2" input="${details-escaped1}" regexp="\n" replace="|n" global="true" defaultValue="${details-escaped1}" />
-		<antcontrib:propertyregex property="details-escaped3" input="${details-escaped2}" regexp="\r" replace="|r" global="true" defaultValue="${details-escaped2}" />
-
-		<property name="${returnTo}" value="${details-escaped3}" />
-	</target>
-
-	<target name="run-integration-test">
-		<concat>##teamcity[testStarted name='${target-server}' flowId='${target-server}']</concat>
-		<antcontrib:trycatch property="tried">
-			<try>
-				<antcall target="integration-test-${target-server}" />
-			</try>
-			<catch>
-				<antcallback target="teamcity-escape" return="tried-escaped">
-					<param name="returnTo" value="tried-escaped" />
-					<param name="message" value="${tried}" />
-				</antcallback>
-				<concat>##teamcity[testFailed name='${target-server}' flowId='${target-server}' message='Integration test for ${target-server} failed.' details='${tried-escaped}']"</concat>
-			</catch>
-		</antcontrib:trycatch>
-		<concat>##teamcity[testFinished name='${target-server}' flowId='${target-server}']"</concat>
-	</target>
-
-	<target name="integration-test-get-lock">
-		<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
-	</target>
-
-	<target name="integration-test-release-lock">
-		<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
-	</target>
-
-	<!-- Remove demo.war -->
-	<target name="integration-test-clean">
-		<sshexec host="${test.integration.server}" username="${user}" keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
-	</target>
+<project xmlns:antcontrib="antlib:net.sf.antcontrib" name="Vaadin Integration Tests"
+    basedir="." default="integration-test-all">
+
+    <!-- Import common targets -->
+    <import file="../common.xml" />
+    <dirname file="${ant.file.Vaadin Integration Tests}"
+        property="integration_test.dir" />
+
+    <!-- Target deploying demo.war -->
+    <fail unless="test.integration.server"
+        message="test.integration.server must be set for integration tests to run" />
+
+    <fail unless="test.integration.user"
+        message="test.integration.user must be set for integration tests to run" />
+    <fail unless="test.integration.antfile"
+        message="test.integration.antfile must be set for integration tests to run" />
+
+    <!-- Test with these browsers -->
+    <property name="test_browsers" value="winxp-firefox17-esr" />
+
+    <!-- Path to key file. Default value -->
+    <property name="sshkey.file" value="id_dsa" />
+
+    <!-- path and name for demo.war to be deployed -->
+    <property name="demo.war" value="demo.war" />
+
+    <!-- Host running Testbench RC or Testbench Hub. Default value -->
+    <property name="com.vaadin.testbench.tester.host" value="127.0.0.1" />
+
+    <!-- Base url where the testable application is deployed -->
+    <property name="deployment.url" value="http://${test.integration.server}:8080" />
+
+    <!-- ssh host values -->
+    <property name="ant.hub" value="${test.integration.antfile}" />
+    <property name="user" value="${test.integration.user}" />
+    <property name="passphrase" value="" />
+
+    <!-- Upload war to deploy to ssh host -->
+    <target name="integration-test-upload-demo">
+        <scp file="${demo.war}"
+            todir="${user}@${test.integration.server}:integration-tests/servers/demo.war"
+            keyfile="${sshkey.file}" passphrase="${passphrase}" />
+    </target>
+
+    <!-- Run basic integration test test -->
+    <target name="integration-test-servlet">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="integration-test-${server-name}-servlet.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+        <subant target="run-tests" failonerror="false" antfile="test.xml">
+            <property name="com.vaadin.testbench.lib.dir"
+                value="${com.vaadin.testbench.lib.dir}" />
+            <property name="com.vaadin.testbench.tester.host"
+                value="${com.vaadin.testbench.tester.host}" />
+            <property name="com.vaadin.testbench.deployment.url"
+                value="${deployment.url}" />
+            <property name="server.start.succeeded" value="1" />
+            <property name="browsers" value="${test_browsers}" />
+            <property name="testfiles" value="${testfiles}" />
+            <property name="test-output-dir"
+                value="${integration_test.dir}/result/integration-test-output/${server-name}" />
+            <property name="retries" value="0" />
+
+            <fileset dir="." includes="test.xml" />
+        </subant>
+    </target>
+
+    <target name="integration-test-push-servlet">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="integration-test-${server-name}-push-servlet.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+        <subant target="run-tests" failonerror="false" antfile="test.xml">
+            <property name="com.vaadin.testbench.lib.dir"
+                value="${com.vaadin.testbench.lib.dir}" />
+            <property name="com.vaadin.testbench.tester.host"
+                value="${com.vaadin.testbench.tester.host}" />
+            <property name="com.vaadin.testbench.deployment.url"
+                value="${deployment.url}" />
+            <property name="server.start.succeeded" value="1" />
+            <property name="browsers" value="${test_browsers}" />
+            <property name="testfiles" value="${testfiles}" />
+            <property name="test-output-dir"
+                value="${integration_test.dir}/result/integration-test-output/${server-name}" />
+            <property name="retries" value="0" />
+
+            <fileset dir="." includes="test.xml" />
+        </subant>
+    </target>
+
+    <target name="integration-test-theme">
+        <subant target="run-tests" failonerror="false" antfile="test.xml">
+            <property name="com.vaadin.testbench.lib.dir"
+                value="${com.vaadin.testbench.lib.dir}" />
+            <property name="com.vaadin.testbench.tester.host"
+                value="${com.vaadin.testbench.tester.host}" />
+            <property name="com.vaadin.testbench.deployment.url"
+                value="${deployment.url}" />
+            <property name="server.start.succeeded" value="1" />
+            <property name="testfiles" value="${testfiles-theme}" />
+            <property name="test-output-dir"
+                value="${integration_test.dir}/result/integration-test-output/${server-name}" />
+
+            <fileset dir="." includes="test.xml" />
+        </subant>
+    </target>
+
+    <!-- Run integration test on GAE -->
+    <target name="integration-test-test-GAE">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="GoogleAppEngine/integration-test-GAE.html" />
+        <pathconvert pathsep=" " property="test-GAE" refid="html-test-files" />
+
+        <subant target="run-tests" failonerror="false" antfile="test.xml">
+            <property name="com.vaadin.testbench.lib.dir"
+                value="${com.vaadin.testbench.lib.dir}" />
+            <property name="com.vaadin.testbench.tester.host"
+                value="${com.vaadin.testbench.tester.host}" />
+            <property name="com.vaadin.testbench.deployment.url"
+                value="http://vaadin-integration-test.appspot.com/" />
+            <property name="server.start.succeeded" value="1" />
+            <property name="browsers" value="${test_browsers}" />
+            <property name="testfiles" value="${test-GAE}" />
+            <property name="test-output-dir"
+                value="../build/integration-test-gae-output" />
+
+            <fileset dir="." includes="test.xml" />
+        </subant>
+    </target>
+
+    <target name="integration-test-deploy-to-GAE">
+        <sshexec host="${test.integration.server}" username="${user}"
+            keyfile="${sshkey.file}" command="ant -f ${ant.hub} deploy-to-GAE" />
+    </target>
+
+
+    <target name="integration-test-tomcat7">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="tomcat7" />
+        </antcall>
+    </target>
+    <target name="integration-test-tomcat5">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="tomcat5" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-tomcat6">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="tomcat6" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jetty5">
+        <antcall target="run-generic-integration-test">
+            <param name="target-server" value="jetty5" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jetty6">
+        <antcall target="run-generic-integration-test">
+            <param name="target-server" value="jetty6" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jetty7">
+        <antcall target="run-generic-integration-test">
+            <param name="target-server" value="jetty7" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jetty8">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="300" />
+            <param name="target-server" value="jetty8" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jboss4">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="jboss4" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jboss5">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="jboss5" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jboss6">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="jboss6" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-jboss7">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="jboss7" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-glassfish2">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="glassfish2" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-glassfish3">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="10" />
+            <param name="target-server" value="glassfish3" />
+        </antcall>
+    </target>
+
+
+    <target name="integration-test-liferay6">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="Liferay-6/integration-test-liferay-6.0.5.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="liferay6" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-liferay6-theme">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <fileset dir="integration-testscripts" id="html-theme-files"
+            includes="Liferay-6/Liferay6-theme.html" />
+        <pathconvert pathsep=" " property="testfiles-theme"
+            refid="html-theme-files" />
+
+
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="liferay6" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-liferay5">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="Liferay-5/integration-test-liferay-5.2.3-portlet2.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="liferay5" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-liferay6ee">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="Liferay-6EE/integration-test-liferay-6ee.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="liferay6ee" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-liferay6ee-theme">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="Liferay-6/Liferay6-and-6EE-theme-deploy.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <fileset dir="integration-testscripts" id="html-theme-files"
+            includes="Liferay-6EE/Liferay6EE-theme.html" />
+        <pathconvert pathsep=" " property="testfiles-theme"
+            refid="html-theme-files" />
+
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="liferay6ee" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-gatein3">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="GateIn-3/integration-test-GateIn-3.1.0-portlet2.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-googlechrome21" />
+            <param name="target-server" value="gatein3" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-exo3">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="eXo-3/integration-test-eXo-3.0.3-portlet2.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="test_browsers" value="winxp-firefox17-esr" />
+            <param name="target-server" value="exo3" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-websphere8">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="target-port" value="9080" />
+            <param name="target-server" value="websphere8" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-weblogic10">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="target-port" value="7001" />
+            <param name="target-server" value="weblogic10" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-weblogic12">
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="target-port" value="7001" />
+            <param name="target-server" value="weblogic12" />
+        </antcall>
+    </target>
+
+
+    <target name="integration-test-weblogicPortal">
+        <fileset dir="integration-testscripts" id="html-test-files"
+            includes="weblogic-portal/integration-test-WebLogic-Portal-10.3.2-portlet2.html" />
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+        <antcall target="run-generic-integration-test">
+            <param name="startDelay" value="600" />
+            <param name="target-port" value="7001" />
+            <param name="target-server" value="weblogicportal" />
+        </antcall>
+    </target>
+
+    <target name="integration-test-GAE">
+        <antcall target="integration-test-deploy-to-GAE" />
+        <antcall target="integration-test-test-GAE" />
+    </target>
+
+    <!-- Upload demo, clean error screenshots and test deployment on all 
+        servers -->
+    <target name="integration-test-all">
+        <property name="passphrase" value="${passphrase}" />
+        <fail unless="sshkey.file" message="You must define an ssh.keyfile parameter" />
+        <fail unless="com.vaadin.testbench.screenshot.directory"
+            message="You must define a com.vaadin.testbench.screenshot.directory parameter" />
+        <parallel>
+            <antcontrib:trycatch property="tried">
+                <try>
+                    <!-- Still running GAE test from the old server which 
+                        requires its own lock -->
+                    <echo message="Getting lock" />
+                    <antcall target="integration-test-get-lock" />
+                    <echo message="Got lock" />
+                    <antcall target="integration-test-upload-demo" />
+
+                    <antcall target="run-integration-test">
+                        <param name="target-server" value="GAE" />
+                    </antcall>
+
+                    <antcall target="integration-test-clean" />
+                    <echo message="Getting lock" />
+                    <antcall target="integration-test-release-lock" />
+                    <echo message="Lock released" />
+
+                </try>
+                <catch>
+                    <echo message="Uploading of demo.war failed. ${tried}" />
+                </catch>
+            </antcontrib:trycatch>
+            <antcall target="integration-test-liferay6" />
+            <antcall target="integration-test-liferay6ee" />
+            <antcall target="integration-test-liferay6-theme" />
+            <antcall target="integration-test-liferay6ee-theme" />
+            <antcall target="integration-test-exo3" />
+            <antcall target="integration-test-weblogicPortal" />
+            <antcall target="integration-test-liferay5" />
+            <antcall target="integration-test-weblogic10" />
+            <antcall target="integration-test-weblogic12" />
+            <antcall target="integration-test-gatein3" />
+            <antcall target="integration-test-glassfish2" />
+            <antcall target="integration-test-glassfish3" />
+            <antcall target="integration-test-jboss4" />
+            <antcall target="integration-test-jboss5" />
+            <antcall target="integration-test-jboss6" />
+            <antcall target="integration-test-jboss7" />
+            <antcall target="integration-test-jetty5" />
+            <antcall target="integration-test-jetty6" />
+            <antcall target="integration-test-jetty7" />
+            <antcall target="integration-test-jetty8" />
+            <antcall target="integration-test-tomcat5" />
+            <antcall target="integration-test-tomcat6" />
+            <antcall target="integration-test-tomcat7" />
+            <antcall target="integration-test-websphere8" />
+
+        </parallel>
+
+    </target>
+
+    <target name="do-run-generic-test">
+        <property name="target-host" value="${target-server}.devnet.vaadin.com" />
+        <property name="target-port" value="8080" />
+        <antcontrib:if>
+            <isset property="startDelay" />
+            <then>
+                <antcontrib:math result="sleepTime"
+                    datatype="int">
+                    <op op="rint">
+                        <op op="*">
+                            <num value="${startDelay}" />
+                            <op op="random" />
+                        </op>
+                    </op>
+                </antcontrib:math>
+                <echo>Delaying startup of ${target-server} with
+                    ${sleepTime} seconds</echo>
+                <sleep seconds="${sleepTime}" />
+            </then>
+        </antcontrib:if>
+
+        <scp todir="${user}@${target-host}:." keyfile="${sshkey.file}"
+            trust="yes" passphrase="${passphrase}">
+            <fileset dir="integration_base_files">
+                <include name="*" />
+            </fileset>
+        </scp>
+
+        <!-- trycatch probably not needed any more as it just fails with 
+            the original message and doesn't do anything in the finally block -->
+        <antcontrib:trycatch property="error_message">
+            <try>
+                <!-- timeout in one hour (remote end should timeout in 55 
+                    minutes) -->
+                <sshexec host="${target-host}" outputproperty="lock-output"
+                    timeout="3600000" username="${user}" keyfile="${sshkey.file}"
+                    trust="yes" command="chmod +x *.sh; ant -f deploy.xml get-lock" />
+                <antcall target="echo-prefix">
+                    <param name="prefix" value="${target-server}: " />
+                    <param name="message" value="${lock-output}" />
+                </antcall>
+
+                <scp file="${demo.war}" todir="${user}@${target-host}:demo.war"
+                    keyfile="${sshkey.file}" trust="yes" passphrase="${passphrase}" />
+
+                <!-- timeout in 15 minutes -->
+                <sshexec host="${target-host}" outputproperty="start-output"
+                    timeout="900000" username="${user}" keyfile="${sshkey.file}"
+                    trust="yes" command="ant -f deploy.xml startup-and-deploy"
+                    failonerror="false" />
+                <antcall target="echo-prefix">
+                    <param name="prefix" value="${target-server}: " />
+                    <param name="message" value="${start-output}" />
+                </antcall>
+
+                <fail message="${start-output}">
+                    <condition>
+                        <not>
+                            <contains string="${start-output}"
+                                substring="Demo deployed successfully" />
+                        </not>
+                    </condition>
+                </fail>
+
+                <copy
+                    file="integration-testscripts/common/integration_test.tpl"
+                    tofile="integration-testscripts/integration-test-${target-server}-servlet.html"
+                    overwrite="true" />
+                <antcall target="integration-test-servlet">
+                    <param name="server-name" value="${target-server}" />
+                    <param name="deployment.url"
+                        value="http://${target-host}:${target-port}" />
+                </antcall>
+
+                <!-- Run theme tests in all browsers if there's a property 
+                    with the test files -->
+                <antcontrib:if>
+                    <isset property="testfiles-theme" />
+                    <antcontrib:then>
+                        <antcall target="integration-test-theme">
+                            <param name="server-name" value="${target-server}" />
+                            <param name="deployment.url"
+                                value="http://${target-host}:${target-port}" />
+                        </antcall>
+                    </antcontrib:then>
+                </antcontrib:if>
+
+                <!-- Run integration tests with push -->
+                <copy
+                    file="integration-testscripts/common/integration_push_test.tpl"
+                    tofile="integration-testscripts/integration-test-${target-server}-push-servlet.html"
+                    overwrite="true" />
+                <antcall target="integration-test-push-servlet">
+                    <param name="server-name" value="${target-server}" />
+                    <param name="deployment.url"
+                        value="http://${target-host}:${target-port}" />
+                </antcall>
+
+                <!-- Run theme tests in all browsers if there's a property 
+                    with the test files -->
+                <antcontrib:if>
+                    <isset property="testfiles-theme" />
+                    <antcontrib:then>
+                        <antcall target="integration-test-theme">
+                            <param name="server-name" value="${target-server}" />
+                            <param name="deployment.url"
+                                value="http://${target-host}:${target-port}" />
+                        </antcall>
+                    </antcontrib:then>
+                </antcontrib:if>
+
+                <!-- timeout in five minutes -->
+                <sshexec host="${target-host}" outputproperty="stop-output"
+                    timeout="600000" username="${user}" keyfile="${sshkey.file}"
+                    trust="yes" command="ant -f deploy.xml shutdown-and-cleanup"
+                    failonerror="false" />
+                <antcall target="echo-prefix">
+                    <param name="prefix" value="${target-server}: " />
+                    <param name="message" value="${stop-output}" />
+                </antcall>
+            </try>
+            <catch>
+                <fail message="${error_message}" />
+            </catch>
+        </antcontrib:trycatch>
+    </target>
+
+    <target name="echo-prefix">
+        <antcontrib:propertyregex property="message-prefixed"
+            input="${prefix}${message}" regexp="\n" replace="\0${prefix}"
+            global="true" defaultValue="${prefix}${message}" />
+        <echo message="${message-prefixed}" />
+    </target>
+
+    <target name="run-generic-integration-test">
+        <concat>##teamcity[testStarted name='${target-server}'
+            flowId='${target-server}']</concat>
+        <antcontrib:trycatch property="tried">
+            <try>
+                <antcall target="do-run-generic-test" />
+            </try>
+            <catch>
+                <antcontrib:antcallback target="teamcity-escape"
+                    return="tried-escaped">
+                    <param name="returnTo" value="tried-escaped" />
+                    <param name="message" value="${tried}" />
+                </antcontrib:antcallback>
+                <concat>##teamcity[testFailed name='${target-server}'
+                    flowId='${target-server}' message='Integration test
+                    for ${target-server} failed.'
+                    details='${tried-escaped}']</concat>
+            </catch>
+        </antcontrib:trycatch>
+        <concat>##teamcity[testFinished name='${target-server}'
+            flowId='${target-server}']"</concat>
+    </target>
+
+    <target name="teamcity-escape">
+        <property name="returnTo" value="return" />
+
+        <!-- Should also perform other escaping (\u0085, \u2028 and \u2029) 
+            - see http://confluence.jetbrains.net/display/TCD65/Build+Script+Interaction+with+TeamCity -->
+        <!-- Immutable properties -> needs to create a new one every time -->
+        <antcontrib:propertyregex property="details-escaped1"
+            input="${message}" regexp="['|\[\]]" replace="|\0" global="true"
+            defaultValue="${message}" />
+        <antcontrib:propertyregex property="details-escaped2"
+            input="${details-escaped1}" regexp="\n" replace="|n" global="true"
+            defaultValue="${details-escaped1}" />
+        <antcontrib:propertyregex property="details-escaped3"
+            input="${details-escaped2}" regexp="\r" replace="|r" global="true"
+            defaultValue="${details-escaped2}" />
+
+        <property name="${returnTo}" value="${details-escaped3}" />
+    </target>
+
+    <target name="run-integration-test">
+        <concat>##teamcity[testStarted name='${target-server}'
+            flowId='${target-server}']</concat>
+        <antcontrib:trycatch property="tried">
+            <try>
+                <antcall target="integration-test-${target-server}" />
+            </try>
+            <catch>
+                <antcallback target="teamcity-escape"
+                    return="tried-escaped">
+                    <param name="returnTo" value="tried-escaped" />
+                    <param name="message" value="${tried}" />
+                </antcallback>
+                <concat>##teamcity[testFailed name='${target-server}'
+                    flowId='${target-server}' message='Integration test
+                    for ${target-server} failed.'
+                    details='${tried-escaped}']"</concat>
+            </catch>
+        </antcontrib:trycatch>
+        <concat>##teamcity[testFinished name='${target-server}'
+            flowId='${target-server}']"</concat>
+    </target>
+
+    <target name="integration-test-get-lock">
+        <sshexec host="${test.integration.server}" username="${user}"
+            keyfile="${sshkey.file}" command="ant -f ${ant.hub} get-lock" />
+    </target>
+
+    <target name="integration-test-release-lock">
+        <sshexec host="${test.integration.server}" username="${user}"
+            keyfile="${sshkey.file}" command="ant -f ${ant.hub} release-lock" />
+    </target>
+
+    <!-- Remove demo.war -->
+    <target name="integration-test-clean">
+        <sshexec host="${test.integration.server}" username="${user}"
+            keyfile="${sshkey.file}" command="ant -f ${ant.hub} clean" />
+    </target>
 </project>
diff --git a/uitest/ivy.xml b/uitest/ivy.xml
index bb54232852..7ff83324ae 100644
--- a/uitest/ivy.xml
+++ b/uitest/ivy.xml
@@ -14,8 +14,8 @@
         <conf name="jetty-run" extends="build" visibility="private" />
     </configurations>
     <publications>
-        <artifact type="war" ext="war"/>
-                   </publications>
+        <artifact type="war" ext="war" />
+    </publications>
     <dependencies defaultconf="build" defaultconfmapping="build,ide->default">
         <!-- API DEPENDENCIES -->
         <dependency org="javax.portlet" name="portlet-api"
@@ -40,9 +40,9 @@
             rev="${vaadin.version}" conf="build->build"></dependency>
         <dependency org="com.vaadin" name="vaadin-themes"
             rev="${vaadin.version}" conf="build->build"></dependency>
-        <dependency org="com.vaadin" name="vaadin-push"
-            rev="${vaadin.version}" conf="build->build"></dependency>
-            
+        <dependency org="com.vaadin" name="vaadin-push" rev="${vaadin.version}"
+            conf="build->build"></dependency>
+
         <!-- For compiling TestingWidgetSet -->
         <dependency org="com.vaadin" name="vaadin-client-compiler"
             rev="${vaadin.version}" conf="build-provided-> build"></dependency>
diff --git a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
index 1b47a86113..fd52e5cd0e 100644
--- a/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
+++ b/uitest/src/com/vaadin/tests/widgetset/TestingWidgetSet.gwt.xml
@@ -1,15 +1,16 @@
 <module>
-	<!-- WS Compiler: manually edited  -->
+    <!-- WS Compiler: manually edited -->
+
+    <!-- Inherit the DefaultWidgetSet -->
+    <inherits name="com.vaadin.DefaultWidgetSet" />
 
-	<!-- Inherit the DefaultWidgetSet -->
-	<inherits name="com.vaadin.DefaultWidgetSet" />
-	
     <replace-with class="com.vaadin.tests.widgetset.client.CustomUIConnector">
         <when-type-is class="com.vaadin.client.ui.ui.UIConnector" />
     </replace-with>
-    
-     <replace-with class="com.vaadin.tests.widgetset.client.TestingPushConnection">
+
+    <replace-with
+        class="com.vaadin.tests.widgetset.client.TestingPushConnection">
         <when-type-is class="com.vaadin.client.communication.PushConnection" />
     </replace-with>
-	
+
 </module>
diff --git a/uitest/test.xml b/uitest/test.xml
index 8228bd9d70..44dac13d90 100644
--- a/uitest/test.xml
+++ b/uitest/test.xml
@@ -1,189 +1,227 @@
 <?xml version="1.0"?>
-<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up">
-
-	<include file="../common.xml" />
-	<dirname property="test.xml.dir" file="${ant.file.Run Vaadin Testbench Tests}" />
-
-	<!-- ================================================================== -->
-	<!-- Configuration                                                      -->
-	<!-- ================================================================== -->
-	<!-- Browsers to use for testing -->
-	<property name="browsers-windows" value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-safari5,winxp-googlechrome21,winxp-opera12" />
-	<property name="browsers-linux" value="linux-firefox3,linux-opera10,linux-googlechrome8" />
-	<property name="browsers-mac" value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" />
-
-	<property name="browsers" value="${browsers-windows}" />
-
-	<!-- Number of times to retry a test if it fails -->
-	<property name="retries" value="2" />
-
-	<!-- Screen shot base directory -->
-	<fail unless="com.vaadin.testbench.screenshot.directory" message="The 'com.vaadin.testbench.screenshot.directory' property must be defined." />
-
-	<!-- Screen shot resolution -->
-	<property name="com.vaadin.testbench.screenshot.resolution" value="1500x850" />
-
-	<!-- Host running Testbench Hub -->
-	<property name="com.vaadin.testbench.tester.host" value="testbench-hub.intra.itmill.com" />
-
-	<property name="com.vaadin.testbench.screenshot.block.error" value="0.025" />
-	<property name="com.vaadin.testbench.debug" value="false" />
-
-
-	<target name="initialize">
-		<!-- classpath must include test bench jar and its dependencies -->
-		<path id="classpath">
-			<fileset dir="${com.vaadin.testbench.lib.dir}" includes="**/*.jar" />
-		</path>
-	</target>
-
-	<!-- fileset containing all TestBench tests to run -->
-	<fileset dir="${test.xml.dir}" id="html-test-files">
-		<include name="src/**/*.html" />
-		<exclude name="integration-testscripts/**/*.html" />
-	</fileset>
-
-	<!-- This target converts HTML tests files to java junit tests. One test file for each browser is created. -->
-	<target name="create-tests" depends="initialize, remove-temp-testclasses">
-		<!-- Temporary output directory, created and removed by this script -->
-		<fail unless="test-output-dir" message="The 'test-output-dir' property must be defined." />
-		<property name="class-dir" value="${test-output-dir}/classes" />
-
-		<pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
-
-		<java classname="com.vaadin.testbench.util.TestConverter" classpathref="classpath" fork="true">
-			<sysproperty key="com.vaadin.testbench.test.retries" value="${retries}" />
-			<jvmarg value="-Duser.language=en" />
-			<jvmarg value="-Duser.country=US" />
-			<arg value="${test-output-dir}" />
-			<arg value="${browsers}" />
-			<arg line="${testfiles}" />
-		</java>
-	</target>
-
-
-	<!-- This target complies the generated java junit tests. -->
-	<target name="compile-tests" depends="create-tests">
-		<mkdir dir="${class-dir}" />
-		<javac includeantruntime="false" srcdir="${test-output-dir}" destdir="${class-dir}" debug="on" fork="yes" failonerror="false" encoding="UTF8">
-			<classpath>
-				<path refid="classpath" />
-			</classpath>
-		</javac>
-	</target>
-
-	<!-- ================================================================== -->
-	<!-- Running Tests                                                      -->
-	<!-- ================================================================== -->
-
-	<target name="check-parameters">
-		<fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." />
-		<fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." />
-		<fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
-	</target>
-
-	<target name="run-tests" depends="compile-tests">
-		<fileset dir="${test-output-dir}" id="tests-fileset">
-			<include name="**/**.java" />
-		</fileset>
-
-		<antcontrib:for threadCount="30" parallel="true" keepgoing="true" param="target">
-			<path>
-				<fileset refid="tests-fileset" />
-			</path>
-			<sequential>
-				<antcall target="execute-tests">
-					<param name="target" value="@{target}" />
-					<reference refid="classpath" />
-				</antcall>
-			</sequential>
-		</antcontrib:for>
-	</target>
-
-	<!-- This target runs the generated and compiled junit tests -->
-	<target name="execute-tests">
-		<junit fork="yes" printsummary="withOutAndErr" maxmemory="96m">
-			<classpath>
-				<path refid="classpath" />
-				<pathelement path="${class-dir}" />
-			</classpath>
-
-			<formatter usefile="false" type="plain" />
-
-			<jvmarg value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" />
-			<jvmarg value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" />
-			<!-- Define where the reference screenshots and diff files are saved -->
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
-			<!-- Resolution for screenshots -->
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" />
-			<jvmarg value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" />
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" />
-
-
-			<jvmarg value="-Djava.awt.headless=true" />
-
-			<!-- true/false system arguments -->
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" />
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" />
-			<jvmarg value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" />
-
-			<batchtest>
-				<filelist dir="${test-output-dir}" files="${target}" />
-			</batchtest>
-		</junit>
-
-	</target>
-
-	<!-- Remove temporary source and compiled java files -->
-	<target name="remove-temp-testclasses">
-		<delete failonerror="false">
-			<fileset dir="${test-output-dir}">
-				<include name="**/**.java" />
-				<include name="**/**.class" />
-			</fileset>
-		</delete>
-	</target>
-
-	<!-- Remove old error screenshots -->
-	<target name="remove-error-screens">
-		<mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
-		<delete>
-			<fileset dir="${com.vaadin.testbench.screenshot.directory}/errors">
-				<include name="**/**.*" />
-			</fileset>
-		</delete>
-	</target>
-
-	<!-- ================================================================== -->
-	<!-- Main Targets                                                       -->
-	<!-- ================================================================== -->
-
-	<!-- The default target. -->
-	<target name="run-and-clean-up" depends="check-parameters,remove-error-screens,run-tests" />
-
-
-	<!-- Starts the server and runs all TestBench tests -->
-	<target name="test-package">
-		<fail unless="war.file" message="No 'war.file' parameter given." />
-		<property name="test-output-dir" location="${test.xml.dir}/result/testbench-junit-classes" />
-		<property name="retries" value="2" />
-
-		<!-- Parameters for the test.xml script. -->
-		<fail unless="com.vaadin.testbench.tester.host" message="The 'com.vaadin.testbench.tester.host' property must be defined." />
-		<fail unless="com.vaadin.testbench.deployment.url" message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
-		<fail unless="com.vaadin.testbench.lib.dir" message="The 'com.vaadin.testbench.lib.dir' property must be defined." />
-		<property name="com.vaadin.testbench.screenshot.block.error" value="0.025" />
-		<property name="com.vaadin.testbench.debug" value="false" />
-
-		<parallel>
-			<daemons>
-				<ant antfile="${test.xml.dir}/vaadin-server.xml" inheritall="true" inheritrefs="true" target="deploy-and-start" />
-			</daemons>
-			<sequential>
-				<ant antfile="${test.xml.dir}/vaadin-server.xml" target="wait-for-startup" />
-				<antcall inheritall="true" inheritrefs="true" target="run-and-clean-up" />
-				<echo message="All TestBench tests have been run" />
-			</sequential>
-		</parallel>
-	</target>
+<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant"
+    name="Run Vaadin Testbench Tests" basedir="." default="run-and-clean-up">
+
+    <include file="../common.xml" />
+    <dirname property="test.xml.dir" file="${ant.file.Run Vaadin Testbench Tests}" />
+
+    <!-- ================================================================== -->
+    <!-- Configuration -->
+    <!-- ================================================================== -->
+    <!-- Browsers to use for testing -->
+    <property name="browsers-windows"
+        value="winxp-ie8,win7-ie9,win7-ie10,winxp-firefox17-esr,winxp-safari5,winxp-googlechrome21,winxp-opera12" />
+    <property name="browsers-linux"
+        value="linux-firefox3,linux-opera10,linux-googlechrome8" />
+    <property name="browsers-mac"
+        value="osx-firefox3,osx-opera10,osx-googlechrome8,osx-safari4,osx-safari5" />
+
+    <property name="browsers" value="${browsers-windows}" />
+
+    <!-- Number of times to retry a test if it fails -->
+    <property name="retries" value="2" />
+
+    <!-- Screen shot base directory -->
+    <fail unless="com.vaadin.testbench.screenshot.directory"
+        message="The 'com.vaadin.testbench.screenshot.directory' property must be defined." />
+
+    <!-- Screen shot resolution -->
+    <property name="com.vaadin.testbench.screenshot.resolution"
+        value="1500x850" />
+
+    <!-- Host running Testbench Hub -->
+    <property name="com.vaadin.testbench.tester.host" value="testbench-hub.intra.itmill.com" />
+
+    <property name="com.vaadin.testbench.screenshot.block.error"
+        value="0.025" />
+    <property name="com.vaadin.testbench.debug" value="false" />
+
+
+    <target name="initialize">
+        <!-- classpath must include test bench jar and its dependencies -->
+        <path id="classpath">
+            <fileset dir="${com.vaadin.testbench.lib.dir}"
+                includes="**/*.jar" />
+        </path>
+    </target>
+
+    <!-- fileset containing all TestBench tests to run -->
+    <fileset dir="${test.xml.dir}" id="html-test-files">
+        <include name="src/**/*.html" />
+        <exclude name="integration-testscripts/**/*.html" />
+    </fileset>
+
+    <!-- This target converts HTML tests files to java junit tests. One test 
+        file for each browser is created. -->
+    <target name="create-tests" depends="initialize, remove-temp-testclasses">
+        <!-- Temporary output directory, created and removed by this script -->
+        <fail unless="test-output-dir"
+            message="The 'test-output-dir' property must be defined." />
+        <property name="class-dir" value="${test-output-dir}/classes" />
+
+        <pathconvert pathsep=" " property="testfiles" refid="html-test-files" />
+
+        <java classname="com.vaadin.testbench.util.TestConverter"
+            classpathref="classpath" fork="true">
+            <sysproperty key="com.vaadin.testbench.test.retries"
+                value="${retries}" />
+            <jvmarg value="-Duser.language=en" />
+            <jvmarg value="-Duser.country=US" />
+            <arg value="${test-output-dir}" />
+            <arg value="${browsers}" />
+            <arg line="${testfiles}" />
+        </java>
+    </target>
+
+
+    <!-- This target complies the generated java junit tests. -->
+    <target name="compile-tests" depends="create-tests">
+        <mkdir dir="${class-dir}" />
+        <javac includeantruntime="false" srcdir="${test-output-dir}"
+            destdir="${class-dir}" debug="on" fork="yes" failonerror="false"
+            encoding="UTF8">
+            <classpath>
+                <path refid="classpath" />
+            </classpath>
+        </javac>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Running Tests -->
+    <!-- ================================================================== -->
+
+    <target name="check-parameters">
+        <fail unless="com.vaadin.testbench.lib.dir"
+            message="The 'com.vaadin.testbench.lib.dir' property must be defined." />
+        <fail unless="com.vaadin.testbench.tester.host"
+            message="The 'com.vaadin.testbench.tester.host' property must be defined." />
+        <fail unless="com.vaadin.testbench.deployment.url"
+            message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
+    </target>
+
+    <target name="run-tests" depends="compile-tests">
+        <fileset dir="${test-output-dir}" id="tests-fileset">
+            <include name="**/**.java" />
+        </fileset>
+
+        <antcontrib:for threadCount="30" parallel="true"
+            keepgoing="true" param="target">
+            <path>
+                <fileset refid="tests-fileset" />
+            </path>
+            <sequential>
+                <antcall target="execute-tests">
+                    <param name="target" value="@{target}" />
+                    <reference refid="classpath" />
+                </antcall>
+            </sequential>
+        </antcontrib:for>
+    </target>
+
+    <!-- This target runs the generated and compiled junit tests -->
+    <target name="execute-tests">
+        <junit fork="yes" printsummary="withOutAndErr" maxmemory="96m">
+            <classpath>
+                <path refid="classpath" />
+                <pathelement path="${class-dir}" />
+            </classpath>
+
+            <formatter usefile="false" type="plain" />
+
+            <jvmarg
+                value="-Dcom.vaadin.testbench.tester.host=${com.vaadin.testbench.tester.host}" />
+            <jvmarg
+                value="-Dcom.vaadin.testbench.deployment.url=${com.vaadin.testbench.deployment.url}" />
+            <!-- Define where the reference screenshots and diff files are 
+                saved -->
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.directory=${com.vaadin.testbench.screenshot.directory}" />
+            <!-- Resolution for screenshots -->
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.resolution=${com.vaadin.testbench.screenshot.resolution}" />
+            <jvmarg
+                value="-Dcom.vaadin.testbench.debug=${com.vaadin.testbench.debug}" />
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.block.error=${com.vaadin.testbench.screenshot.block.error}" />
+
+
+            <jvmarg value="-Djava.awt.headless=true" />
+
+            <!-- true/false system arguments -->
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.softfail=${com.vaadin.testbench.screenshot.softfail}" />
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.reference.debug=${com.vaadin.testbench.screenshot.reference.debug}" />
+            <jvmarg
+                value="-Dcom.vaadin.testbench.screenshot.cursor=${com.vaadin.testbench.screenshot.cursor}" />
+
+            <batchtest>
+                <filelist dir="${test-output-dir}" files="${target}" />
+            </batchtest>
+        </junit>
+
+    </target>
+
+    <!-- Remove temporary source and compiled java files -->
+    <target name="remove-temp-testclasses">
+        <delete failonerror="false">
+            <fileset dir="${test-output-dir}">
+                <include name="**/**.java" />
+                <include name="**/**.class" />
+            </fileset>
+        </delete>
+    </target>
+
+    <!-- Remove old error screenshots -->
+    <target name="remove-error-screens">
+        <mkdir dir="${com.vaadin.testbench.screenshot.directory}/errors" />
+        <delete>
+            <fileset
+                dir="${com.vaadin.testbench.screenshot.directory}/errors">
+                <include name="**/**.*" />
+            </fileset>
+        </delete>
+    </target>
+
+    <!-- ================================================================== -->
+    <!-- Main Targets -->
+    <!-- ================================================================== -->
+
+    <!-- The default target. -->
+    <target name="run-and-clean-up"
+        depends="check-parameters,remove-error-screens,run-tests" />
+
+
+    <!-- Starts the server and runs all TestBench tests -->
+    <target name="test-package">
+        <fail unless="war.file" message="No 'war.file' parameter given." />
+        <property name="test-output-dir"
+            location="${test.xml.dir}/result/testbench-junit-classes" />
+        <property name="retries" value="2" />
+
+        <!-- Parameters for the test.xml script. -->
+        <fail unless="com.vaadin.testbench.tester.host"
+            message="The 'com.vaadin.testbench.tester.host' property must be defined." />
+        <fail unless="com.vaadin.testbench.deployment.url"
+            message="The 'com.vaadin.testbench.deployment.url' property must be defined." />
+        <fail unless="com.vaadin.testbench.lib.dir"
+            message="The 'com.vaadin.testbench.lib.dir' property must be defined." />
+        <property name="com.vaadin.testbench.screenshot.block.error"
+            value="0.025" />
+        <property name="com.vaadin.testbench.debug" value="false" />
+
+        <parallel>
+            <daemons>
+                <ant antfile="${test.xml.dir}/vaadin-server.xml"
+                    inheritall="true" inheritrefs="true" target="deploy-and-start" />
+            </daemons>
+            <sequential>
+                <ant antfile="${test.xml.dir}/vaadin-server.xml"
+                    target="wait-for-startup" />
+                <antcall inheritall="true" inheritrefs="true"
+                    target="run-and-clean-up" />
+                <echo message="All TestBench tests have been run" />
+            </sequential>
+        </parallel>
+    </target>
 </project>
diff --git a/uitest/vaadin-server.xml b/uitest/vaadin-server.xml
index 5741d78525..4b32cebe26 100644
--- a/uitest/vaadin-server.xml
+++ b/uitest/vaadin-server.xml
@@ -1,34 +1,38 @@
 <?xml version="1.0"?>
-<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant" name="vaadin-server" default="deploy-and-start" basedir=".">
-	<include file="../common.xml" />
-	<dirname property="dir" file="${ant.file.vaadin-server}" />
+<project xmlns:antcontrib="antlib:net.sf.antcontrib" xmlns:ivy="antlib:org.apache.ivy.ant"
+    name="vaadin-server" default="deploy-and-start" basedir=".">
+    <include file="../common.xml" />
+    <dirname property="dir" file="${ant.file.vaadin-server}" />
 
-	<target name="deploy-and-start">
-		<fail unless="war.file" message="No war file given in 'war.file'" />
+    <target name="deploy-and-start">
+        <fail unless="war.file" message="No war file given in 'war.file'" />
 
-		<ivy:resolve file="${dir}/ivy.xml" />
-		<ivy:cachepath pathid="classpath.jetty" conf="jetty-run" />
-		<java classname="org.mortbay.jetty.runner.Runner" fork="yes" output="${vaadin.basedir}/result/jetty.java.out" resultproperty="resultCode">
-			<arg value="--port" />
-			<arg value="8888" />
-			<arg value="--out" />
-			<arg value="${vaadin.basedir}/result/jetty.out" />
-			<arg value="--log" />
-			<arg value="${vaadin.basedir}/result/jetty.log" />
-			<arg value="${war.file}" />
-			<classpath refid="classpath.jetty" />
-			<jvmarg value="-ea" />
-		</java>
-		<echo message="Jetty process ended with result code ${resultCode}" />
+        <ivy:resolve file="${dir}/ivy.xml" />
+        <ivy:cachepath pathid="classpath.jetty" conf="jetty-run" />
+        <java classname="org.mortbay.jetty.runner.Runner" fork="yes"
+            output="${vaadin.basedir}/result/jetty.java.out"
+            resultproperty="resultCode">
+            <arg value="--port" />
+            <arg value="8888" />
+            <arg value="--out" />
+            <arg value="${vaadin.basedir}/result/jetty.out" />
+            <arg value="--log" />
+            <arg value="${vaadin.basedir}/result/jetty.log" />
+            <arg value="${war.file}" />
+            <classpath refid="classpath.jetty" />
+            <jvmarg value="-ea" />
+        </java>
+        <echo message="Jetty process ended with result code ${resultCode}" />
 
-	</target>
+    </target>
 
-	<target name="wait-for-startup">
-		<echo>Waiting for Servlet Container to start up.</echo>
-		<waitfor maxwait="60" maxwaitunit="second" checkevery="5" checkeveryunit="second" timeoutproperty="server.start.failed">
-			<http url="http://localhost:8888" />
-		</waitfor>
-		<fail if="server.start.failed" message="Server startup failed" />
-	</target>
+    <target name="wait-for-startup">
+        <echo>Waiting for Servlet Container to start up.</echo>
+        <waitfor maxwait="60" maxwaitunit="second" checkevery="5"
+            checkeveryunit="second" timeoutproperty="server.start.failed">
+            <http url="http://localhost:8888" />
+        </waitfor>
+        <fail if="server.start.failed" message="Server startup failed" />
+    </target>
 
 </project>
-- 
cgit v1.2.3


From 03830aeb46d93d675fa01c35ce3700e30a4a9c7d Mon Sep 17 00:00:00 2001
From: Leif Åstrand <leif@vaadin.com>
Date: Fri, 31 May 2013 15:16:16 +0300
Subject: Ignore style resource that has already been added (#11667)

Change-Id: I828166f69c3ad1ac7e24c00de640c8645d2f2153
---
 server/src/com/vaadin/server/Page.java             | 111 ++++++++++++++-------
 .../src/com/vaadin/tests/themes/CSSInjectTest.html |  11 +-
 .../src/com/vaadin/tests/themes/CSSInjectTest.java |  24 +++--
 3 files changed, 101 insertions(+), 45 deletions(-)

(limited to 'uitest/src')

diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index d4c16fe7f7..11553527e0 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -21,11 +21,10 @@ import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.EventObject;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 
 import com.vaadin.event.EventRouter;
 import com.vaadin.shared.ui.BorderStyle;
@@ -307,6 +306,61 @@ public class Page implements Serializable {
         }
     }
 
+    private static interface InjectedStyle {
+        public void paint(int id, PaintTarget target) throws PaintException;
+    }
+
+    private static class InjectedStyleString implements InjectedStyle {
+
+        private String css;
+
+        public InjectedStyleString(String css) {
+            this.css = css;
+        }
+
+        @Override
+        public void paint(int id, PaintTarget target) throws PaintException {
+            target.startTag("css-string");
+            target.addAttribute("id", id);
+            target.addText(css);
+            target.endTag("css-string");
+        }
+    }
+
+    private static class InjectedStyleResource implements InjectedStyle {
+
+        private final Resource resource;
+
+        public InjectedStyleResource(Resource resource) {
+            this.resource = resource;
+        }
+
+        @Override
+        public void paint(int id, PaintTarget target) throws PaintException {
+            target.startTag("css-resource");
+            target.addAttribute("id", id);
+            target.addAttribute("url", resource);
+            target.endTag("css-resource");
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == this) {
+                return true;
+            } else if (obj instanceof InjectedStyleResource) {
+                InjectedStyleResource that = (InjectedStyleResource) obj;
+                return resource.equals(that.resource);
+            } else {
+                return false;
+            }
+        }
+
+        @Override
+        public int hashCode() {
+            return resource.hashCode();
+        }
+    }
+
     /**
      * Contains dynamically injected styles injected in the HTML document at
      * runtime.
@@ -315,16 +369,9 @@ public class Page implements Serializable {
      */
     public static class Styles implements Serializable {
 
-        private final Map<Integer, String> stringInjections = new HashMap<Integer, String>();
-
-        private final Map<Integer, Resource> resourceInjections = new HashMap<Integer, Resource>();
+        private LinkedHashSet<InjectedStyle> injectedStyles = new LinkedHashSet<InjectedStyle>();
 
-        // The combined injection counter between both string and resource
-        // injections. Used as the key for the injection maps
-        private int injectionCounter = 0;
-
-        // Points to the next injection that has not yet been made into the Page
-        private int nextInjectionPosition = 0;
+        private LinkedHashSet<InjectedStyle> pendingInjections = new LinkedHashSet<InjectedStyle>();
 
         private final UI ui;
 
@@ -344,7 +391,7 @@ public class Page implements Serializable {
                         "Cannot inject null CSS string");
             }
 
-            stringInjections.put(injectionCounter++, css);
+            pendingInjections.add(new InjectedStyleString(css));
             ui.markAsDirty();
         }
 
@@ -360,43 +407,33 @@ public class Page implements Serializable {
                         "Cannot inject null resource");
             }
 
-            resourceInjections.put(injectionCounter++, resource);
-            ui.markAsDirty();
+            InjectedStyleResource injection = new InjectedStyleResource(
+                    resource);
+            if (!injectedStyles.contains(injection)
+                    && pendingInjections.add(injection)) {
+                ui.markAsDirty();
+            }
         }
 
         private void paint(PaintTarget target) throws PaintException {
 
             // If full repaint repaint all injections
             if (target.isFullRepaint()) {
-                nextInjectionPosition = 0;
+                injectedStyles.addAll(pendingInjections);
+                pendingInjections = injectedStyles;
+                injectedStyles = new LinkedHashSet<InjectedStyle>();
             }
 
-            if (injectionCounter > nextInjectionPosition) {
+            if (!pendingInjections.isEmpty()) {
 
                 target.startTag("css-injections");
 
-                while (injectionCounter > nextInjectionPosition) {
-
-                    String stringInjection = stringInjections
-                            .get(nextInjectionPosition);
-                    if (stringInjection != null) {
-                        target.startTag("css-string");
-                        target.addAttribute("id", nextInjectionPosition);
-                        target.addText(stringInjection);
-                        target.endTag("css-string");
-                    }
-
-                    Resource resourceInjection = resourceInjections
-                            .get(nextInjectionPosition);
-                    if (resourceInjection != null) {
-                        target.startTag("css-resource");
-                        target.addAttribute("id", nextInjectionPosition);
-                        target.addAttribute("url", resourceInjection);
-                        target.endTag("css-resource");
-                    }
-
-                    nextInjectionPosition++;
+                for (InjectedStyle pending : pendingInjections) {
+                    int id = injectedStyles.size();
+                    pending.paint(id, target);
+                    injectedStyles.add(pending);
                 }
+                pendingInjections.clear();
 
                 target.endTag("css-injections");
             }
diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
index 05a0f256c2..0c70d6f711 100644
--- a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
+++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.html
@@ -51,7 +51,16 @@
 	<td></td>
 	<td>world-red</td>
 </tr>
-
+<tr>
+	<td>click</td>
+	<td>vaadin=runcomvaadinteststhemesCSSInjectTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[4]/VButton[0]/domChild[0]/domChild[0]</td>
+	<td></td>
+</tr>
+<tr>
+	<td>screenCapture</td>
+	<td></td>
+	<td>world-still-red</td>
+</tr>
 </tbody></table>
 </body>
 </html>
diff --git a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
index f4448bf326..738d8fc681 100644
--- a/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
+++ b/uitest/src/com/vaadin/tests/themes/CSSInjectTest.java
@@ -22,14 +22,16 @@ public class CSSInjectTest extends TestBase {
         final Styles stylesheet = Page.getCurrent().getStyles();
 
         // Inject some resources initially
-        stylesheet.add(new StreamResource(new StreamResource.StreamSource() {
+        final StreamResource initialResource = new StreamResource(
+                new StreamResource.StreamSource() {
 
-            @Override
-            public InputStream getStream() {
-                return new ByteArrayInputStream(
-                        ".hello, .world { color:silver; }".getBytes());
-            }
-        }, "mystyles-" + System.currentTimeMillis() + ".css"));
+                    @Override
+                    public InputStream getStream() {
+                        return new ByteArrayInputStream(
+                                ".hello, .world { color:silver; }".getBytes());
+                    }
+                }, "mystyles-" + System.currentTimeMillis() + ".css");
+        stylesheet.add(initialResource);
 
         Label hello = new Label(
                 "<span class='hello'>Hello</span> <span class='world'>world</span>",
@@ -72,6 +74,14 @@ public class CSSInjectTest extends TestBase {
                     }
                 });
         addComponent(injectRandom);
+
+        addComponent(new Button("Inject initial again!",
+                new Button.ClickListener() {
+                    @Override
+                    public void buttonClick(ClickEvent event) {
+                        stylesheet.add(initialResource);
+                    }
+                }));
     }
 
     @Override
-- 
cgit v1.2.3


From 84bf5a77e678f6d8a73f71d42fea2300b4f174cc Mon Sep 17 00:00:00 2001
From: John Ahlroos <john@vaadin.com>
Date: Thu, 30 May 2013 16:19:47 +0300
Subject: Enabled drag & drop to Calendar #11048

Change-Id: I2dcc1f7159a6283cfbc0baafe6cba66530bf0a45
---
 client/src/com/vaadin/client/ui/VCalendar.java     |  26 ++++-
 .../client/ui/calendar/CalendarConnector.java      |  88 ++++++---------
 .../calendar/schedule/dd/CalendarDropHandler.java  |  11 +-
 .../schedule/dd/CalendarMonthDropHandler.java      |   5 +
 .../schedule/dd/CalendarWeekDropHandler.java       |   5 +
 server/src/com/vaadin/ui/Calendar.java             |  31 +++++-
 .../components/calendar/CalendarDragAndDrop.html   |  59 ++++++++++
 .../components/calendar/CalendarDragAndDrop.java   | 123 +++++++++++++++++++++
 8 files changed, 289 insertions(+), 59 deletions(-)
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html
 create mode 100644 uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java

(limited to 'uitest/src')

diff --git a/client/src/com/vaadin/client/ui/VCalendar.java b/client/src/com/vaadin/client/ui/VCalendar.java
index c5c12f2d72..38bcc0b14f 100644
--- a/client/src/com/vaadin/client/ui/VCalendar.java
+++ b/client/src/com/vaadin/client/ui/VCalendar.java
@@ -39,6 +39,8 @@ import com.vaadin.client.ui.calendar.schedule.SimpleDayToolbar;
 import com.vaadin.client.ui.calendar.schedule.SimpleWeekToolbar;
 import com.vaadin.client.ui.calendar.schedule.WeekGrid;
 import com.vaadin.client.ui.calendar.schedule.WeeklyLongEvents;
+import com.vaadin.client.ui.calendar.schedule.dd.CalendarDropHandler;
+import com.vaadin.client.ui.dd.VHasDropHandler;
 import com.vaadin.shared.ui.calendar.DateConstants;
 
 /**
@@ -47,7 +49,7 @@ import com.vaadin.shared.ui.calendar.DateConstants;
  * @since 7.1
  * @author Vaadin Ltd.
  */
-public class VCalendar extends Composite {
+public class VCalendar extends Composite implements VHasDropHandler {
 
     public static final String ATTR_FIRSTDAYOFWEEK = "firstDay";
     public static final String ATTR_LASTDAYOFWEEK = "lastDay";
@@ -96,6 +98,8 @@ public class VCalendar extends Composite {
     private int firstHour;
     private int lastHour;
 
+    private CalendarDropHandler dropHandler;
+
     /**
      * Listener interface for listening to event click events
      */
@@ -1443,4 +1447,24 @@ public class VCalendar extends Composite {
     public void setForwardNavigationEnabled(boolean enabled) {
         forwardNavigationEnabled = enabled;
     }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.client.ui.dd.VHasDropHandler#getDropHandler()
+     */
+    @Override
+    public CalendarDropHandler getDropHandler() {
+        return dropHandler;
+    }
+
+    /**
+     * Set the drop handler
+     * 
+     * @param dropHandler
+     *            The drophandler to use
+     */
+    public void setDropHandler(CalendarDropHandler dropHandler) {
+        this.dropHandler = dropHandler;
+    }
 }
diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
index be3abb39ea..5a83579d46 100644
--- a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
+++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java
@@ -19,6 +19,7 @@ import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 
 import com.google.gwt.core.shared.GWT;
@@ -30,6 +31,7 @@ import com.google.gwt.user.client.Element;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Widget;
 import com.vaadin.client.ApplicationConnection;
+import com.vaadin.client.Paintable;
 import com.vaadin.client.TooltipInfo;
 import com.vaadin.client.UIDL;
 import com.vaadin.client.Util;
@@ -60,7 +62,8 @@ import com.vaadin.client.ui.calendar.schedule.HasTooltipKey;
 import com.vaadin.client.ui.calendar.schedule.MonthEventLabel;
 import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
 import com.vaadin.client.ui.calendar.schedule.dd.CalendarDropHandler;
-import com.vaadin.client.ui.dd.VHasDropHandler;
+import com.vaadin.client.ui.calendar.schedule.dd.CalendarMonthDropHandler;
+import com.vaadin.client.ui.calendar.schedule.dd.CalendarWeekDropHandler;
 import com.vaadin.shared.ui.Connect;
 import com.vaadin.shared.ui.Connect.LoadStyle;
 import com.vaadin.shared.ui.calendar.CalendarClientRpc;
@@ -79,16 +82,16 @@ import com.vaadin.ui.Calendar;
  */
 @Connect(value = Calendar.class, loadStyle = LoadStyle.LAZY)
 public class CalendarConnector extends AbstractComponentConnector implements
-        VHasDropHandler, ActionOwner, SimpleManagedLayout {
+        ActionOwner, SimpleManagedLayout, Paintable {
 
     private CalendarServerRpc rpc = RpcProxy.create(CalendarServerRpc.class,
             this);
 
-    private CalendarDropHandler dropHandler;
-
     private final HashMap<String, String> actionMap = new HashMap<String, String>();
     private HashMap<Object, String> tooltips = new HashMap<Object, String>();
 
+    private static final String DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG = "-ac";
+
     /**
      * 
      */
@@ -306,13 +309,16 @@ public class CalendarConnector extends AbstractComponentConnector implements
         });
     }
 
+    private boolean showingMonthView() {
+        return getState().days.size() > 7;
+    }
+
     @Override
     public void onStateChanged(StateChangeEvent stateChangeEvent) {
         super.onStateChanged(stateChangeEvent);
 
         CalendarState state = getState();
         VCalendar widget = getWidget();
-        boolean monthView = state.days.size() > 7;
 
         // Enable or disable the forward and backward navigation buttons
         widget.setForwardNavigationEnabled(hasEventListener(CalendarEventId.FORWARD));
@@ -336,10 +342,19 @@ public class CalendarConnector extends AbstractComponentConnector implements
         List<CalendarState.Day> days = state.days;
         List<CalendarState.Event> events = state.events;
 
-        if (monthView) {
+        CalendarDropHandler dropHandler = getWidget().getDropHandler();
+        if (showingMonthView()) {
             updateMonthView(days, events);
+            if (dropHandler != null
+                    && !(dropHandler instanceof CalendarMonthDropHandler)) {
+                getWidget().setDropHandler(new CalendarMonthDropHandler(this));
+            }
         } else {
             updateWeekView(days, events);
+            if (dropHandler != null
+                    && !(dropHandler instanceof CalendarWeekDropHandler)) {
+                getWidget().setDropHandler(new CalendarWeekDropHandler(this));
+            }
         }
 
         updateSizes();
@@ -355,32 +370,22 @@ public class CalendarConnector extends AbstractComponentConnector implements
      * com.vaadin.terminal.gwt.client.Paintable#updateFromUIDL(com.vaadin.terminal
      * .gwt.client.UIDL, com.vaadin.terminal.gwt.client.ApplicationConnection)
      */
+    @Override
     public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
-
-        // check for DD -related access criteria
-        // Iterator<Object> childIterator = uidl.getChildIterator();
-        // while (childIterator.hasNext()) {
-        // UIDL child = (UIDL) childIterator.next();
-        //
-        // // Drag&drop
-        // if (ACCESSCRITERIA.equals(child.getTag())) {
-        // if (monthView
-        // && !(getDropHandler() instanceof CalendarMonthDropHandler)) {
-        // setDropHandler(new CalendarMonthDropHandler());
-        //
-        // } else if (!monthView
-        // && !(getDropHandler() instanceof CalendarWeekDropHandler)) {
-        // setDropHandler(new CalendarWeekDropHandler());
-        // }
-        //
-        // getDropHandler().setCalendarPaintable(this);
-        // getDropHandler().updateAcceptRules(child);
-        //
-        // } else {
-        // setDropHandler(null);
-        // }
-        //
-        // }
+        Iterator<Object> childIterator = uidl.getChildIterator();
+        while (childIterator.hasNext()) {
+            UIDL child = (UIDL) childIterator.next();
+            if (DROPHANDLER_ACCEPT_CRITERIA_PAINT_TAG.equals(child.getTag())) {
+                if (getWidget().getDropHandler() == null) {
+                    getWidget().setDropHandler(
+                            showingMonthView() ? new CalendarMonthDropHandler(
+                                    this) : new CalendarWeekDropHandler(this));
+                }
+                getWidget().getDropHandler().updateAcceptRules(child);
+            } else {
+                getWidget().setDropHandler(null);
+            }
+        }
     }
 
     /**
@@ -449,27 +454,6 @@ public class CalendarConnector extends AbstractComponentConnector implements
                 calendarDayListOf(days));
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * com.vaadin.terminal.gwt.client.ui.dd.VHasDropHandler#getDropHandler()
-     */
-    @Override
-    public CalendarDropHandler getDropHandler() {
-        return dropHandler;
-    }
-
-    /**
-     * Set the drop handler
-     * 
-     * @param dropHandler
-     *            The drophandler to use
-     */
-    public void setDropHandler(CalendarDropHandler dropHandler) {
-        this.dropHandler = dropHandler;
-    }
-
     private Action[] getActionsBetween(Date start, Date end) {
         List<Action> actions = new ArrayList<Action>();
         for (int i = 0; i < actionKeys.size(); i++) {
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
index aab9ca9c38..ab0c9f2e9a 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarDropHandler.java
@@ -28,15 +28,16 @@ import com.vaadin.client.ui.dd.VAbstractDropHandler;
  */
 public abstract class CalendarDropHandler extends VAbstractDropHandler {
 
-    protected CalendarConnector calendarConnector;
+    protected final CalendarConnector calendarConnector;
 
     /**
-     * Set the calendar instance
+     * Constructor
      * 
-     * @param calendarPaintable
+     * @param connector
+     *            The connector of the calendar
      */
-    public void setConnector(CalendarConnector calendarConnector) {
-        this.calendarConnector = calendarConnector;
+    public CalendarDropHandler(CalendarConnector connector) {
+        calendarConnector = connector;
     }
 
     /*
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
index 913477ee14..fd0be4881e 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarMonthDropHandler.java
@@ -18,6 +18,7 @@ package com.vaadin.client.ui.calendar.schedule.dd;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.vaadin.client.Util;
+import com.vaadin.client.ui.calendar.CalendarConnector;
 import com.vaadin.client.ui.calendar.schedule.SimpleDayCell;
 import com.vaadin.client.ui.dd.VAcceptCallback;
 import com.vaadin.client.ui.dd.VDragEvent;
@@ -32,6 +33,10 @@ import com.vaadin.client.ui.dd.VDragEvent;
  */
 public class CalendarMonthDropHandler extends CalendarDropHandler {
 
+    public CalendarMonthDropHandler(CalendarConnector connector) {
+        super(connector);
+    }
+
     private Element currentTargetElement;
     private SimpleDayCell currentTargetDay;
 
diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
index 0ea683dc3c..cede1827a2 100644
--- a/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
+++ b/client/src/com/vaadin/client/ui/calendar/schedule/dd/CalendarWeekDropHandler.java
@@ -18,6 +18,7 @@ package com.vaadin.client.ui.calendar.schedule.dd;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Element;
 import com.vaadin.client.Util;
+import com.vaadin.client.ui.calendar.CalendarConnector;
 import com.vaadin.client.ui.calendar.schedule.DateCell;
 import com.vaadin.client.ui.calendar.schedule.DateCellDayEvent;
 import com.vaadin.client.ui.dd.VAcceptCallback;
@@ -36,6 +37,10 @@ public class CalendarWeekDropHandler extends CalendarDropHandler {
     private com.google.gwt.user.client.Element currentTargetElement;
     private DateCell currentTargetDay;
 
+    public CalendarWeekDropHandler(CalendarConnector connector) {
+        super(connector);
+    }
+
     /*
      * (non-Javadoc)
      * 
diff --git a/server/src/com/vaadin/ui/Calendar.java b/server/src/com/vaadin/ui/Calendar.java
index 38fa355dd8..c3385baa2c 100644
--- a/server/src/com/vaadin/ui/Calendar.java
+++ b/server/src/com/vaadin/ui/Calendar.java
@@ -45,6 +45,8 @@ import com.vaadin.event.dd.DropHandler;
 import com.vaadin.event.dd.DropTarget;
 import com.vaadin.event.dd.TargetDetails;
 import com.vaadin.server.KeyMapper;
+import com.vaadin.server.PaintException;
+import com.vaadin.server.PaintTarget;
 import com.vaadin.shared.ui.calendar.CalendarEventId;
 import com.vaadin.shared.ui.calendar.CalendarServerRpc;
 import com.vaadin.shared.ui.calendar.CalendarState;
@@ -114,7 +116,7 @@ public class Calendar extends AbstractComponent implements
         CalendarComponentEvents.RangeSelectNotifier,
         CalendarComponentEvents.EventResizeNotifier,
         CalendarEventProvider.EventSetChangeListener, DropTarget,
-        CalendarEditableEventProvider, Action.Container {
+        CalendarEditableEventProvider, Action.Container, LegacyComponent {
 
     /**
      * Calendar can use either 12 hours clock or 24 hours clock.
@@ -1842,4 +1844,31 @@ public class Calendar extends AbstractComponent implements
             }
         }
     }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see com.vaadin.server.VariableOwner#changeVariables(java.lang.Object,
+     * java.util.Map)
+     */
+    @Override
+    public void changeVariables(Object source, Map<String, Object> variables) {
+        /*
+         * Only defined to fulfill the LegacyComponent interface used for
+         * calendar drag & drop. No implementation required.
+         */
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * com.vaadin.ui.LegacyComponent#paintContent(com.vaadin.server.PaintTarget)
+     */
+    @Override
+    public void paintContent(PaintTarget target) throws PaintException {
+        if (dropHandler != null) {
+            dropHandler.getAcceptCriterion().paint(target);
+        }
+    }
 }
\ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html
new file mode 100644
index 0000000000..425f95c529
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.html
@@ -0,0 +1,59 @@
+<?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:7171/" />
+<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.calendar.CalendarDragAndDrop?restartApplication</td>
+	<td></td>
+</tr>
+<!--// Test drag and drop in month view-->
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]/domChild[0]/domChild[0]</td>
+	<td>76,7</td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[0]/VCalendar[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[5]/domChild[0]/domChild[2]</td>
+	<td>54,9</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[5]/domChild[0]/domChild[1]</td>
+	<td>12:00 AM Event 10</td>
+</tr>
+<!--//Test drag and drop in week view-->
+<tr>
+	<td>mouseClick</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[1]/domChild[0]/domChild[0]/domChild[1]/domChild[1]/domChild[0]/domChild[0]</td>
+	<td>7,85</td>
+</tr>
+<tr>
+	<td>drag</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VHorizontalLayout[0]/Slot[1]/VScrollTable[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[11]/domChild[0]/domChild[0]</td>
+	<td>34,12</td>
+</tr>
+<tr>
+	<td>drop</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[15]</td>
+	<td>75,9</td>
+</tr>
+<tr>
+	<td>assertText</td>
+	<td>vaadin=runcomvaadintestscomponentscalendarCalendarDragAndDrop::PID_SCalendar/domChild[0]/domChild[3]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[0]/domChild[2]/domChild[0]/domChild[48]/domChild[0]</td>
+	<td>7:30 AM: Event 13</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java
new file mode 100644
index 0000000000..7477fc84ce
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/components/calendar/CalendarDragAndDrop.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright 2000-2013 Vaadin Ltd.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+/**
+ * 
+ */
+package com.vaadin.tests.components.calendar;
+
+import java.util.GregorianCalendar;
+import java.util.Locale;
+
+import com.vaadin.event.dd.DragAndDropEvent;
+import com.vaadin.event.dd.DropHandler;
+import com.vaadin.event.dd.acceptcriteria.AcceptAll;
+import com.vaadin.event.dd.acceptcriteria.AcceptCriterion;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.ui.Calendar;
+import com.vaadin.ui.HorizontalLayout;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.TableDragMode;
+import com.vaadin.ui.Table.TableTransferable;
+import com.vaadin.ui.components.calendar.CalendarTargetDetails;
+import com.vaadin.ui.components.calendar.event.BasicEvent;
+
+public class CalendarDragAndDrop extends AbstractTestUI {
+
+    private Calendar calendar;
+
+    private Table table;
+
+    private class TestDropHandler implements DropHandler {
+
+        @Override
+        public void drop(DragAndDropEvent event) {
+            CalendarTargetDetails details = (CalendarTargetDetails) event
+                    .getTargetDetails();
+
+            TableTransferable transferable = (TableTransferable) event
+                    .getTransferable();
+
+            calendar.addEvent(new BasicEvent(transferable.getItemId()
+                    .toString(), "This event was dragged here", details
+                    .getDropTime()));
+
+            table.removeItem(transferable.getItemId());
+        }
+
+        @Override
+        public AcceptCriterion getAcceptCriterion() {
+            return AcceptAll.get();
+        }
+    }
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        setSizeFull();
+        getContent().setSizeFull();
+        getLayout().setSizeFull();
+
+        HorizontalLayout root = new HorizontalLayout();
+        root.setSizeFull();
+        addComponent(root);
+
+        Locale locale = new Locale("en", "US");
+        GregorianCalendar cal = new GregorianCalendar(locale);
+        cal.set(2013, 0, 1);
+
+        calendar = new Calendar();
+        calendar.setId("Calendar");
+        calendar.setLocale(locale);
+        calendar.setDropHandler(new TestDropHandler());
+        calendar.setSizeFull();
+        root.addComponent(calendar);
+
+        calendar.setStartDate(cal.getTime());
+        cal.add(java.util.Calendar.MONTH, 1);
+        calendar.setEndDate(cal.getTime());
+
+        table = new Table();
+        table.setSizeFull();
+        table.setDragMode(TableDragMode.ROW);
+        table.addGeneratedColumn("COLUMN", new Table.ColumnGenerator() {
+
+            @Override
+            public Object generateCell(Table source, Object itemId,
+                    Object columnId) {
+                return itemId;
+            }
+        });
+
+        for (int eventNum = 1; eventNum < 50; eventNum++) {
+            table.addItem("Event " + eventNum);
+        }
+
+        root.addComponent(table);
+    }
+
+    @Override
+    protected String getTestDescription() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11048;
+    }
+
+}
-- 
cgit v1.2.3