Class DisplayableData

java.lang.Object
ucar.visad.display.Displayable
ucar.visad.display.DisplayableData
Direct Known Subclasses:
ColorScale, FrontDrawer, ImageRGBDisplayable, IntermediateRings, LineDrawing, RGBDisplayable, StationModelDisplayable

public class DisplayableData extends Displayable
Provides support for displaying data that comprises a single VisAD Data object (and, consequently, needs only a single DataReference).

Instances of this class have the following bound properties:

Name Type Access Default Description
boolean set/is true Whether or not the data should be rendered.
manipulable boolean set/is false Whether or not the data can be manipulated (i.e. modified) via the display.
Version:
$Revision: 1.55 $
Author:
Steven R. Emmerson
  • Field Details

    • MANIPULABLE

      public static final String MANIPULABLE
      The name of the "manipulable" property.
      See Also:
    • VISIBLE

      public static final String VISIBLE
      The name of the "visible" property.
      See Also:
    • LINE_WIDTH

      public static String LINE_WIDTH
      The name of the line-width property.
    • renderer

      protected DataRenderer renderer
      renderer for the data
  • Constructor Details

    • DisplayableData

      public DisplayableData(String name) throws VisADException, RemoteException
      Constructs from a name for the Displayable. Constructs with a default DataRenderer which is appropriate for the dimensionality of the display and does not directly manipulate the data. The "visible" property will initially be true.
      Parameters:
      name - The name for the Displayable.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • DisplayableData

      public DisplayableData(DisplayableData that) throws VisADException, RemoteException
      Constructs from another instance. The following attributes are set from the other instance: name, manipulatility, visibility, the data reference, and activity. Note, in particular, that the data reference is set by assignment from the data reference of the other instance (i.e. the same data reference is used).
      Parameters:
      that - The other instance.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
  • Method Details

    • 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.
    • cloneForDisplay

      public Displayable cloneForDisplay() throws VisADException, RemoteException

      Returns a clone of this instance suitable for another VisAD Display.

      This implementation does not clone the underlying data.

      Specified by:
      cloneForDisplay in class Displayable
      Returns:
      A clone of this instance for another display.
      Throws:
      VisADException - if a VisAD failure occurs.
      RemoteException - if a Java RMI failure occurs.
    • getName

      public final String getName()
      Returns the name of this instance.
      Returns:
      The name of this instance as given to the constructor.
    • setManipulable

      public final void setManipulable(boolean manipulable) throws VisADException, RemoteException

      Sets the "manipulable" property. This property may be set even while this instance is being displayed. This method fires a PropertyChangeEvent for @link #MANIPULABLE}.

      This implementation uses the overridable method getDataRenderer() to obtain a new DataRenderer, if necessary, and the method Displayable.getConstantMaps() if the data-reference needs to be (re)added to the display.

      Overrides:
      setManipulable in class Displayable
      Parameters:
      manipulable - Whether or not this instance may be directly manipulated by the VisAD system.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • isManipulable

      public final boolean isManipulable()
      Gets the "manipulable" property.
      Returns:
      true if and only if this instance may be directly manipulated by the VisAD system.
    • setVisible

      public void setVisible(boolean visible) throws RemoteException, VisADException
      Sets the "visible" property. This method fires a PropertyChangeEvent for VISIBLE.
      Overrides:
      setVisible in class Displayable
      Parameters:
      visible - Whether or not this instance should be visible.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • getActive

      public boolean getActive()
      Gets the "active" property.
      Returns:
      active state
    • setActive

      public final void setActive(boolean active) throws VisADException, RemoteException
      Sets the "active" property. Changes to the data object are reported if and only if the value of the "active" property is true. If the data object changed while the active property was false, then the change will be reported when the active property is set to true.
      Parameters:
      active - Whether or not to report changes to the data object.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • myAddDataReferences

      protected final void myAddDataReferences() throws VisADException, RemoteException

      Adds the VisAD DataReference of this instance to the associated VisAD display if appropriate. This method does not verify that the VisAD display has been set. This method is idempotent.

      This implementation uses the overridable methods getDataRenderer() and Displayable.getConstantMaps().

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

      protected final void myRemoveDataReferences() throws VisADException, RemoteException
      Removes the VisAD DataReference of this instance from the associated VisAD display. This method does not verify that the VisAD display has been set. This method is idempotent. Invoking this method will result in the overridable method getDataRenderer() being invoked if this instance is subsequently added to the display.
      Specified by:
      myRemoveDataReferences in class Displayable
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • myAddConstantMaps

      protected void myAddConstantMaps(ConstantMap[] newMaps) throws VisADException, RemoteException
      Adds this instance's data references to the associated VisAD display if possible. This method does not verify that the VisAD display has been set. This method is idempotent.
      Overrides:
      myAddConstantMaps in class Displayable
      Parameters:
      newMaps - maps to add
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • dataChange

      protected void dataChange() throws VisADException, RemoteException

      Handles a change to the data. This method is called when the data of this instance's DataReference changes -- whether by direct manipulation by the VisAD display or by the setData() or setDataReference() methods. This method should be overridden in subclasses when appropriate.

      This implementation does nothing.

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

      public final void setDataReference(DataReference reference) throws TypeException, RemoteException, VisADException

      Set the data reference for this instance. This method will result in the invocation of the dataChange() method. This method may be called even while this instance is being rendered in the associated VisAD display: it will cause the new data to be rendered.

      This implementations uses the overridable methods getDataRenderer() and Displayable.getConstantMaps().

      Parameters:
      reference - The data reference for this instance. May not have null data.
      Throws:
      TypeException - Data reference has null data.
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
      See Also:
    • 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.
    • setData

      public final void setData(Data data) throws RemoteException, VisADException

      Sets the data for this instance. This method will result in the invocation of the dataChange() method. This method may be called even while this instance is being rendered in the associated VisAD display: it will cause the new data to be rendered.

      This implementation uses the overridable methods getDataRenderer() and Displayable.getConstantMaps().

      Parameters:
      data - The data for this instance.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
      See Also:
    • hasDataObject

      public final boolean hasDataObject()

      Indicates whether or not this Displayable adapts a single, VisAD data object.

      This implementation always returns true.

      Overrides:
      hasDataObject in class Displayable
      Returns:
      True if and only if this instance adapts a single, VisAD data object.
    • getData

      public final Data getData() throws VisADException, RemoteException
      Returns the data of this instance or null if no such data exists. If the return-value is non-null then it is the actual data and not a copy.
      Overrides:
      getData in class Displayable
      Returns:
      The data value or null.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
      See Also:
    • addAction

      public final void addAction(Action action) throws VisADException, RemoteException
      Adds a listener for data changes.
      Parameters:
      action - The listener for changes to the underlying data.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • removeAction

      public final void removeAction(Action action) throws VisADException, RemoteException
      Removes a listener for data changes.
      Parameters:
      action - The listener for changes to the underlying data.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • hasData

      public boolean hasData() throws VisADException, RemoteException
      See if any data has been set in the DataReference for this DisplayableData.
      Returns:
      true if the data in the reference is not null.
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • getDataRenderer

      protected DataRenderer getDataRenderer() throws VisADException
      Obtains the DataRenderer for this displayable. This is a template method: it may be overridden in subclasss to supply a non-default DataRenderer.
      Returns:
      The DataRenderer for this displayable.
      Throws:
      VisADException - VisAD failure.
    • showme

      public String showme()
      Print out my name
      Returns:
      my name
    • setPickable

      public void setPickable(boolean pickable) throws VisADException, RemoteException
      Set the pickable property
      Parameters:
      pickable - true to pick
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • isPickable

      public boolean isPickable()
      Get the pickable property
      Returns:
      true if pickable
    • getAnimationSet

      public Set getAnimationSet(RealType aniType, boolean force) throws VisADException, RemoteException

      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
      force - true to force
      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:
    • toString

      public String toString()
      Get a String representation of this object.
      Overrides:
      toString in class Object
      Returns:
      a String representation of this.
    • setLineWidth

      public void setLineWidth(float lineWidth) throws VisADException, RemoteException
      Sets the width of lines in this Displayable.
      Overrides:
      setLineWidth in class Displayable
      Parameters:
      lineWidth - Width of lines (1 = normal)
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • getLineWidth

      public float getLineWidth()
      Gets the current line width associated with this Displayable
      Returns:
      line width
    • setPointSize

      public void setPointSize(float pointSize) throws VisADException, RemoteException
      Sets the size of points in this Displayable.
      Overrides:
      setPointSize in class Displayable
      Parameters:
      pointSize - Size of points (2 = normal)
      Throws:
      VisADException - VisAD failure.
      RemoteException - Java RMI failure.
    • getPointSize

      public float getPointSize()
      Gets the point size associated with this DisplayableData
      Returns:
      point size
    • setDragAdapter

      public void setDragAdapter(DisplayableData.DragAdapter dragAdapter)
      Set the drag adapter
      Parameters:
      dragAdapter - the drag adapter