Class LabelImageElement
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.impl.LabelElement
-
- org.zkoss.zul.impl.LabelImageElement
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
- Direct Known Subclasses:
A,Button,Caption,Checkbox,Comboitem,FooterElement,HeaderElement,Listcell,Menu,Menuitem,Tab,Treecell
public abstract class LabelImageElement extends LabelElement
A XUL element with a label (LabelElement.getLabel()) and an image (getImage()).[Since 6.0.0]
To turn on the preload image function for this component, you have to specify the component's attribute map with key "org.zkoss.zul.image.preload" to true. That is, for example, if in a zul file, you shall specify <custom-attributes> of the component like this:
Or specify it onto the root component. For example,<button ...> <custom-attributes org.zkoss.zul.image.preload="true"/> </button>
[Since 6.5.2]<window ...> <custom-attributes org.zkoss.zul.image.preload="true"/> <button .../> </window>Preload image function is also configurable from zk.xml by setting library properties. For example,
<library-property/> <name>org.zkoss.zul.image.preload</name/> <value>true</value/> </library-property/>- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classLabelImageElement.ExtraCtrlA utility class to implementHtmlBasedComponent.getExtraCtrl().
-
Constructor Summary
Constructors Modifier Constructor Description protectedLabelImageElement()protectedLabelImageElement(java.lang.String label)protectedLabelImageElement(java.lang.String label, java.lang.String image)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()java.lang.ObjectgetExtraCtrl()java.lang.StringgetHoverImage()Returns the URI of the hover image.org.zkoss.image.ImagegetHoverImageContent()Returns the content of the hover image set bysetHoverImageContent(Image)orsetHoverImageContent(RenderedImage).java.lang.StringgetIconSclass()Returns the icon fontjava.lang.String[]getIconSclasses()Returns the icon font String arrayjava.lang.StringgetIconTooltip()Returns the iconTooltip contentjava.lang.String[]getIconTooltips()Returns the iconTooltip content String arrayjava.lang.StringgetImage()Returns the image URI.org.zkoss.image.ImagegetImageContent()Returns the image content set bysetImageContent(Image)orsetImageContent(RenderedImage).org.zkoss.zk.ui.sys.PropertyAccessgetPropertyAccess(java.lang.String prop)booleanisImageAssigned()Returns whether the image is available.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)voidsetHoverImage(java.lang.String src)Sets the image URI.voidsetHoverImageContent(java.awt.image.RenderedImage image)Sets the content of the hover image directly with the rendered image.voidsetHoverImageContent(org.zkoss.image.Image image)Sets the content of the hover image directly.voidsetIconSclass(java.lang.String iconSclass)Sets the icon font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclassvoidsetIconSclasses(java.lang.String[] iconSclasses)Sets multiple icons font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclassvoidsetIconTooltip(java.lang.String iconTooltip)Sets the iconTooltip, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltipvoidsetIconTooltips(java.lang.String[] iconTooltips)Sets multiple iconTooltips, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltipvoidsetImage(java.lang.String src)Sets the image URI.voidsetImageContent(java.awt.image.RenderedImage image)Sets the content directly with the rendered image.voidsetImageContent(org.zkoss.image.Image image)Sets the content directly.-
Methods inherited from class org.zkoss.zul.impl.LabelElement
getLabel, renderCrawlable, setLabel
-
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Method Detail
-
setIconSclass
public void setIconSclass(java.lang.String iconSclass)
Sets the icon font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclass- Parameters:
iconSclass- a CSS class name for the icon font- Since:
- 7.0.0
-
setIconSclasses
public void setIconSclasses(java.lang.String[] iconSclasses)
Sets multiple icons font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclass- Parameters:
iconSclasses- a CSS class name String array for the icon font- Since:
- 10.0.0
-
getIconSclass
public java.lang.String getIconSclass()
Returns the icon font- Since:
- 7.0.0
-
getIconSclasses
public java.lang.String[] getIconSclasses()
Returns the icon font String array- Since:
- 10.0.0
-
setIconTooltip
public void setIconTooltip(java.lang.String iconTooltip)
Sets the iconTooltip, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltip- Parameters:
iconTooltip- a content String for iconTooltip- Since:
- 10.0.0
-
setIconTooltips
public void setIconTooltips(java.lang.String[] iconTooltips)
Sets multiple iconTooltips, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltip- Parameters:
iconTooltips- a content String array for iconTooltip- Since:
- 10.0.0
-
getIconTooltip
public java.lang.String getIconTooltip()
Returns the iconTooltip content- Since:
- 10.0.0
-
getIconTooltips
public java.lang.String[] getIconTooltips()
Returns the iconTooltip content String array- Since:
- 10.0.0
-
getImage
public java.lang.String getImage()
Returns the image URI.Default: null.
-
setImage
public void setImage(java.lang.String src)
Sets the image URI.Calling this method implies setImageContent(null). In other words, the last invocation of
setImage(java.lang.String)overrides the previoussetImageContent(org.zkoss.image.Image), if any. The image would hide if src == null
-
setImageContent
public void setImageContent(org.zkoss.image.Image image)
Sets the content directly.Default: null.
Calling this method implies setImage(null). In other words, the last invocation of
setImageContent(org.zkoss.image.Image)overrides the previoussetImage(java.lang.String), if any.- Parameters:
image- the image to display.- See Also:
setImage(java.lang.String)
-
setImageContent
public void setImageContent(java.awt.image.RenderedImage image)
Sets the content directly with the rendered image. It actually encodes the rendered image to an PNG image (Image) withImages.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean), and then invokesetImageContent(org.zkoss.image.Image).If you want more control such as different format, quality, and naming, you can use
Imagesdirectly.- Since:
- 3.0.7
-
getImageContent
public org.zkoss.image.Image getImageContent()
Returns the image content set bysetImageContent(Image)orsetImageContent(RenderedImage).Note: it won't load the content specified by
setImage(java.lang.String). Actually, it returns null ifsetImage(java.lang.String)was called.
-
getHoverImage
public java.lang.String getHoverImage()
Returns the URI of the hover image. The hover image is used when the mouse is moving over this component.Default: null.
- Since:
- 3.5.0
-
setHoverImage
public void setHoverImage(java.lang.String src)
Sets the image URI. The hover image is used when the mouse is moving over this component.Calling this method implies setHoverImageContent(null). In other words, the last invocation of
setHoverImage(java.lang.String)overrides the previoussetHoverImageContent(org.zkoss.image.Image), if any.- Since:
- 3.5.0
-
getHoverImageContent
public org.zkoss.image.Image getHoverImageContent()
Returns the content of the hover image set bysetHoverImageContent(Image)orsetHoverImageContent(RenderedImage).Note: it won't load the content specified by
setImage(java.lang.String). Actually, it returns null ifsetImage(java.lang.String)was called.- Since:
- 5.0.8
-
setHoverImageContent
public void setHoverImageContent(org.zkoss.image.Image image)
Sets the content of the hover image directly. The hover image is used when the mouse is moving over this component.Default: null.
Calling this method implies setHoverImage(null). In other words, the last invocation of
setHoverImageContent(org.zkoss.image.Image)overrides the previoussetHoverImage(java.lang.String), if any.- Parameters:
image- the image to display.- Since:
- 3.5.0
-
setHoverImageContent
public void setHoverImageContent(java.awt.image.RenderedImage image)
Sets the content of the hover image directly with the rendered image. The hover image is used when the mouse is moving over this component.It actually encodes the rendered image to an PNG image (
Image) withImages.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean), and then invokesetHoverImageContent(org.zkoss.image.Image).If you want more control such as different format, quality, and naming, you can use
Imagesdirectly.- Since:
- 3.5.0
-
isImageAssigned
public boolean isImageAssigned()
Returns whether the image is available. In other words, it return true ifsetImage(java.lang.String)orsetImageContent(org.zkoss.image.Image)is called with non-null.
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException- Overrides:
renderPropertiesin classLabelElement- Throws:
java.io.IOException
-
getExtraCtrl
public java.lang.Object getExtraCtrl()
- Specified by:
getExtraCtrlin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getExtraCtrlin classorg.zkoss.zk.ui.HtmlBasedComponent
-
getPropertyAccess
public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess(java.lang.String prop)
- Specified by:
getPropertyAccessin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getPropertyAccessin classLabelElement
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceorg.zkoss.zk.ui.Component- Overrides:
clonein classXulElement
-
-