gov.noaa.pmel.swing
Class JSlider2Date

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--gov.noaa.pmel.swing.JSlider2Date
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JSlider2Date
extends java.awt.Container
implements java.io.Serializable

Class provides graphical and textual input of a time range. Time calculations are performed using GeoDate. Minimum value are required to be less than or equal to the maximum value. Support has been added for java.util.Date, for both setting the range and getting and setting the slider values.

Version:
$Revision: 1.8 $, $Date: 2000/11/12 19:22:09 $
Author:
Donald Denbo
See Also:
JSlider2, GeoDate, Serialized Form

Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JSlider2Date()
          Default constructor.
JSlider2Date(boolean twoHandles)
          Constructs a single or double time slider.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener l)
          Add a property change listener.
 boolean getAlwaysPost()
          Get the always post flag for the slider.
 GeoDate getEndValue()
           
 java.lang.String getFormat()
          Get the format for the slider range label.
 int getHandleSize()
          Get the current slider handle size.
 java.util.Date getMaxDate()
          Get the maximum for the range.
 java.awt.Dimension getMaximumSize()
           
 GeoDate getMaxRange()
          Get the maximum for the range.
 GeoDate getMaxValue()
          Get the maximum handle value
 java.util.Date getMinDate()
          Get the minimum for the range.
 java.awt.Dimension getMinimumSize()
           
 GeoDate getMinRange()
          Get the minimum for the range.
 GeoDate getMinValue()
          Get the minimum handle value
 java.awt.Dimension getPreferredSize()
           
 TimeRange getRange()
          Get the slider range.
 boolean getShowBorder()
          Get border status for the slider.
 GeoDate getStartValue()
           
 boolean getTwoHandles()
          Get the two handle flag.
 boolean isTwoHandles()
          Get the two handle flag.
static void main(java.lang.String[] args)
           
 void removePropertyChangeListener(java.beans.PropertyChangeListener l)
          Remove a property change listener.
 void reset()
          Reset the slider handles
 void setAlwaysPost(boolean ap)
          Set the always post flag for the slider.
 void setEndValue(GeoDate tmax)
           
 void setFormat(java.lang.String frmt)
          Set the format for the slider range label.
 void setHandleSize(int sz)
          Set the handle size for the slider.
 void setMaxDate(java.util.Date dmax)
          Set the maximum for the range.
 void setMaxRange(GeoDate max)
          Set the maximum for the range.
 void setMaxValue(GeoDate tmax)
          Set the maximum handle value.
 void setMinDate(java.util.Date dmin)
          Set the minimum for the range.
 void setMinRange(GeoDate min)
          Set the minimum for the range.
 void setMinValue(GeoDate tmin)
          Set the minimum handle value.
 void setRange(java.util.Date dmin, java.util.Date dmax)
          Set the range for the slider.
 void setRange(GeoDate min, GeoDate max)
          Set the range for the slider.
 void setRange(TimeRange range)
          Set the range for the slider.
 void setShowBorder(boolean sb)
          Show a border around the slider.
 void setSize(java.awt.Dimension dim)
           
 void setSize(int w, int h)
           
 void setStartValue(GeoDate tmin)
           
 void setTwoHandles(boolean th)
          Set the two handle mode.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addNotify, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getAccessibleContext, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSlider2Date

public JSlider2Date()
Default constructor. The default creates two handles.


JSlider2Date

public JSlider2Date(boolean twoHandles)
Constructs a single or double time slider.

Parameters:
twoHandles - if true create two handles
Method Detail

setRange

public void setRange(GeoDate min,
                     GeoDate max)
Set the range for the slider. The minimum value must be less than the maximum value.

Parameters:
min - minimum value
max - maximum value

setRange

public void setRange(java.util.Date dmin,
                     java.util.Date dmax)
Set the range for the slider. The minimum value must be less than the maximum value.


setRange

public void setRange(TimeRange range)
Set the range for the slider. The minimum value must be less than the maximum value.

Parameters:
range - slider time range

getRange

public TimeRange getRange()
Get the slider range.

