com.google.gwt.user.client.ui

## Class ValueLabel<T>

- java.lang.Object
- - com.google.gwt.user.client.ui.UIObject
  - - com.google.gwt.user.client.ui.Widget
    - - com.google.gwt.user.client.ui.LabelBase<T>
      - - com.google.gwt.user.client.ui.ValueLabel<T>

Type Parameters:
  `T` - the value type.

All Implemented Interfaces:
  IsEditor<LeafValueEditor<T>>, HasAttachHandlers, HasHandlers, HasDirectionEstimator, EventListener, TakesValue<T>, HasAutoHorizontalAlignment, HasHorizontalAlignment, HasVisibility, HasWordWrap, IsWidget

Direct Known Subclasses:
  DateLabel, NumberLabel

    public class ValueLabel<T>
    extends LabelBase<T>
    implements TakesValue<T>, IsEditor<LeafValueEditor<T>>

A label displaying its value through a renderer.

### Nested Class Summary

### 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.user.client.ui.HasHorizontalAlignment

`HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant`

### Field Summary

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

`directionalTextHelper`

### 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`

### Fields inherited from interface com.google.gwt.user.client.ui.HasAutoHorizontalAlignment

`ALIGN_CONTENT_END, ALIGN_CONTENT_START`

### Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment

`ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT`

### Constructor Summary

Constructors
`` `ValueLabel()`
`protected` `ValueLabel(Element element, Renderer<? super T> renderer)` This constructor may be used by subclasses to explicitly use an existing element.
`` `ValueLabel(Renderer<? super T> renderer)` Creates an empty value label.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`LeafValueEditor<T>` `asEditor()` Returns the Editor encapsulated by the view object.
`T` `getValue()` Returns the current value.
`void` `setValue(T value)` Sets the value.
`static <T> ValueLabel<T>` `wrap(Element element, Renderer<? super T> renderer)` Creates a ValueLabel widget that wraps an existing <span> element.
`static <T> ValueLabel<T>` `wrap(Element element, Renderer<? super T> renderer, Parser<? extends T> parser)` Creates a ValueLabel widget that wraps an existing <span> element.

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

`getAutoHorizontalAlignment, getDirectionEstimator, getHorizontalAlignment, getWordWrap, setAutoHorizontalAlignment, setDirectionEstimator, setDirectionEstimator, setHorizontalAlignment, setWordWrap, updateHorizontalAlignment`

### 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, onAttach, onBrowserEvent, onDetach, onLoad, 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`

### Constructor Detail

#### ValueLabel

    public ValueLabel()

#### ValueLabel

    @UiConstructor
    public ValueLabel(Renderer<? super T> renderer)

Creates an empty value label.

Parameters:
  `renderer` -

#### ValueLabel

    protected ValueLabel(Element element,
                         Renderer<? super T> renderer)

This constructor may be used by subclasses to explicitly use an existing element. This element must be either a <span> or a <div> element.

Parameters:
  `element` - the element to be used

### Method Detail

#### wrap

    public static <T> ValueLabel<T> wrap(Element element,
                                         Renderer<? super T> renderer)

Creates a ValueLabel widget that wraps an existing <span> element.

The ValueLabel's value will be `null`, whether the element being wrapped has content or not. Use `wrap(Element, Renderer, Parser)` to parse the initial element's content to initialize the ValueLabel's value.

This element must already be attached to the document. If the element is removed from the document, you must call `RootPanel.detachNow(Widget)`.

Parameters:
  `element` - the element to be wrapped
  `renderer` - the renderer used to render values into the element

#### wrap

    public static <T> ValueLabel<T> wrap(Element element,
                                         Renderer<? super T> renderer,
                                         Parser<? extends T> parser)
                                  throws java.text.ParseException

Creates a ValueLabel widget that wraps an existing <span> element.

The ValueLabel's value will be initialized with the element's content, passed through the `parser`.

This element must already be attached to the document. If the element is removed from the document, you must call `RootPanel.detachNow(Widget)`.

Parameters:
  `element` - the element to be wrapped
  `renderer` - the renderer used to render values into the element
  `parser` - the parser used to initialize the ValueLabel's value from the element's content
Throws:
  `java.text.ParseException`

#### asEditor

    public LeafValueEditor<T> asEditor()

Description copied from interface: `IsEditor`
Returns the Editor encapsulated by the view object.

Specified by:
  `asEditor` in interface `IsEditor<LeafValueEditor<T>>`
Returns:
  an `Editor` of type E

#### getValue

    public T getValue()

Description copied from interface: `TakesValue`
Returns the current value.

Specified by:
  `getValue` in interface `TakesValue<T>`
Returns:
  the value as an object of type V
See Also:
  `TakesValue.setValue(V)`

#### setValue

    public void setValue(T value)

Description copied from interface: `TakesValue`
Sets the value.

Specified by:
  `setValue` in interface `TakesValue<T>`
Parameters:
  `value` - a value object of type V
See Also:
  `TakesValue.getValue()`