ucar.visad.display
Class CompositeDisplayable

java.lang.Object
  extended by ucar.visad.display.Displayable
      extended by ucar.visad.display.CompositeDisplayable
Direct Known Subclasses:
AerologicalDisplay.DisplayablePseudoAdiabaticTrajectory, MeanWindSet, PseudoAdiabaticDisplayable, RadarGrid, SelectorDisplayable, Sounding, SoundingSet, WindProfile, WindProfileSet

public class CompositeDisplayable
extends Displayable

Supports composition of a list of Displayable-s into a single Displayable.

A change to the list of Displayable-s of an instance of this class fires a javax.swing.event.ListDataEvent.

Version:
$Revision: 1.50 $
Author:
Steven R. Emmerson

Field Summary
static int cnt
          _more_
 String label
          _more_
 
Fields inherited from class ucar.visad.display.Displayable
DISPLAY, parent, SCALAR_MAP_SET
 
Constructor Summary
  CompositeDisplayable()
          Constructs from nothing.
protected CompositeDisplayable(CompositeDisplayable that)
          Constructs from another instance.
  CompositeDisplayable(LocalDisplay display)
          Constructs from an initial VisAD display.
  CompositeDisplayable(String lbl)
          _more_
 
Method Summary
 ConstantMap addConstantMap(ConstantMap map)
          Associates a ConstantMap with this Displayable.
 void addDisplayable(Displayable displayable)
          Adds a Displayable to the composite.
 void addListDataListener(ListDataListener listener)
          Adds a listener for list-data events.
 void clearDisplayables()
          Removes all displayables from this composite -- causing them to be removed from the VisAD display.
 Displayable cloneForDisplay()
          Returns a clone of this instance suitable for another VisAD display.
 void debug()
          _more_
protected  void destroy()
          Called when the displayable is removed from a display master
 void destroyAll()
          _more_
 int displayableCount()
          Gets the current number of displayables.
protected  void fireListDataContentsChanged(int index0, int index1)
          Invokes the contentsChanged() method of all registered ListDataListener-s.
protected  void fireListDataIntervalAdded(int index0, int index1)
          Invokes the intervalAdded() method of all registered ListDataListener-s.
protected  void fireListDataIntervalRemoved(int index0, int index1)
          Invokes the intervalRemoved() method of all registered ListDataListener-s.
 Set getAnimationSet(RealType aniType)
          Returns the set of values for the given aniType if the contained Data object adapted by this DisplayableData have any data of that type.
 Displayable getDisplayable(int index)
          Gets a Displayable of the composite.
 int indexOf(Displayable displayable)
          Gets the index of the particular Displayable.
 Iterator iterator()
          Obtains an Iterator over the children of this composite.
 Displayable lastDisplayable()
          Obtains the last displayable added to this composite.
protected  void myAddDataReferences()
          Adds DataReference-s to the associated display.
protected  void myRemoveDataReferences()
          Removes this instance's DataReference-s from the associated VisAD display.
 boolean removeDisplayable(Displayable displayable)
          Removes a Displayable from the composite.
 Displayable removeDisplayable(int index)
          Removes a Displayable from the composite.
 void removeListDataListener(ListDataListener listener)
          Removes a listener for list-data events.
 void setAdjustFlow(boolean adjust)
          Sets whether flows are adjusted.
 void setColor(Color c)
          Sets the color of the children
 void setColorPalette(float[][] c)
          Sets the color table of the children.
 void setColorUnit(Unit unit)
          Sets the unit to be used for colors on all contained children
 void setConstantPosition(double value, DisplayRealType type)
          Set the z position to given value
 void setDisplay(LocalDisplay display)
          Sets the associated VisAD display.
 void setDisplayable(int index, Displayable displayable)
          Sets a Displayable of the composite.
protected  void setDisplayMaster(DisplayMaster master)
          _more_
 void setDisplayUnit(Unit unit)
          Sets the unit on all contained children.
 void setLineWidth(float width)
          Sets the line width of the children.
 void setPointMode(boolean usePoints)
          Set the flags for whether the Displayable displays data as points.
 void setPointSize(float size)
          Sets the point size of the children
 void setSelectedRange(double low, double hi)
          Set the range of the selected data on each of the children displayables.
 void setUseFastRendering(boolean fastRender)
          Set the flags for whether the Displayable uses it's methods to render quickly (eg, not account for projection seams).
 void setUseTimesInAnimation(boolean value)
          Set the UseTimesInAnimation property.
 void setVisible(boolean visible)
          Sets the visibility of this Displayable.
 void setVisible(boolean visible, int index)
          Sets the visibility of an individual child.
 void setVisible(boolean visible, int lowerIndex, int upperIndex)
          Sets the visibility of an interval of children.
 void toFront()
          Brings all the children to front.
 String toString()
          Returns a string representation of this composite.
 
