Class 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.
  • Constructor Details

    • 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 Details

    • 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