|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zkoss.zk.ui.AbstractComponent org.zkoss.zk.ui.HtmlBasedComponent org.zkoss.zul.impl.XulElement org.zkoss.zul.Image
public class Image
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:
<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?
Nested Class Summary | |
---|---|
protected class |
Image.ExtraCtrl
A utility class to implement HtmlBasedComponent.getExtraCtrl() . |
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent |
---|
AbstractComponent.Children |
Field Summary |
---|
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
_zclass |
Fields inherited from interface org.zkoss.zk.ui.Component |
---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl |
---|
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE |
Constructor Summary | |
---|---|
Image()
|
|
Image(java.lang.String src)
|
Method Summary | |
---|---|
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. |
Methods inherited from class org.zkoss.zul.impl.XulElement |
---|
clone, getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
---|
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 |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Image()
public Image(java.lang.String src)
Method Detail |
---|
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
See also ZK Client-side Reference: Property Rendering
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |