Package ucar.visad.display
Class DisplayAdapter
java.lang.Object
ucar.visad.display.DisplayAdapter
Provides support for adapting VisAD Display-s into something that is
(hopefully) easier to use. Instances of this class have a separate thread
that updates the display. The thread runs at a lower priority than the
creating thread in order to allow the accumulation of a bunch of changes to
the display. Instances of this class also track changes to the JavaBean
properties of added
ScalarMapAdapter
s and ConstantMapAdapter
s
and modify the underlying VisAD display as necessary.- Version:
- $Revision: 1.12 $
- Author:
- Steven R. Emmerson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ScalarMapAdapter
accept
(ScalarMapAdapter adapter) Accepts a ScalarMapAdapter for inclusion.final void
add
(ConstantMaps constantMaps) Adds adapted, VisADConstantMap
(s).final void
add
(DataAdapter dataAdapter) Adds an adapted, VisAD data object.Returns the AWT component.int
Returns the dimensionality of the display.final void
remove
(ConstantMaps constantMaps) Removes adapted, VisADConstantMaps
.final void
remove
(DataAdapter dataAdapter) Removes an adapted, VisAD data object.final void
remove
(ScalarMapAdapter adapter) Removes an adapted, VisAD ScalarMap.
-
Constructor Details
-
DisplayAdapter
Constructs.- Parameters:
display
- The VisAD display to use.- Throws:
DisplayException
- The VisAD display isnull
.VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
-
Method Details
-
getDimensionality
public int getDimensionality()Returns the dimensionality of the display.- Returns:
- The dimensionality of the display (either 2 or 3).
-
accept
public final ScalarMapAdapter accept(ScalarMapAdapter adapter) throws VisADException, RemoteException Accepts a ScalarMapAdapter for inclusion. The name "accept" is used rather than "add" because this class supports the "addition" of the same ScalarMapAdapter multiple times (unlike a VisAD display withScalarMap
). If a ScalarMapAdapter was previously added, then subsequent additions result in the underlyingScalarMap
of the ScalarMapAdapter being set to that of the previously- added ScalarMapAdapter (the "controlling" ScalarMapAdapter). Otherwise, the ScalarMapAdapter is simply added and returned. In either case, this instance registers itself with the ScalarMapAdapter as aPropertyChangeListener
for theScalarMapAdapter.SCALAR_MAP
property. A change to the ScalarMapAdapter's underlying ScalarMap will cause the display to be rebuilt, if ncessary.- Parameters:
adapter
- The adapted ScalarMap to accept.- Returns:
- The "controlling" ScalarMapAdapter. The argument is returned if its ScalarMap is unique; otherwise, the previously-added ScalarMapAdapter with the same ScalarMap is returned.
- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
remove
Removes an adapted, VisAD ScalarMap.- Parameters:
adapter
- TheScalarMapAdapter
to be removed from this instance.
-
add
Adds an adapted, VisAD data object.- Parameters:
dataAdapter
- The adapted data object to be added to this instance.- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
remove
Removes an adapted, VisAD data object.- Parameters:
dataAdapter
- The adapted, VisAD data object to be removed from this instance.- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
add
public final void add(ConstantMaps constantMaps) throws BadMappingException, VisADException, RemoteException Adds adapted, VisADConstantMap
(s).- Parameters:
constantMaps
- The adapted, VisADConstantMaps
to be added to this instance.- Throws:
BadMappingException
- The addition of theConstantMap
-s would cause aDisplayRealType
to have multiple values.VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
remove
Removes adapted, VisADConstantMaps
.- Parameters:
constantMaps
- The adapted, VisADConstantMap
-s to be removed from this instance.- Throws:
VisADException
- VisAD failure.RemoteException
- Java RMI failure.
-
getComponent
Returns the AWT component.- Returns:
- The AWT component.
-