From 0383f0e250b1d8f3fb9497531af9f17be3956bad Mon Sep 17 00:00:00 2001 From: Anton Johansson Date: Tue, 7 Jul 2015 17:22:11 +0200 Subject: [PATCH] Expose same functionality in MaterialTextArea as TextArea --- .../ui/AbstractMaterialTextBoxBase.java | 428 ++++++++++++++++++ .../design/client/ui/MaterialTextArea.java | 136 +----- .../design/client/ui/MaterialTextBox.java | 372 +-------------- 3 files changed, 463 insertions(+), 473 deletions(-) create mode 100644 src/main/java/gwt/material/design/client/ui/AbstractMaterialTextBoxBase.java diff --git a/src/main/java/gwt/material/design/client/ui/AbstractMaterialTextBoxBase.java b/src/main/java/gwt/material/design/client/ui/AbstractMaterialTextBoxBase.java new file mode 100644 index 000000000..2e11c100e --- /dev/null +++ b/src/main/java/gwt/material/design/client/ui/AbstractMaterialTextBoxBase.java @@ -0,0 +1,428 @@ +package gwt.material.design.client.ui; + +/* + * #%L + * GwtMaterial + * %% + * Copyright (C) 2015 GwtMaterialDesign + * %% + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + + +import gwt.material.design.client.custom.CustomIcon; +import gwt.material.design.client.custom.CustomLabel; + +import com.google.gwt.editor.client.IsEditor; +import com.google.gwt.editor.ui.client.adapters.ValueBoxEditor; +import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.ChangeHandler; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.DoubleClickHandler; +import com.google.gwt.event.dom.client.DragEndHandler; +import com.google.gwt.event.dom.client.DragEnterHandler; +import com.google.gwt.event.dom.client.DragHandler; +import com.google.gwt.event.dom.client.DragLeaveHandler; +import com.google.gwt.event.dom.client.DragOverHandler; +import com.google.gwt.event.dom.client.DragStartHandler; +import com.google.gwt.event.dom.client.DropHandler; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.GestureChangeHandler; +import com.google.gwt.event.dom.client.GestureEndHandler; +import com.google.gwt.event.dom.client.GestureStartHandler; +import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers; +import com.google.gwt.event.dom.client.HasAllFocusHandlers; +import com.google.gwt.event.dom.client.HasAllGestureHandlers; +import com.google.gwt.event.dom.client.HasAllKeyHandlers; +import com.google.gwt.event.dom.client.HasAllMouseHandlers; +import com.google.gwt.event.dom.client.HasAllTouchHandlers; +import com.google.gwt.event.dom.client.HasChangeHandlers; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.dom.client.HasDoubleClickHandlers; +import com.google.gwt.event.dom.client.HasKeyUpHandlers; +import com.google.gwt.event.dom.client.KeyDownHandler; +import com.google.gwt.event.dom.client.KeyPressHandler; +import com.google.gwt.event.dom.client.KeyUpHandler; +import com.google.gwt.event.dom.client.MouseDownHandler; +import com.google.gwt.event.dom.client.MouseMoveHandler; +import com.google.gwt.event.dom.client.MouseOutHandler; +import com.google.gwt.event.dom.client.MouseOverHandler; +import com.google.gwt.event.dom.client.MouseUpHandler; +import com.google.gwt.event.dom.client.MouseWheelHandler; +import com.google.gwt.event.dom.client.TouchCancelHandler; +import com.google.gwt.event.dom.client.TouchEndHandler; +import com.google.gwt.event.dom.client.TouchMoveHandler; +import com.google.gwt.event.dom.client.TouchStartHandler; +import com.google.gwt.event.logical.shared.ValueChangeHandler; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.i18n.client.AutoDirectionHandler; +import com.google.gwt.i18n.shared.DirectionEstimator; +import com.google.gwt.i18n.shared.HasDirectionEstimator; +import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HasEnabled; +import com.google.gwt.user.client.ui.HasName; +import com.google.gwt.user.client.ui.HasText; +import com.google.gwt.user.client.ui.HasValue; +import com.google.gwt.user.client.ui.Label; +import com.google.gwt.user.client.ui.TextBoxBase; +import com.google.gwt.user.client.ui.Widget; + +/** + * Abstract base class for Material text box widgets. + * + * @author Anton Johansson + */ +abstract class AbstractMaterialTextBoxBase extends Composite implements + HasChangeHandlers, HasName, HasDirectionEstimator, HasValue, + HasText, AutoDirectionHandler.Target, IsEditor>, + HasKeyUpHandlers, HasClickHandlers, HasDoubleClickHandlers, + HasEnabled, HasAllDragAndDropHandlers, HasAllFocusHandlers, + HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, + HasAllTouchHandlers +{ + private String type = "text"; + private String icon = ""; + private boolean isValid = true; + private String length; + + protected AbstractMaterialTextBoxBase() { + Widget widget = getContentWidget(); + initWidget(widget); + } + + /** + * Gets the content widget to use for this text box. + * + * @return Returns the content widget. + */ + abstract Widget getContentWidget(); + + /** + * Gets the custom label. + */ + abstract CustomLabel customLabel(); + + /** + * Gets the title label. + */ + abstract Label label(); + + /** + * Gets the actual text box. + */ + abstract TextBoxBase textBox(); + + /** + * Gets the icon panel. + */ + abstract CustomIcon iconPanel(); + + /** + * Resets the textbox by removing its content and resetting visual state. + */ + public void clear() { + textBox().setText(""); + backToDefault(); + customLabel().removeStyleName("active"); + } + + public void setInvalid() { + backToDefault(); + textBox().getElement().addClassName("invalid"); + isValid = false; + } + + public void setValid() { + backToDefault(); + textBox().getElement().addClassName("valid"); + isValid = true; + } + + public void backToDefault() { + textBox().getElement().removeClassName("valid"); + textBox().getElement().removeClassName("invalid"); + } + + public String getPlaceholder() { + return label().getText(); + } + + public void setPlaceholder(String placeholder) { + label().setText(placeholder); + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + textBox().getElement().setAttribute("type", type); + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + iconPanel().addStyleName(icon + " prefix"); + } + + public boolean isValid() { + return isValid; + } + + public void setValid(boolean isValid) { + this.isValid = isValid; + } + + public String getLength() { + return length; + } + + public void setLength(String length) { + this.length = length; + textBox().getElement().setAttribute("length", length); + } + + @Override + protected void onAttach() { + super.onAttach(); + String name = String.valueOf(hashCode()); + textBox().getElement().setId(name); + customLabel().getElement().setAttribute("for", name); + } + + @Override + public boolean isEnabled() { + return textBox().isEnabled(); + } + + @Override + public void setEnabled(boolean enabled) { + textBox().setEnabled(enabled); + } + + @Override + public String getText() { + return textBox().getText(); + } + + @Override + public void setText(String text) { + textBox().setText(text); + customLabel().addStyleName("active"); + } + + @Override + public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) { + return textBox().addValueChangeHandler(handler); + } + + @Override + public String getValue() { + return textBox().getValue(); + } + + @Override + public void setValue(String value) { + textBox().setValue(value); + } + + @Override + public void setValue(String value, boolean fireEvents) { + textBox().setValue(value, fireEvents); + } + + @Override + public void setDirection(Direction direction) { + textBox().setDirection(direction); + } + + @Override + public Direction getDirection() { + return textBox().getDirection(); + } + + @Override + public ValueBoxEditor asEditor() { + return textBox().asEditor(); + } + + @Override + public DirectionEstimator getDirectionEstimator() { + return textBox().getDirectionEstimator(); + } + + @Override + public void setDirectionEstimator(boolean enabled) { + textBox().setDirectionEstimator(enabled); + } + + @Override + public void setDirectionEstimator(DirectionEstimator directionEstimator) { + textBox().setDirectionEstimator(directionEstimator); + } + + @Override + public void setName(String name) { + textBox().setName(name); + } + + @Override + public String getName() { + return textBox().getName(); + } + + @Override + public HandlerRegistration addChangeHandler(ChangeHandler handler) { + return textBox().addChangeHandler(handler); + } + + @Override + public HandlerRegistration addDragEndHandler(DragEndHandler handler) { + return textBox().addDragEndHandler(handler); + } + + @Override + public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) { + return textBox().addDragEnterHandler(handler); + } + + @Override + public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) { + return textBox().addDragLeaveHandler(handler); + } + + @Override + public HandlerRegistration addDragHandler(DragHandler handler) { + return textBox().addDragHandler(handler); + } + + @Override + public HandlerRegistration addDragOverHandler(DragOverHandler handler) { + return textBox().addDragOverHandler(handler); + } + + @Override + public HandlerRegistration addDragStartHandler(DragStartHandler handler) { + return textBox().addDragStartHandler(handler); + } + + @Override + public HandlerRegistration addDropHandler(DropHandler handler) { + return textBox().addDropHandler(handler); + } + + @Override + public HandlerRegistration addFocusHandler(FocusHandler handler) { + return textBox().addFocusHandler(handler); + } + + @Override + public HandlerRegistration addBlurHandler(BlurHandler handler) { + return textBox().addBlurHandler(handler); + } + + @Override + public HandlerRegistration addGestureStartHandler(GestureStartHandler handler) { + return textBox().addGestureStartHandler(handler); + } + + @Override + public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler) { + return textBox().addGestureChangeHandler(handler); + } + + @Override + public HandlerRegistration addGestureEndHandler(GestureEndHandler handler) { + return textBox().addGestureEndHandler(handler); + } + + @Override + public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { + return textBox().addKeyDownHandler(handler); + } + + @Override + public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { + return textBox().addKeyUpHandler(handler); + } + + @Override + public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { + return textBox().addKeyPressHandler(handler); + } + + @Override + public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { + return textBox().addMouseDownHandler(handler); + } + + @Override + public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { + return textBox().addMouseUpHandler(handler); + } + + @Override + public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { + return textBox().addMouseOutHandler(handler); + } + + @Override + public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { + return textBox().addMouseOverHandler(handler); + } + + @Override + public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { + return textBox().addMouseMoveHandler(handler); + } + + @Override + public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { + return textBox().addMouseWheelHandler(handler); + } + + @Override + public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) { + return textBox().addTouchStartHandler(handler); + } + + @Override + public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { + return textBox().addTouchMoveHandler(handler); + } + + @Override + public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) { + return textBox().addTouchEndHandler(handler); + } + + @Override + public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) { + return textBox().addTouchCancelHandler(handler); + } + + @Override + public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) { + return textBox().addDoubleClickHandler(handler); + } + + @Override + public HandlerRegistration addClickHandler(ClickHandler handler) { + return textBox().addClickHandler(handler); + } +} diff --git a/src/main/java/gwt/material/design/client/ui/MaterialTextArea.java b/src/main/java/gwt/material/design/client/ui/MaterialTextArea.java index e46e7c95e..a78732ed2 100644 --- a/src/main/java/gwt/material/design/client/ui/MaterialTextArea.java +++ b/src/main/java/gwt/material/design/client/ui/MaterialTextArea.java @@ -24,151 +24,51 @@ import gwt.material.design.client.custom.CustomLabel; import com.google.gwt.core.client.GWT; -import com.google.gwt.event.dom.client.ChangeEvent; -import com.google.gwt.event.dom.client.ChangeHandler; -import com.google.gwt.event.dom.client.HasChangeHandlers; -import com.google.gwt.event.dom.client.HasKeyDownHandlers; -import com.google.gwt.event.dom.client.HasKeyPressHandlers; -import com.google.gwt.event.dom.client.HasKeyUpHandlers; -import com.google.gwt.event.dom.client.KeyDownEvent; -import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; -import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HasText; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.TextArea; +import com.google.gwt.user.client.ui.TextBoxBase; import com.google.gwt.user.client.ui.Widget; -public class MaterialTextArea extends Composite implements HasText,HasKeyPressHandlers,HasKeyDownHandlers,HasKeyUpHandlers,HasChangeHandlers { +public class MaterialTextArea extends AbstractMaterialTextBoxBase { - private static MaterialTextAreaUiBinder uiBinder = GWT - .create(MaterialTextAreaUiBinder.class); + private static MaterialTextAreaUiBinder uiBinder = GWT.create(MaterialTextAreaUiBinder.class); - interface MaterialTextAreaUiBinder extends - UiBinder { + interface MaterialTextAreaUiBinder extends UiBinder { } - private String placeholder; - private String type = "text"; - private String icon = ""; - private boolean isValid = true; - private String length; @UiField - CustomLabel - customLabel; + protected CustomLabel customLabel; @UiField - Label lblName; + protected Label lblName; @UiField - TextArea txtBox; + protected TextArea txtBox; @UiField - CustomIcon iconPanel; + protected CustomIcon iconPanel; - public MaterialTextArea() { - initWidget(uiBinder.createAndBindUi(this)); - } - - public void setInvalid() { - backToDefault(); - txtBox.getElement().addClassName("invalid"); - isValid = false; - } - - public void setValid() { - backToDefault(); - txtBox.getElement().addClassName("valid"); - isValid = true; - } - - public void backToDefault() { - txtBox.getElement().removeClassName("valid"); - txtBox.getElement().removeClassName("invalid"); - } - - public String getText() { - return txtBox.getText(); - } - - public void setText(String text) { - txtBox.setText(text); - customLabel.addStyleName("active"); - } - @Override - protected void onAttach() { - super.onAttach(); - customLabel.getElement().setAttribute("for", "field"); - } - - public String getPlaceholder() { - return placeholder; - - } - - public void setPlaceholder(String placeholder) { - this.placeholder = placeholder; - lblName.setText(placeholder); - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - txtBox.getElement().setAttribute("type", type); - } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - iconPanel.addStyleName(icon + " prefix"); - } - - public boolean isValid() { - return isValid; - } - - public void setValid(boolean isValid) { - this.isValid = isValid; - } - - public String getLength() { - return length; - } - - public void setLength(String length) { - this.length = length; - txtBox.getElement().setAttribute("length", length); + Widget getContentWidget() { + return uiBinder.createAndBindUi(this); } @Override - public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { - return addDomHandler(handler, KeyDownEvent.getType()); + CustomLabel customLabel() { + return customLabel; } @Override - public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { - return addDomHandler(handler, KeyUpEvent.getType()); + Label label() { + return lblName; } @Override - public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { - return addDomHandler(handler, KeyPressEvent.getType()); + TextBoxBase textBox() { + return txtBox; } @Override - public HandlerRegistration addChangeHandler(ChangeHandler handler) { - return addDomHandler(handler, ChangeEvent.getType()); + CustomIcon iconPanel() { + return iconPanel; } - - } diff --git a/src/main/java/gwt/material/design/client/ui/MaterialTextBox.java b/src/main/java/gwt/material/design/client/ui/MaterialTextBox.java index e1ccc037a..5d09b84ab 100644 --- a/src/main/java/gwt/material/design/client/ui/MaterialTextBox.java +++ b/src/main/java/gwt/material/design/client/ui/MaterialTextBox.java @@ -24,85 +24,23 @@ import gwt.material.design.client.custom.CustomLabel; import com.google.gwt.core.client.GWT; -import com.google.gwt.editor.client.IsEditor; -import com.google.gwt.editor.ui.client.adapters.ValueBoxEditor; -import com.google.gwt.event.dom.client.BlurHandler; -import com.google.gwt.event.dom.client.ChangeHandler; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DoubleClickHandler; -import com.google.gwt.event.dom.client.DragEndHandler; -import com.google.gwt.event.dom.client.DragEnterHandler; -import com.google.gwt.event.dom.client.DragHandler; -import com.google.gwt.event.dom.client.DragLeaveHandler; -import com.google.gwt.event.dom.client.DragOverHandler; -import com.google.gwt.event.dom.client.DragStartHandler; -import com.google.gwt.event.dom.client.DropHandler; -import com.google.gwt.event.dom.client.FocusHandler; -import com.google.gwt.event.dom.client.GestureChangeHandler; -import com.google.gwt.event.dom.client.GestureEndHandler; -import com.google.gwt.event.dom.client.GestureStartHandler; -import com.google.gwt.event.dom.client.HasAllDragAndDropHandlers; -import com.google.gwt.event.dom.client.HasAllFocusHandlers; -import com.google.gwt.event.dom.client.HasAllGestureHandlers; -import com.google.gwt.event.dom.client.HasAllKeyHandlers; -import com.google.gwt.event.dom.client.HasAllMouseHandlers; -import com.google.gwt.event.dom.client.HasAllTouchHandlers; -import com.google.gwt.event.dom.client.HasChangeHandlers; -import com.google.gwt.event.dom.client.HasClickHandlers; -import com.google.gwt.event.dom.client.HasDoubleClickHandlers; -import com.google.gwt.event.dom.client.HasKeyUpHandlers; import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.event.dom.client.KeyUpEvent; -import com.google.gwt.event.dom.client.KeyUpHandler; -import com.google.gwt.event.dom.client.MouseDownHandler; -import com.google.gwt.event.dom.client.MouseMoveHandler; -import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverHandler; -import com.google.gwt.event.dom.client.MouseUpHandler; -import com.google.gwt.event.dom.client.MouseWheelHandler; -import com.google.gwt.event.dom.client.TouchCancelHandler; -import com.google.gwt.event.dom.client.TouchEndHandler; -import com.google.gwt.event.dom.client.TouchMoveHandler; -import com.google.gwt.event.dom.client.TouchStartHandler; -import com.google.gwt.event.logical.shared.ValueChangeHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.i18n.client.AutoDirectionHandler; -import com.google.gwt.i18n.shared.DirectionEstimator; -import com.google.gwt.i18n.shared.HasDirectionEstimator; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HasEnabled; -import com.google.gwt.user.client.ui.HasName; -import com.google.gwt.user.client.ui.HasText; -import com.google.gwt.user.client.ui.HasValue; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.TextBox; +import com.google.gwt.user.client.ui.TextBoxBase; import com.google.gwt.user.client.ui.Widget; -public class MaterialTextBox extends Composite implements - HasChangeHandlers, HasName, HasDirectionEstimator, HasValue, - HasText, AutoDirectionHandler.Target, IsEditor>, - HasKeyUpHandlers, HasClickHandlers, HasDoubleClickHandlers, - HasEnabled, HasAllDragAndDropHandlers, HasAllFocusHandlers, - HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, - HasAllTouchHandlers { +public class MaterialTextBox extends AbstractMaterialTextBoxBase { private static MaterialTextBoxUiBinder uiBinder = GWT.create(MaterialTextBoxUiBinder.class); interface MaterialTextBoxUiBinder extends UiBinder { } - private String placeholder; - private String type = "text"; - private String icon = ""; - private boolean isValid = true; - private boolean enabled; - private String length; - @UiField protected CustomLabel customLabel; @UiField @@ -112,74 +50,35 @@ interface MaterialTextBoxUiBinder extends UiBinder { @UiField protected CustomIcon iconPanel; - public MaterialTextBox() { - initWidget(uiBinder.createAndBindUi(this)); - } - @Override - protected void onAttach() { - // TODO Auto-generated method stub - super.onAttach(); - String name = String.valueOf(hashCode()); - txtBox.getElement().setId(name); - customLabel.getElement().setAttribute("for", name); - } - - public void setInvalid() { - backToDefault(); - txtBox.getElement().addClassName("invalid"); - isValid = false; - } - - public void setValid() { - backToDefault(); - txtBox.getElement().addClassName("valid"); - isValid = true; - } - - /** - * Resets the textbox by removing its content and resetting visual state. - */ - public void clear() { - txtBox.setText(""); - backToDefault(); - customLabel.removeStyleName("active"); - } - - public void backToDefault() { - txtBox.getElement().removeClassName("valid"); - txtBox.getElement().removeClassName("invalid"); + Widget getContentWidget() { + return uiBinder.createAndBindUi(this); } @Override - public String getText() { - return txtBox.getText(); + CustomLabel customLabel() { + return customLabel; } @Override - public void setText(String text) { - txtBox.setText(text); - customLabel.addStyleName("active"); + Label label() { + return lblName; } - public String getPlaceholder() { - return placeholder; - - } - - public void setPlaceholder(String placeholder) { - this.placeholder = placeholder; - lblName.setText(placeholder); + @Override + TextBoxBase textBox() { + return txtBox; } - public String getType() { - return type; + @Override + CustomIcon iconPanel() { + return iconPanel; } + @Override public void setType(String type) { - this.type = type; - txtBox.getElement().setAttribute("type", type); - if(type.equals("number")){ + super.setType(type); + if (type.equals("number")) { txtBox.addKeyPressHandler(new KeyPressHandler() { @Override @@ -194,241 +93,4 @@ public void onKeyPress(KeyPressEvent event) { }); } } - - public String getIcon() { - return icon; - } - - public void setIcon(String icon) { - this.icon = icon; - iconPanel.addStyleName(icon + " prefix"); - } - - public boolean isValid() { - return isValid; - } - - public void setValid(boolean isValid) { - this.isValid = isValid; - } - - @Override - public boolean isEnabled() { - return enabled; - } - - @Override - public void setEnabled(boolean enabled) { - this.enabled = enabled; - txtBox.setEnabled(enabled); - } - - @Override - public HandlerRegistration addKeyUpHandler(KeyUpHandler handler) { - return addDomHandler(handler, KeyUpEvent.getType()); - } - - public String getLength() { - return length; - } - - public void setLength(String length) { - this.length = length; - txtBox.getElement().setAttribute("length", length); - } - - @Override - public HandlerRegistration addValueChangeHandler(ValueChangeHandler handler) { - return txtBox.addValueChangeHandler(handler); - } - - @Override - public String getValue() { - return txtBox.getValue(); - } - - @Override - public void setValue(String value) { - txtBox.setValue(value); - } - - @Override - public void setValue(String value, boolean fireEvents) { - txtBox.setValue(value, fireEvents); - } - - @Override - public void setDirection(Direction direction) { - txtBox.setDirection(direction); - } - - @Override - public Direction getDirection() { - return txtBox.getDirection(); - } - - @Override - public ValueBoxEditor asEditor() { - return txtBox.asEditor(); - } - - @Override - public DirectionEstimator getDirectionEstimator() { - return txtBox.getDirectionEstimator(); - } - - @Override - public void setDirectionEstimator(boolean enabled) { - txtBox.setDirectionEstimator(enabled); - } - - @Override - public void setDirectionEstimator(DirectionEstimator directionEstimator) { - txtBox.setDirectionEstimator(directionEstimator); - } - - @Override - public void setName(String name) { - txtBox.setName(name); - } - - @Override - public String getName() { - return txtBox.getName(); - } - - @Override - public HandlerRegistration addChangeHandler(ChangeHandler handler) { - return txtBox.addChangeHandler(handler); - } - - @Override - public HandlerRegistration addDragEndHandler(DragEndHandler handler) { - return txtBox.addDragEndHandler(handler); - } - - @Override - public HandlerRegistration addDragEnterHandler(DragEnterHandler handler) { - return txtBox.addDragEnterHandler(handler); - } - - @Override - public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler) { - return txtBox.addDragLeaveHandler(handler); - } - - @Override - public HandlerRegistration addDragHandler(DragHandler handler) { - return txtBox.addDragHandler(handler); - } - - @Override - public HandlerRegistration addDragOverHandler(DragOverHandler handler) { - return txtBox.addDragOverHandler(handler); - } - - @Override - public HandlerRegistration addDragStartHandler(DragStartHandler handler) { - return txtBox.addDragStartHandler(handler); - } - - @Override - public HandlerRegistration addDropHandler(DropHandler handler) { - return txtBox.addDropHandler(handler); - } - - @Override - public HandlerRegistration addFocusHandler(FocusHandler handler) { - return txtBox.addFocusHandler(handler); - } - - @Override - public HandlerRegistration addBlurHandler(BlurHandler handler) { - return txtBox.addBlurHandler(handler); - } - - @Override - public HandlerRegistration addGestureStartHandler(GestureStartHandler handler) { - return txtBox.addGestureStartHandler(handler); - } - - @Override - public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler) { - return txtBox.addGestureChangeHandler(handler); - } - - @Override - public HandlerRegistration addGestureEndHandler(GestureEndHandler handler) { - return txtBox.addGestureEndHandler(handler); - } - - @Override - public HandlerRegistration addKeyDownHandler(KeyDownHandler handler) { - return txtBox.addKeyDownHandler(handler); - } - - @Override - public HandlerRegistration addKeyPressHandler(KeyPressHandler handler) { - return txtBox.addKeyPressHandler(handler); - } - - @Override - public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { - return txtBox.addMouseDownHandler(handler); - } - - @Override - public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { - return txtBox.addMouseUpHandler(handler); - } - - @Override - public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { - return txtBox.addMouseOutHandler(handler); - } - - @Override - public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { - return txtBox.addMouseOverHandler(handler); - } - - @Override - public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) { - return txtBox.addMouseMoveHandler(handler); - } - - @Override - public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) { - return txtBox.addMouseWheelHandler(handler); - } - - @Override - public HandlerRegistration addTouchStartHandler(TouchStartHandler handler) { - return txtBox.addTouchStartHandler(handler); - } - - @Override - public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler) { - return txtBox.addTouchMoveHandler(handler); - } - - @Override - public HandlerRegistration addTouchEndHandler(TouchEndHandler handler) { - return txtBox.addTouchEndHandler(handler); - } - - @Override - public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler) { - return txtBox.addTouchCancelHandler(handler); - } - - @Override - public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler) { - return txtBox.addDoubleClickHandler(handler); - } - - @Override - public HandlerRegistration addClickHandler(ClickHandler handler) { - return txtBox.addClickHandler(handler); - } }