Package snap.view

Class ThumbWheel

All Implemented Interfaces:
PropChange.DoChange, XMLArchiver.Archivable

public class ThumbWheel extends View
This class has the behavior of a slider, without boundaries (so you can set values beyond the visible min and max). Furthermore, it has a 3D thumbwheel look, that is particularly nice for radial values. It also has an optional linear look, which is good for unbounded linear values.
  • Field Details

  • Constructor Details

    • ThumbWheel

      public ThumbWheel()
      Creates a new thumbwheel.
  • Method Details

    • getType

      public byte getType()
      Returns the type (radial or linear).
    • setType

      public void setType(byte aType)
      Sets the type (radial or linear).
    • getValue

      public double getValue()
      Returns the value.
    • setValue

      public void setValue(double aValue)
      Sets the value.
    • getRound

      public float getRound()
      Returns the value that thumbwheel values are rounded to.
    • setRound

      public void setRound(float aValue)
      Sets the value that thumbwheel values are rounded to.
    • getVisibleMin

      public float getVisibleMin()
      Returns the smallest value in the visible range (ie, on the left side) of the thumbhweel.
    • setVisibleMin

      public void setVisibleMin(float aValue)
      Sets the smallest value in the visible range (ie, on the left side) of the thumbhweel.
    • getVisibleMax

      public float getVisibleMax()
      Returns the largest value in the visible range (ie, on the right side) of the thumbhweel.
    • setVisibleMax

      public void setVisibleMax(float aValue)
      Sets the largest value in the visible range (ie, on the right side) of the thumbhweel.
    • getAbsoluteMin

      public float getAbsoluteMin()
      Returns the smallest value permitted by the thumbwheel (even when outside visible range).
    • setAbsoluteMin

      public void setAbsoluteMin(float aValue)
      Sets the smallest value permitted by the thumbwheel (even when outside visible range).
    • getAbsoluteMax

      public float getAbsoluteMax()
      Returns the largest value permitted by the thumbwheel (even when outside visible range).
    • setAbsoluteMax

      public void setAbsoluteMax(float aValue)
      Sets the largest value permitted by the thumbwheel (even when outside visible range).
    • getAbsoluteMode

      public byte getAbsoluteMode()
      Returns the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED).
    • setAbsoluteMode

      public void setAbsoluteMode(byte aValue)
      Sets the thumbhweel absolute mode (ABSOLUTE_BOUNDED or ABSOLUTE_WRAPPED).
    • processEvent

      protected void processEvent(ViewEvent anEvent)
      Forwards mouse events to mouse methods.
      Overrides:
      processEvent in class View
    • getValueAtPoint

      public double getValueAtPoint(Point aPoint)
      This method gives the value that corresponds to a point with respect to the given frame and the visible range. When in radial mode, the point on the thumbwheel is approximated with a power series for arcCos to get legal values for points outside of the frame.
    • isRadial

      public boolean isRadial()
      Returns whether thumbwheel is radial.
    • isLinear

      public boolean isLinear()
      Returns whether thumbwheel is linear.
    • isBounded

      public boolean isBounded()
      Returns whether thumbwheel is absolute bounded.
    • isWrapped

      public boolean isWrapped()
      Returns whether thumbwheel does absolute wrapping.
    • getVisibleRange

      public float getVisibleRange()
      Returns the extent of the thumbwheel's visible range.
    • paintFront

      protected void paintFront(Painter aPntr)
      Override to paint thumbwheel.
      Overrides:
      paintFront in class View
    • paintBack

      protected void paintBack(Painter aPntr)
      Override to suppress.
      Overrides:
      paintBack in class View
    • getDefaultFill

      public Paint getDefaultFill()
      Override to return white.
      Overrides:
      getDefaultFill in class View
    • setWidth

      public void setWidth(double aValue)
      Override to reset image.
      Overrides:
      setWidth in class View
    • setHeight

      public void setHeight(double aValue)
      Override to reset image.
      Overrides:
      setHeight in class View
    • getPropValue

      public Object getPropValue(String aPropName)
      Returns the value for given key.
      Overrides:
      getPropValue in class View
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Sets the value for given key.
      Overrides:
      setPropValue in class View
    • toXML

      public XMLElement toXML(XMLArchiver anArchiver)
      XML archival.
      Specified by:
      toXML in interface XMLArchiver.Archivable
      Overrides:
      toXML in class View
    • fromXML

      public Object fromXML(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Specified by:
      fromXML in interface XMLArchiver.Archivable
      Overrides:
      fromXML in class View