dk.klafbang.tincpn.animation.plugin
Class SceneBeans

java.lang.Object
  extended by dk.klafbang.tincpn.gui.sheet.Sheet
      extended by dk.klafbang.tincpn.animation.AnimationSheet
          extended by dk.klafbang.tincpn.animation.plugin.SceneBeans
All Implemented Interfaces:
java.util.EventListener, uk.ac.ic.doc.scenebeans.event.AnimationListener

public class SceneBeans
extends dk.klafbang.tincpn.animation.AnimationSheet
implements uk.ac.ic.doc.scenebeans.event.AnimationListener

Makes custom animations using SceneBeans.

SceneBeans allows you to create elaborate animations, but is also quite complex to use. For more information on writing SceneBeans animations, check the SceneBeans homepage.

SceneBeans animations are particularily usefull when you want to animate some physical process or protocol. Good examples include a protocol in a mobile ad-hoc network, a workflow at a bank etc.

Since:
1.0
Author:
Michael Westergaard
See Also:
Stop Signal example, Presentation with description of Stop Signal example, SceneBeans homepage

Constructor Summary
SceneBeans(java.lang.String name, java.lang.String id)
          Constructs a SceneBeans object.
 
Method Summary
 void animationEvent(uk.ac.ic.doc.scenebeans.event.AnimationEvent ev)
           
 javax.swing.JComponent createAnimation()
           
 java.lang.String getNextEvent()
          Wait for, remove and return the next event.
 java.awt.Dimension getPreferredSize()
           
 java.lang.String getValue(java.lang.String object, java.lang.String name)
          Get the value of a parameter vith the given name on the given object.
 boolean hasMoreEvents()
          Return whether more events are currently available.
 void invokeCommand(java.lang.String name)
          Invoke the command with the given name.
 java.lang.String peekNextEvent()
          Wait for and return the next event.
 void reset()
          Reload this animation.
 void setAnimation(java.lang.String filename)
          Loads and displays a new animation.
 void setAnimationFile(java.io.File file)
           
 void setValue(java.lang.String object, java.lang.String name, java.lang.String value)
          Set the value of a parameter with the given name on the given object.
 void waitForEvent(java.lang.String name)
          Wait for and remove the next event with the given name.
 
Methods inherited from class dk.klafbang.tincpn.animation.AnimationSheet
canCoexistWith, getComponentImpl
 
Methods inherited from class dk.klafbang.tincpn.gui.sheet.Sheet
addSheetHook, getComponent, getIndexNode, getText, removeComponent, setText
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SceneBeans

public SceneBeans(java.lang.String name,
                  java.lang.String id)
Constructs a SceneBeans object.

Parameters:
name - the name of the SceneBeans animation
id -
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Specified by:
getPreferredSize in class dk.klafbang.tincpn.gui.sheet.Sheet
See Also:
Sheet.getPreferredSize()

createAnimation

public javax.swing.JComponent createAnimation()
Specified by:
createAnimation in class dk.klafbang.tincpn.animation.AnimationSheet
See Also:
AnimationSheet.createAnimation()

animationEvent

public void animationEvent(uk.ac.ic.doc.scenebeans.event.AnimationEvent ev)
Specified by:
animationEvent in interface uk.ac.ic.doc.scenebeans.event.AnimationListener
See Also:
AnimationListener.animationEvent(uk.ac.ic.doc.scenebeans.event.AnimationEvent)

setAnimation

public void setAnimation(java.lang.String filename)
                  throws java.lang.Exception
Loads and displays a new animation.

Parameters:
filename - the name of a file containing the animation description
Throws:
java.lang.Exception
See Also:
The SceneBeans XML File Format, SceneBeans Components

setAnimationFile

public void setAnimationFile(java.io.File file)
                      throws java.lang.Exception
Parameters:
file -
Throws:
java.lang.Exception

setValue

public void setValue(java.lang.String object,
                     java.lang.String name,
                     java.lang.String value)
              throws java.lang.Exception
Set the value of a parameter with the given name on the given object.

Parameters:
object - the object
name - the name
value - the value
Throws:
java.lang.Exception
See Also:
getValue(java.lang.String, java.lang.String)

getValue

public java.lang.String getValue(java.lang.String object,
                                 java.lang.String name)
                          throws java.lang.Exception
Get the value of a parameter vith the given name on the given object.

Parameters:
object - the object
name - the name
Returns:
the value
Throws:
java.lang.Exception
See Also:
setValue(java.lang.String, java.lang.String, java.lang.String)

getNextEvent

public java.lang.String getNextEvent()
Wait for, remove and return the next event.

Returns:
the name of the event

peekNextEvent

public java.lang.String peekNextEvent()
Wait for and return the next event.

Returns:
the name of the event

waitForEvent

public void waitForEvent(java.lang.String name)
Wait for and remove the next event with the given name.

Parameters:
name - the name of the event to wait for

hasMoreEvents

public boolean hasMoreEvents()
Return whether more events are currently available.

Returns:
false if getNextEvent() will block, true otherwise

invokeCommand

public void invokeCommand(java.lang.String name)
                   throws java.lang.Exception
Invoke the command with the given name.

Parameters:
name - the name of the command to invoke
Throws:
java.lang.Exception

reset

public void reset()
Reload this animation.