|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Label
public class Label
A label.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
HtmlBasedComponent.ExtraCtrl |
| Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
AbstractComponent.Children |
| Field Summary |
|---|
| Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
_zclass, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
_visible |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
Label()
|
|
Label(java.lang.String value)
|
|
| Method Summary | |
|---|---|
java.lang.String |
getEncodedText()
Returns the text for generating HTML tags (Internal Use Only). |
int |
getMaxlength()
Returns the maximal length of the label. |
java.lang.String |
getOuterAttrs()
Returns the exterior attributes for generating the enclosing HTML tag; never return null. |
java.lang.String |
getValue()
Returns the value. |
java.lang.String |
getZclass()
Returns the Style of label Default: "z-label" |
void |
invalidate()
Invalidates this component by setting the dirty flag such that it will be redraw the whole content later. |
boolean |
isChildable()
No child is allowed. |
boolean |
isHyphen()
Returns whether to hyphenate a long word if maxlength is specified. |
boolean |
isIdRequired()
Whether to generate the value directly without ID. |
boolean |
isMultiline()
Returns whether to preserve the new line and the white spaces at the begining of each line. |
boolean |
isPre()
Returns whether to preserve the white spaces, such as space, tab and new line. |
void |
redraw(java.io.Writer out)
Redraws this component. |
void |
setHyphen(boolean hyphen)
Sets whether to hyphen a long word if maxlength is specified. |
void |
setMaxlength(int maxlength)
Sets the maximal length of the label. |
void |
setMultiline(boolean multiline)
Sets whether to preserve the new line and the white spaces at the begining of each line. |
void |
setPre(boolean pre)
Sets whether to preserve the white spaces, such as space, tab and new line. |
void |
setValue(java.lang.String value)
Sets the value. |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, newExtraCtrl, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
|---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
|---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Constructor Detail |
|---|
public Label()
public Label(java.lang.String value)
| Method Detail |
|---|
public java.lang.String getValue()
Default: "".
getValue in interface Labelpublic void setValue(java.lang.String value)
setValue in interface Labelpublic int getMaxlength()
Noteice:
Since 3.0.4, you can set the style class (@{link #setSclass}) to "word-wrap" to wrap a long word instead of using the hyphen and maxlength property. However, word-wrap is not applicable to Opera (it works fine with FF, IE and Safari).
getMaxlength in interface Labelpublic void setMaxlength(int maxlength)
See getMaxlength() for the relationship among pre, hyphen and
maxlength.
setMaxlength in interface Labelpublic boolean isPre()
It is the same as style="white-space:pre". However, IE has a bug when handling such style if the content is updated dynamically. Refer to Bug 1455584.
See getMaxlength() for the relationship among pre, hyphen and
maxlength.
Note: the new line is preserved either isPre() or
isMultiline() returns true.
In other words, pre implies multiline
isPre in interface Labelpublic void setPre(boolean pre)
See getMaxlength() for the relationship among pre, hyphen and
maxlength.
setPre in interface Labelpublic boolean isMultiline()
Note: the new line is preserved either isPre() or
isMultiline() returns true.
In other words, pre implies multiline
isMultiline in interface Labelpublic void setMultiline(boolean multiline)
setMultiline in interface Labelpublic boolean isHyphen()
Since 3.0.4, you can set the style class (@{link #setSclass}) to "word-wrap" to wrap a long word instead of using the hyphen and maxlength property. However, word-wrap is not applicable to Opera (it works fine with FF, IE and Safari).
See getMaxlength() for the relationship among pre, hyphen and
maxlength.
isHyphen in interface Labelpublic void setHyphen(boolean hyphen)
See getMaxlength() for the relationship among pre, hyphen and
maxlength.
setHyphen in interface Labelpublic boolean isIdRequired()
Used only for component generated. Not for applications.
public java.lang.String getEncodedText()
Used only for component generation. Not for applications.
public java.lang.String getOuterAttrs()
HtmlBasedComponentUsed only by component developers.
Default: Generates the tooltip text, style, sclass, draggable
and droppable attribute if necessary.
In other words, the corresponding attribute is generated if
HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(),
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable()
are defined.
You have to call both HtmlBasedComponent.getOuterAttrs() and
HtmlBasedComponent.getInnerAttrs() to generate complete attributes.
For simple components that all attributes are put on the outest HTML element, all you need is as follows.
<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>
If you want to put attributes in a nested HTML element, you
shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs()
in a different tag, the tag must be named with "${self.uuid}!real".
<xx id="${self.uuid}"${self.outerAttrs}>
<yy id="${self.uuid}!real"${self.innerAttrs}>...
Note: This class handles non-deferrable event listeners automatically.
However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event
the component handles in HtmlBasedComponent.getOuterAttrs() as follows.
appendAsapAttr(sb, Events.ON_OPEN);
appendAsapAttr(sb, Events.ON_CHANGE);
Theorectically, you could put any attributes in either
HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs().
However, zkau.js assumes all attributes are put at the outer one.
If you want something different, you have to provide your own
setAttr (refer to how checkbox is implemented).
getOuterAttrs in class XulElementpublic java.lang.String getZclass()
Default: "z-label"
getZclass in interface HtmlBasedComponentgetZclass in class HtmlBasedComponentHtmlBasedComponent.getSclass(),
HtmlBasedComponent.getRealSclass()public void invalidate()
ComponentIt can be called only in the request-processing and event-processing phases; excluding the redrawing phase.
invalidate in interface Componentinvalidate in class AbstractComponent
public void redraw(java.io.Writer out)
throws java.io.IOException
AbstractComponentAbstractComponent.getMoldURI() to retrieve the mold
to redraw. The mold is either an URI (String) or a
ComponentRenderer instance.
Execution.include(java.io.Writer, java.lang.String, java.util.Map, int) to generate
the output.ComponentRenderer instance, ComponentRenderer.render(org.zkoss.zk.ui.Component, java.io.Writer)
is called to generate the output.
redraw in interface Componentredraw in class HtmlBasedComponentjava.io.IOExceptionpublic boolean isChildable()
isChildable in interface ComponentisChildable in class AbstractComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||