Skip to content

Commit 829ab27

Browse files
committed
Added event handlers to MaterialTextArea for:
keyDown keyUp keyPress change
1 parent 904f02a commit 829ab27

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

src/main/java/gwt/material/design/client/ui/MaterialTextArea.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,27 @@
44
import gwt.material.design.client.custom.CustomLabel;
55

66
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;
720
import com.google.gwt.uibinder.client.UiBinder;
821
import com.google.gwt.uibinder.client.UiField;
922
import com.google.gwt.user.client.ui.Composite;
1023
import com.google.gwt.user.client.ui.Label;
1124
import com.google.gwt.user.client.ui.TextArea;
1225
import com.google.gwt.user.client.ui.Widget;
1326

14-
public class MaterialTextArea extends Composite {
27+
public class MaterialTextArea extends Composite implements HasKeyPressHandlers,HasKeyDownHandlers,HasKeyUpHandlers,HasChangeHandlers {
1528

1629
private static MaterialTextAreaUiBinder uiBinder = GWT
1730
.create(MaterialTextAreaUiBinder.class);
@@ -68,7 +81,6 @@ public void setText(String text) {
6881

6982
@Override
7083
protected void onAttach() {
71-
// TODO Auto-generated method stub
7284
super.onAttach();
7385
customLabel.getElement().setAttribute("for", "field");
7486
}
@@ -118,4 +130,25 @@ public void setLength(String length) {
118130
txtBox.getElement().setAttribute("length", length);
119131
}
120132

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+
121154
}

0 commit comments

Comments
 (0)