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() . |
AbstractComponent.Children
_zclass
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAlign()
Deprecated.
as of release 6.0.0, use CSS instead.
|
java.lang.String |
getBorder()
Deprecated.
As of release 5.0.5, use CSS instead.
|
Image |
getContent()
Returns the content set by
setContent(org.zkoss.image.Image) . |
java.lang.Object |
getExtraCtrl()
Returns the client control for this component.
|
java.lang.String |
getHover()
Returns the URI of the hover image.
|
java.lang.String |
getHspace()
Deprecated.
as of release 6.0.0, use CSS instead.
|
java.lang.String |
getSrc()
Returns the source URI of the image.
|
java.lang.String |
getVspace()
Deprecated.
as of release 6.0.0, use CSS instead.
|
protected boolean |
isChildable()
Default: not childable.
|
protected void |
renderProperties(ContentRenderer renderer)
Renders the content of this component, excluding the enclosing
tags and children.
|
void |
setAlign(java.lang.String align)
Deprecated.
as of release 6.0.0, use CSS instead.
|
void |
setBorder(java.lang.String border)
Deprecated.
As of release 5.0.5, use CSS instead.
|
void |
setContent(Image image)
Sets the content directly.
|
void |
setContent(java.awt.image.RenderedImage image)
Sets the content directly with the rendered image.
|
void |
setHover(java.lang.String src)
Sets the image URI.
|
void |
setHoverContent(Image image)
Sets the content of the hover image directly.
|
void |
setHoverContent(java.awt.image.RenderedImage image)
Sets the content of the hover image directly with the rendered image.
|
void |
setHspace(java.lang.String hspace)
Deprecated.
as of release 6.0.0, use CSS instead.
|
void |
setSrc(java.lang.String src)
Sets the source URI of the image.
|
void |
setVspace(java.lang.String vspace)
Deprecated.
as of release 6.0.0, use CSS instead.
|
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
focus, getAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
addAnnotation, addAnnotation, 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, 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, getShadowRoots, 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, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, 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 java.lang.String getAlign()
Default: null (use browser default).
public void setAlign(java.lang.String align)
public java.lang.String getBorder()
public void setBorder(java.lang.String border)
public java.lang.String getHspace()
Default: null (use browser default).
public void setHspace(java.lang.String hspace)
public java.lang.String getVspace()
Default: null (use browser default).
public void setVspace(java.lang.String vspace)
public java.lang.String getSrc()
Default: null.
public void setSrc(java.lang.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(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(java.awt.image.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 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 java.lang.String getHover()
Default: null.
public void setHover(java.lang.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(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(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 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(ContentRenderer renderer) throws java.io.IOException
HtmlBasedComponent
renderProperties
in class XulElement
java.io.IOException
protected boolean isChildable()
isChildable
in class AbstractComponent
public java.lang.Object getExtraCtrl()
HtmlBasedComponent
Default: creates an instance of HtmlBasedComponent.ExtraCtrl
.
getExtraCtrl
in interface ComponentCtrl
getExtraCtrl
in class HtmlBasedComponent
Cropper
.ComponentCtrl.getExtraCtrl()
Copyright © 2005-2011 Potix Corporation. All Rights Reserved.