Methods inherited from class ucar.visad.display.Displayable
addConstantMaps, addDataReferences, addPropertyChangeListener, addPropertyChangeListener, addRefsInvoked, addScalarMap, addScalarMaps, applyColorUnit, applyDisplayUnit, checkUnit, combineConstantMaps, firePropertyChange, firePropertyChange, fireScalarMapSetChange, getColorUnit, getConstantMaps, getData, getDisplay, getDisplayMaster, getDisplayUnit, getPointMode, getScalarMap, getScalarMap, getScalarMap, getScalarMapSet, getUseFastRendering, getUseTimesInAnimation, getVisible, hasDataObject, isActive, isUnitCompatible, isVisible, logException, myAddConstantMaps, removeConstantMap, removeDataReferences, removePropertyChangeListener, removePropertyChangeListener, removeScalarMap, replaceScalarMap, setColorPalette, setContourInfo, setDisplayActive, setDisplayInactive, setOverrideAnimationSet, setOverrideAnimationSet, setParent, setRangeForColor, setRangeForColor, setScalarMapSet, setSelectedRange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

label

public String label
_more_


cnt

public static int cnt
_more_

Constructor Detail

CompositeDisplayable

public CompositeDisplayable()
                     throws RemoteException,
                            VisADException
Constructs from nothing.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

CompositeDisplayable

public CompositeDisplayable(String lbl)
                     throws RemoteException,
                            VisADException
_more_

Parameters:
lbl - _more_
Throws:
RemoteException - _more_
VisADException - _more_

CompositeDisplayable

public CompositeDisplayable(LocalDisplay display)
                     throws RemoteException,
                            VisADException
Constructs from an initial VisAD display.

Parameters:
display - The VisAD display.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

CompositeDisplayable

protected CompositeDisplayable(CompositeDisplayable that)
                        throws VisADException,
                               RemoteException
Constructs from another instance. The Displayable-s and ConstantMap-s are copied from the other instance. The list of ListDataListener-s, however, is empty.

Parameters:
that - The other instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
Method Detail

addListDataListener

public void addListDataListener(ListDataListener listener)
Adds a listener for list-data events.

Parameters:
listener - The listener for list-data events.

removeListDataListener

public void removeListDataListener(ListDataListener listener)
Removes a listener for list-data events.

Parameters:
listener - The listener for list-data events.

addDisplayable

public void addDisplayable(Displayable displayable)
                    throws RemoteException,
                           VisADException
Adds a Displayable to the composite.

Parameters:
displayable - The Displayable to be added.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
See Also:
setDisplayable(int, ucar.visad.display.Displayable)

setDisplayable

public void setDisplayable(int index,
                           Displayable displayable)
                    throws RemoteException,
                           VisADException
Sets a Displayable of the composite. The Displayable will receive the ConstantMap-s associated with this instance. The ScalarMap-s of the Displayable will be added to this instance. The "visible" property of the Displayable will be unaffected.

Parameters:
index - The index of the Displayable.
displayable - The Displayable to be added.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

getDisplayable

public Displayable getDisplayable(int index)
                           throws IndexOutOfBoundsException
Gets a Displayable of the composite.

Parameters:
index - The position that contains the Displayable. Must be non-negative and less than the number of Displayable-s.
Returns:
The Displayable at the given position.
Throws:
IndexOutOfBoundsException - Invalid index.

removeDisplayable

public boolean removeDisplayable(Displayable displayable)
                          throws VisADException,
                                 RemoteException
Removes a Displayable from the composite.

Parameters:
displayable - The Displayable to be removed.
Returns:
true if and only if this composite contained the specified Displayable.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

destroy

protected void destroy()
                throws RemoteException,
                       VisADException
Called when the displayable is removed from a display master

Overrides:
destroy in class Displayable
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

removeDisplayable

public Displayable removeDisplayable(int index)
                              throws RemoteException,
                                     VisADException
