Package org.zkoss.zul

Class Rating

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Disable, org.zkoss.zk.ui.ext.Readonly, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl

    public class Rating
    extends org.zkoss.zk.ui.HtmlBasedComponent
    implements org.zkoss.zk.ui.ext.Disable, org.zkoss.zk.ui.ext.Readonly
    A rating component provides a icon based rating input. The default icon is Unicode ★ star icon. Icons could be set to unicode icons by specifying Unicode. (for example: ☎) Or even Font Awesome icons with the prefix z-icon. (for example: z-icon-home) The selectedIndex decides the rating input of this component.

    Default HtmlBasedComponent.getZclass(): z-rating.

    Since:
    8.6.0
    Author:
    wenninghsu
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent

        org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl
      • Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

        org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo
    • 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

        AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
    • Constructor Summary

      Constructors 
      Constructor Description
      Rating()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getIconSclass()
      Returns the iconSclass name of this rating.
      int getMax()
      Returns the max rating of this rating component.
      java.lang.String getOrient()
      Returns the orientation of this rating component.
      org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess​(java.lang.String prop)  
      int getRating()
      Returns the rating.
      boolean isCancelable()
      Returns whether this rating component is cancelable.
      boolean isDisabled()
      Returns if this rating component is disabled.
      boolean isReadonly()
      Returns if this rating component is readonly.
      protected void renderProperties​(org.zkoss.zk.ui.sys.ContentRenderer renderer)  
      void service​(org.zkoss.zk.au.AuRequest request, boolean everError)  
      void setCancelable​(boolean cancelable)
      Sets whether to enable the cancel feature.
      void setDisabled​(boolean disabled)
      Sets whether this component is disabled, means the rating is not changeable.
      void setIconSclass​(java.lang.String iconSclass)
      Sets the iconSclass name of this rating.
      void setMax​(int max)
      Sets the max rate of this rating component.
      void setOrient​(java.lang.String orient)
      Sets the orientation of this rating component.
      void setRating​(int rating)
      Sets the rating.
      void setReadonly​(boolean readonly)
      Sets whether this component is readonly.
      • Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent

        addSclass, clone, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
      • Methods inherited from class org.zkoss.zk.ui.AbstractComponent

        addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Rating

        public Rating()
    • Method Detail

      • getIconSclass

        public java.lang.String getIconSclass()
        Returns the iconSclass name of this rating.
        Returns:
        the iconSclass name
      • setIconSclass

        public void setIconSclass​(java.lang.String iconSclass)
        Sets the iconSclass name of this rating.
        Parameters:
        iconSclass - String
      • getOrient

        public java.lang.String getOrient()
        Returns the orientation of this rating component. Default: horizontal if not specified.
        Returns:
        vertical or horizontal.
      • setOrient

        public void setOrient​(java.lang.String orient)
        Sets the orientation of this rating component. Default: horizontal if not specified.
        Parameters:
        orient - vertical or horizontal.
      • getRating

        public int getRating()
        Returns the rating.
        Returns:
        the rating input
      • setRating

        public void setRating​(int rating)
        Sets the rating.
        Parameters:
        rating -
      • isCancelable

        public boolean isCancelable()
        Returns whether this rating component is cancelable. If true, the rating could be cancelled by clicking the rated rating again. Default: true
        Returns:
        true if enabled
      • setCancelable

        public void setCancelable​(boolean cancelable)
        Sets whether to enable the cancel feature. If true, the rating could be cancel by clicking the rated rating again. Default: true
        Parameters:
        cancelable -
      • getMax

        public int getMax()
        Returns the max rating of this rating component. Default: 5
        Returns:
        max rate
      • setMax

        public void setMax​(int max)
        Sets the max rate of this rating component. Default: 5
        Parameters:
        max -
      • isDisabled

        public boolean isDisabled()
        Returns if this rating component is disabled.
        Specified by:
        isDisabled in interface org.zkoss.zk.ui.ext.Disable
        Returns:
        boolean
      • setDisabled

        public void setDisabled​(boolean disabled)
        Sets whether this component is disabled, means the rating is not changeable.
        Specified by:
        setDisabled in interface org.zkoss.zk.ui.ext.Disable
        Parameters:
        disabled -
      • isReadonly

        public boolean isReadonly()
        Returns if this rating component is readonly.
        Specified by:
        isReadonly in interface org.zkoss.zk.ui.ext.Readonly
        Returns:
        boolean
      • setReadonly

        public void setReadonly​(boolean readonly)
        Sets whether this component is readonly.
        Specified by:
        setReadonly in interface org.zkoss.zk.ui.ext.Readonly
        Parameters:
        readonly -
      • renderProperties

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

        public org.zkoss.zk.ui.sys.PropertyAccess getPropertyAccess​(java.lang.String prop)
        Specified by:
        getPropertyAccess in interface org.zkoss.zk.ui.sys.ComponentCtrl
        Overrides:
        getPropertyAccess in class org.zkoss.zk.ui.HtmlBasedComponent
      • service

        public void service​(org.zkoss.zk.au.AuRequest request,
                            boolean everError)
        Specified by:
        service in interface org.zkoss.zk.ui.sys.ComponentCtrl
        Overrides:
        service in class org.zkoss.zk.ui.HtmlBasedComponent