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() . |
AbstractComponent.Children
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Modifier | Constructor and Description |
---|---|
protected |
LabelImageElement() |
protected |
LabelImageElement(java.lang.String label) |
protected |
LabelImageElement(java.lang.String label,
java.lang.String image) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Clones the component.
|
java.lang.Object |
getExtraCtrl()
Returns the client control for this component.
|
java.lang.String |
getHoverImage()
Returns the URI of the hover image.
|
Image |
getHoverImageContent()
Returns the content of the hover image
set by
setHoverImageContent(Image)
or setHoverImageContent(RenderedImage) . |
java.lang.String |
getIconSclass()
Returns the icon font
|
java.lang.String |
getImage()
Returns the image URI.
|
Image |
getImageContent()
Returns the image content
set by
setImageContent(Image)
or setImageContent(RenderedImage) . |
PropertyAccess |
getPropertyAccess(java.lang.String prop)
Returns the corresponding property access object from the given property
name, if any.
|
java.lang.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(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
setHoverImage(java.lang.String src)
Sets the image URI.
|
void |
setHoverImageContent(Image image)
Sets the content of the hover image directly.
|
void |
setHoverImageContent(java.awt.image.RenderedImage image)
Sets the content of the hover image directly with the rendered image.
|
void |
setIconSclass(java.lang.String iconSclass)
Sets the icon font
|
void |
setImage(java.lang.String src)
Sets the image URI.
|
void |
setImageContent(Image image)
Sets the content directly.
|
void |
setImageContent(java.awt.image.RenderedImage image)
Sets the content directly with the rendered image.
|
void |
setSrc(java.lang.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
addSclass, evalCSSFlex, focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, 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, 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, invalidatePartial, isChildable, isInitialized, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
protected LabelImageElement()
protected LabelImageElement(java.lang.String label, java.lang.String image)
protected LabelImageElement(java.lang.String label)
public void setIconSclass(java.lang.String iconSclass)
iconSclass
- a CSS class name for the icon fontpublic java.lang.String getIconSclass()
public java.lang.String getImage()
Default: null.
public void setImage(java.lang.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 java.lang.String getSrc()
getImage()
public void setSrc(java.lang.String src)
setImage(java.lang.String)
public void setImageContent(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(java.awt.image.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 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 java.lang.String getHoverImage()
Default: null.
public void setHoverImage(java.lang.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 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(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(java.awt.image.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(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class LabelElement
java.io.IOException
public java.lang.Object getExtraCtrl()
HtmlBasedComponent
Default: creates an instance of HtmlBasedComponent.ExtraCtrl
.
getExtraCtrl
in interface ComponentCtrl
getExtraCtrl
in class HtmlBasedComponent
Cropper
.ComponentCtrl.getExtraCtrl()
public PropertyAccess getPropertyAccess(java.lang.String prop)
ComponentCtrl
getPropertyAccess
in interface ComponentCtrl
getPropertyAccess
in class LabelElement
prop
- the name of the propertypublic java.lang.Object clone()
Component
clone
in interface Component
clone
in class XulElement
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.