|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.WObject
eu.webtoolkit.jwt.WWidget
eu.webtoolkit.jwt.WWebWidget
eu.webtoolkit.jwt.WInteractWidget
eu.webtoolkit.jwt.WLabel
public class WLabel
A label for a form field.
The label may contain an image and/or text. It acts like a proxy for giving
focus to a WFormWidget. When both an image and text are specified,
the image is put to the left of the text.
Usage example:
{
@code
WContainerWidget w = new WContainerWidget();
WLabel label = new WLabel("Favourite Actress: ", w);
WLineEdit edit = new WLineEdit("Renee Zellweger", w);
label.setBuddy(edit);
}
The widget corresponds to the HTML <label> tag. When no
buddy is set, it is rendered using an HTML <span> or
<div> to avoid click event handling misbehavior on
Microsoft Internet Explorer.
WLabel is an inline widget.
This widget does not provide styling, and can be styled using inline or
external CSS as appropriate. A label's text may be styled via a nested
<span> element, and it's image may be styled via a
nested <img> element.
| Constructor Summary | |
|---|---|
WLabel()
Creates a label with empty text and optional parent. |
|
WLabel(java.lang.CharSequence text)
Creates a label with a given text. |
|
WLabel(java.lang.CharSequence text,
WContainerWidget parent)
Creates a label with a given text. |
|
WLabel(WContainerWidget parent)
Creates a label with empty text and optional parent. |
|
WLabel(WImage image)
Creates a label with an image. |
|
WLabel(WImage image,
WContainerWidget parent)
Creates a label with an image. |
|
| Method Summary | |
|---|---|
WFormWidget |
getBuddy()
Returns the buddy of this label. |
WImage |
getImage()
Returns the image. |
WString |
getText()
Returns the label text. |
boolean |
hasWordWrap()
Returns whether word wrapping is on. |
protected void |
propagateSetEnabled(boolean enabled)
Propagates that a widget was enabled or disabled through children. |
void |
remove()
Destructor. |
void |
setBuddy(WFormWidget buddy)
Sets the buddy of this label. |
void |
setImage(WImage image)
Sets the image. |
void |
setImage(WImage image,
Side side)
Sets the image. |
void |
setText(java.lang.CharSequence text)
Sets the label text. |
void |
setWordWrap(boolean wordWrap)
Configures word wrapping. |
protected void |
updateImage(eu.webtoolkit.jwt.DomElement element,
boolean all,
WApplication app,
int pos)
|
protected void |
updateText(eu.webtoolkit.jwt.DomElement element,
boolean all,
WApplication app,
int pos)
|
| Methods inherited from class eu.webtoolkit.jwt.WInteractWidget |
|---|
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, setDraggable, setDraggable, setDraggable, setDraggable, touchEnded, touchMoved, touchStarted |
| Methods inherited from class eu.webtoolkit.jwt.WWidget |
|---|
acceptDrops, acceptDrops, addCssRule, addCssRule, addStyleClass, animateHide, animateShow, boxBorder, boxPadding, containsExposed, disable, dropEvent, enable, getDrop, getJsRef, getParent, hide, htmlText, isLayoutSizeAware, layoutSizeChanged, positionAt, positionAt, removeStyleClass, resize, setClearSides, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, tr |
| Methods inherited from class eu.webtoolkit.jwt.WObject |
|---|
addChild, getObjectName, setObjectName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WLabel(WContainerWidget parent)
public WLabel()
Calls this((WContainerWidget)null)
public WLabel(java.lang.CharSequence text,
WContainerWidget parent)
public WLabel(java.lang.CharSequence text)
Calls this(text, (WContainerWidget)null)
public WLabel(WImage image,
WContainerWidget parent)
public WLabel(WImage image)
Calls this(image,
(WContainerWidget)null)
| Method Detail |
|---|
public void remove()
WWidgetDeletes a widget and all children (recursively). If the widget is contained in another widget, it is removed first.
remove in class WInteractWidgetWContainerWidget.removeWidget(WWidget widget)public WFormWidget getBuddy()
setBuddy(WFormWidget buddy)public void setBuddy(WFormWidget buddy)
Sets the buddy FormWidget for which this label acts as a proxy.
WFormWidget.getLabel(),
getBuddy()public void setText(java.lang.CharSequence text)
public WString getText()
public void setImage(WImage image,
Side side)
public final void setImage(WImage image)
Calls setImage(image,
Side.Left)
public WImage getImage()
public void setWordWrap(boolean wordWrap)
When wordWrap is true, the widget may break
lines, creating a multi-line text. When wordWrap is
false, the text will displayed on a single line, unless the
text contains end-of-lines (for TextFormat.PlainText) or <br
/> tags or other block-level tags (for TextFormat.XHTMLText).
The default value is false.
hasWordWrap()public boolean hasWordWrap()
setWordWrap(boolean wordWrap)protected void propagateSetEnabled(boolean enabled)
WWidget
When enabling or disabling a widget, you usually also want to disable
contained children. This method is called by
setDisabled() to propagate
its state to all children.
You may want to reimplement this method if they wish to render differently when a widget is disabled. The default implementation will propagate the signal to all children.
propagateSetEnabled in class WInteractWidget
protected void updateImage(eu.webtoolkit.jwt.DomElement element,
boolean all,
WApplication app,
int pos)
protected void updateText(eu.webtoolkit.jwt.DomElement element,
boolean all,
WApplication app,
int pos)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||