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.magnoliashell.shell;
35
36 import info.magnolia.ui.vaadin.gwt.client.icon.widget.BadgeIconWidget;
37 import info.magnolia.ui.vaadin.gwt.client.shared.magnoliashell.ShellAppType;
38
39 import com.google.gwt.event.shared.HandlerRegistration;
40 import com.google.gwt.user.client.DOM;
41 import com.google.gwt.user.client.Element;
42 import com.google.gwt.user.client.Event;
43 import com.google.gwt.user.client.ui.FlowPanel;
44 import com.googlecode.mgwt.dom.client.event.touch.TouchEndHandler;
45 import com.googlecode.mgwt.ui.client.widget.touch.TouchDelegate;
46
47
48
49
50 public class NavigatorButton extends FlowPanel {
51
52 private final BadgeIconWidgetclient/icon/widget/BadgeIconWidget.html#BadgeIconWidget">BadgeIconWidget indicator = new BadgeIconWidget();
53
54 private final TouchDelegateient/widget/touch/TouchDelegate.html#TouchDelegate">TouchDelegate delegate = new TouchDelegate(this);
55
56 public NavigatorButton(final ShellAppType type) {
57 super();
58 addStyleName("btn-shell");
59 Element root = getElement();
60 root.setId("btn-" + type.getCssClass());
61 root.addClassName("icon-" + type.getCssClass());
62
63 indicator.setFillColor("#fff");
64 indicator.setStrokeColor("#689600");
65 indicator.setOutline(true);
66 root.appendChild(indicator.getElement());
67
68 DOM.sinkEvents(getElement(), Event.TOUCHEVENTS);
69 }
70
71 public void setIndication(int indication) {
72 indicator.setValue(indication);
73 }
74
75 public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
76 return delegate.addTouchEndHandler(handler);
77 }
78 }