ucar.visad.display
Class DisplayAdapter

java.lang.Object
  extended by ucar.visad.display.DisplayAdapter

public class DisplayAdapter
extends Object

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
DisplayAdapter(DisplayImpl display)
          Constructs.
 
Method Summary
 ScalarMapAdapter accept(ScalarMapAdapter adapter)
          Accepts a ScalarMapAdapter for inclusion.
 void add(ConstantMaps constantMaps)
          Adds adapted, VisAD ConstantMap(s).
 void add(DataAdapter dataAdapter)
          Adds an adapted, VisAD data object.
 Component getComponent()
          Returns the AWT component.
 int getDimensionality()
          Returns the dimensionality of the display.
 void remove(ConstantMaps constantMaps)
          Removes adapted, VisAD ConstantMaps.
 void remove(DataAdapter dataAdapter)
          Removes an adapted, VisAD data object.
 void remove(ScalarMapAdapter adapter)
          Removes an adapted, VisAD ScalarMap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DisplayAdapter

public DisplayAdapter(DisplayImpl display)
               throws DisplayException,
                      VisADException,
                      RemoteException
Constructs.

Parameters:
display - The VisAD display to use.
Throws:
DisplayException - The VisAD display is null.
VisADException - VisAD failure.
RemoteException - Java RMI failure.
Method Detail

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 with ScalarMap). If a ScalarMapAdapter was previously added, then subsequent additions result in the underlying ScalarMap 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 a PropertyChangeListener for the ScalarMapAdapter.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

public final void remove(ScalarMapAdapter adapter)
Removes an adapted, VisAD ScalarMap.

Parameters:
adapter - The ScalarMapAdapter to be removed from this instance.

add

public final void add(DataAdapter dataAdapter)
               throws VisADException,
                      RemoteException
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

public final void remove(DataAdapter dataAdapter)
                  throws VisADException,
                         RemoteException
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, VisAD ConstantMap(s).

Parameters:
constantMaps - The adapted, VisAD ConstantMaps to be added to this instance.
Throws:
BadMappingException - The addition of the ConstantMap-s would cause a DisplayRealType to have multiple values.
VisADException - VisAD failure.
RemoteException - Java RMI failure.

remove

public final void remove(ConstantMaps constantMaps)
                  throws VisADException,
                         RemoteException
Removes adapted, VisAD ConstantMaps.

Parameters:
constantMaps - The adapted, VisAD ConstantMap-s to be removed from this instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getComponent

public Component getComponent()
Returns the AWT component.

Returns:
The AWT component.