Class LabelImageElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, Component, Scope, ComponentCtrl
    Direct Known Subclasses:
    A, Button, Caption, Checkbox, Comboitem, Fisheye, FooterElement, HeaderElement, Listcell, Menu, Menuitem, Nav, Navitem, Orgnode, 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.image.preload="true"/>
     </button>
     
    Or specify it onto the root component. For example,
     <window ...>
         <custom-attributes org.zkoss.zul.image.preload="true"/>
         <button .../>
     </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/>
     
    Author:
    tomyeh
    See Also:
    Serialized Form
    • 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

      • setIconSclass

        public void setIconSclass​(java.lang.String iconSclass)
        Sets the icon font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclass
        Parameters:
        iconSclass - a CSS class name for the icon font
        Since:
        7.0.0
      • setIconSclasses

        public void setIconSclasses​(java.lang.String[] iconSclasses)
        Sets multiple icons font, if iconSclasses is set, iconSclass will be ignored, iconSclasses will take precedence over iconSclass
        Parameters:
        iconSclasses - a CSS class name String array for the icon font
        Since:
        10.0.0
      • getIconSclass

        public java.lang.String getIconSclass()
        Returns the icon font
        Since:
        7.0.0
      • getIconSclasses

        public java.lang.String[] getIconSclasses()
        Returns the icon font String array
        Since:
        10.0.0
      • setIconTooltip

        public void setIconTooltip​(java.lang.String iconTooltip)
        Sets the iconTooltip, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltip
        Parameters:
        iconTooltip - a content String for iconTooltip
        Since:
        10.0.0
      • setIconTooltips

        public void setIconTooltips​(java.lang.String[] iconTooltips)
        Sets multiple iconTooltips, if iconTooltips is set, iconTooltip will be ignored, iconTooltips will take precedence over iconTooltip
        Parameters:
        iconTooltips - a content String array for iconTooltip
        Since:
        10.0.0
      • getIconTooltip

        public java.lang.String getIconTooltip()
        Returns the iconTooltip content
        Since:
        10.0.0
      • getIconTooltips

        public java.lang.String[] getIconTooltips()
        Returns the iconTooltip content String array
        Since:
        10.0.0
      • getImage

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

        Default: null.

      • 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
      • setHoverImageContent

        public void setHoverImageContent​(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
      • getPropertyAccess

        public PropertyAccess getPropertyAccess​(java.lang.String prop)
        Description copied from interface: ComponentCtrl
        Returns the corresponding property access object from the given property name, if any.
        Specified by:
        getPropertyAccess in interface ComponentCtrl
        Overrides:
        getPropertyAccess in class LabelElement
        Parameters:
        prop - the name of the property
        Returns:
        null it means not to support for the property name.
      • clone

        public java.lang.Object clone()
        Description copied from interface: Component
        Clones the component. All of its children and descendants are cloned. Also, ID are preserved.
        Specified by:
        clone in interface Component
        Overrides:
        clone in class XulElement
        Returns:
        the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.