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 package info.magnolia.ui.vaadin.gwt.client.tabsheet.event;
35
36 import info.magnolia.ui.vaadin.gwt.client.tabsheet.tab.widget.MagnoliaTabWidget;
37
38 import com.google.gwt.event.shared.EventHandler;
39 import com.google.gwt.event.shared.GwtEvent;
40 import com.google.gwt.event.shared.HandlerRegistration;
41
42
43
44
45 public class ActiveTabChangedEvent extends GwtEvent<ActiveTabChangedEvent.Handler> {
46
47 public final static Type<ActiveTabChangedEvent.Handler> TYPE = new Type<ActiveTabChangedEvent.Handler>();
48
49
50
51
52 public interface Handler extends EventHandler {
53 void onActiveTabChanged(ActiveTabChangedEvent event);
54 }
55
56
57
58
59 public interface HasActiveTabChangeHandlers {
60 HandlerRegistration addActiveTabChangedHandler(Handler handler);
61 }
62
63 private final MagnoliaTabWidget tab;
64
65 private boolean isShowingAllTabs = false;
66
67 private boolean notifyServer = true;
68
69 public ActiveTabChangedEvent(final MagnoliaTabWidget tab) {
70 this.tab = tab;
71 }
72
73 public ActiveTabChangedEvent(final MagnoliaTabWidget tab, boolean notifyServer) {
74 this.tab = tab;
75 this.notifyServer = notifyServer;
76 }
77
78 public ActiveTabChangedEvent(boolean isShowingAll, boolean notifyServer) {
79 this.tab = null;
80 this.isShowingAllTabs = isShowingAll;
81 this.notifyServer = notifyServer;
82 }
83
84 public boolean isShowingAllTabs() {
85 return isShowingAllTabs;
86 }
87
88 public boolean isNotifyServer() {
89 return notifyServer;
90 }
91
92 public MagnoliaTabWidget getTab() {
93 return tab;
94 }
95
96 @Override
97 protected void dispatch(ActiveTabChangedEvent.Handler handler) {
98 handler.onActiveTabChanged(this);
99 }
100
101 @Override
102 public GwtEvent.Type<ActiveTabChangedEvent.Handler> getAssociatedType() {
103 return TYPE;
104 }
105 }