Returns:
slider range

setMinRange

public void setMinRange(GeoDate min)
Set the minimum for the range.

Parameters:
min - minimum range value

getMinRange

public GeoDate getMinRange()
Get the minimum for the range.

Returns:
minimum range value

setMaxRange

public void setMaxRange(GeoDate max)
Set the maximum for the range.

Parameters:
max - maximum range value

getMaxRange

public GeoDate getMaxRange()
Get the maximum for the range.

Returns:
maximum range value

reset

public void reset()
Reset the slider handles


setTwoHandles

public void setTwoHandles(boolean th)
Set the two handle mode.

Parameters:
th - if true set two handles

getTwoHandles

public boolean getTwoHandles()
Get the two handle flag.

Returns:
true if two handles

isTwoHandles

public boolean isTwoHandles()
Get the two handle flag.

Returns:
true if two handles

setMinDate

public void setMinDate(java.util.Date dmin)
Set the minimum for the range.

Parameters:
dmin - minimum range value

getMinDate

public java.util.Date getMinDate()
Get the minimum for the range.


setMaxDate

public void setMaxDate(java.util.Date dmax)
Set the maximum for the range.

Parameters:
dmax - maximum range value

getMaxDate

public java.util.Date getMaxDate()
Get the maximum for the range.


getStartValue

public GeoDate getStartValue()

getEndValue

public GeoDate getEndValue()

setStartValue

public void setStartValue(GeoDate tmin)

setEndValue

public void setEndValue(GeoDate tmax)

setMinValue

public void setMinValue(GeoDate tmin)
Set the minimum handle value.

Parameters:
tmin - minimum handle value

setMaxValue

public void setMaxValue(GeoDate tmax)
Set the maximum handle value.

Parameters:
tmax - maximum handle value

getMinValue

public GeoDate getMinValue()
Get the minimum handle value

Returns:
minimum handle value

getMaxValue

public GeoDate getMaxValue()
Get the maximum handle value

Returns:
maximum handle value

setFormat

public void setFormat(java.lang.String frmt)
Set the format for the slider range label.

Parameters:
frmt - Format in GeoDate syntax
See Also:
GeoDate

getFormat

public java.lang.String getFormat()
Get the format for the slider range label.

Returns:
the format in GeoDate syntax
See Also:
GeoDate

setShowBorder

public void setShowBorder(boolean sb)
Show a border around the slider.

Parameters:
sb - if true show the border

getShowBorder

public boolean getShowBorder()
Get border status for the slider.

Returns:
true if border is showing

setHandleSize

public void setHandleSize(int sz)
Set the handle size for the slider.

Parameters:
sz - handle size in pixels

getHandleSize

public int getHandleSize()
Get the current slider handle size.

Returns:
handle size in pixels

setAlwaysPost

public void setAlwaysPost(boolean ap)
Set the always post flag for the slider. If true any motion of the slider will fire a property change, if false a property change is only caused when the mouse button is released.

Parameters:
ap - if true always post

getAlwaysPost

public boolean getAlwaysPost()
Get the always post flag for the slider.

Returns:
true if the slider will always post

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property change listener. The properties that fire a property change are "minValue" and "maxValue". The old and new GeoDate objects are set.

Overrides:
addPropertyChangeListener in class java.awt.Container
Parameters:
l - property change listener

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a property change listener.

Overrides:
removePropertyChangeListener in class java.awt.Component
Parameters:
l - property change listener

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Container

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Container

getMaximumSize

public java.awt.Dimension getMaximumSize()
Overrides:
getMaximumSize in class java.awt.Container

setSize

public void setSize(java.awt.Dimension dim)
Overrides:
setSize in class java.awt.Component

setSize

public void setSize(int w,
                    int h)
Overrides:
setSize in class java.awt.Component

main

public static void main(java.lang.String[] args)


Send comments about the Scientific Graphics toolkit to Donald.W.Denbo@noaa.gov. For more information about Java Development in the EPIC Group see the EPIC Software Page
Generated on October 9 2003