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
ScalarMapAdapters and ConstantMapAdapters
and modify the underlying VisAD display as necessary.- Version:
- $Revision: 1.12 $
- Author:
- Steven R. Emmerson
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal ScalarMapAdapteraccept(ScalarMapAdapter adapter) Accepts a ScalarMapAdapter for inclusion.final voidadd(ConstantMaps constantMaps) Adds adapted, VisADConstantMap(s).final voidadd(DataAdapter dataAdapter) Adds an adapted, VisAD data object.Returns the AWT component.intReturns the dimensionality of the display.final voidremove(ConstantMaps constantMaps) Removes adapted, VisADConstantMaps.final voidremove(DataAdapter dataAdapter) Removes an adapted, VisAD data object.final voidremove(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 underlyingScalarMapof 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 aPropertyChangeListenerfor theScalarMapAdapter.SCALAR_MAPproperty. 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- TheScalarMapAdapterto 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, VisADConstantMapsto be added to this instance.- Throws:
BadMappingException- The addition of theConstantMap-s would cause aDisplayRealTypeto 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.
-