Package ucar.unidata.view.sounding
Class DataModelImpl
java.lang.Object
ucar.unidata.view.sounding.DataModelImpl
Provides support for adapting a JList of sounding observations to the API-s
of the sounding and wind data models. The conceptual model that this class
presents is that of a set of soundings -- a subset of which are the SELECTED
SOUNDINGS -- and of which at most one sounding is the SELECTED SOUNDING. The
soundings that constitute the set may change -- as may the selected soundings
and the selected sounding. Modifications to the soundings by users of this
class will appear to actually modify the soundings in the set.
- Version:
- $Id: DataModelImpl.java,v 1.12 2005/05/13 18:33:27 jeffmc Exp $
- Author:
- Steven R. Emmerson
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The name of the index-of-the-selected-thing property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListDataListener
(ListDataListener listener) Adds a listener for changes to the underlying list of things.void
Adds a listener for changes to the selected things.void
addPropertyChangeListener
(String name, PropertyChangeListener listener) Adds a PropertyChangeListener for a named property.protected static FlatField
Ensures that a wind profile is in cartesian coordinates.getDewPointProfile
(int index) Returns the dew-point profile at the given index.getMeanWind
(int index) Returns the mean-wind at the given index.protected MeanWindCell
getMeanWindCell
(int index) Returns the mean-wind cell at the given index.getMeanWindRef
(int index) Returns the data reference for the mean-wind at the given index.protected RAOB
getRAOB
(int index) Returns the RAOB at the given index.int
Returns the index of the selected sounding.int
getSize()
Returns the number of soundings.Field[]
getSounding
(int index) Returns the aerological sounding data at the given index.getTemperatureProfile
(int index) Returns the temperature profile at the given index.Object[]
getWindData
(int index) Returns the wind profile and mean-wind at the given index.getWindProfile
(int index) Returns the wind profile at the given index.boolean
isSelectedIndex
(int index) Indicates if the given sounding is a member of the selected soundings.void
removeListDataListener
(ListDataListener listener) Removes a listener for changes to the underlying list of things.void
Removes a listener for changes to the selected things.void
removePropertyChangeListener
(String name, PropertyChangeListener listener) Removes a PropertyChangeListener for a named property.void
Restores the selected soundings to their original values.
-
Field Details
-
SELECTED_INDEX
The name of the index-of-the-selected-thing property.- See Also:
-
-
Constructor Details
-
DataModelImpl
Constructs from a JList. The JList's data model and selection model must be in their final form. The SELECTED_INDEX property of this instance will be bound to the "selectedIndex" property of the JList and PropertyChangeEvent-s will be propagated.- Parameters:
jList
- The underlying JList whose mutable data model contains the sounding data and whose list selection model determines the selected soundings and selected sounding.
-
-
Method Details
-
getSize
public int getSize()Returns the number of soundings.- Returns:
- The number of soundings.
-
isSelectedIndex
public boolean isSelectedIndex(int index) Indicates if the given sounding is a member of the selected soundings.- Parameters:
index
- The index of the sounding.- Returns:
true
if and only if the given sounding is a member of the selected soundings.
-
getSelectedIndex
public int getSelectedIndex()Returns the index of the selected sounding.- Returns:
- The index of the selected thing or -1 if nothing is selected.
-
restoreSelectedSoundings
Restores the selected soundings to their original values. Doesn't affect unselected soundings.- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getSounding
Returns the aerological sounding data at the given index.- Parameters:
index
- The index of the sounding.- Returns:
- The aerological sounding data at the given index. The returned array has 2 elements; the first element is the temperature profile and the second element is the dew-point profile.
- Throws:
IndexOutOfBoundsException
- The index is out of range.
-
getTemperatureProfile
Returns the temperature profile at the given index.- Parameters:
index
- The index of the temperature profile.- Returns:
- The temperature profile at the given index.
- Throws:
IndexOutOfBoundsException
- The index is out of range.
-
getDewPointProfile
Returns the dew-point profile at the given index.- Parameters:
index
- The index of the dew-point profile.- Returns:
- The dew-point profile at the given index.
- Throws:
IndexOutOfBoundsException
- The index is out of range.
-
getWindData
public Object[] getWindData(int index) throws IndexOutOfBoundsException, VisADException, RemoteException Returns the wind profile and mean-wind at the given index.- Parameters:
index
- The index of the sounding.- Returns:
- The wind data at the given index. The returned array has 2 elements; the first element is the wind profile and the second element is the mean wind.
- Throws:
IndexOutOfBoundsException
- The index is out of range.VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getWindProfile
public Field getWindProfile(int index) throws IndexOutOfBoundsException, VisADException, RemoteException Returns the wind profile at the given index.- Parameters:
index
- The index of the wind profile.- Returns:
- The wind profile at the given index.
- Throws:
IndexOutOfBoundsException
- The index is out of range.VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getMeanWind
Returns the mean-wind at the given index.- Parameters:
index
- The index of the mean-wind.- Returns:
- The mean-wind at the given index.
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getMeanWindRef
Returns the data reference for the mean-wind at the given index.- Parameters:
index
- The index of the mean-wind.- Returns:
- The data reference for the mean-wind at the given index.
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
addPropertyChangeListener
Adds a PropertyChangeListener for a named property.- Parameters:
name
- The name of the property.listener
- The PropertyChangeListener to be added.
-
removePropertyChangeListener
Removes a PropertyChangeListener for a named property.- Parameters:
name
- The name of the property.listener
- The PropertyChangeListener to be removed.
-
addListSelectionListener
Adds a listener for changes to the selected things.- Parameters:
listener
- The listener for changes to the selected things.
-
removeListSelectionListener
Removes a listener for changes to the selected things.- Parameters:
listener
- The listener for changes to the selected things.
-
addListDataListener
Adds a listener for changes to the underlying list of things.- Parameters:
listener
- The listener for changes to the underlying list of things.
-
removeListDataListener
Removes a listener for changes to the underlying list of things.- Parameters:
listener
- The listener for changes to the underlying list of things.
-
getRAOB
Returns the RAOB at the given index.- Parameters:
index
- The index of the RAOB.- Returns:
- The RAOB at the given index.
- Throws:
IndexOutOfBoundsException
- The index is out of range.
-
ensureCartesianWindProfile
protected static FlatField ensureCartesianWindProfile(FlatField input) throws VisADException, RemoteException Ensures that a wind profile is in cartesian coordinates.- Parameters:
input
- Wind profile in cartesian or polar coordinates.- Returns:
- Wind profile in cartesian coordinates.
- Throws:
VisADException
- if a core VisAD failure occurs.RemoteException
- if a Java RMI failure occurs.
-
getMeanWindCell
Returns the mean-wind cell at the given index.- Parameters:
index
- The index of the mean-wind cell.- Returns:
- The mean-wind cell at the given index.
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-