Package 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 Modifier Constructor Description 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 Modifier and Type Method Description 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
-
-
-
-
Constructor Detail
-
ValueLabel
public ValueLabel()
-
ValueLabel
@UiConstructor public ValueLabel(Renderer<? super T> renderer)
Creates an empty value label.- Parameters:
renderer
-
-
-
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. Usewrap(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 wrappedrenderer
- 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 wrappedrenderer
- the renderer used to render values into the elementparser
- 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.
-
getValue
public T getValue()
Description copied from interface:TakesValue
Returns the current value.- Specified by:
getValue
in interfaceTakesValue<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 interfaceTakesValue<T>
- Parameters:
value
- a value object of type V- See Also:
TakesValue.getValue()
-
-