Package org.zkoss.zul

Class Rating

All Implemented Interfaces:
Serializable, Cloneable, Component, Disable, Readonly, Scope, ComponentCtrl

public class Rating extends HtmlBasedComponent implements Disable, 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:
  • Constructor Details

    • Rating

      public Rating()
  • Method Details

    • getIconSclass

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

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

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

      public void setOrient(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 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 Disable
      Parameters:
      disabled -
    • isReadonly

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

      public void setReadonly(boolean readonly)
      Sets whether this component is readonly.
      Specified by:
      setReadonly in interface Readonly
      Parameters:
      readonly -
    • renderProperties

      protected void renderProperties(ContentRenderer renderer) throws IOException
      Description copied from class: HtmlBasedComponent
      Renders the content of this component, excluding the enclosing tags and children.

      See also ZK Client-side Reference: Property Rendering

      Overrides:
      renderProperties in class HtmlBasedComponent
      Throws:
      IOException
    • getPropertyAccess

      public PropertyAccess getPropertyAccess(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 HtmlBasedComponent
      Parameters:
      prop - the name of the property
      Returns:
      null it means not to support for the property name.
    • service

      public void service(AuRequest request, boolean everError)
      Description copied from class: HtmlBasedComponent
      Processes an AU request.

      Default: it handles onClick, onDoubleClick, onRightClick onMove, onSize, onZIndex.

      Specified by:
      service in interface ComponentCtrl
      Overrides:
      service in class HtmlBasedComponent
      everError - whether any error ever occurred before processing this request.
      See Also: