public class Label extends LabelBase<java.lang.String> implements HasDirectionalText, HasDirection, HasClickHandlers, HasDoubleClickHandlers, SourcesClickEvents, SourcesMouseEvents, HasAllDragAndDropHandlers, HasAllGestureHandlers, HasAllMouseHandlers, HasAllTouchHandlers, IsEditor<LeafValueEditor<java.lang.String>>
LabelBase.setDirectionEstimator(boolean)
or
passing a DirectionEstimator parameter to the constructor, and is off by
default.
public class HTMLExample implements EntryPoint { public void onModuleLoad() { // Create a Label and an HTML widget. Label lbl = new Label("This is just text. It will not be interpreted " + "as <html>."); HTML html = new HTML( "This is <b>HTML</b>. It will be interpreted as such if you specify " + "the <span style='font-family:fixed'>asHTML</span> flag.", true); // Add them to the root panel. VerticalPanel panel = new VerticalPanel(); panel.add(lbl); panel.add(html); RootPanel.get().add(panel); } }
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasDirection.Direction
HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant
Modifier and Type | Field and Description |
---|---|
static DirectionEstimator |
DEFAULT_DIRECTION_ESTIMATOR |
directionalTextHelper
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
ALIGN_CONTENT_END, ALIGN_CONTENT_START
ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT
Modifier | Constructor and Description |
---|---|
|
Label()
Creates an empty label.
|
protected |
Label(Element element)
This constructor may be used by subclasses to explicitly use an existing
element.
|
|
Label(java.lang.String text)
Creates a label with the specified text.
|
|
Label(java.lang.String text,
boolean wordWrap)
Creates a label with the specified text.
|
|
Label(java.lang.String text,
DirectionEstimator directionEstimator)
Creates a label with the specified text and a default direction estimator.
|
|
Label(java.lang.String text,
HasDirection.Direction dir)
Creates a label with the specified text and direction.
|
getAutoHorizontalAlignment, getDirectionEstimator, getHorizontalAlignment, getWordWrap, setAutoHorizontalAlignment, setDirectionEstimator, setDirectionEstimator, setHorizontalAlignment, setWordWrap, updateHorizontalAlignment
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
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public static final DirectionEstimator DEFAULT_DIRECTION_ESTIMATOR
public Label()
public Label(java.lang.String text)
text
- the new label's textpublic Label(java.lang.String text, HasDirection.Direction dir)
text
- the new label's textdir
- the text's direction. Note that DEFAULT
means direction
should be inherited from the widget's parent element.public Label(java.lang.String text, DirectionEstimator directionEstimator)
text
- the new label's textdirectionEstimator
- A DirectionEstimator object used for automatic
direction adjustment. For convenience,
DEFAULT_DIRECTION_ESTIMATOR
can be used.public Label(java.lang.String text, boolean wordWrap)
text
- the new label's textwordWrap
- false
to disable word wrappingprotected Label(Element element)
element
- the element to be usedpublic static Label wrap(Element element)
RootPanel.detachNow(Widget)
.element
- the element to be wrappedpublic HandlerRegistration addClickHandler(ClickHandler handler)
HasClickHandlers
ClickEvent
handler.addClickHandler
in interface HasClickHandlers
handler
- the click handlerHandlerRegistration
used to remove this handler@Deprecated public void addClickListener(ClickListener listener)
addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
insteadSourcesClickEvents
addClickListener
in interface SourcesClickEvents
listener
- the listener interface to addpublic HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
HasDoubleClickHandlers
DoubleClickEvent
handler.addDoubleClickHandler
in interface HasDoubleClickHandlers
handler
- the double click handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragEndHandler(DragEndHandler handler)
HasDragEndHandlers
DragEndEvent
handler.addDragEndHandler
in interface HasDragEndHandlers
handler
- the drag end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
HasDragEnterHandlers
DragEnterEvent
handler.addDragEnterHandler
in interface HasDragEnterHandlers
handler
- the drag end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragHandler(DragHandler handler)
HasDragHandlers
DragEvent
handler.addDragHandler
in interface HasDragHandlers
handler
- the drag handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
HasDragLeaveHandlers
DragLeaveEvent
handler.addDragLeaveHandler
in interface HasDragLeaveHandlers
handler
- the drag leave handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragOverHandler(DragOverHandler handler)
HasDragOverHandlers
DragOverEvent
handler.addDragOverHandler
in interface HasDragOverHandlers
handler
- the drag over handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDragStartHandler(DragStartHandler handler)
HasDragStartHandlers
DragStartEvent
handler.addDragStartHandler
in interface HasDragStartHandlers
handler
- the drag start handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addDropHandler(DropHandler handler)
HasDropHandlers
DropEvent
handler.addDropHandler
in interface HasDropHandlers
handler
- the drop handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)
HasGestureChangeHandlers
GestureChangeEvent
handler.addGestureChangeHandler
in interface HasGestureChangeHandlers
handler
- the gesture change handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addGestureEndHandler(GestureEndHandler handler)
HasGestureEndHandlers
GestureEndEvent
handler.addGestureEndHandler
in interface HasGestureEndHandlers
handler
- the gesture end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addGestureStartHandler(GestureStartHandler handler)
HasGestureStartHandlers
GestureStartEvent
handler.addGestureStartHandler
in interface HasGestureStartHandlers
handler
- the gesture start handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
HasMouseDownHandlers
MouseDownEvent
handler.addMouseDownHandler
in interface HasMouseDownHandlers
handler
- the mouse down handlerHandlerRegistration
used to remove this handler@Deprecated public void addMouseListener(MouseListener listener)
addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
,
addMouseMoveHandler(com.google.gwt.event.dom.client.MouseMoveHandler)
, addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)
,
addMouseUpHandler(com.google.gwt.event.dom.client.MouseUpHandler)
and addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
insteadSourcesMouseEvents
addMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to addpublic HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
HasMouseMoveHandlers
MouseMoveEvent
handler.addMouseMoveHandler
in interface HasMouseMoveHandlers
handler
- the mouse move handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
HasMouseOutHandlers
MouseOutEvent
handler.addMouseOutHandler
in interface HasMouseOutHandlers
handler
- the mouse out handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
HasMouseOverHandlers
MouseOverEvent
handler.addMouseOverHandler
in interface HasMouseOverHandlers
handler
- the mouse over handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
HasMouseUpHandlers
MouseUpEvent
handler.addMouseUpHandler
in interface HasMouseUpHandlers
handler
- the mouse up handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
HasMouseWheelHandlers
MouseWheelEvent
handler.addMouseWheelHandler
in interface HasMouseWheelHandlers
handler
- the mouse wheel handlerHandlerRegistration
used to remove this handler@Deprecated public void addMouseWheelListener(MouseWheelListener listener)
addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)
insteadpublic HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
HasTouchCancelHandlers
TouchCancelEvent
handler.addTouchCancelHandler
in interface HasTouchCancelHandlers
handler
- the touch cancel handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
HasTouchEndHandlers
TouchEndEvent
handler.addTouchEndHandler
in interface HasTouchEndHandlers
handler
- the touch end handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
HasTouchMoveHandlers
TouchMoveEvent
handler.addTouchMoveHandler
in interface HasTouchMoveHandlers
handler
- the touch move handlerHandlerRegistration
used to remove this handlerpublic HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
HasTouchStartHandlers
TouchStartEvent
handler.addTouchStartHandler
in interface HasTouchStartHandlers
handler
- the touch start handlerHandlerRegistration
used to remove this handlerpublic LeafValueEditor<java.lang.String> asEditor()
IsEditor
asEditor
in interface IsEditor<LeafValueEditor<java.lang.String>>
Editor
of type E@Deprecated public HasDirection.Direction getDirection()
getTextDirection()
insteadgetDirection
in interface HasDirection
RTL
if the directionality is right-to-left,
LTR
if the directionality is left-to-right, or
DEFAULT
if the directionality is not explicitly specifiedpublic java.lang.String getText()
HasText
public HasDirection.Direction getTextDirection()
HasDirectionalText
getTextDirection
in interface HasDirectionalText
@Deprecated public void removeClickListener(ClickListener listener)
HandlerRegistration.removeHandler()
method on
the object returned by addClickHandler(com.google.gwt.event.dom.client.ClickHandler)
insteadSourcesClickEvents
removeClickListener
in interface SourcesClickEvents
listener
- the listener interface to remove@Deprecated public void removeMouseListener(MouseListener listener)
HandlerRegistration.removeHandler()
method on the object returned by an add*Handler method insteadSourcesMouseEvents
removeMouseListener
in interface SourcesMouseEvents
listener
- the listener interface to remove@Deprecated public void removeMouseWheelListener(MouseWheelListener listener)
HandlerRegistration.removeHandler()
method on the object returned by addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler)
instead@Deprecated public void setDirection(HasDirection.Direction direction)
LabelBase.setDirectionEstimator(boolean)
and / or pass explicit
direction to setText(java.lang.String)
insteadsetDirection
in interface HasDirection
direction
- RTL
if the directionality should be set to right-to-left,
LTR
if the directionality should be set to left-to-right
DEFAULT
if the directionality should not be explicitly setpublic void setText(java.lang.String text)
Doesn't change the widget's direction or horizontal alignment if directionEstimator
is null. Otherwise, the widget's direction is set using
the estimator, and its alignment may therefore change as described in
setText(String, Direction)
.
public void setText(java.lang.String text, HasDirection.Direction dir)
This will have the following effect on the horizontal alignment:
dir
parameter). If that is DEFAULT, the locale direction is used.
setText
in interface HasDirectionalText
text
- the widget's new textdir
- the text's direction. Note: Direction.DEFAULT
means
direction should be inherited from the widget's parent element.