Class Image
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.zul.Image
-
- 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
public class Image extends XulElement
An image.[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,<image ...> <custom-attributes org.zkoss.zul.image.preload='true'/> </image>
[Since 6.5.2]<window ...> <custom-attributes org.zkoss.zul.image.preload="true"/> <image .../> </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/>See also how to fix the alpha transparency problem of PNG files found in IE6?
- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classImage.ExtraCtrlA utility class to implementHtmlBasedComponent.getExtraCtrl().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.zkoss.image.ImagegetContent()Returns the content set bysetContent(org.zkoss.image.Image).java.lang.ObjectgetExtraCtrl()java.lang.StringgetHover()Returns the URI of the hover image.java.lang.StringgetSrc()Returns the source URI of the image.protected booleanisChildable()Default: not childable.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)voidsetContent(java.awt.image.RenderedImage image)Sets the content directly with the rendered image.voidsetContent(org.zkoss.image.Image image)Sets the content directly.voidsetHover(java.lang.String src)Sets the image URI.voidsetHoverContent(java.awt.image.RenderedImage image)Sets the content of the hover image directly with the rendered image.voidsetHoverContent(org.zkoss.image.Image image)Sets the content of the hover image directly.voidsetSrc(java.lang.String src)Sets the source URI of the image.-
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, 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, 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
-
getSrc
public java.lang.String getSrc()
Returns the source URI of the image.Default: null.
-
setSrc
public void setSrc(java.lang.String src)
Sets the source URI of the image.Calling this method implies setContent(null). In other words, the last invocation of
setSrc(java.lang.String)overrides the previoussetContent(org.zkoss.image.Image), if any.- Parameters:
src- the URI of the image source- See Also:
setContent(org.zkoss.image.Image),setContent(RenderedImage)
-
setContent
public void setContent(org.zkoss.image.Image image)
Sets the content directly.Default: null.
Calling this method implies setSrc(null). In other words, the last invocation of
setContent(org.zkoss.image.Image)overrides the previoussetSrc(java.lang.String), if any.- Parameters:
image- the image to display.- See Also:
setSrc(java.lang.String)
-
setContent
public void setContent(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 invokesetContent(org.zkoss.image.Image).If you want more control such as different format, quality, and naming, you can use
Imagesdirectly.- Since:
- 3.0.7
-
getContent
public org.zkoss.image.Image getContent()
Returns the content set bysetContent(org.zkoss.image.Image).Note: it won't fetch what is set thru by
setSrc(java.lang.String). It simply returns what is passed tosetContent(org.zkoss.image.Image).
-
getHover
public java.lang.String getHover()
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
-
setHover
public void setHover(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 setHoverContent(null). In other words, the last invocation of
setHover(java.lang.String)overrides the previoussetHoverContent(org.zkoss.image.Image), if any.- Since:
- 3.5.0
- See Also:
setHoverContent(org.zkoss.image.Image),setHoverContent(RenderedImage)
-
setHoverContent
public void setHoverContent(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 setHover(null). In other words, the last invocation of
setHoverContent(org.zkoss.image.Image)overrides the previoussetHover(java.lang.String), if any.- Parameters:
image- the image to display.- Since:
- 3.5.0
- See Also:
setHover(java.lang.String)
-
setHoverContent
public void setHoverContent(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 invokesetHoverContent(org.zkoss.image.Image).If you want more control such as different format, quality, and naming, you can use
Imagesdirectly.- Since:
- 3.5.0
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException- Overrides:
renderPropertiesin classXulElement- Throws:
java.io.IOException
-
isChildable
protected boolean isChildable()
Default: not childable.- Overrides:
isChildablein classorg.zkoss.zk.ui.AbstractComponent
-
getExtraCtrl
public java.lang.Object getExtraCtrl()
- Specified by:
getExtraCtrlin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getExtraCtrlin classorg.zkoss.zk.ui.HtmlBasedComponent
-
-