public class

ValueLabel

extends LabelBase<T>
implements IsEditor<E extends Editor<?>> TakesValue<V>
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>
Known Direct Subclasses

Class Overview

A label displaying its value through a renderer.

Summary

[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
[Expand]
Inherited Fields
From interface com.google.gwt.user.client.ui.HasAutoHorizontalAlignment
From interface com.google.gwt.user.client.ui.HasHorizontalAlignment
Public Constructors
ValueLabel(Renderer<? super T> renderer)
Creates an empty value label.
Protected Constructors
ValueLabel(Element element, Renderer<? super T> renderer)
This constructor may be used by subclasses to explicitly use an existing element.
Public Methods
LeafValueEditor<T> asEditor()
Returns the Editor encapsulated by the view object.
T getValue()
Returns the current value.
void setValue(T value)
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.
static <T> ValueLabel<T> wrap(Element element, Renderer<? super T> renderer)
Creates a ValueLabel widget that wraps an existing <span> element.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.LabelBase
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.editor.client.IsEditor
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.i18n.shared.HasDirectionEstimator
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.TakesValue
From interface com.google.gwt.user.client.ui.HasAutoHorizontalAlignment
From interface com.google.gwt.user.client.ui.HasHorizontalAlignment
From interface com.google.gwt.user.client.ui.HasWordWrap
From interface com.google.gwt.user.client.ui.IsWidget

Public Constructors

public ValueLabel (Renderer<? super T> renderer)

Creates an empty value label.

Protected Constructors

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

Public Methods

public LeafValueEditor<T> asEditor ()

Returns the Editor encapsulated by the view object.

Returns

public T getValue ()

Returns the current value.

Returns
  • the value as an object of type V

public void setValue (T value)

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

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

public static 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 detachNow(Widget).

Parameters
element the element to be wrapped
renderer the renderer used to render values into the element