|
GWT 2.1.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Label
public class Label
A widget that contains arbitrary text, not interpreted as HTML. This widget uses a <div> element, causing it to be displayed with block layout.
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);
}
}
| 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.i18n.client.HasDirection |
|---|
HasDirection.Direction |
| 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.UIObject |
|---|
DEBUG_ID_PREFIX |
| 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 | |
|---|---|
|
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,
HasDirection.Direction dir)
Creates a label with the specified text and direction. |
| Methods inherited from class com.google.gwt.user.client.ui.Widget |
|---|
addAttachHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents |
| 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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.google.gwt.event.shared.HasHandlers |
|---|
fireEvent |
| Constructor Detail |
|---|
public Label()
public Label(java.lang.String text)
text - the new label's text
public 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,
boolean wordWrap)
text - the new label's textwordWrap - false to disable word wrappingprotected Label(Element element)
element - the element to be used| Method Detail |
|---|
public static Label wrap(Element element)
RootPanel.detachNow(Widget).
element - the element to be wrappedpublic HandlerRegistration addClickHandler(ClickHandler handler)
HasClickHandlersClickEvent handler.
addClickHandler in interface HasClickHandlershandler - the click handler
HandlerRegistration used to remove this handler@Deprecated public void addClickListener(ClickListener listener)
addClickHandler(com.google.gwt.event.dom.client.ClickHandler) instead
SourcesClickEvents
addClickListener in interface SourcesClickEventslistener - the listener interface to addpublic HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
HasDoubleClickHandlersDoubleClickEvent handler.
addDoubleClickHandler in interface HasDoubleClickHandlershandler - the double click handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
HasMouseDownHandlersMouseDownEvent handler.
addMouseDownHandler in interface HasMouseDownHandlershandler - the mouse down handler
HandlerRegistration 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) instead
SourcesMouseEvents
addMouseListener in interface SourcesMouseEventslistener - the listener interface to addpublic HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
HasMouseMoveHandlersMouseMoveEvent handler.
addMouseMoveHandler in interface HasMouseMoveHandlershandler - the mouse move handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
HasMouseOutHandlersMouseOutEvent handler.
addMouseOutHandler in interface HasMouseOutHandlershandler - the mouse out handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
HasMouseOverHandlersMouseOverEvent handler.
addMouseOverHandler in interface HasMouseOverHandlershandler - the mouse over handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
HasMouseUpHandlersMouseUpEvent handler.
addMouseUpHandler in interface HasMouseUpHandlershandler - the mouse up handler
HandlerRegistration used to remove this handlerpublic HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
HasMouseWheelHandlersMouseWheelEvent handler.
addMouseWheelHandler in interface HasMouseWheelHandlershandler - the mouse wheel handler
HandlerRegistration used to remove this handler@Deprecated public void addMouseWheelListener(MouseWheelListener listener)
addMouseWheelHandler(com.google.gwt.event.dom.client.MouseWheelHandler) instead
public LeafValueEditor<java.lang.String> asEditor()
IsEditor
asEditor in interface IsEditor<LeafValueEditor<java.lang.String>>Editor of type Epublic HasHorizontalAlignment.AutoHorizontalAlignmentConstant getAutoHorizontalAlignment()
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.
getAutoHorizontalAlignment in interface HasAutoHorizontalAlignment@Deprecated public HasDirection.Direction getDirection()
getTextDirection() instead
getDirection in interface HasDirectionRTL if the directionality is right-to-left,
LTR if the directionality is left-to-right, or
DEFAULT if the directionality is not explicitly specifiedpublic DirectionEstimator getDirectionEstimator()
HasDirectionEstimatorDirectionEstimator object.
getDirectionEstimator in interface HasDirectionEstimatorpublic HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()
getHorizontalAlignment in interface HasHorizontalAlignmentHasHorizontalAlignment.ALIGN_LEFT,
HasHorizontalAlignment.ALIGN_CENTER,
HasHorizontalAlignment.ALIGN_RIGHT,
HasHorizontalAlignment.ALIGN_JUSTIFY, or
null).public java.lang.String getText()
HasText
getText in interface HasTextpublic HasDirection.Direction getTextDirection()
HasDirectionalText
getTextDirection in interface HasDirectionalTextpublic boolean getWordWrap()
HasWordWrap
getWordWrap in interface HasWordWraptrue if word-wrapping is enabled.@Deprecated public void removeClickListener(ClickListener listener)
HandlerRegistration.removeHandler() method on
the object returned by addClickHandler(com.google.gwt.event.dom.client.ClickHandler) instead
SourcesClickEvents
removeClickListener in interface SourcesClickEventslistener - the listener interface to remove@Deprecated public void removeMouseListener(MouseListener listener)
HandlerRegistration.removeHandler()
method on the object returned by an add*Handler method instead
SourcesMouseEvents
removeMouseListener in interface SourcesMouseEventslistener - 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
public void setAutoHorizontalAlignment(HasHorizontalAlignment.AutoHorizontalAlignmentConstant autoAlignment)
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.
setAutoHorizontalAlignment in interface HasAutoHorizontalAlignmentautoAlignment - the new automatic horizontal alignment
policyHasHorizontalAlignment@Deprecated public void setDirection(HasDirection.Direction direction)
setDirectionEstimator(boolean) and / or pass explicit
direction to setText(java.lang.String) instead
setDirection in interface HasDirectiondirection - 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 setDirectionEstimator(boolean enabled)
See note at setDirectionEstimator(DirectionEstimator).
setDirectionEstimator in interface HasDirectionEstimatorenabled - Whether to enable direction estimation. If true,
sets the DirectionEstimator object to a default
DirectionEstimator.public void setDirectionEstimator(DirectionEstimator directionEstimator)
DirectionEstimator object.
Note: 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; DirectionEstimator should be set before the widget has any content.
setDirectionEstimator in interface HasDirectionEstimatordirectionEstimator - The {code DirectionEstimator} to be set. null means turning off direction estimation.public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)
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.
setHorizontalAlignment in interface HasHorizontalAlignmentalign - the horizontal alignment (
HasHorizontalAlignment.ALIGN_LEFT,
HasHorizontalAlignment.ALIGN_CENTER,
HasHorizontalAlignment.ALIGN_RIGHT,
HasHorizontalAlignment.ALIGN_JUSTIFY,
HasHorizontalAlignment.ALIGN_LOCALE_START, or
HasHorizontalAlignment.ALIGN_LOCALE_END).setAutoHorizontalAlignment(com.google.gwt.user.client.ui.HasHorizontalAlignment.AutoHorizontalAlignmentConstant)public 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).
setText in interface HasTexttext - the widget's new text
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 HasDirectionalTexttext - the widget's new textdir - the text's direction. Note: Direction.DEFAULT means
direction should be inherited from the widget's parent element.public void setWordWrap(boolean wrap)
HasWordWrap
setWordWrap in interface HasWordWrapwrap - true to enable word-wrapping.protected java.lang.String getTextOrHtml(boolean isHtml)
protected void setHTML(SafeHtml html)
setText(String) for details on potential effects on direction and
alignment.
html - the widget's new safe html
protected void setHTML(SafeHtml html,
HasDirection.Direction dir)
setText(String) for details on potential effects on direction and
alignment.
html - the widget's new safe htmldir - the content's direction
protected void setTextOrHtml(java.lang.String content,
boolean isHtml)
setText(String) for details on potential effects on direction
and alignment.
content - the widget's new contentisHtml - whether the content is HTML
protected void setTextOrHtml(java.lang.String content,
HasDirection.Direction dir,
boolean isHtml)
setText(String, Direction) for details on potential effects on alignment.
Implementation details:
BidiFormatter for
more details.
content - the widget's new contentdir - the content's directionisHtml - whether the content is HTML
|
GWT 2.1.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||