Skip to content

Commit 1aa1f04

Browse files
committed
Merge pull request #51 from anton-johansson/master
Expose same functionality in MaterialTextBox as TextBox
2 parents a3aa0b4 + c9ac47f commit 1aa1f04

File tree

1 file changed

+230
-9
lines changed

1 file changed

+230
-9
lines changed

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

Lines changed: 230 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,72 @@
2424
import gwt.material.design.client.custom.CustomLabel;
2525

2626
import com.google.gwt.core.client.GWT;
27+
import com.google.gwt.editor.client.IsEditor;
28+
import com.google.gwt.editor.ui.client.adapters.ValueBoxEditor;
29+
import com.google.gwt.event.dom.client.BlurHandler;
30+
import com.google.gwt.event.dom.client.ChangeHandler;
31+
import com.google.gwt.event.dom.client.ClickHandler;
32+
import com.google.gwt.event.dom.client.DoubleClickHandler;
33+
import com.google.gwt.event.dom.client.DragEndHandler;
34+
import com.google.gwt.event.dom.client.DragEnterHandler;
35+
import com.google.gwt.event.dom.client.DragHandler;
36+
import com.google.gwt.event.dom.client.DragLeaveHandler;
37+
import com.google.gwt.event.dom.client.DragOverHandler;
38+
import com.google.gwt.event.dom.client.DragStartHandler;
39+
import com.google.gwt.event.dom.client.DropHandler;
40+
import com.google.gwt.event.dom.client.FocusHandler;
41+
import com.google.gwt.event.dom.client.GestureChangeHandler;
42+
import com.google.gwt.event.dom.client.GestureEndHandler;
43+
import com.google.gwt.event.dom.client.GestureStartHandler;
44+
import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers;
45+
import com.google.gwt.event.dom.client.HasAllFocusHandlers;
46+
import com.google.gwt.event.dom.client.HasAllGestureHandlers;
47+
import com.google.gwt.event.dom.client.HasAllKeyHandlers;
48+
import com.google.gwt.event.dom.client.HasAllMouseHandlers;
49+
import com.google.gwt.event.dom.client.HasAllTouchHandlers;
50+
import com.google.gwt.event.dom.client.HasChangeHandlers;
51+
import com.google.gwt.event.dom.client.HasClickHandlers;
52+
import com.google.gwt.event.dom.client.HasDoubleClickHandlers;
2753
import com.google.gwt.event.dom.client.HasKeyUpHandlers;
2854
import com.google.gwt.event.dom.client.KeyCodes;
55+
import com.google.gwt.event.dom.client.KeyDownHandler;
2956
import com.google.gwt.event.dom.client.KeyPressEvent;
3057
import com.google.gwt.event.dom.client.KeyPressHandler;
3158
import com.google.gwt.event.dom.client.KeyUpEvent;
3259
import com.google.gwt.event.dom.client.KeyUpHandler;
60+
import com.google.gwt.event.dom.client.MouseDownHandler;
61+
import com.google.gwt.event.dom.client.MouseMoveHandler;
62+
import com.google.gwt.event.dom.client.MouseOutHandler;
63+
import com.google.gwt.event.dom.client.MouseOverHandler;
64+
import com.google.gwt.event.dom.client.MouseUpHandler;
65+
import com.google.gwt.event.dom.client.MouseWheelHandler;
66+
import com.google.gwt.event.dom.client.TouchCancelHandler;
67+
import com.google.gwt.event.dom.client.TouchEndHandler;
68+
import com.google.gwt.event.dom.client.TouchMoveHandler;
69+
import com.google.gwt.event.dom.client.TouchStartHandler;
3370
import com.google.gwt.event.logical.shared.ValueChangeHandler;
3471
import com.google.gwt.event.shared.HandlerRegistration;
72+
import com.google.gwt.i18n.client.AutoDirectionHandler;
73+
import com.google.gwt.i18n.shared.DirectionEstimator;
74+
import com.google.gwt.i18n.shared.HasDirectionEstimator;
3575
import com.google.gwt.uibinder.client.UiBinder;
3676
import com.google.gwt.uibinder.client.UiField;
3777
import com.google.gwt.user.client.ui.Composite;
78+
import com.google.gwt.user.client.ui.HasEnabled;
79+
import com.google.gwt.user.client.ui.HasName;
3880
import com.google.gwt.user.client.ui.HasText;
3981
import com.google.gwt.user.client.ui.HasValue;
4082
import com.google.gwt.user.client.ui.Label;
4183
import com.google.gwt.user.client.ui.TextBox;
4284
import com.google.gwt.user.client.ui.Widget;
4385

