diff options
author | Artur Signell <artur@vaadin.com> | 2013-03-24 16:38:45 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-03-28 07:27:01 +0000 |
commit | a2a8666118de8b8f746e631a3aab4c58d2d4a6af (patch) | |
tree | 57ea2053e10543840906dd1506bfb1c0bec751f6 | |
parent | 5e77672975c6d272072baeec77005c847535fd97 (diff) | |
download | vaadin-framework-a2a8666118de8b8f746e631a3aab4c58d2d4a6af.tar.gz vaadin-framework-a2a8666118de8b8f746e631a3aab4c58d2d4a6af.zip |
Added Page.reload (#10250)
Change-Id: I8ec7edbc370388d8b36a474a8845e846395f26ed
5 files changed, 95 insertions, 0 deletions
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; + } + +} |