Package ucar.visad.display
Class AnimationWidget
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.visad.display.AnimationWidget
- All Implemented Interfaces:
ActionListener
,EventListener
,Sharable
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 Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
Do we show the big iconstatic final String
property for setting the widget to the loop in reversestatic final String
property for setting the widget to the first framestatic final String
property for setting the widget to the last framestatic final String
property for setting the widget to the loop forwardstatic final String
Flag for changing the INDEXstatic final String
property for propertiesstatic final String
property for setting the widget to the start or stopstatic final String
The property for sharing the animation indexstatic final String
The property for sharing the animation value -
Constructor Summary
ConstructorsConstructorDescriptionDefault ConstructorAnimationWidget
(JFrame parentf) Construct an AnimationWidget using the parent supplied.AnimationWidget
(JFrame parentf, Animation anim) Construct an AnimationWidget using the parent, the AnimationAnimationWidget
(JFrame parentf, Animation anim, AnimationInfo info) Contruct a new AnimationWidget.AnimationWidget
(AnimationInfo info) Contruct an AnimationWidget using the info supplied. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Public by implementing ActionListener.void
actionPerformed
(String cmd) Handle the actionvoid
addAnimation
(Animation anim) Adds anucar.visad.display.Animation
to be controlled by this widget.void
Changing the info from the dialogprotected void
applyProperties
(AnimationInfo info, boolean andShare) Apply the info from the dialogprotected void
boxPanelChanged
(AnimationBoxPanel boxPanel) Called when the box panel has changed through a user drag or clickvoid
destroy()
Method called when destroying this object.Get theAnimationInfo
associated with this widget.Holds the synthetic animation set infoboolean
Get the BoxPanelVisible property.Get the Java Component which is the set of controls.getContents
(boolean floatToolBar) get the Java Component which is the set of controls.protected DisplayMaster
Get the display master that the animation is inGet the component used to display the time step value.getTimeAtIndex
(int index) Get the time at the given index.DateTime[]
getTimes()
Get the array of timesDateTime[]
Get the time list.void
Go to the beginning of the animation sequence.void
gotoEnd()
Go to the end of the animation sequence.void
gotoIndex
(int index) Set the current frame to the index supplied.protected void
handleSharedTime
(Real time) We got the tiem from another animation widget.boolean
Are we runningstatic void
Main method for testingvoid
receiveShareData
(Sharable from, Object dataId, Object[] data) Method called when sharing is turned on.void
Force the existing animation properties, held in the animation widget's "animationInfo" member data, into this widget's set of Animation objects.void
setAnimation
(Animation newAnimation) Sets theucar.visad.display.Animation
controlled by this widget.void
setBaseTimes
(Set times) Set the times that should be used.void
setBoxPanelVisible
(boolean value) Set the BoxPanelVisible property.void
setProperties
(AnimationInfo transfer) From the "animationInfo" set of animation properties, set all these values into all the Animation objects held as memeber data.void
setRunning
(boolean state) Set the animation state and change the start/stop widgetvoid
setTimeFromUser
(Real time) THis allows external code to set the time.protected void
Share the index of the animation step.protected void
Share the value of the animation step.protected void
shareValue
(Real time) Share the time valuevoid
showDateBox
(boolean v) Show the date boxprotected void
Make and show an AnimationPropertiesDialog; if that returns animationInfo ok, set the new animationInfo data into the the Animations.protected void
Take one step backward in the animation sequence.void
Take one step forward in the animation sequence.void
stepsOkChanged
(boolean[] stepsOk) The user has clicked on the box.void
updateIndicator
(Set timeSet) Update the indicator with the list of timesMethods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
-
Field Details
-
bigIcon
public static boolean bigIconDo we show the big icon -
CMD_INDEX
Flag for changing the INDEX- See Also:
-
CMD_BEGINNING
property for setting the widget to the first frame- See Also:
-
CMD_BACKWARD
property for setting the widget to the loop in reverse- See Also:
-
CMD_STARTSTOP
property for setting the widget to the start or stop- See Also:
-
CMD_FORWARD
property for setting the widget to the loop forward- See Also:
-
CMD_END
property for setting the widget to the last frame- See Also:
-
CMD_PROPS
property for properties- See Also:
-
SHARE_VALUE
The property for sharing the animation value- See Also:
-
SHARE_INDEX
The property for sharing the animation index- See Also:
-
-
Constructor Details
-
AnimationWidget
public AnimationWidget()Default Constructor -
AnimationWidget
Contruct an AnimationWidget using the info supplied.- Parameters:
info
- default state to use.
-
AnimationWidget
Construct an AnimationWidget using the parent supplied.- Parameters:
parentf
- the parent JFrame
-
AnimationWidget
Construct an AnimationWidget using the parent, the Animation- Parameters:
parentf
- the parent JFrameanim
- a ucar.visad.display.Animation object to manage
-
AnimationWidget
Contruct a new AnimationWidget.- Parameters:
parentf
- the parent JFrameanim
- a ucar.visad.display.Animation object to manageinfo
- Default values for the AnimationInfo
-
-
Method Details
-
showDateBox
public void showDateBox(boolean v) Show the date box- Parameters:
v
- true to show
-
setBaseTimes
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 badnessVisADException
- On badness
-
getContents
Get the Java Component which is the set of controls.- Returns:
- a Java Component
-
getContents
get the Java Component which is the set of controls.- Parameters:
floatToolBar
- true if the toolbar should be floatable- Returns:
- a Java Component
-
getIndicatorComponent
Get the component used to display the time step value.- Returns:
- timesCbx component
-
applyProperties
Apply the info from the dialog- Parameters:
info
- The infoandShare
- 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
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
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
Get the display master that the animation is in- Returns:
- The display master or null
-
actionPerformed
Public by implementing ActionListener.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
e
- ActionEvent to check
-
actionPerformed
Handle the action- Parameters:
cmd
- The action
-
setTimeFromUser
THis allows external code to set the time. It sets the time on the animation and it does a doShare.- Parameters:
time
- The time
-
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
Get theAnimationInfo
associated with this widget.- Returns:
- AnimationInfo used by this widget.
-
getAnimationSetInfo
Holds the synthetic animation set info- Returns:
- Animation set info
-
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
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
Sets theucar.visad.display.Animation
controlled by this widget. Removes any otherucar.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
Adds anucar.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
Update the indicator with the list of times- Parameters:
timeSet
- set of times
-
getTimeAtIndex
Get the time at the given index. May return null.- Parameters:
index
- Index- Returns:
- Time
-
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
Main method for testing- Parameters:
args
- arguments
-