Package com.google.gwt.user.client.ui

## Class ValueBox<T>

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.google.gwt.user.client.ui.FocusWidget
      - - com.google.gwt.user.client.ui.ValueBoxBase<T>
        - - com.google.gwt.user.client.ui.ValueBox<T>

- Type Parameters:
    `T` - the value type
  All Implemented Interfaces:
    `IsEditor<ValueBoxEditor<T>>`, `HasAllDragAndDropHandlers`, `HasAllFocusHandlers`, `HasAllGestureHandlers`, `HasAllKeyHandlers`, `HasAllMouseHandlers`, `HasAllTouchHandlers`, `HasBlurHandlers`, `HasChangeHandlers`, `HasClickHandlers`, `HasDoubleClickHandlers`, `HasDragEndHandlers`, `HasDragEnterHandlers`, `HasDragHandlers`, `HasDragLeaveHandlers`, `HasDragOverHandlers`, `HasDragStartHandlers`, `HasDropHandlers`, `HasFocusHandlers`, `HasGestureChangeHandlers`, `HasGestureEndHandlers`, `HasGestureStartHandlers`, `HasKeyDownHandlers`, `HasKeyPressHandlers`, `HasKeyUpHandlers`, `HasMouseDownHandlers`, `HasMouseMoveHandlers`, `HasMouseOutHandlers`, `HasMouseOverHandlers`, `HasMouseUpHandlers`, `HasMouseWheelHandlers`, `HasTouchCancelHandlers`, `HasTouchEndHandlers`, `HasTouchMoveHandlers`, `HasTouchStartHandlers`, `HasAttachHandlers`, `HasValueChangeHandlers<T>`, `HasHandlers`, `AutoDirectionHandler.Target`, `HasDirection`, `HasDirectionEstimator`, `EventListener`, `TakesValue<T>`, `Focusable`, `HasEnabled`, `HasFocus`, `HasName`, `HasText`, `HasValue<T>`, `HasVisibility`, `IsWidget`, `SourcesClickEvents`, `SourcesFocusEvents`, `SourcesKeyboardEvents`, `SourcesMouseEvents`
  Direct Known Subclasses:
    `DoubleBox`, `IntegerBox`, `LongBox`

      public class ValueBox<T>
      extends ValueBoxBase<T>

  A text box able to parse its displayed value.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.ValueBoxBase

      `ValueBoxBase.TextAlignment`

    - ### Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

      `UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled`

    - ### Nested classes/interfaces inherited from interface com.google.gwt.i18n.client.HasDirection

      `HasDirection.Direction`

  - ### Field Summary

    - ### Fields inherited from class com.google.gwt.user.client.ui.Widget

      `eventsToSink`

    - ### Fields inherited from class com.google.gwt.user.client.ui.UIObject

      `DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `ValueBox​(Element element, Renderer<T> renderer, Parser<T> parser)` | This constructor may be used by subclasses to explicitly use an existing element.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `int` | `getMaxLength()` | Gets the maximum allowable length.
    `int` | `getVisibleLength()` | Gets the number of visible characters.
    `void` | `setMaxLength​(int length)` | Sets the maximum allowable length.
    `void` | `setVisibleLength​(int length)` | Sets the number of visible characters.
    `static <T> ValueBox<T>` | `wrap​(Element element, Renderer<T> renderer, Parser<T> parser)` | Creates a ValueBox widget that wraps an existing <input type='text'> element.

    - ### Methods inherited from class com.google.gwt.user.client.ui.ValueBoxBase

      `addChangeHandler, addValueChangeHandler, asEditor, cancelKey, getCursorPos, getDirection, getDirectionEstimator, getImpl, getName, getSelectedText, getSelectionLength, getText, getValue, getValueOrThrow, isReadOnly, onBrowserEvent, onLoad, removeChangeListener, selectAll, setAlignment, setCursorPos, setDirection, setDirectionEstimator, setDirectionEstimator, setKey, setName, setReadOnly, setSelectionRange, setText, setValue, setValue`

    - ### Methods inherited from class com.google.gwt.user.client.ui.FocusWidget

      `addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, getTabIndex, isEnabled, onAttach, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setEnabled, setFocus, setTabIndex`

    - ### Methods inherited from class com.google.gwt.user.client.ui.Widget

      `addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents`

    - ### Methods inherited from class com.google.gwt.user.client.ui.UIObject

      `addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface com.google.gwt.event.shared.HasHandlers

      `fireEvent`

    - ### Methods inherited from interface com.google.gwt.event.dom.client.HasKeyUpHandlers

      `addKeyUpHandler`

- - ### Constructor Detail

    - #### ValueBox

          protected ValueBox​(Element element,
                             Renderer<T> renderer,
                             Parser<T> parser)

      This constructor may be used by subclasses to explicitly use an existing element. This element must be an <input> element whose type is 'text'.
      Parameters:
        `element` - the element to be used

  - ### Method Detail

    - #### wrap

          public static <T> ValueBox<T> wrap​(Element element,
                                             Renderer<T> renderer,
                                             Parser<T> parser)

      Creates a ValueBox widget that wraps an existing <input type='text'> element. This element must already be attached to the document. If the element is removed from the document, you must call `Widget.removeFromParent()`.
      Parameters:
        `element` - the element to be wrapped

    - #### getMaxLength

          public int getMaxLength()

      Gets the maximum allowable length.
      Returns:
        the maximum length, in characters

    - #### getVisibleLength

          public int getVisibleLength()

      Gets the number of visible characters.
      Returns:
        the number of visible characters

    - #### setMaxLength

          public void setMaxLength​(int length)

      Sets the maximum allowable length.
      Parameters:
        `length` - the maximum length, in characters

    - #### setVisibleLength

          public void setVisibleLength​(int length)

      Sets the number of visible characters.
      Parameters:
        `length` - the number of visible characters