player
Class JAFramesPlayer

java.lang.Object
  extended by player.JAFramesPlayer
All Implemented Interfaces:
AvatarEventHandler
Direct Known Subclasses:
JALoadingPlayer, JASocketPlayer

public class JAFramesPlayer
extends java.lang.Object
implements AvatarEventHandler

A JAFramesPlayer provides a Java ARP avatar canvas together with the capability of playing sequences of CAS animation frames on that avatar.


Field Summary
static int SZ_CAM_DATA
          Length of the camera-settings data array.
 
Constructor Summary
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options and canvas-embedder, but with no avatar-event handler, and with the player's cyclic-play and "single-sign" flags both initially false.
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder, AvatarEventHandler aehdlr)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, and avatar-event handler, and with the player's cyclic-play and "single-sign" flags both initially false.
JAFramesPlayer(JAOptions jopts, JACanvasEmbedder embedder, AvatarEventHandler aehdlr, boolean cyclic, boolean onesign)
          Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, and avatar-event handler, and with the given initial settings of the player's cyclic-play and "single-sign" flags.
 
Method Summary
 void avatarIsLoaded(java.lang.String avatar)
          Handler for the avatar-loaded event generated by our view: sets up a camera controller for the view, and forwards the event to this player's own handler if it has one.
 void avatarIsUnloaded(java.lang.String avatar)
          Handler for the avatar-unloaded event generated by our view: updates the preferences with the camera settings, and forwards the event to this player's own handler if it has one.
 void awaitPlayerInactive()
          Delays until this player is inactive.
 void clearAnimation()
          Clears this player's animation scan.
 int countFrames()
          Returns the number of frames in the currently loaded animation, or 0 if there is none.
 int countSigns()
          Returns the number of signs in the currently loaded animation, or -1 if there are none.
 void createStandardCameraChangeMonitor()
           
 AnimatedSign currentSign()
          Returns the current sign for this player's animation scan, or null if the player currently has no animation scan.
 boolean cyclicPlayIsOn()
          Returns this player's current cyclic-play flag value.
 SiGMLAnimation getAnimation()
          Returns the animation currently associated with this player if there is one, or null otherwise.
 CameraChangeMonitor getCameraChangeMonitor()
          Creates a new camera change monitor for this player.
 float[] getCameraSettings()
          Returns the current camera settings data as an array of length SZ_CAM_DATA.
 boolean hasAnimationData()
          Returns a flag value indicating whether or not this player has a playable animation loaded.
 SignStatusRecord makeSignStatusRecord()
          Returns a new SignStatusRecord associated with this player's scan if it has one; otherwise returns null.
 boolean playerIsActive()
          Indicates whether this player is currently active.
 void requestSwitchAvatar(java.lang.String avatar)
          Initiates loading of the specified avatar be loaded into this player's JA view.
 void requestSwitchAvatar(java.lang.String avatar, java.lang.String nonstddef)
          Initiates loading of the specified avatar be loaded into this player's JA view, using the given special definition file URL if it is non-null.
 void setAnimation(SiGMLAnimation anim)
          Sets the given animation sequence to be the current one for this player.
 void setCamera(float[] cam)
          Sets the camera for this player's view in accordance with the settings in the given array, whose length should be SZ_CAM_DATA.
 void setCyclicPlay(boolean cyclic)
          Sets this player's cyclic-play flag to the given value.
 void setSingleSignPlay(boolean ss)
          Sets this player's single-sign flag to the given value.
 void showFrame(int F)
          Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so.
 void showFrame(int F, SignStatusRecord ss)
          Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so; the given status record is updated accordingly.
 boolean singleSignPlayIsOn()
          Returns this player's current single-sign flag value.
 void startPlayer(JAPlayerEventHandler peh)
          Initiates the playing by this player of its current animation, assuming it has one, with no speed control and using the given player event handler to announce animation events as they occur.
 void startPlayer(SpeedProvider SP, JAPlayerEventHandler peh)
          Initiates the playing by this player of its current animation, assuming it has one, using the given speed controller, and using the given player event handler to announce animation events as they occur.
 void stopPlayer()
          Aborts this player's current animation, if any.
 void terminate()
          Terminates this player and its display.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SZ_CAM_DATA

public static final int SZ_CAM_DATA
Length of the camera-settings data array.

See Also:
Constant Field Values
Constructor Detail

JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options and canvas-embedder, but with no avatar-event handler, and with the player's cyclic-play and "single-sign" flags both initially false.


JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder,
                      AvatarEventHandler aehdlr)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, and avatar-event handler, and with the player's cyclic-play and "single-sign" flags both initially false.


JAFramesPlayer

public JAFramesPlayer(JAOptions jopts,
                      JACanvasEmbedder embedder,
                      AvatarEventHandler aehdlr,
                      boolean cyclic,
                      boolean onesign)
Constructs a new JAFramesPlayer: sets up the JA avatar canvas, with the given JA options, canvas-embedder, and avatar-event handler, and with the given initial settings of the player's cyclic-play and "single-sign" flags.

Method Detail

requestSwitchAvatar

public void requestSwitchAvatar(java.lang.String avatar)
Initiates loading of the specified avatar be loaded into this player's JA view.


requestSwitchAvatar

public void requestSwitchAvatar(java.lang.String avatar,
                                java.lang.String nonstddef)
Initiates loading of the specified avatar be loaded into this player's JA view, using the given special definition file URL if it is non-null.


setCyclicPlay

public void setCyclicPlay(boolean cyclic)
Sets this player's cyclic-play flag to the given value.


cyclicPlayIsOn

public boolean cyclicPlayIsOn()
Returns this player's current cyclic-play flag value.


setSingleSignPlay

public void setSingleSignPlay(boolean ss)
Sets this player's single-sign flag to the given value.


singleSignPlayIsOn

public boolean singleSignPlayIsOn()
Returns this player's current single-sign flag value.


avatarIsLoaded

public void avatarIsLoaded(java.lang.String avatar)
Handler for the avatar-loaded event generated by our view: sets up a camera controller for the view, and forwards the event to this player's own handler if it has one.

Specified by:
avatarIsLoaded in interface AvatarEventHandler

avatarIsUnloaded

public void avatarIsUnloaded(java.lang.String avatar)
Handler for the avatar-unloaded event generated by our view: updates the preferences with the camera settings, and forwards the event to this player's own handler if it has one.

Specified by:
avatarIsUnloaded in interface AvatarEventHandler

makeSignStatusRecord

public SignStatusRecord makeSignStatusRecord()
Returns a new SignStatusRecord associated with this player's scan if it has one; otherwise returns null.


countFrames

public int countFrames()
Returns the number of frames in the currently loaded animation, or 0 if there is none.


countSigns

public int countSigns()
Returns the number of signs in the currently loaded animation, or -1 if there are none.


hasAnimationData

public boolean hasAnimationData()
Returns a flag value indicating whether or not this player has a playable animation loaded.


currentSign

public AnimatedSign currentSign()
Returns the current sign for this player's animation scan, or null if the player currently has no animation scan.


setAnimation

public void setAnimation(SiGMLAnimation anim)
Sets the given animation sequence to be the current one for this player.


clearAnimation

public void clearAnimation()
Clears this player's animation scan.


getAnimation

public SiGMLAnimation getAnimation()
Returns the animation currently associated with this player if there is one, or null otherwise.


getCameraSettings

public float[] getCameraSettings()
Returns the current camera settings data as an array of length SZ_CAM_DATA.


setCamera

public void setCamera(float[] cam)
Sets the camera for this player's view in accordance with the settings in the given array, whose length should be SZ_CAM_DATA.


createStandardCameraChangeMonitor

public void createStandardCameraChangeMonitor()

getCameraChangeMonitor

public CameraChangeMonitor getCameraChangeMonitor()
Creates a new camera change monitor for this player.


terminate

public void terminate()
               throws java.lang.InterruptedException
Terminates this player and its display.

Throws:
java.lang.InterruptedException

awaitPlayerInactive

public void awaitPlayerInactive()
                         throws java.lang.InterruptedException
Delays until this player is inactive.

Throws:
java.lang.InterruptedException

showFrame

public void showFrame(int F)
Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so.


showFrame

public void showFrame(int F,
                      SignStatusRecord ss)
Displays the given frame on this player's avatar, assuming that the player is not already active, and that it is otherwise equipped to do so; the given status record is updated accordingly.


stopPlayer

public void stopPlayer()
Aborts this player's current animation, if any.


startPlayer

public void startPlayer(JAPlayerEventHandler peh)
Initiates the playing by this player of its current animation, assuming it has one, with no speed control and using the given player event handler to announce animation events as they occur.


startPlayer

public void startPlayer(SpeedProvider SP,
                        JAPlayerEventHandler peh)
Initiates the playing by this player of its current animation, assuming it has one, using the given speed controller, and using the given player event handler to announce animation events as they occur.


playerIsActive

public boolean playerIsActive()
Indicates whether this player is currently active.