Removes a Displayable from the composite.

Parameters:
index - The index of the displayable to be removed.
Returns:
The given Displayable.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

iterator

public Iterator iterator()
Obtains an Iterator over the children of this composite.

Returns:
An Iterator over the children of this composite.

setDisplay

public void setDisplay(LocalDisplay display)
                throws RemoteException,
                       VisADException
Sets the associated VisAD display.

Overrides:
setDisplay in class Displayable
Parameters:
display - The associated VisAD display.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.
See Also:
Displayable.removeDataReferences()

setDisplayMaster

protected void setDisplayMaster(DisplayMaster master)
                         throws VisADException,
                                RemoteException
_more_

Overrides:
setDisplayMaster in class Displayable
Parameters:
master - _more_
Throws:
RemoteException - _more_
VisADException - _more_

myAddDataReferences

protected final void myAddDataReferences()
                                  throws VisADException,
                                         RemoteException
Adds DataReference-s to the associated display.

Specified by:
myAddDataReferences in class Displayable
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

myRemoveDataReferences

protected final void myRemoveDataReferences()
                                     throws VisADException,
                                            RemoteException
Removes this instance's DataReference-s from the associated VisAD display.

Specified by:
myRemoveDataReferences in class Displayable
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

addConstantMap

public ConstantMap addConstantMap(ConstantMap map)
                           throws VisADException,
                                  RemoteException
Associates a ConstantMap with this Displayable.

Overrides:
addConstantMap in class Displayable
Parameters:
map - A ConstantMap to be associated with this Displayable.
Returns:
The ConstantMap (as a convenience).
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

debug

public void debug()
_more_


setVisible

public void setVisible(boolean visible)
                throws RemoteException,
                       VisADException
Sets the visibility of this Displayable.

Overrides:
setVisible in class Displayable
Parameters:
visible - If true and this composite's addScalarMaps() and addDataReferences() methods have been invoked, then the composite will be made visible; otherwise, if false, then it is or will become invisible.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setVisible

public void setVisible(boolean visible,
                       int lowerIndex,
                       int upperIndex)
                throws RemoteException,
                       VisADException
Sets the visibility of an interval of children.

Parameters:
visible - Whether or not to display the interval of children.
lowerIndex - The lower index of the interval.
upperIndex - The upper index of the interval.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setUseFastRendering

public void setUseFastRendering(boolean fastRender)
                         throws VisADException,
                                RemoteException
Set the flags for whether the Displayable uses it's methods to render quickly (eg, not account for projection seams).

Overrides:
setUseFastRendering in class Displayable
Parameters:
fastRender - Should the rendering be quick (and possibly inaccurate)
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setPointMode

public void setPointMode(boolean usePoints)
                  throws VisADException,
                         RemoteException
Set the flags for whether the Displayable displays data as points.

Overrides:
setPointMode in class Displayable
Parameters:
usePoints - true to display as points
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setConstantPosition

public void setConstantPosition(double value,
                                DisplayRealType type)
                         throws VisADException,
                                RemoteException
Set the z position to given value

Overrides:
setConstantPosition in class Displayable
Parameters:
value - The value
type - The type
Throws:
RemoteException - On badness
VisADException - On badness

toFront

public void toFront()
             throws RemoteException,
                    VisADException
Brings all the children to front.

Overrides:
toFront in class Displayable
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setColor

public void setColor(Color c)
              throws RemoteException,
                     VisADException
Sets the color of the children

Overrides:
setColor in class Displayable
Parameters:
c - The color.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setUseTimesInAnimation

public void setUseTimesInAnimation(boolean value)
                            throws RemoteException,
                                   VisADException
Set the UseTimesInAnimation property.

Overrides:
setUseTimesInAnimation in class Displayable
Parameters:
value - The new value for UseTimesInAnimation
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setAdjustFlow

public void setAdjustFlow(boolean adjust)
                   throws RemoteException,
                          VisADException
Sets whether flows are adjusted. Used by displays that don't support this.

Overrides:
setAdjustFlow in class Displayable
Parameters:
adjust - true to adjust
Throws:
RemoteException - Java RMI failure.
VisADException - VisAD failure.

setDisplayUnit

public void setDisplayUnit(Unit unit)
                    throws RemoteException,
                           VisADException
Sets the unit on all contained children.

Overrides:
setDisplayUnit in class Displayable
Parameters:
unit - The display unit to use.
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setSelectedRange

public void setSelectedRange(double low,
                             double hi)
                      throws RemoteException,
                             VisADException
Set the range of the selected data on each of the children displayables.

Overrides:
setSelectedRange in class Displayable
Parameters:
low - The minimum value of the selected range
hi - The maximum value of the selected range
Throws:
VisADException - if a VisADFailure occurs.
RemoteException - if a Java RMI failure occurs.

setColorUnit

public void setColorUnit(Unit unit)
                  throws RemoteException,
                         VisADException
Sets the unit to be used for colors on all contained children

Overrides:
setColorUnit in class Displayable
Parameters:
unit - The display unit to use.
Throws:
RemoteException
VisADException

setPointSize

public void setPointSize(float size)
                  throws RemoteException,
                         VisADException
Sets the point size of the children

Overrides:
setPointSize in class Displayable
Parameters:
size - size (pixels)
Throws:
RemoteException
VisADException

setLineWidth

public void setLineWidth(float width)
                  throws RemoteException,
                         VisADException
Sets the line width of the children. Calls setLineWidth on each child

Overrides:
setLineWidth in class Displayable
Parameters:
width - width for children (pixels)
Throws:
RemoteException
VisADException

setColorPalette

public void setColorPalette(float[][] c)
                     throws RemoteException,
                            VisADException
Sets the color table of the children. Calls setColorPalette on each child

Overrides:
setColorPalette in class Displayable
Parameters:
c - color palette
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

setVisible

public void setVisible(boolean visible,
                       int index)
                throws RemoteException,
                       VisADException
Sets the visibility of an individual child.

Parameters:
visible - Whether or not to display the
index - The index of the child.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

clearDisplayables

public void clearDisplayables()
                       throws RemoteException,
                              VisADException
Removes all displayables from this composite -- causing them to be removed from the VisAD display.

Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

destroyAll

public void destroyAll()
                throws RemoteException,
                       VisADException
_more_

Throws:
RemoteException - _more_
VisADException - _more_

lastDisplayable

public Displayable lastDisplayable()
Obtains the last displayable added to this composite.

Returns:
The last Displayable added to this composite.

displayableCount

public int displayableCount()
Gets the current number of displayables.

Returns:
The current number of Displayable-s in this composite.

indexOf

public int indexOf(Displayable displayable)
Gets the index of the particular Displayable. If the Displayable doesn't exist, then -1 is returned.

Parameters:
displayable - The Displayable to have its index returned.
Returns:
The index of the Displayable in this composite or -1.

getAnimationSet

public Set getAnimationSet(RealType aniType)
                    throws RemoteException,
                           VisADException

Returns the set of values for the given aniType if the contained Data object adapted by this DisplayableData have any data of that type. null will be returned if this instance adapts such an object but the object is unset, or if this instance does not support this type.

Overrides:
getAnimationSet in class Displayable
Parameters:
aniType - The type used for animation
Returns:
The set of times from all data May be null.
Throws:
VisADException - if a VisAD failure occurs.
RemoteException - if a Java RMI failure occurs.
See Also:
Displayable.hasDataObject()

cloneForDisplay

public Displayable cloneForDisplay()
                            throws RemoteException,
                                   VisADException
Returns a clone of this instance suitable for another VisAD display. Underlying data objects are not cloned.

Specified by:
cloneForDisplay in class Displayable
Returns:
A semi-deep clone of this instance.
Throws:
VisADException - VisAD failure.
RemoteException - Java RMI failure.

fireListDataContentsChanged

protected void fireListDataContentsChanged(int index0,
                                           int index1)
Invokes the contentsChanged() method of all registered ListDataListener-s.

Parameters:
index0 - The lower index of the range.
index1 - The upper index of the range.

fireListDataIntervalAdded

protected void fireListDataIntervalAdded(int index0,
                                         int index1)
Invokes the intervalAdded() method of all registered ListDataListener-s.

Parameters:
index0 - The lower index of the range.
index1 - The upper index of the range.

fireListDataIntervalRemoved

protected void fireListDataIntervalRemoved(int index0,
                                           int index1)
Invokes the intervalRemoved() method of all registered ListDataListener-s.

Parameters:
index0 - The lower index of the range.
index1 - The upper index of the range.

toString

public String toString()
Returns a string representation of this composite.

Overrides:
toString in class Object
Returns:
A string representation of this composite.