Class AbstractOrientation

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractOrientation()
      Creates a new instance.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected static int calculate​(int val, int max, int size)
      Returns the fraction val/max rounded to [0..size].
      int getCur()
      Returns the current value.
      int getH()
      Returns the height of the highlighted part of the image.
      int getHeight()
      Returns the total height of the image.
      int getMax()
      Returns the maximum value.
      int getMin()
      Returns the minimum value.
      int getW()
      Returns the width of the highlighted part of the image.
      int getWidth()
      Returns the total width of the image.
      int getX()
      Returns the x-coordinate of the highlighted part of the image.
      int getY()
      Returns the y-coordinate of the highlighted part of the image.
      boolean isNegativeImage()
      Returns whether the negative image should be shown.
      boolean isValid()
      Returns whether the gauge's values are valid.
      protected abstract void reCalculate()
      Recalculate the extents of the highlighted image part.
      boolean setExtends​(int width, int height)
      Sets the extends of the image.
      protected void setExtent​(int x, int y, int w, int h)
      Sets the extent of the highlighted part of the image.
      void setHasNegativeImage​(boolean hasNegativeImage)
      Sets whether the gauge can display negative images.
      boolean setValues​(int cur, int min, int max)
      Sets the gauge's values.
      • Methods inherited from class java.lang.Object

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

      • AbstractOrientation

        protected AbstractOrientation()
        Creates a new instance.
    • Method Detail

      • setHasNegativeImage

        public void setHasNegativeImage​(boolean hasNegativeImage)
        Description copied from interface: Orientation
        Sets whether the gauge can display negative images. By default negative images are not supported.
        Specified by:
        setHasNegativeImage in interface Orientation
        Parameters:
        hasNegativeImage - whether the gauge can display negative images
      • setValues

        public boolean setValues​(int cur,
                                 int min,
                                 int max)
        Description copied from interface: Orientation
        Sets the gauge's values.
        Specified by:
        setValues in interface Orientation
        Parameters:
        cur - the current value
        min - the minimum value
        max - the maximum value
        Returns:
        whether the values have been updated
      • setExtends

        public boolean setExtends​(int width,
                                  int height)
        Description copied from interface: Orientation
        Sets the extends of the image.
        Specified by:
        setExtends in interface Orientation
        Parameters:
        width - the width
        height - the height
        Returns:
        true if the size changed, false else
      • getX

        public int getX()
        Description copied from interface: Orientation
        Returns the x-coordinate of the highlighted part of the image.
        Specified by:
        getX in interface Orientation
        Returns:
        the x-coordinate
      • getY

        public int getY()
        Description copied from interface: Orientation
        Returns the y-coordinate of the highlighted part of the image.
        Specified by:
        getY in interface Orientation
        Returns:
        the y-coordinate
      • getW

        public int getW()
        Description copied from interface: Orientation
        Returns the width of the highlighted part of the image.
        Specified by:
        getW in interface Orientation
        Returns:
        the width
      • getH

        public int getH()
        Description copied from interface: Orientation
        Returns the height of the highlighted part of the image.
        Specified by:
        getH in interface Orientation
        Returns:
        the height
      • isNegativeImage

        public boolean isNegativeImage()
        Description copied from interface: Orientation
        Returns whether the negative image should be shown.
        Specified by:
        isNegativeImage in interface Orientation
        Returns:
        whether the negative image should be shown
      • isValid

        public boolean isValid()
        Description copied from interface: Orientation
        Returns whether the gauge's values are valid.
        Specified by:
        isValid in interface Orientation
        Returns:
        whether the values are valid
      • reCalculate

        protected abstract void reCalculate()
        Recalculate the extents of the highlighted image part.
      • calculate

        protected static int calculate​(int val,
                                       int max,
                                       int size)
        Returns the fraction val/max rounded to [0..size].
        Parameters:
        val - the value
        max - the range size
        size - the size of the result
        Returns:
        the fraction in pixels
      • getWidth

        public int getWidth()
        Returns the total width of the image.
        Returns:
        the width
      • getHeight

        public int getHeight()
        Returns the total height of the image.
        Returns:
        the height
      • getCur

        public int getCur()
        Returns the current value.
        Returns:
        the current value
      • getMin

        public int getMin()
        Returns the minimum value.
        Returns:
        the minimum value
      • getMax

        public int getMax()
        Returns the maximum value.
        Returns:
        the maximum value
      • setExtent

        protected void setExtent​(int x,
                                 int y,
                                 int w,
                                 int h)
        Sets the extent of the highlighted part of the image.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        w - the width
        h - the height