GWT 2.7.0

com.google.gwt.user.client.ui
Class LabelBase<T>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.LabelBase<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, HasDirectionEstimator, EventListener, HasAutoHorizontalAlignment, HasHorizontalAlignment, HasVisibility, HasWordWrap, IsWidget
Direct Known Subclasses:
Label, ValueLabel

public class LabelBase<T>
extends Widget
implements HasWordWrap, HasDirectionEstimator, HasAutoHorizontalAlignment

Abstract base class for all text display widgets.

Use in UiBinder Templates


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
(package private)  DirectionalTextHelper directionalTextHelper
          The widget's DirectionalTextHelper object.
 
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
protected LabelBase(boolean inline)
           
protected LabelBase(Element element)
           
 
Method Summary
 HasHorizontalAlignment.AutoHorizontalAlignmentConstant getAutoHorizontalAlignment()
          Gets the horizontal auto-alignment setting.
 DirectionEstimator getDirectionEstimator()
          Returns the DirectionEstimator object.
 HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
          Gets the horizontal alignment.
 boolean getWordWrap()
          Gets whether word-wrapping is enabled.
 void setAutoHorizontalAlignment(HasHorizontalAlignment.AutoHorizontalAlignmentConstant autoAlignment)
          Sets the horizontal alignment, allowing in addition to the "static" HasHorizontalAlignment.HorizontalAlignmentConstant values, the "automatic" HasHorizontalAlignment.AutoHorizontalAlignmentConstant values that depend on the content direction.
 void setDirectionEstimator(boolean enabled)
          Toggles on / off direction estimation.
 void setDirectionEstimator(DirectionEstimator directionEstimator)
          Sets the DirectionEstimator object.
 void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
          Sets the horizontal alignment.
 void setWordWrap(boolean wrap)
          Sets whether word-wrapping is enabled.
protected  void updateHorizontalAlignment()
          Sets the horizontal alignment of the widget according to the current AutoHorizontalAlignment setting.
 
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
 

Field Detail

directionalTextHelper

final DirectionalTextHelper directionalTextHelper
The widget's DirectionalTextHelper object.

Constructor Detail

LabelBase

protected LabelBase(boolean inline)

LabelBase

protected LabelBase(Element element)
Method Detail

getAutoHorizontalAlignment

public HasHorizontalAlignment.AutoHorizontalAlignmentConstant getAutoHorizontalAlignment()
Description copied from interface: HasAutoHorizontalAlignment
Gets the horizontal auto-alignment setting. This may be one of the auto-alignment values above that depend on content direction (e.g. HasAutoHorizontalAlignment.ALIGN_CONTENT_START), or one of the "static" HasHorizontalAlignment.HorizontalAlignmentConstant alignment values (e.g. HasHorizontalAlignment.ALIGN_LOCALE_START). It may be set by either setAutoHorizontalAlignment or HasHorizontalAlignment#setHorizontalAlignment. The default is null, indicating that no specific horizontal alignment has been set, allowing it to be determined by the usual HTML and CSS mechanisms.

Specified by:
getAutoHorizontalAlignment in interface HasAutoHorizontalAlignment
Returns:
the current automatic horizontal alignment policy.

getDirectionEstimator

public DirectionEstimator getDirectionEstimator()
Description copied from interface: HasDirectionEstimator
Returns the DirectionEstimator object.

Specified by:
getDirectionEstimator in interface HasDirectionEstimator

getHorizontalAlignment

public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
Description copied from interface: HasHorizontalAlignment
Gets the horizontal alignment.

Specified by:
getHorizontalAlignment in interface HasHorizontalAlignment
Returns:
the current horizontal alignment ( HasHorizontalAlignment.ALIGN_LEFT, HasHorizontalAlignment.ALIGN_CENTER, HasHorizontalAlignment.ALIGN_RIGHT, HasHorizontalAlignment.ALIGN_JUSTIFY, or null).

