org.zkoss.zul
Class Label

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.Label
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.sys.ComponentCtrl

public class Label
extends XulElement

A label.

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl
 
Field Summary
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH
 
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()
           
 java.lang.String getValue()
          Returns the value.
 void invalidate()
           
 boolean isChildable()
          No child is allowed.
 boolean isHyphen()
          Returns whether to hyphen a long word if maxlength is specified.
 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)
           
 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, getAllOnClickAttrs, getContext, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setPopup, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addEventListener, appendAsapAttr, focus, getDraggable, getDroppable, getHeight, getLeft, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZIndex, isAsapRequired, newExtraCtrl, removeEventListener, setClass, setDraggable, setDroppable, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZIndex
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, clone, containsVariable, detach, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getDefinition, getDesktop, getEventHandler, getExtraCtrl, getFellow, getFellowIfAny, getId, getListenerIterator, getMold, getMoldURI, getNamespace, getPage, getParent, getPropagatee, getRoot, getSpaceOwner, getUuid, getVariable, insertBefore, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onDrawNewChild, onWrongValue, removeAttribute, removeAttribute, removeChild, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setParent, setVariable, setVisible, smartUpdate, smartUpdate, smartUpdate, toString, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Label

public Label()

Label

public Label(java.lang.String value)
Method Detail

getValue

public java.lang.String getValue()
Returns the value.

Default: "".


setValue

public void setValue(java.lang.String value)
Sets the value.


getMaxlength

public int getMaxlength()
Returns the maximal length of the label.

Noteice:

hyphen="false" and pre="false"
maxlength is the maximal length to display. Exceeding part is truncated.
hyphen="true"
maxlength is the maximal length of each word, and hyphenation is added if a word exceeds maxlength.
hyphen="false" and pre="true"
maxlength has no effect.
maxlength=0
hyphen has no effect


setMaxlength

public void setMaxlength(int maxlength)
Sets the maximal length of the label.

See getMaxlength() for the relationship among pre, hyphen and maxlength.


isPre

public boolean isPre()
Returns whether to preserve the white spaces, such as space, tab and new line.

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


setPre

public void setPre(boolean pre)
Sets whether to preserve the white spaces, such as space, tab and new line.

See getMaxlength() for the relationship among pre, hyphen and maxlength.


isMultiline

public boolean isMultiline()
Returns whether to preserve the new line and the white spaces at the begining of each line.

Note: the new line is preserved either isPre() or isMultiline() returns true. In other words, pre implies multiline


setMultiline

public void setMultiline(boolean multiline)
Sets whether to preserve the new line and the white spaces at the begining of each line.


isHyphen

public boolean isHyphen()
Returns whether to hyphen a long word if maxlength is specified.

See getMaxlength() for the relationship among pre, hyphen and maxlength.


setHyphen

public void setHyphen(boolean hyphen)
Sets whether to hyphen a long word if maxlength is specified.

See getMaxlength() for the relationship among pre, hyphen and maxlength.


getEncodedText

public java.lang.String getEncodedText()
Returns the text for generating HTML tags (Internal Use Only).

Used only for component generation. Not for applications.


getOuterAttrs

public java.lang.String getOuterAttrs()
Overrides:
getOuterAttrs in class XulElement

invalidate

public void invalidate()
Specified by:
invalidate in interface org.zkoss.zk.ui.Component
Overrides:
invalidate in class org.zkoss.zk.ui.AbstractComponent

redraw

public void redraw(java.io.Writer out)
            throws java.io.IOException
Specified by:
redraw in interface org.zkoss.zk.ui.Component
Overrides:
redraw in class org.zkoss.zk.ui.AbstractComponent
Throws:
java.io.IOException

isChildable

public boolean isChildable()
No child is allowed.

Specified by:
isChildable in interface org.zkoss.zk.ui.Component
Overrides:
isChildable in class org.zkoss.zk.ui.AbstractComponent


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.