public abstract class LabelImageElement extends LabelElement
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>ture</value/>
</library-property/>
Modifier and Type | Class and Description |
---|---|
protected class |
LabelImageElement.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl() . |
Modifier | Constructor and Description |
---|---|
protected |
LabelImageElement() |
protected |
LabelImageElement(String label) |
protected |
LabelImageElement(String label,
String image) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
Object |
getExtraCtrl() |
String |
getHoverImage()
Returns the URI of the hover image.
|
org.zkoss.image.Image |
getHoverImageContent()
Returns the content of the hover image
set by
setHoverImageContent(Image)
or setHoverImageContent(RenderedImage) . |
String |
getIconSclass()
Returns the icon font
|
String |
getImage()
Returns the image URI.
|
org.zkoss.image.Image |
getImageContent()
Returns the image content
set by
setImageContent(Image)
or setImageContent(RenderedImage) . |
org.zkoss.zk.ui.sys.PropertyAccess |
getPropertyAccess(String prop) |
String |
getSrc()
Deprecated.
As of release 3.5.0, it is redundant since
it is the same as
getImage() |
boolean |
isImageAssigned()
Returns whether the image is available.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
setHoverImage(String src)
Sets the image URI.
|
void |
setHoverImageContent(org.zkoss.image.Image image)
Sets the content of the hover image directly.
|
void |
setHoverImageContent(RenderedImage image)
Sets the content of the hover image directly with the rendered image.
|
void |
setIconSclass(String iconSclass)
Sets the icon font
|
void |
setImage(String src)
Sets the image URI.
|
void |
setImageContent(org.zkoss.image.Image image)
Sets the content directly.
|
void |
setImageContent(RenderedImage image)
Sets the content directly with the rendered image.
|
void |
setSrc(String src)
Deprecated.
As of release 3.5.0, it is redundant since
it is the same as
setImage(java.lang.String) |
getLabel, renderCrawlable, setLabel
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, service, setAction, setClass, 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
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, 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, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, 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, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
protected LabelImageElement()
protected LabelImageElement(String label)
public void setIconSclass(String iconSclass)
iconSclass
- a CSS class name for the icon fontpublic String getIconSclass()
public String getImage()
Default: null.
public void setImage(String src)
Calling this method implies setImageContent(null).
In other words, the last invocation of setImage(java.lang.String)
overrides
the previous setImageContent(org.zkoss.image.Image)
, if any.
The image would hide if src == null
public String getSrc()
getImage()
public void setSrc(String src)
setImage(java.lang.String)
public void setImageContent(org.zkoss.image.Image image)
Default: null.
Calling this method implies setImage(null).
In other words, the last invocation of setImageContent(org.zkoss.image.Image)
overrides
the previous setImage(java.lang.String)
, if any.
image
- the image to display.setImage(java.lang.String)
public void setImageContent(RenderedImage image)
Image
) with Images.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean)
,
and then invoke setImageContent(org.zkoss.image.Image)
.
If you want more control such as different format, quality,
and naming, you can use Images
directly.
public org.zkoss.image.Image getImageContent()
setImageContent(Image)
or setImageContent(RenderedImage)
.
Note: it won't load the content specified by setImage(java.lang.String)
.
Actually, it returns null if setImage(java.lang.String)
was called.
public String getHoverImage()
Default: null.
public void setHoverImage(String src)
Calling this method implies setHoverImageContent(null).
In other words, the last invocation of setHoverImage(java.lang.String)
overrides
the previous setHoverImageContent(org.zkoss.image.Image)
, if any.
public org.zkoss.image.Image getHoverImageContent()
setHoverImageContent(Image)
or setHoverImageContent(RenderedImage)
.
Note: it won't load the content specified by setImage(java.lang.String)
.
Actually, it returns null if setImage(java.lang.String)
was called.
public void setHoverImageContent(org.zkoss.image.Image image)
Default: null.
Calling this method implies setHoverImage(null).
In other words, the last invocation of setHoverImageContent(org.zkoss.image.Image)
overrides
the previous setHoverImage(java.lang.String)
, if any.
image
- the image to display.public void setHoverImageContent(RenderedImage image)
It actually encodes the rendered image to an PNG image
(Image
) with Images.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean)
,
and then invoke setHoverImageContent(org.zkoss.image.Image)
.
If you want more control such as different format, quality,
and naming, you can use Images
directly.
public boolean isImageAssigned()
setImage(java.lang.String)
or
setImageContent(org.zkoss.image.Image)
is called with non-null.protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
renderProperties
in class LabelElement
IOException
public Object getExtraCtrl()
getExtraCtrl
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getExtraCtrl
in class org.zkoss.zk.ui.HtmlBasedComponent
public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess(String prop)
getPropertyAccess
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getPropertyAccess
in class LabelElement
public Object clone()
clone
in interface org.zkoss.zk.ui.Component
clone
in class XulElement
Copyright © 2018. All rights reserved.