public class Image extends XulElement
[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:
<image ...>
<custom-attributes org.zkoss.zul.image.preload='true'/>
</image>
Or specify it onto the root component.
For example,
<window ...>
<custom-attributes org.zkoss.zul.image.preload="true"/>
<image .../>
</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/>
See also how to fix the alpha transparency problem of PNG files found in IE6?
Modifier and Type | Class and Description |
---|---|
protected class |
Image.ExtraCtrl
A utility class to implement
HtmlBasedComponent.getExtraCtrl() . |
Modifier and Type | Method and Description |
---|---|
String |
getAlign()
Deprecated.
as of release 6.0.0, use CSS instead.
|
String |
getBorder()
Deprecated.
As of release 5.0.5, use CSS instead.
|
org.zkoss.image.Image |
getContent()
Returns the content set by
setContent(org.zkoss.image.Image) . |
Object |
getExtraCtrl() |
String |
getHover()
Returns the URI of the hover image.
|
String |
getHspace()
Deprecated.
as of release 6.0.0, use CSS instead.
|
String |
getSrc()
Returns the source URI of the image.
|
String |
getVspace()
Deprecated.
as of release 6.0.0, use CSS instead.
|
protected boolean |
isChildable()
Default: not childable.
|
protected void |
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) |
void |
setAlign(String align)
Deprecated.
as of release 6.0.0, use CSS instead.
|
void |
setBorder(String border)
Deprecated.
As of release 5.0.5, use CSS instead.
|
void |
setContent(org.zkoss.image.Image image)
Sets the content directly.
|
void |
setContent(RenderedImage image)
Sets the content directly with the rendered image.
|
void |
setHover(String src)
Sets the image URI.
|
void |
setHoverContent(org.zkoss.image.Image image)
Sets the content of the hover image directly.
|
void |
setHoverContent(RenderedImage image)
Sets the content of the hover image directly with the rendered image.
|
void |
setHspace(String hspace)
Deprecated.
as of release 6.0.0, use CSS instead.
|
void |
setSrc(String src)
Sets the source URI of the image.
|
void |
setVspace(String vspace)
Deprecated.
as of release 6.0.0, use CSS instead.
|
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, 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, 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
public Image()
public Image(String src)
public String getAlign()
Default: null (use browser default).
public void setAlign(String align)
public String getBorder()
public void setBorder(String border)
public String getHspace()
Default: null (use browser default).
public void setHspace(String hspace)
public String getVspace()
Default: null (use browser default).
public void setVspace(String vspace)
public String getSrc()
Default: null.
public void setSrc(String src)
Calling this method implies setContent(null).
In other words, the last invocation of setSrc(java.lang.String)
overrides
the previous setContent(org.zkoss.image.Image)
, if any.
src
- the URI of the image sourcesetContent(org.zkoss.image.Image)
,
setContent(RenderedImage)
public void setContent(org.zkoss.image.Image image)
Default: null.
Calling this method implies setSrc(null).
In other words, the last invocation of setContent(org.zkoss.image.Image)
overrides
the previous setSrc(java.lang.String)
, if any.
image
- the image to display.setSrc(java.lang.String)
public void setContent(RenderedImage image)
Image
) with Images.encode(java.lang.String, java.awt.image.RenderedImage, float, boolean)
,
and then invoke setContent(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 getContent()
setContent(org.zkoss.image.Image)
.
Note: it won't fetch what is set thru by setSrc(java.lang.String)
.
It simply returns what is passed to setContent(org.zkoss.image.Image)
.
public String getHover()
Default: null.
public void setHover(String src)
Calling this method implies setHoverContent(null).
In other words, the last invocation of setHover(java.lang.String)
overrides
the previous setHoverContent(org.zkoss.image.Image)
, if any.
setHoverContent(org.zkoss.image.Image)
,
setHoverContent(RenderedImage)
public void setHoverContent(org.zkoss.image.Image image)
Default: null.
Calling this method implies setHover(null).
In other words, the last invocation of setHoverContent(org.zkoss.image.Image)
overrides
the previous setHover(java.lang.String)
, if any.
image
- the image to display.setHover(java.lang.String)
public void setHoverContent(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 setHoverContent(org.zkoss.image.Image)
.
If you want more control such as different format, quality,
and naming, you can use Images
directly.
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
renderProperties
in class XulElement
IOException
protected boolean isChildable()
isChildable
in class org.zkoss.zk.ui.AbstractComponent
public Object getExtraCtrl()
getExtraCtrl
in interface org.zkoss.zk.ui.sys.ComponentCtrl
getExtraCtrl
in class org.zkoss.zk.ui.HtmlBasedComponent
Copyright © 2019. All rights reserved.