RangeSlider extension

Hello,

I have been using VisAD for visualization apps and
I really like it.  For one situation I wanted
a RangeSlider that would only allow endpoints
from a range of tickmarked values, such as 1.
to 100. in steps of 3.0.

The most obvious way to do this involved a
small change to a private method in the current
source for RangeSlider.  In the main class I
replaced:
  private float gripToValue(int pos, int width) {
    return (((maxLimit - minLimit) * ((float) (pos -
GRIP_WIDTH))) /
      (float) (width - (GRIP_WIDTH * 2))) + minLimit;
  }

With:
  private float gripToValue(int pos, int width) {
    return  adjustValue( (((maxLimit - minLimit) *
((float) (pos - GRIP_WIDTH))) /
      (float) (width - (GRIP_WIDTH * 2))) + minLimit
);
  }
  public float adjustValue(float val) { return val ; }

And this allowed me to do what I need in a subclass.
But this means that I need to include the original 
RangeSlider source, and to maintain it if it changes
in future versions of VisAD.

Is there a better way to create the RangeSlider I
want that would not involve future code maintaince?
Or would it be possible to have this sort of change
incorporated into the standard distribution?

Thanks,
Paul

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: