ucar.unidata.idv.ui
Class ValueSliderComponent

java.lang.Object
  extended by ucar.unidata.idv.ui.ValueSliderComponent
All Implemented Interfaces:
Removable
Direct Known Subclasses:
ValueSliderWidget

public class ValueSliderComponent
extends Object
implements Removable

A class for holding a text field and a slider for setting the some integer value

Version:
$Revision: 1.8 $
Author:
IDV Development Team

Field Summary
protected  Object callingObject
          readout for value
 
Constructor Summary
ValueSliderComponent(Object co, int min, int max, String property, String label)
          Create a ValueSliderComponent
ValueSliderComponent(Object co, int min, int max, String property, String label, float scale, boolean andSet)
          Create a ValueSliderComponent
ValueSliderComponent(Object co, int min, int max, String property, String label, float scale, boolean andSet, String tip)
          Create a ValueSliderComponent
 
Method Summary
 void doRemove()
          Remove the reference to the displayControl
 JComponent getContents(boolean withLabel)
          Get the GUI contents
 boolean getObjectHasInitialized()
          Has the calling object been initialized? Subclasses should override if necessary.
 float getValue()
          Get the value of the widget
 void logException(String msg, Exception exc)
          Shortcut to logging facility for subclasses to use
 void setEnabled(boolean enable)
          Enable or disable the widget.
 void setPaintLabels(boolean value)
          Set the property on the slider
 void setPaintTicks(boolean value)
          Set the property on the slider
 void setSnapToTicks(boolean value)
          Set the property on the slider
 void setValue(float value)
          Set the value on the widget.
 void setValue(int value)
          Set the value on the widget.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

callingObject

protected Object callingObject
readout for value

Constructor Detail

ValueSliderComponent

public ValueSliderComponent(Object co,
                            int min,
                            int max,
                            String property,
                            String label)
Create a ValueSliderComponent

Parameters:
co - calling object
min - minimum slider value
max - maximum slider value
property - Object's property to set
label - label for the widget

ValueSliderComponent

public ValueSliderComponent(Object co,
                            int min,
                            int max,
                            String property,
                            String label,
                            float scale,
                            boolean andSet)
Create a ValueSliderComponent

Parameters:
co - calling object
min - minimum slider value
max - maximum slider value
property - Object's property to set
label - label for the widget
scale - scale factor for the values
andSet - set the property on the calling object if true

ValueSliderComponent

public ValueSliderComponent(Object co,
                            int min,
                            int max,
                            String property,
                            String label,
                            float scale,
                            boolean andSet,
                            String tip)
Create a ValueSliderComponent

Parameters:
co - calling object
min - minimum slider value
max - maximum slider value
property - calling object property to set
label - label for the widget
scale - scale factor for the values
andSet - set the property on the calling object if true
tip - tool tip text for the widget
Method Detail

getContents

public JComponent getContents(boolean withLabel)
Get the GUI contents

Parameters:
withLabel - true if the component should include the label
Returns:
the component

setValue

public void setValue(int value)
Set the value on the widget.

Parameters:
value - new value

setValue

public void setValue(float value)
Set the value on the widget.

Parameters:
value - new value

getValue

public float getValue()
Get the value of the widget

Returns:
new value

setEnabled

public void setEnabled(boolean enable)
Enable or disable the widget.

Parameters:
enable - true to enable

setSnapToTicks

public void setSnapToTicks(boolean value)
Set the property on the slider

Parameters:
value - true to snap slider to ticks

setPaintTicks

public void setPaintTicks(boolean value)
Set the property on the slider

Parameters:
value - true to paint slider ticks

setPaintLabels

public void setPaintLabels(boolean value)
Set the property on the slider

Parameters:
value - true to paint slider labels

getObjectHasInitialized

public boolean getObjectHasInitialized()
Has the calling object been initialized? Subclasses should override if necessary.

Returns:
true

logException

public void logException(String msg,
                         Exception exc)
Shortcut to logging facility for subclasses to use

Parameters:
msg - error message
exc - error Exception

doRemove

public void doRemove()
Remove the reference to the displayControl

Specified by:
doRemove in interface Removable