org.zkoss.zul.impl
Class LabelImageElement

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.zul.impl.LabelElement
                  extended by org.zkoss.zul.impl.LabelImageElement
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
Direct Known Subclasses:
A, Button, Caption, Checkbox, Comboitem, FooterElement, HeaderElement, Listcell, Menu, Menuitem, Tab, Treecell

public abstract class LabelImageElement
extends LabelElement

A XUL element with a label (LabelElement.getLabel()) and an image (getImage()). [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:

<button ...>
        <custom-attributes org.zkoss.zul.listbox.rod='true'/>
</button>
 
Or specify it onto the root component. For example,
<window ...>
        <custom-attributes org.zkoss.zul.listbox.rod="true"/>
  <button .../>
 </window>
 

Author:
tomyeh
See Also:
Serialized Form

Nested Class Summary
protected  class LabelImageElement.ExtraCtrl
          A utility class to implement HtmlBasedComponent.getExtraCtrl().
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.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
protected LabelImageElement()
           
protected LabelImageElement(java.lang.String label)
           
protected LabelImageElement(java.lang.String label, java.lang.String image)
           
 
Method Summary
 java.lang.Object clone()
           
 java.lang.Object getExtraCtrl()
           
 java.lang.String getHoverImage()
          Returns the URI of the hover image.
 org.zkoss.image.Image getHoverImageContent()
          Returns the content of the hover image set by setHoverImageContent(Image) or setHoverImageContent(RenderedImage).
 java.lang.String getImage()
          Returns the image URI.
 org.zkoss.image.Image getImageContent()
          Returns the image content set by setImageContent(Image) or setImageContent(RenderedImage).
 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  void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
           
 void setHoverImage(java.lang.String src)
          Sets the image URI.
 void setHoverImageContent(org.zkoss.image.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(org.zkoss.image.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, renderCrawlable, setLabel
 
Methods inherited from class org.zkoss.zul.impl.XulElement
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 org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LabelImageElement

protected LabelImageElement()

LabelImageElement

protected LabelImageElement(java.lang.String label,
                            java.lang.String image)
Since:
5.0.0

LabelImageElement

protected LabelImageElement(java.lang.String label)
Since:
5.0.0
Method Detail

getImage

public java.lang.String getImage()
Returns the image URI.

Default: null.


setImage

public void setImage(java.lang.String src)
Sets the image URI.

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.

See Also:
setImageContent(Image), setImageContent(RenderedImage)

getSrc

public java.lang.String getSrc()
Deprecated. As of release 3.5.0, it is redudant since it is the same as getImage()


setSrc

public 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)


setImageContent

public void setImageContent(org.zkoss.image.Image image)
Sets the content directly.

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.

Parameters:
image - the image to display.
See Also:
setImage(java.lang.String)

setImageContent

public void setImageContent(java.awt.image.RenderedImage image)
Sets the content directly with the rendered 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 setImageContent(org.zkoss.image.Image).

If you want more control such as different format, quality, and naming, you can use Images directly.

Since:
3.0.7

getImageContent

public org.zkoss.image.Image getImageContent()
Returns the image content set by 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.


getHoverImage

public java.lang.String getHoverImage()
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

setHoverImage

public void setHoverImage(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 setHoverImageContent(null). In other words, the last invocation of setHoverImage(java.lang.String) overrides the previous setHoverImageContent(org.zkoss.image.Image), if any.

Since:
3.5.0

getHoverImageContent

public org.zkoss.image.Image getHoverImageContent()
Returns the content of the hover image set by setHoverImageContent(Image) or setHoverImageContent(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.

Since:
5.0.8

setHoverImageContent

public void setHoverImageContent(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 setHoverImage(null). In other words, the last invocation of setHoverImageContent(org.zkoss.image.Image) overrides the previous setHoverImage(java.lang.String), if any.

Parameters:
image - the image to display.
Since:
3.5.0

setHoverImageContent

public void setHoverImageContent(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) 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.

Since:
3.5.0

isImageAssigned

public boolean isImageAssigned()
Returns whether the image is available. In other words, it return true if setImage(java.lang.String) or setImageContent(org.zkoss.image.Image) is called with non-null.


renderProperties

protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                         throws java.io.IOException
Overrides:
renderProperties in class LabelElement
Throws:
java.io.IOException

getExtraCtrl

public java.lang.Object getExtraCtrl()
Specified by:
getExtraCtrl in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
getExtraCtrl in class org.zkoss.zk.ui.HtmlBasedComponent

clone

public java.lang.Object clone()
Specified by:
clone in interface org.zkoss.zk.ui.Component
Overrides:
clone in class XulElement


Copyright © 2012. All Rights Reserved.