blob: 8d870f72bc723de885a74216c8f3fc9136cac5d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package com.vaadin.tests.push;
import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.shared.ui.ui.Transport;
import com.vaadin.tests.components.AbstractReindeerTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Label;
@PreserveOnRefresh
@Push(transport = Transport.WEBSOCKET_XHR)
public class PushWithPreserveOnRefresh extends AbstractReindeerTestUI {
private Log log = new Log(5);
private int times = 0;
@Override
protected void setup(VaadinRequest request) {
setTheme("valo");
// Internal parameter sent by vaadinBootstrap.js,
addComponent(new Label("window.name: " + request.getParameter("v-wn")));
addComponent(new Label("UI id: " + getUIId()));
addComponent(log);
addButton("click me", event -> log
.log("Button has been clicked " + (++times) + " times"));
}
@Override
protected String getTestDescription() {
return "Refreshing the browser window should preserve the state and push should continue to work";
}
@Override
protected Integer getTicketNumber() {
return Integer.valueOf(13620);
}
}
|