Re: [visad] Visad SelectRangeWidget data display format

Hi Merril-

I don't have a solution for you, but here is some other info:

The labels are drawn in the visad.browser.RangeSlider.drawLabels method which is currently private. If it were public, one could potentially override it to change the behavior. One issue is that the date strings tend to end up being longer than the values being printed now.

Another issue is that RangeSliders work with floats. For very large values (e.g. seconds since 1970-01-01), there is some loss of precision using SelectRange. In my application (IDV), we change the units to be smaller values (e.g. seconds since 2000-01-01) so there isn't a loss of precision.

Don Murray

mbradshaw3@xxxxxxxxxxxxxxx wrote:
I have added a SelectRangeWidget that is used to select time ranges with a slider. The range widget works correctly but displays the time as an integer value which is the seconds since the Epoch. I wish to display the time as a DateTime format on the the range widget. Is that possible with Visad?

            // time = RealType.getRealTypeByName("Time");
            time = RealType.getRealType("Time", 
CommonUnit.secondsSinceTheEpoch);
            rangeTime = new ScalarMap(time, Display.SelectRange );
            display.addMap( rangeTime );



 /**This function create range sliders and put them in a panel*/
          private Component createRangeSliders(){
                  JPanel p = new JPanel();
                  p.setLayout(new BoxLayout(p,BoxLayout.Y_AXIS));
                  try {
                          p.add( new SelectRangeWidget( rangeTime ) );
                  }
                  catch (Exception ex) {
                          ex.printStackTrace();
                  }
                  return p;
          }

Best Regards,

Merril Bradshaw

_______________________________________________
visad mailing list
visad@xxxxxxxxxxxxxxxx
For list information, to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/

--
*************************************************************
Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307
http://www.unidata.ucar.edu/staff/donm
*************************************************************