blob: 1b855e4e517eb58d6b6181a7c51e361ab5b6a2e5 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
package com.vaadin.tests.minitutorials.v7a3;
import java.lang.reflect.Method;
import java.util.EventObject;
import com.vaadin.server.AbstractExtension;
import com.vaadin.tests.widgetset.client.minitutorials.v7a3.RefresherRpc;
import com.vaadin.tests.widgetset.client.minitutorials.v7a3.RefresherState;
import com.vaadin.ui.UI;
import com.vaadin.util.ReflectTools;
public class Refresher extends AbstractExtension {
public interface RefreshListener {
static Method METHOD = ReflectTools.findMethod(RefreshListener.class,
"refresh", RefreshEvent.class);
public void refresh(RefreshEvent refreshEvent);
}
public class RefreshEvent extends EventObject {
public RefreshEvent(Refresher refresher) {
super(refresher);
}
public Refresher getRefresher() {
return (Refresher) getSource();
}
}
public Refresher() {
registerRpc(new RefresherRpc() {
@Override
public void refresh() {
fireEvent(new RefreshEvent(Refresher.this));
}
});
}
@Override
public RefresherState getState() {
return (RefresherState) super.getState();
}
public void setInterval(int millis) {
getState().interval = millis;
}
public int getInterval() {
return getState().interval;
}
public void setEnabled(boolean enabled) {
getState().enabled = enabled;
}
public boolean isEnabled() {
return getState().enabled;
}
public void addRefreshListener(RefreshListener listener) {
super.addListener(RefreshEvent.class, listener, RefreshListener.METHOD);
}
public void removeRefreshListener(RefreshListener listener) {
super.removeListener(RefreshEvent.class, listener,
RefreshListener.METHOD);
}
public void extend(UI target) {
super.extend(target);
}
}
|