|
4 | 4 | import gwt.material.design.client.custom.CustomLabel; |
5 | 5 |
|
6 | 6 | import com.google.gwt.core.client.GWT; |
| 7 | +import com.google.gwt.event.dom.client.ChangeEvent; |
| 8 | +import com.google.gwt.event.dom.client.ChangeHandler; |
| 9 | +import com.google.gwt.event.dom.client.HasChangeHandlers; |
| 10 | +import com.google.gwt.event.dom.client.HasKeyDownHandlers; |
| 11 | +import com.google.gwt.event.dom.client.HasKeyPressHandlers; |
| 12 | +import com.google.gwt.event.dom.client.HasKeyUpHandlers; |
| 13 | +import com.google.gwt.event.dom.client.KeyDownEvent; |
| 14 | +import com.google.gwt.event.dom.client.KeyDownHandler; |
| 15 | +import com.google.gwt.event.dom.client.KeyPressEvent; |
| 16 | +import com.google.gwt.event.dom.client.KeyPressHandler; |
| 17 | +import com.google.gwt.event.dom.client.KeyUpEvent; |
| 18 | +import com.google.gwt.event.dom.client.KeyUpHandler; |
| 19 | +import com.google.gwt.event.shared.HandlerRegistration; |
7 | 20 | import com.google.gwt.uibinder.client.UiBinder; |
8 | 21 | import com.google.gwt.uibinder.client.UiField; |
9 | 22 | import com.google.gwt.user.client.ui.Composite; |
10 | 23 | import com.google.gwt.user.client.ui.Label; |
11 | 24 | import com.google.gwt.user.client.ui.TextArea; |
12 | 25 | import com.google.gwt.user.client.ui.Widget; |
13 | 26 |
|
14 | | -public class MaterialTextArea extends Composite { |
| 27 | +public class MaterialTextArea extends Composite implements HasKeyPressHandlers,HasKeyDownHandlers,HasKeyUpHandlers,HasChangeHandlers { |
15 | 28 |
|
16 | 29 | private static MaterialTextAreaUiBinder uiBinder = GWT |
17 | 30 | .create(MaterialTextAreaUiBinder.class); |
@@ -68,7 +81,6 @@ public void setText(String text) { |
68 | 81 |
|
69 | 82 | @Override |
70 | 83 | protected void onAttach() { |
71 | | - // TODO Auto-generated method stub |
72 | 84 | super.onAttach(); |
73 | 85 | customLabel.getElement().setAttribute("for", "field"); |
74 | 86 | } |
@@ -118,4 +130,25 @@ public void setLength(String length) { |
118 | 130 | txtBox.getElement().setAttribute("length", length); |
119 | 131 | } |
120 | 132 |
|
| 133 | + @Override |
| 134 | + public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { |
| 135 | + return addDomHandler(handler, KeyDownEvent.getType()); |
| 136 | + } |
| 137 | + |
| 138 | + @Override |
| 139 | + public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { |
| 140 | + return addDomHandler(handler, KeyUpEvent.getType()); |
| 141 | + } |
| 142 | + |
| 143 | + @Override |
| 144 | + public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { |
| 145 | + return addDomHandler(handler, KeyPressEvent.getType()); |
| 146 | + } |
| 147 | + |
| 148 | + @Override |
| 149 | + public HandlerRegistration addChangeHandler(ChangeHandler handler) { |
| 150 | + return addDomHandler(handler, ChangeEvent.getType()); |
| 151 | + } |
| 152 | + |
| 153 | + |
121 | 154 | } |
0 commit comments