Class AnimationWidget

java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.visad.display.AnimationWidget
All Implemented Interfaces:
ActionListener, EventListener, Sharable

public class AnimationWidget extends SharableImpl implements ActionListener
A widget to control animation in a VisAD display. Allows user to set loop position at first frame, step backward one step, step forward one step, set loop position at last frame, toggle looping on and off, and invoke an AnimationPropertiesDialogWidget. Uses several image icons in "auxdata.jar, making a kind of GUI wrapper for a set of ucar.visad.Animation "displayables"; uses methods of ucar.visad.display Animation which invoke VisAD Animation class methods.
Version:
$Revision: 1.115 $
Author:
IDV Development Team
  • Field Details

    • bigIcon

      public static boolean bigIcon
      Do we show the big icon
    • CMD_INDEX

      public static final String CMD_INDEX
      Flag for changing the INDEX
      See Also:
    • CMD_BEGINNING

      public static final String CMD_BEGINNING
      property for setting the widget to the first frame
      See Also:
    • CMD_BACKWARD

      public static final String CMD_BACKWARD
      property for setting the widget to the loop in reverse
      See Also:
    • CMD_STARTSTOP

      public static final String CMD_STARTSTOP
      property for setting the widget to the start or stop
      See Also:
    • CMD_FORWARD

      public static final String CMD_FORWARD
      property for setting the widget to the loop forward
      See Also:
    • CMD_END

      public static final String CMD_END
      property for setting the widget to the last frame
      See Also:
    • CMD_PROPS

      public static final String CMD_PROPS
      property for properties
      See Also:
    • SHARE_VALUE

      public static final String SHARE_VALUE
      The property for sharing the animation value
      See Also:
    • SHARE_INDEX

      public static final String SHARE_INDEX
      The property for sharing the animation index
      See Also:
  • Constructor Details

    • AnimationWidget

      public AnimationWidget()
      Default Constructor
    • AnimationWidget

      public AnimationWidget(AnimationInfo info)
      Contruct an AnimationWidget using the info supplied.
      Parameters:
      info - default state to use.
    • AnimationWidget

      public AnimationWidget(JFrame parentf)
      Construct an AnimationWidget using the parent supplied.
      Parameters:
      parentf - the parent JFrame
    • AnimationWidget

      public AnimationWidget(JFrame parentf, Animation anim)
      Construct an AnimationWidget using the parent, the Animation
      Parameters:
      parentf - the parent JFrame
      anim - a ucar.visad.display.Animation object to manage
    • AnimationWidget

      public AnimationWidget(JFrame parentf, Animation anim, AnimationInfo info)
      Contruct a new AnimationWidget.
      Parameters:
      parentf - the parent JFrame
      anim - a ucar.visad.display.Animation object to manage
      info - Default values for the AnimationInfo
  • Method Details

    • showDateBox

      public void showDateBox(boolean v)
      Show the date box
      Parameters:
      v - true to show
    • setBaseTimes

      public void setBaseTimes(Set times) throws VisADException, RemoteException
      Set the times that should be used. If this is set we don't go to the displaymaster to get the times.
      Parameters:
      times - List of times
      Throws:
      RemoteException - On badness
      VisADException - On badness
    • getContents

      public JComponent getContents()
      Get the Java Component which is the set of controls.
      Returns:
      a Java Component
    • getContents

      public JComponent getContents(boolean floatToolBar)
      get the Java Component which is the set of controls.
      Parameters:
      floatToolBar - true if the toolbar should be floatable
      Returns:
      a Java Component
    • getIndicatorComponent

      public Component getIndicatorComponent()
      Get the component used to display the time step value.
      Returns:
      timesCbx component
    • applyProperties

      protected void applyProperties(AnimationInfo info, boolean andShare)
      Apply the info from the dialog
      Parameters:
      info - The info
      andShare - Share the state with other widgets
    • animationSetChanged

      public void animationSetChanged()
      Changing the info from the dialog
    • showPropertiesDialog

      protected void showPropertiesDialog()
      Make and show an AnimationPropertiesDialog; if that returns animationInfo ok, set the new animationInfo data into the the Animations.
    • boxPanelChanged

      protected void boxPanelChanged(AnimationBoxPanel boxPanel)
      Called when the box panel has changed through a user drag or click
      Parameters:
      boxPanel - The changed box panel
    • resetProperties

      public void resetProperties()
      Force the existing animation properties, held in the animation widget's "animationInfo" member data, into this widget's set of Animation objects.
    • setProperties

      public void setProperties(AnimationInfo transfer)
      From the "animationInfo" set of animation properties, set all these values into all the Animation objects held as memeber data.
      Parameters:
      transfer - AnimationInfo to get properties from
    • getDisplayMaster

      protected DisplayMaster getDisplayMaster()
      Get the display master that the animation is in
      Returns:
      The display master or null
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      Public by implementing ActionListener.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - ActionEvent to check
    • actionPerformed

      public void actionPerformed(String cmd)
      Handle the action
      Parameters:
      cmd - The action
    • handleSharedTime

      protected void handleSharedTime(Real time)
      We got the tiem from another animation widget.
      Parameters:
      time - The time.
    • setTimeFromUser

      public void setTimeFromUser(Real time)
      THis allows external code to set the time. It sets the time on the animation and it does a doShare.
      Parameters:
      time - The time
    • receiveShareData

      public void receiveShareData(Sharable from, Object dataId, Object[] data)
      Method called when sharing is turned on.
      Specified by:
      receiveShareData in interface Sharable
      Overrides:
      receiveShareData in class SharableImpl
      Parameters:
      from - source of shareable information
      dataId - ID for the data
      data - the shareable data
    • setRunning

      public void setRunning(boolean state)
      Set the animation state and change the start/stop widget
      Parameters:
      state - true to start animating
    • isRunning

      public boolean isRunning()
      Are we running
      Returns:
      Is running
    • getAnimationInfo

      public AnimationInfo getAnimationInfo()
      Get the AnimationInfo associated with this widget.
      Returns:
      AnimationInfo used by this widget.
    • getAnimationSetInfo

      public AnimationSetInfo getAnimationSetInfo()
      Holds the synthetic animation set info
      Returns:
      Animation set info
    • shareIndex

      protected void shareIndex()
      Share the index of the animation step.
    • shareValue

      protected void shareValue()
      Share the value of the animation step.
    • shareValue

      protected void shareValue(Real time)
      Share the time value
      Parameters:
      time - The value to share
    • stepForward

      public void stepForward()
      Take one step forward in the animation sequence.
    • stepBackward

      protected void stepBackward()
      Take one step backward in the animation sequence.
    • gotoIndex

      public void gotoIndex(int index)
      Set the current frame to the index supplied. Turn off animation This ignores any frames the user may have turned off
      Parameters:
      index - index into the animation set
    • gotoBeginning

      public void gotoBeginning()
      Go to the beginning of the animation sequence.
    • getTimes

      public DateTime[] getTimes()
      Get the array of times
      Returns:
      times
    • gotoEnd

      public void gotoEnd()
      Go to the end of the animation sequence.
    • stepsOkChanged

      public void stepsOkChanged(boolean[] stepsOk)
      The user has clicked on the box. Pass this through to the animation
      Parameters:
      stepsOk - What time steps are ok
    • setAnimation

      public void setAnimation(Animation newAnimation)
      Sets the ucar.visad.display.Animation controlled by this widget. Removes any other ucar.visad.display.Animation from the control of this widget.
      Parameters:
      newAnimation - ucar.visad.display.Animation to control
    • destroy

      public void destroy()
      Method called when destroying this object.
    • addAnimation

      public void addAnimation(Animation anim)
      Adds an ucar.visad.display.Animation to be controlled by this widget.
      Parameters:
      anim - ucar.visad.display.Animation to control (must not be null) deprecated use setAnimation();
    • updateIndicator

      public void updateIndicator(Set timeSet)
      Update the indicator with the list of times
      Parameters:
      timeSet - set of times
    • getTimeAtIndex

      public DateTime getTimeAtIndex(int index)
      Get the time at the given index. May return null.
      Parameters:
      index - Index
      Returns:
      Time
    • getTimesArray

      public DateTime[] getTimesArray()
      Get the time list.
      Returns:
      Time
    • setBoxPanelVisible

      public void setBoxPanelVisible(boolean value)
      Set the BoxPanelVisible property.
      Parameters:
      value - The new value for BoxPanelVisible
    • getBoxPanelVisible

      public boolean getBoxPanelVisible()
      Get the BoxPanelVisible property.
      Returns:
      The BoxPanelVisible
    • main

      public static void main(String[] args)
      Main method for testing
      Parameters:
      args - arguments