Package org.zkoss.zul

Class DialModelScale

  • All Implemented Interfaces:
    java.io.Serializable

    public class DialModelScale
    extends java.lang.Object
    implements java.io.Serializable
    A set of information of a scale in a Dial chart. You cannot new a DialModelScale directly; instead, use DialModel.newScale() to start setting the scale.
    Author:
    henrichen
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex()  
      double getMajorTickInterval()
      Returns the interval between major tick (in lower bound and upper bound).
      int getMinorTickCount()
      returns the number of minor ticks between major tick.
      java.lang.String getNeedleColor()
      Get the needle color of this scale(in string as #RRGGBB).
      double getNeedleRadius()
      Return the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.
      int[] getNeedleRGB()
      Get the needle color of this scale in int array (0: red, 1: green, 2:blue).
      java.lang.String getNeedleType()
      Returns the needle type of this scale ("pointer" or "pin")
      DialModelRange getRange​(int index)
      Returns the color range of the specified index.
      double getScaleExtent()
      Returns angles in degree extended from the starting angle (counter clockwise is positive).
      double getScaleLowerBound()
      Returns the scale's lower bound.
      double getScaleStartAngle()
      Returns starting angle in degree associated to the sclae's lower bound (0 degree point to east, counter-clockwise is positive).
      double getScaleUpperBound()
      Returns the scale's upper bound.
      java.lang.String getText()
      Returns the text annotation of this scale.
      java.awt.Font getTextFont()
      Returns the text annotation font.
      double getTextRadius()
      Return the radius percentage(0 ~ 1) to place the text annotation.
      java.lang.String getTickColor()
      Get the tick color of this scale(in string as #RRGGBB).
      java.awt.Font getTickFont()
      Returns the tick label font.
      double getTickLabelOffset()
      Returns the radius offset in percentage(0 ~ 1) between the tick and tick label.
      double getTickRadius()
      Return the radius percentage(0 ~ 1) to place the tick label.
      int[] getTickRGB()
      Get the tick color of this scale in int array (0: red, 1: green, 2:blue).
      double getValue()
      Get the value
      double getValueAngle()
      Return the angle to place the value (counter clockwise is positive).
      java.awt.Font getValueFont()
      Returns the value font.
      double getValueRadius()
      Return the radius percentage(0 ~ 1) to place the value.
      DialModelRange newRange​(double lower, double upper, java.lang.String color, double innerRadius, double outerRadius)
      Setup the DailModel range.
      int rangeSize()
      Returns the number of ranges associated with this scale.
      void removeRange​(DialModelRange range)
      Removes the specified range from this scale.
      void setNeedleColor​(java.lang.String color)
      Set the needle color.
      void setNeedleRadius​(double radius)
      Sets the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.
      void setNeedleType​(java.lang.String type)
      Sets the needle type of this scale ("pointer" or "pin")
      void setScale​(double lowerBound, double upperBound, double startAngle, double extent, double majorTickInterval, int minorTickCount)
      Sets the scale information of this DialModelScale.
      void setText​(java.lang.String text)
      Sets the text annotation of this scale; e.g.
      void setTextFont​(java.awt.Font font)
      Sets the text annotation font.
      void setTextRadius​(double radius)
      Sets the radius percentage(0 ~ 1) to place the text annotation.
      void setTickColor​(java.lang.String color)
      Set the tick color.
      void setTickFont​(java.awt.Font font)
      Sets the tick label font.
      void setTickLabelOffset​(double tickLabelOffset)
      Sets the radius offset in percentage(0 ~ 1) between the tick and tick label.
      void setTickRadius​(double radius)
      Sets the radius percentage(0 ~ 1) to place the tick label.
      void setValue​(double val)  
      void setValueAngle​(double angle)
      Sets the angle in degree to place the value (counter clockwise is positive).
      void setValueFont​(java.awt.Font font)
      Sets the value font.
      void setValueRadius​(double radius)
      Sets the radius percentage(0 ~ 1) to place the value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getIndex

        public int getIndex()
      • getValue

        public double getValue()
        Get the value
      • setValue

        public void setValue​(double val)
      • getText

        public java.lang.String getText()
        Returns the text annotation of this scale.
      • setText

        public void setText​(java.lang.String text)
        Sets the text annotation of this scale; e.g. "Temperature" for a temperature dial meter.
        Parameters:
        text - text annotation(subtitle) of this scale.
      • getTextFont

        public java.awt.Font getTextFont()
        Returns the text annotation font.
        Returns:
        the text annotation font.
      • setTextFont

        public void setTextFont​(java.awt.Font font)
        Sets the text annotation font.
        Parameters:
        font - the text annotation font.
      • getTextRadius

        public double getTextRadius()
        Return the radius percentage(0 ~ 1) to place the text annotation.
        Returns:
        the radius percentage(0 ~ 1) to place the text annotation.
      • setTextRadius

        public void setTextRadius​(double radius)
        Sets the radius percentage(0 ~ 1) to place the text annotation.
        Parameters:
        radius - radius percentage(0 ~ 1) to place the text annotation.
      • getValueFont

        public java.awt.Font getValueFont()
        Returns the value font.
        Returns:
        the value font.
      • setValueFont

        public void setValueFont​(java.awt.Font font)
        Sets the value font.
        Parameters:
        font - the value font.
      • getValueRadius

        public double getValueRadius()
        Return the radius percentage(0 ~ 1) to place the value.
        Returns:
        the radius percentage(0 ~ 1) to place the value.
      • setValueRadius

        public void setValueRadius​(double radius)
        Sets the radius percentage(0 ~ 1) to place the value.
        Parameters:
        radius - radius percentage(0 ~ 1) to place the value.
      • getValueAngle

        public double getValueAngle()
        Return the angle to place the value (counter clockwise is positive).
        Returns:
        the angle to place the value (counter clockwise is positive).
      • setValueAngle

        public void setValueAngle​(double angle)
        Sets the angle in degree to place the value (counter clockwise is positive).
        Parameters:
        angle - angle in degree to place the value (counter clockwise is positive).
      • setScale

        public void setScale​(double lowerBound,
                             double upperBound,
                             double startAngle,
                             double extent,
                             double majorTickInterval,
                             int minorTickCount)
        Sets the scale information of this DialModelScale.
        Parameters:
        lowerBound - lower bound of this scale.
        upperBound - upper bound of this scale.
        startAngle - starting angle in degree associated to the sclae's lower bound(0 degree point to east, counter-clockwise is positive).
        extent - angles in degree extended from the starting angle (counter clockwise is positive).
        majorTickInterval - the interval between major tick (in lower bound and upper bound).
        minorTickCount - the number of minor ticks between major tick.
      • getScaleLowerBound

        public double getScaleLowerBound()
        Returns the scale's lower bound.
        Returns:
        the scale's lower bound.
      • getScaleUpperBound

        public double getScaleUpperBound()
        Returns the scale's upper bound.
        Returns:
        the scale's upper bound.
      • getScaleStartAngle

        public double getScaleStartAngle()
        Returns starting angle in degree associated to the sclae's lower bound (0 degree point to east, counter-clockwise is positive).
        Returns:
        starting angle in degree associated to the sclae's lower bound (0 degree point to east, counter-clockwise is positive).
      • getScaleExtent

        public double getScaleExtent()
        Returns angles in degree extended from the starting angle (counter clockwise is positive).
        Returns:
        angles in degree extended from the starting angle (counter clockwise is positive).
      • getMajorTickInterval

        public double getMajorTickInterval()
        Returns the interval between major tick (in lower bound and upper bound).
        Returns:
        the interval between major tick (in lower bound and upper bound).
      • getMinorTickCount

        public int getMinorTickCount()
        returns the number of minor ticks between major tick.
        Returns:
        the number of minor ticks between major tick.
      • getTickFont

        public java.awt.Font getTickFont()
        Returns the tick label font.
        Returns:
        the tick label font.
      • setTickFont

        public void setTickFont​(java.awt.Font font)
        Sets the tick label font.
        Parameters:
        font - the tick label font.
      • getTickRadius

        public double getTickRadius()
        Return the radius percentage(0 ~ 1) to place the tick label.
        Returns:
        the radius percentage(0 ~ 1) to place the tick label.
      • setTickRadius

        public void setTickRadius​(double radius)
        Sets the radius percentage(0 ~ 1) to place the tick label.
        Parameters:
        radius - radius percentage(0 ~ 1) to place the tick label.
      • getTickLabelOffset

        public double getTickLabelOffset()
        Returns the radius offset in percentage(0 ~ 1) between the tick and tick label.
        Returns:
        the radius offset in percentage(0 ~ 1) between the tick and tick label.
      • setTickLabelOffset

        public void setTickLabelOffset​(double tickLabelOffset)
        Sets the radius offset in percentage(0 ~ 1) between the tick and tick label.
        Parameters:
        tickLabelOffset - the radius offset in percentage(0 ~ 1) between the tick and tick label.
      • setTickColor

        public void setTickColor​(java.lang.String color)
        Set the tick color.
        Parameters:
        color - in #RRGGBB format (hexadecimal).
      • getTickColor

        public java.lang.String getTickColor()
        Get the tick color of this scale(in string as #RRGGBB). null means default.
      • getTickRGB

        public int[] getTickRGB()
        Get the tick color of this scale in int array (0: red, 1: green, 2:blue). null means default.
      • newRange

        public DialModelRange newRange​(double lower,
                                       double upper,
                                       java.lang.String color,
                                       double innerRadius,
                                       double outerRadius)
        Setup the DailModel range.
        Parameters:
        lower - the lower bound in the scale.
        upper - the upper bound in the scale.
        color - the color in #RRGGBB format (hexadecimal); default to blue.
        innerRadius - the inner radius percentage(0 ~ 1) of the range; default to 0.7.
        outerRadius - the outer radius percentage(0 ~ 1) of the range; default to 0.8;
      • rangeSize

        public int rangeSize()
        Returns the number of ranges associated with this scale.
        Returns:
        the number of ranges associated with this scale.
      • getRange

        public DialModelRange getRange​(int index)
        Returns the color range of the specified index.
        Parameters:
        index - the specified index.
        Returns:
        the color range of the specified index.
      • removeRange

        public void removeRange​(DialModelRange range)
        Removes the specified range from this scale.
        Parameters:
        range - the range to be removed.
      • getNeedleType

        public java.lang.String getNeedleType()
        Returns the needle type of this scale ("pointer" or "pin")
        Returns:
        the needle type of this scale ("pointer" or "pin")
      • setNeedleType

        public void setNeedleType​(java.lang.String type)
        Sets the needle type of this scale ("pointer" or "pin")
        Parameters:
        type - the needle type of this scale ("pointer" or "pin")
      • setNeedleColor

        public void setNeedleColor​(java.lang.String color)
        Set the needle color.
        Parameters:
        color - in #RRGGBB format (hexadecimal).
      • getNeedleColor

        public java.lang.String getNeedleColor()
        Get the needle color of this scale(in string as #RRGGBB). null means default.
      • getNeedleRGB

        public int[] getNeedleRGB()
        Get the needle color of this scale in int array (0: red, 1: green, 2:blue). null means default.
      • setNeedleRadius

        public void setNeedleRadius​(double radius)
        Sets the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.
        Parameters:
        radius - the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.
      • getNeedleRadius

        public double getNeedleRadius()
        Return the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.
        Returns:
        the radius percentage(0 ~ 1) of the scale's needle; default to 0.9.