getWordWrap

public boolean getWordWrap()
Description copied from interface: HasWordWrap
Gets whether word-wrapping is enabled.

Specified by:
getWordWrap in interface HasWordWrap
Returns:
true if word-wrapping is enabled.

setAutoHorizontalAlignment

public void setAutoHorizontalAlignment(HasHorizontalAlignment.AutoHorizontalAlignmentConstant autoAlignment)
Description copied from interface: HasAutoHorizontalAlignment
Sets the horizontal alignment, allowing in addition to the "static" HasHorizontalAlignment.HorizontalAlignmentConstant values, the "automatic" HasHorizontalAlignment.AutoHorizontalAlignmentConstant values that depend on the content direction. Determines the values returned by both HasAutoHorizontalAlignment.getAutoHorizontalAlignment() and HasHorizontalAlignment.getHorizontalAlignment().

For the ALIGN_CONTENT_START and ALIGN_CONTENT_END values, sets the horizontal alignment (including the value of HasHorizontalAlignment#getHorizontalAlignment()) to the start or end edge of the current content's direction, respectively, and continues to automatically update it whenever the content direction changes.

For other values, operates like HasHorizontalAlignment.setHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant).

For null, the horizontal alignment is cleared, allowing it to be determined by the standard HTML mechanisms such as inheritance and CSS rules.

Specified by:
setAutoHorizontalAlignment in interface HasAutoHorizontalAlignment
Parameters:
autoAlignment - the new automatic horizontal alignment policy
See Also:
HasHorizontalAlignment

setDirectionEstimator

public void setDirectionEstimator(boolean enabled)
Toggles on / off direction estimation.

See note at setDirectionEstimator(DirectionEstimator).

Specified by:
setDirectionEstimator in interface HasDirectionEstimator
Parameters:
enabled - Whether to enable direction estimation. If true, sets the DirectionEstimator object to a default DirectionEstimator.

setDirectionEstimator

public void setDirectionEstimator(DirectionEstimator directionEstimator)
Sets the DirectionEstimator object.

Note: DirectionEstimator should be set before the widget has any content; it's highly recommended to set it using a constructor. Reason: if the widget already has non-empty content, this will update its direction according to the new estimator's result. This may cause flicker, and thus should be avoided.

Specified by:
setDirectionEstimator in interface HasDirectionEstimator
Parameters:
directionEstimator - The DirectionEstimator to be set. null means turning off direction estimation.

setHorizontalAlignment

public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
Sets the horizontal alignment.

Use null to clear horizontal alignment, allowing it to be determined by the standard HTML mechanisms such as inheritance and CSS rules.

Note: A subsequent call to setAutoHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant) may override the horizontal alignment set by this method.

Note: For null, the horizontal alignment is cleared, allowing it to be determined by the standard HTML mechanisms such as inheritance and CSS rules.

Specified by:
setHorizontalAlignment in interface HasHorizontalAlignment
Parameters:
align - the horizontal alignment ( HasHorizontalAlignment.ALIGN_LEFT, HasHorizontalAlignment.ALIGN_CENTER, HasHorizontalAlignment.ALIGN_RIGHT, HasHorizontalAlignment.ALIGN_JUSTIFY, HasHorizontalAlignment.ALIGN_LOCALE_START, or HasHorizontalAlignment.ALIGN_LOCALE_END).
See Also:
setAutoHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant)

setWordWrap

public void setWordWrap(boolean wrap)
Description copied from interface: HasWordWrap
Sets whether word-wrapping is enabled.

Specified by:
setWordWrap in interface HasWordWrap
Parameters:
wrap - true to enable word-wrapping.

updateHorizontalAlignment

protected void updateHorizontalAlignment()
Sets the horizontal alignment of the widget according to the current AutoHorizontalAlignment setting. Should be invoked whenever the horizontal alignment may be affected, i.e. on every modification of the content or its direction.


GWT 2.7.0