Class LabelImageElement
- All Implemented Interfaces:
Serializable,Cloneable,Component,Scope,ComponentCtrl
- Direct Known Subclasses:
A,Avatar,Breadcrumbitem,Button,Caption,Carouselitem,Checkbox,Chip,Comboitem,Fisheye,FooterElement,HeaderElement,Listcell,Menu,Menuitem,Nav,Navitem,Orgnode,Tab,Treecell
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:
<button ...>
<custom-attributes org.zkoss.zul.image.preload="true"/>
</button>
Or specify it onto the root component.
For example,
<window ...>
<custom-attributes org.zkoss.zul.image.preload="true"/>
<button .../>
</window>
[Since 6.5.2]
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classA utility class to implementHtmlBasedComponent.getExtraCtrl().Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedLabelImageElement(String label) protectedLabelImageElement(String label, String image) -
Method Summary
Modifier and TypeMethodDescriptionclone()Clones the component.Returns the client control for this component.Returns the URI of the hover image.Returns the content of the hover image set bysetHoverImageContent(Image)orsetHoverImageContent(RenderedImage).Returns the icon fontString[]Returns the icon font String arrayReturns the iconTooltip contentString[]Returns the iconTooltip content String arraygetImage()Returns the image URI.Returns the image content set bysetImageContent(Image)orsetImageContent(RenderedImage).getPropertyAccess(String prop) Returns the corresponding property access object from the given property name, if any.booleanReturns whether the image is available.protected voidrenderProperties(ContentRenderer renderer) Renders the content of this component, excluding the enclosing tags and children.voidsetHoverImage(String src) Sets the image URI.voidSets the content of the hover image directly with the rendered image.voidsetHoverImageContent(Image image) Sets the content of the hover image directly.voidsetIconSclass(String iconSclass) Sets the icon font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclassvoidsetIconSclasses(String[] iconSclasses) Sets multiple icons font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclassvoidsetIconTooltip(String iconTooltip) Sets the iconTooltip, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltipvoidsetIconTooltips(String[] iconTooltips) Sets multiple iconTooltips, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltipvoidSets the image URI.voidsetImageContent(RenderedImage image) Sets the content directly with the rendered image.voidsetImageContent(Image image) Sets the content directly.Methods inherited from class org.zkoss.zul.impl.LabelElement
getLabel, renderCrawlable, setLabelMethods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, 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, setSkeleton, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods 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, getStubonlyDescendants, 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, setStubonlyDescendants, 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
-
Constructor Details
-
LabelImageElement
protected LabelImageElement() -
LabelImageElement
- Since:
- 5.0.0
-
LabelImageElement
- Since:
- 5.0.0
-
-
Method Details
-
setIconSclass
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
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
Returns the icon font- Since:
- 7.0.0
-
getIconSclasses
Returns the icon font String array- Since:
- 10.0.0
-
setIconTooltip
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
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
Returns the iconTooltip content- Since:
- 10.0.0
-
getIconTooltips
Returns the iconTooltip content String array- Since:
- 10.0.0
-
getImage
Returns the image URI.Default: null.
-
setImage
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
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:
-
setImageContent
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
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
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
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
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
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
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
Description copied from class:HtmlBasedComponentRenders the content of this component, excluding the enclosing tags and children.- Overrides:
renderPropertiesin classLabelElement- Throws:
IOException
-
getExtraCtrl
Description copied from class:HtmlBasedComponentReturns the client control for this component. It is used only by component developers.Default: creates an instance of
HtmlBasedComponent.ExtraCtrl.- Specified by:
getExtraCtrlin interfaceComponentCtrl- Overrides:
getExtraCtrlin classHtmlBasedComponent- Returns:
- null if no special handling required. If the component
requires some special controls, it could return an object that
implements one or several interfaces in the org.zkoss.zk.ui.ext.render
package.
For example,
Cropper. - See Also:
-
getPropertyAccess
Description copied from interface:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Overrides:
getPropertyAccessin classLabelElement- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
clone
Description copied from interface:ComponentClones the component. All of its children and descendants are cloned. Also, ID are preserved.- Specified by:
clonein interfaceComponent- Overrides:
clonein classXulElement- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-