|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.impl.LabelElement
org.zkoss.zul.impl.LabelImageElement
public class LabelImageElement
A XUL element with a label (LabelElement.getLabel())
and an image (getImage()).
| Nested Class Summary | |
|---|---|
protected class |
LabelImageElement.ExtraCtrl
A utility class to implement AbstractComponent.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, RS_NO_DISPLAY, RS_NO_HEIGHT, RS_NO_WIDTH |
| Fields inherited from class org.zkoss.zk.ui.AbstractComponent |
|---|
_visible |
| Fields inherited from interface org.zkoss.zk.ui.Component |
|---|
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE |
| Constructor Summary | |
|---|---|
LabelImageElement()
|
|
| Method Summary | |
|---|---|
java.lang.String |
getEncodedImageURL()
Returns the encoded URL for the image ( getImage()
or getImageContent()), or null if no image. |
java.lang.String |
getHoverImage()
Returns the URI of the hover image. |
java.lang.String |
getImage()
Returns the image URI. |
Image |
getImageContent()
Returns the image content set by setImageContent(Image)
or setImageContent(RenderedImage). |
java.lang.String |
getImgTag()
Returns the HTML IMG tag for the image part, or null if no image is assigned ( isImageAssigned())
Used only for component development, not for application developers. |
protected java.lang.String |
getImgTag(java.lang.String sclass,
boolean enforce)
Utilities to implement getImgTag(). |
java.lang.String |
getOuterAttrs()
Returns the exterior attributes for generating the enclosing HTML tag; never return null. |
java.lang.String |
getSrc()
Deprecated. As of release 3.5.0, it is redudant since it is the same as getImage() |
boolean |
isImageAssigned()
Returns whether the image is available. |
protected java.lang.Object |
newExtraCtrl()
Used by AbstractComponent.getExtraCtrl() to create a client control. |
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 |
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 redudant since it is the same as setImage(java.lang.String) |
| Methods inherited from class org.zkoss.zul.impl.LabelElement |
|---|
getLabel, setLabel |
| Methods inherited from class org.zkoss.zul.impl.XulElement |
|---|
getAction, getActionAttrs, getAllOnClickAttrs, getContext, getCtrlKeys, getInnerAttrs, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent |
|---|
focus, getAllOnClickAttrs, getDraggable, getDroppable, getHeight, getLeft, getMoldSclass, getRealSclass, getRealStyle, getRealStyleFlags, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, redraw, setClass, setDraggable, setDroppable, setFocus, setHeight, setLeft, setMoldSclass, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.zkoss.zul.impl.api.LabelElement |
|---|
getLabel, setLabel |
| Methods inherited from interface org.zkoss.zul.impl.api.XulElement |
|---|
getAction, getContext, getCtrlKeys, getPopup, getTooltip, setAction, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip |
| Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent |
|---|
focus, getHeight, getLeft, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, setLeft, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex |
| Constructor Detail |
|---|
public LabelImageElement()
| Method Detail |
|---|
public java.lang.String getImage()
Default: null.
getImage in interface LabelImageElementpublic 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.
If src is changed, the component's inner is invalidate. Thus, you want to smart-update, you have to override this method.
setImage in interface LabelImageElementsetImageContent(Image),
setImageContent(RenderedImage)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.
setImageContent in interface LabelImageElementimage - 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.
setImageContent in interface LabelImageElementpublic 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.
getImageContent in interface LabelImageElementpublic java.lang.String getHoverImage()
Default: null.
getHoverImage in interface LabelImageElementpublic 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.
setHoverImage in interface LabelImageElementpublic 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.
setHoverImageContent in interface LabelImageElementimage - 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.
setHoverImageContent in interface LabelImageElementpublic boolean isImageAssigned()
setImage(java.lang.String) or
setImageContent(org.zkoss.image.Image) is called with non-null.
public java.lang.String getImgTag()
isImageAssigned())
Used only for component development, not for application developers.
Note: the component template shall use this method to
generate the HTML tag, instead of using getImage().
protected java.lang.String getImgTag(java.lang.String sclass,
boolean enforce)
getImgTag().
By default, getImgTag() is the same as getImageTag(null, false).
Used only for component developements; not by app developers.
sclass - the style class of the generated image.enforce - whether to generate an empty pixel if no image is assigned.
By default, null is returned. However, if you prefer to generate
an image tag with an empty pixel, you can specify true here.public java.lang.String getEncodedImageURL()
getImage()
or getImageContent()), or null if no image.
Used only for component developements; not by app developers.
Note: this method can be invoked only if execution is not null.
public java.lang.String getOuterAttrs()
HtmlBasedComponentUsed only by component developers.
Default: Generates the tooltip text, style, sclass, draggable
and droppable attribute if necessary.
In other words, the corresponding attribute is generated if
HtmlBasedComponent.getTooltiptext(), HtmlBasedComponent.getRealStyle(),
HtmlBasedComponent.getSclass(), HtmlBasedComponent.getDraggable(), HtmlBasedComponent.getDroppable()
are defined.
You have to call both HtmlBasedComponent.getOuterAttrs() and
HtmlBasedComponent.getInnerAttrs() to generate complete attributes.
For simple components that all attributes are put on the outest HTML element, all you need is as follows.
<xx id="${self.uuid}"${self.outerAttrs}${self.innerAttrs}>
If you want to put attributes in a nested HTML element, you
shall use the following pattern. Notice: if HtmlBasedComponent.getInnerAttrs()
in a different tag, the tag must be named with "${self.uuid}!real".
<xx id="${self.uuid}"${self.outerAttrs}>
<yy id="${self.uuid}!real"${self.innerAttrs}>...
Note: This class handles non-deferrable event listeners automatically.
However, you have to invoke AbstractComponent.appendAsapAttr(java.lang.StringBuffer, java.lang.String) for each event
the component handles in HtmlBasedComponent.getOuterAttrs() as follows.
appendAsapAttr(sb, Events.ON_OPEN);
appendAsapAttr(sb, Events.ON_CHANGE);
Theorectically, you could put any attributes in either
HtmlBasedComponent.getInnerAttrs() or HtmlBasedComponent.getOuterAttrs().
However, zkau.js assumes all attributes are put at the outer one.
If you want something different, you have to provide your own
setAttr (refer to how checkbox is implemented).
getOuterAttrs in class XulElementprotected java.lang.Object newExtraCtrl()
HtmlBasedComponentAbstractComponent.getExtraCtrl() to create a client control.
It is used only by component developers.
Defaut: creates an instance of HtmlBasedComponent.ExtraCtrl.
newExtraCtrl in class HtmlBasedComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||