ucar.unidata.ui
Class TimeLengthField

java.lang.Object
  extended by ucar.unidata.ui.TimeLengthField

public class TimeLengthField
extends Object

Class TimeField is a widget that provides for showing a time length label borken down as days/hours/minutes and a dialog that allows the user to set the time length.

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

Constructor Summary
TimeLengthField(String name)
          ctor
TimeLengthField(String name, boolean isPositiveOnly)
          ctor
TimeLengthField(String name, boolean isPositiveOnly, boolean showYearsFld)
          ctor
TimeLengthField(String name, double minutes)
          ctor
TimeLengthField(String name, double minutes, boolean isPositiveOnly, boolean showYearsFld)
          ctor
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 boolean applyFields(boolean allFields)
          Apply the fields to the internal state
 JComponent getContents()
          Get the gui contents
 JComponent getFieldsComponent(boolean allFields)
          Get the gui component
 double getTime()
          Current time interval as minutes
 void setTime(double minutes)
          set the time as minutes
 boolean showDialog()
          Show the dialog
 boolean showDialog(String topMsg)
          Show the dialog
 void timeChanged()
          Signal that the time changed
 String toString()
          to string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TimeLengthField

public TimeLengthField(String name)
ctor

Parameters:
name - The name we use

TimeLengthField

public TimeLengthField(String name,
                       boolean isPositiveOnly)
ctor

Parameters:
name - The name we use
isPositiveOnly - Only show positive numbers

TimeLengthField

public TimeLengthField(String name,
                       double minutes)
ctor

Parameters:
name - The name we use
minutes - minutes

TimeLengthField

public TimeLengthField(String name,
                       boolean isPositiveOnly,
                       boolean showYearsFld)
ctor

Parameters:
name - The name
isPositiveOnly - only have positive values
showYearsFld - Also show the years field

TimeLengthField

public TimeLengthField(String name,
                       double minutes,
                       boolean isPositiveOnly,
                       boolean showYearsFld)
ctor

Parameters:
name - The name
minutes - Number of initial minutes
isPositiveOnly - only have positive values
showYearsFld - Also show the years field
Method Detail

showDialog

public boolean showDialog()
Show the dialog

Returns:
User pressed ok

getFieldsComponent

public JComponent getFieldsComponent(boolean allFields)
Get the gui component

Parameters:
allFields - ignored
Returns:
the gui

showDialog

public boolean showDialog(String topMsg)
Show the dialog

Parameters:
topMsg - If non-null show this in the dialog as a label
Returns:
User pressed ok

applyFields

public boolean applyFields(boolean allFields)
Apply the fields to the internal state

Parameters:
allFields - ignored
Returns:
everything ok

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener.

Parameters:
listener - The PropertyChangeListener to add.

getContents

public JComponent getContents()
Get the gui contents

Returns:
contents

getTime

public double getTime()
Current time interval as minutes

Returns:
time length as minutes

setTime

public void setTime(double minutes)
set the time as minutes

Parameters:
minutes - minutes

timeChanged

public void timeChanged()
Signal that the time changed


toString

public String toString()
to string

Overrides:
toString in class Object
Returns:
string