Package org.zkoss.zul

Class Comboitem

    • Constructor Detail

      • Comboitem

        public Comboitem()
      • Comboitem

        public Comboitem​(java.lang.String label)
      • Comboitem

        public Comboitem​(java.lang.String label,
                         java.lang.String image)
    • Method Detail

      • setDisabled

        public void setDisabled​(boolean disabled)
        Sets whether it is disabled.
        Specified by:
        setDisabled in interface Disable
        Since:
        3.0.1
      • isDisabled

        public boolean isDisabled()
        Returns whether it is disabled.

        Default: false.

        Specified by:
        isDisabled in interface Disable
        Since:
        3.0.1
      • getDescription

        public java.lang.String getDescription()
        Returns the description (never null). The description is used to provide extra information such that users is easy to make a selection.

        Default: "".

        Deriving class can override it to return whatever it wants other than null.

      • setDescription

        public void setDescription​(java.lang.String desc)
        Sets the description.
      • getContent

        public java.lang.String getContent()
        Returns the embedded content (i.e., HTML tags) that is shown as part of the description.

        It is useful to show the description in more versatile way.

        Since:
        3.0.0
        See Also:
        getDescription()
      • setContent

        public void setContent​(java.lang.String content)
        Sets the embedded content (i.e., HTML tags) that is shown as part of the description.

        It is useful to show the description in more versatile way.

        Default: empty ("").

        Deriving class can override it to return whatever it wants other than null.

        Security Note

        Unlike other methods, the content assigned to this method is generated directly to the browser without escaping. Thus, it is better not to have something input by the user to avoid any XSS attach.

        Note: since 10.0.0, the content is sanitized by default to avoid XSS attack, and please don't use JavaScript in the content.

        Since:
        3.0.0
        See Also:
        setDescription(java.lang.String)
      • setValue

        public <T> void setValue​(T value)
        Associate the value with this combo item. The value is application dependent. It can be anything.
        Since:
        2.4.0
        See Also:
        Combobox.getSelectedItem(), getValue()
      • getIndex

        public int getIndex()
        Returns the index of this Comboitem.
        Since:
        6.0.0
      • setLabel

        public void setLabel​(java.lang.String label)
        Description copied from class: LabelElement
        Sets the label.

        If label is changed, the whole component is invalidate. Thus, you want to smart-update, you have to override this method.

        Overrides:
        setLabel in class LabelElement
      • 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 LabelImageElement
        Returns:
        the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.