aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/src/com/vaadin/client/ui/ui/UIConnector.java9
-rw-r--r--server/src/com/vaadin/server/Page.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java2
-rw-r--r--shared/src/com/vaadin/shared/ui/ui/PageState.java5
-rw-r--r--uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.html36
-rw-r--r--uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.java30
6 files changed, 77 insertions, 7 deletions
diff --git a/client/src/com/vaadin/client/ui/ui/UIConnector.java b/client/src/com/vaadin/client/ui/ui/UIConnector.java
index 45b0a7ab9d..460cde5522 100644
--- a/client/src/com/vaadin/client/ui/ui/UIConnector.java
+++ b/client/src/com/vaadin/client/ui/ui/UIConnector.java
@@ -100,10 +100,6 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
protected void init() {
super.init();
registerRpc(PageClientRpc.class, new PageClientRpc() {
- @Override
- public void setTitle(String title) {
- com.google.gwt.user.client.Window.setTitle(title);
- }
@Override
public void reload() {
@@ -644,6 +640,11 @@ public class UIConnector extends AbstractSingleComponentContainerConnector
configurePolling();
}
+ if (stateChangeEvent.hasPropertyChanged("title")) {
+ com.google.gwt.user.client.Window
+ .setTitle(getState().pageState.title);
+ }
+
if (stateChangeEvent.hasPropertyChanged("pushConfiguration")) {
getConnection().setPushEnabled(
getState().pushConfiguration.mode.isEnabled());
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index 4dd7d34e38..4d7d2c10c5 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -1079,7 +1079,7 @@ public class Page implements Serializable {
* the new page title to set
*/
public void setTitle(String title) {
- uI.getRpcProxy(PageClientRpc.class).setTitle(title);
+ getState(true).title = title;
}
/**
diff --git a/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java b/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
index eb847bacd0..76a3fbfdb6 100644
--- a/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
+++ b/shared/src/com/vaadin/shared/ui/ui/PageClientRpc.java
@@ -20,8 +20,6 @@ import com.vaadin.shared.communication.ClientRpc;
public interface PageClientRpc extends ClientRpc {
- public void setTitle(String title);
-
public void reload();
}
diff --git a/shared/src/com/vaadin/shared/ui/ui/PageState.java b/shared/src/com/vaadin/shared/ui/ui/PageState.java
index 0b51eb4bba..ded73d16d5 100644
--- a/shared/src/com/vaadin/shared/ui/ui/PageState.java
+++ b/shared/src/com/vaadin/shared/ui/ui/PageState.java
@@ -30,4 +30,9 @@ public class PageState implements Serializable {
* True if the page has browser window resize listeners.
*/
public boolean hasResizeListeners = false;
+
+ /**
+ * Non-null if the title is set.
+ */
+ public String title = null;
} \ No newline at end of file
diff --git a/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.html b/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.html
new file mode 100644
index 0000000000..f366054f45
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.html
@@ -0,0 +1,36 @@
+<?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/com.vaadin.tests.application.RefreshStatePreserveTitle?restartApplication" />
+<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.application.RefreshStatePreserveTitle?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>TEST</td>
+ <td></td>
+</tr>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.application.RefreshStatePreserveTitle</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertTitle</td>
+ <td>TEST</td>
+ <td></td>
+</tr>
+</tbody></table>
+</body>
+</html>
diff --git a/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.java b/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.java
new file mode 100644
index 0000000000..88b3a9b9f4
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/application/RefreshStatePreserveTitle.java
@@ -0,0 +1,30 @@
+package com.vaadin.tests.application;
+
+import com.vaadin.annotations.PreserveOnRefresh;
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Label;
+
+@PreserveOnRefresh
+public class RefreshStatePreserveTitle extends AbstractTestUI {
+
+ private Log log = new Log(5);
+
+ @Override
+ protected void setup(VaadinRequest request) {
+ getPage().setTitle("TEST");
+ addComponent(new Label(
+ "Refresh the page and observe that window title 'TEST' is lost."));
+ }
+
+ @Override
+ protected String getTestDescription() {
+ return "Refreshing the browser window should preserve the window title";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return Integer.valueOf(11054);
+ }
+} \ No newline at end of file