44-
public class MaterialTextBox extends Composite implements HasText, HasKeyUpHandlers, HasValue<String> {
86+
public class MaterialTextBox extends Composite implements
87+
HasChangeHandlers, HasName, HasDirectionEstimator, HasValue<String>,
88+
HasText, AutoDirectionHandler.Target, IsEditor<ValueBoxEditor<String>>,
89+
HasKeyUpHandlers, HasClickHandlers, HasDoubleClickHandlers,
90+
HasEnabled, HasAllDragAndDropHandlers, HasAllFocusHandlers,
91+
HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers,
92+
HasAllTouchHandlers {
4593

4694
private static MaterialTextBoxUiBinder uiBinder = GWT.create(MaterialTextBoxUiBinder.class);
4795

@@ -56,20 +104,17 @@ interface MaterialTextBoxUiBinder extends UiBinder<Widget, MaterialTextBox> {
56104
private String length;
57105

58106
@UiField
59-
CustomLabel
60-
customLabel;
107+
protected CustomLabel customLabel;
61108
@UiField
62-
Label lblName;
109+
protected Label lblName;
63110
@UiField
64-
TextBox txtBox;
111+
protected TextBox txtBox;
65112
@UiField
66-
CustomIcon iconPanel;
113+
protected CustomIcon iconPanel;
67114

68115
public MaterialTextBox() {
69116
initWidget(uiBinder.createAndBindUi(this));
70117
}
71-
72-
73118

74119
@Override
75120
protected void onAttach() {
@@ -167,14 +212,15 @@ public void setValid(boolean isValid) {
167212
this.isValid = isValid;
168213
}
169214

215+
@Override
170216
public boolean isEnabled() {
171217
return enabled;
172218
}
173219

220+
@Override
174221
public void setEnabled(boolean enabled) {
175222
this.enabled = enabled;
176223
txtBox.setEnabled(enabled);
177-
178224
}
179225

180226
@Override
@@ -210,4 +256,179 @@ public void setValue(String value) {
210256
public void setValue(String value, boolean fireEvents) {
211257
txtBox.setValue(value, fireEvents);
212258
}
259+
260+
@Override
261+
public void setDirection(Direction direction) {
262+
txtBox.setDirection(direction);
263+
}
264+
265+
@Override
266+
public Direction getDirection() {
267+
return txtBox.getDirection();
268+
}
269+
270+
@Override
271+
public ValueBoxEditor<String> asEditor() {
272+
return txtBox.asEditor();
273+
}
274+
275+
@Override
276+
public DirectionEstimator getDirectionEstimator() {
277+
return txtBox.getDirectionEstimator();
278+
}
279+
280+
@Override
281+
public void setDirectionEstimator(boolean enabled) {
282+
txtBox.setDirectionEstimator(enabled);
283+
}
284+
285+
@Override
286+
public void setDirectionEstimator(DirectionEstimator directionEstimator) {
287+
txtBox.setDirectionEstimator(directionEstimator);
288+
}
289+
290+
@Override
291+
public void setName(String name) {
292+
txtBox.setName(name);
293+
}
294+
295+
@Override
296+
public String getName() {
297+
return txtBox.getName();
298+
}
299+
300+
@Override
301+
public HandlerRegistration addChangeHandler(ChangeHandler handler) {
302+
return txtBox.addChangeHandler(handler);
303+
}
304+
305+
@Override
306+
public HandlerRegistration addDragEndHandler(DragEndHandler handler) {
307+
return txtBox.addDragEndHandler(handler);
308+
}
309+
310+
@Override
311+
public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) {
312+
return txtBox.addDragEnterHandler(handler);
313+
}
314+
315+
@Override
316+
public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) {
317+
return txtBox.addDragLeaveHandler(handler);
318+
}
319+
320+
@Override
321+
public HandlerRegistration addDragHandler(DragHandler handler) {
322+
return txtBox.addDragHandler(handler);
323+
}
324+
325+
@Override
326+
public HandlerRegistration addDragOverHandler(DragOverHandler handler) {
327+
return txtBox.addDragOverHandler(handler);
328+
}
329+
330+
@Override
331+
public HandlerRegistration addDragStartHandler(DragStartHandler handler) {
332+
return txtBox.addDragStartHandler(handler);
333+
}
334+
335+
@Override
336+
public HandlerRegistration addDropHandler(DropHandler handler) {
337+
return txtBox.addDropHandler(handler);
338+
}
339+
340+
@Override
341+
public HandlerRegistration addFocusHandler(FocusHandler handler) {
342+
return txtBox.addFocusHandler(handler);
343+
}
344+
345+
@Override
346+
public HandlerRegistration addBlurHandler(BlurHandler handler) {
347+
return txtBox.addBlurHandler(handler);
348+
}
349+
350+
@Override
351+
public HandlerRegistration addGestureStartHandler(GestureStartHandler handler) {
352+
return txtBox.addGestureStartHandler(handler);
353+
}
354+
355+
@Override
356+
public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler) {
357+
return txtBox.addGestureChangeHandler(handler);
358+
}
359+
360+
@Override
361+
public HandlerRegistration addGestureEndHandler(GestureEndHandler handler) {
362+
return txtBox.addGestureEndHandler(handler);
363+
}
364+
365+
@Override
366+
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) {
367+
return txtBox.addKeyDownHandler(handler);
368+
}
369+
370+
@Override
371+
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) {
372+
return txtBox.addKeyPressHandler(handler);
373+
}
374+
375+
@Override
376+
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {
377+
return txtBox.addMouseDownHandler(handler);
378+
}
379+
380+
@Override
381+
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {
382+
return txtBox.addMouseUpHandler(handler);
383+
}
384+
385+
@Override
386+
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {
387+
return txtBox.addMouseOutHandler(handler);
388+
}
389+
390+
@Override
391+
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {
392+
return txtBox.addMouseOverHandler(handler);
393+
}
394+
395+
@Override
396+
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {
397+
return txtBox.addMouseMoveHandler(handler);
398+
}
399+
400+
@Override
401+
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {
402+
return txtBox.addMouseWheelHandler(handler);
403+
}
404+
405+
@Override
406+
public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) {
407+
return txtBox.addTouchStartHandler(handler);
408+
}
409+
410+
@Override
411+
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) {
412+
return txtBox.addTouchMoveHandler(handler);
413+
}
414+
415+
@Override
416+
public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) {
417+
return txtBox.addTouchEndHandler(handler);
418+
}
419+
420+
@Override
421+
public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) {
422+
return txtBox.addTouchCancelHandler(handler);
423+
}
424+
425+
@Override
426+
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) {
427+
return txtBox.addDoubleClickHandler(handler);
428+
}
429+
430+
@Override
431+
public HandlerRegistration addClickHandler(ClickHandler handler) {
432+
return txtBox.addClickHandler(handler);
433+
}
213434
}

0 commit comments

Comments
 (0)