1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.gwtwidgets.client.wwrapper;
18
19 import com.google.gwt.user.client.DOM;
20 import com.google.gwt.user.client.Element;
21 import com.google.gwt.user.client.Event;
22 import com.google.gwt.user.client.ui.Button;
23 import com.google.gwt.user.client.ui.ClickListener;
24
25 public class WButton extends Button implements WrappedWidget
26 {
27 private static final String WIDGET_TYPE = "button";
28
29 public WButton (String id)
30 throws ElementNotFoundException
31 {
32 super();
33
34 Element e = DOM.getElementById(id);
35
36 if (e == null) {
37 throw new ElementNotFoundException(id);
38 }
39
40 setElement(e);
41 sinkEvents(Event.ONCLICK);
42 WBuilder.resetElement(this);
43 }
44
45 public WButton (Element element)
46 {
47 super();
48 setElement(element);
49 sinkEvents(Event.ONCLICK);
50 WBuilder.resetElement(this);
51 }
52
53 public String getWidgetType ()
54 {
55 return WIDGET_TYPE;
56 }
57
58 public void addClickListener(ClickListener listener)
59 {
60 super.addClickListener(listener);
61 }
62
63 }