CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.rubik.parser
Class ScriptPlayer

java.lang.Object
  extended by org.monte.media.AbstractPlayer
      extended by ch.randelshofer.rubik.parser.ScriptPlayer
All Implemented Interfaces:
java.lang.Runnable, org.monte.media.Player, org.monte.media.StateModel

public class ScriptPlayer
extends org.monte.media.AbstractPlayer

ScriptPlayer.

Version:
7.9.2 2011-02-17 Merged with Media project.
7.9.1 2010-11-13 Fixes enabled state of reset and scramble button.
7.9 2010-08-03 The Locale of the player can now be changed by setting a new locale on its control panel component.
7.8 2010-05-02 Alt- or Ctrl-Click on reset button only resets the canvas but not the cube.
7.7 2009-07-26 Enable/Disable the movie control.
7.6 2009-01-09 Use modifiersEx instead of modifiers.
7.5 2008-12-30 Localized tooltips.
7.4 2008-12-26 Added methods setScrambleButtonVisible.
7.3 2008-01-08 Fixed highlighting during seeks.
7.2 2008-01-07 Implemented methods isProcessingCurrentNode and getCurrentNode.
7.1 2008-01-05 Replaced AbstractButtonAWT by JButton.
7.0 2007-11-15 Upgraded to Java 1.4.
6.1 2007-09-09 Changed modifiersEx: Alt-Key twists counter-clockwise, Shift-Key twists by 180°, Meta-Key twists two layers.
6.0.1 2007-06-10 Added sleeps after seeks to method doStarted.
6.0 2005-03-13 Reworked.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class org.monte.media.AbstractPlayer
dispatcher, listenerList, propertyChangeSupport
 
Fields inherited from interface org.monte.media.Player
CLOSED, PREFETCHED, PREFETCHING, REALIZED, REALIZING, STARTED, UNREALIZED
 
Constructor Summary
ScriptPlayer()
          Creates a new instance.
 
Method Summary
protected  void doClosed()
          Does the work for the closed state.
protected  void doPrefetched()
          Does the work for the prefetched state.
protected  void doPrefetching()
          Does the work for the prefetching state.
protected  void doRealized()
          Does the work for the realized state.
protected  void doRealizing()
          Does the work for the realizing state.
protected  void doStarted()
          Does the work for the started state.
protected  void doUnrealized()
          Does the work for the unrealized state.
 int getBlockTurnCount()
           
 javax.swing.BoundedRangeModel getCachingModel()
          Gets the model representing the realizing progress of the player.
 Cube3DCanvas getCanvas()
           
 java.awt.Component getControlPanelComponent()
           
 Cube getCube()
           
 Cube3D getCube3D()
           
 Node getCurrentNode()
           
 int getFaceTurnCount()
           
 int getLayerTurnCount()
           
 int getQuarterTurnCount()
           
 Cube getResetCube()
           
 Node getScript()
           
 javax.swing.BoundedRangeModel getTimeModel()
          Gets the model representing the time line of the player.
 long getTotalDuration()
           
 java.awt.Component getVisualComponent()
           
 boolean isAudioAvailable()
          Returns true if audio is available.
 boolean isAudioEnabled()
          Returns true if audio is enabled.
 boolean isCached()
          Returns true when the player has completely cached all movie data.
 boolean isEnabled()
           
 boolean isProcessingCurrentNode()
           
 boolean isResetButtonVisible()
           
 boolean isScrambleButtonVisible()
           
 void moveToCaret(int caret)
          Moves the playhead to an Node node, which is located at the specified caret.
 void reset()
          Stops the player, sets the playhead to the start position and resets the cube and its 3D representation.
 void scramble()
           
 void setAudioEnabled(boolean b)
          Sets the audio enabled state.
 void setCanvas(Cube3DCanvas newValue)
           
 void setCube(Cube newValue)
           
 void setCube3D(Cube3D newValue)
           
 void setEnabled(boolean newValue)
           
 void setHandle3DEvents(boolean value)
          Set this to false, if the player shall not handle 3D events.
 void setHideControlsIfNoScript(boolean newValue)
           
 void setMovieControl(org.monte.media.MovieControl mc)
           
 void setResetButtonVisible(boolean newValue)
           
 void setResetCube(Cube newValue)
           
 void setScrambleButtonVisible(boolean newValue)
           
 void setScript(Node newValue)
           
 void stop()
          Initiates the following asynchronous state transitions: started -> prefetched unrealized realizing prefetching prefetched closed -> throws IllegalStateException
 
Methods inherited from class org.monte.media.AbstractPlayer
addChangeListener, addPropertyChangeListener, addStateListener, close, deallocate, fireStateChanged, fireStateChanged, getState, getTargetState, isActive, prefetch, realize, removeChangeListener, removePropertyChangeListener, removeStateListener, run, setTargetState, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptPlayer

public ScriptPlayer()
Creates a new instance.

Method Detail

setMovieControl

public void setMovieControl(org.monte.media.MovieControl mc)

isCached

public boolean isCached()
Description copied from interface: org.monte.media.Player
Returns true when the player has completely cached all movie data. This player informs all property change listeners, when the value of this property changes. The name of the property is 'cached'.


setCube

public void setCube(Cube newValue)

getCube

public Cube getCube()

setResetCube

public void setResetCube(Cube newValue)

getResetCube

public Cube getResetCube()

setResetButtonVisible

public void setResetButtonVisible(boolean newValue)

isResetButtonVisible

public boolean isResetButtonVisible()

setScrambleButtonVisible

public void setScrambleButtonVisible(boolean newValue)

isScrambleButtonVisible

public boolean isScrambleButtonVisible()

setEnabled

public void setEnabled(boolean newValue)

isEnabled

public boolean isEnabled()

setCube3D

public void setCube3D(Cube3D newValue)

getCube3D

public Cube3D getCube3D()

setScript

public void setScript(Node newValue)

getScript

public Node getScript()

setCanvas

public void setCanvas(Cube3DCanvas newValue)

getVisualComponent

public java.awt.Component getVisualComponent()

getCanvas

public Cube3DCanvas getCanvas()

getCurrentNode

public Node getCurrentNode()

isProcessingCurrentNode

public boolean isProcessingCurrentNode()

stop

public void stop()
Description copied from class: org.monte.media.AbstractPlayer
Initiates the following asynchronous state transitions: started -> prefetched unrealized realizing prefetching prefetched closed -> throws IllegalStateException

Specified by:
stop in interface org.monte.media.Player
Overrides:
stop in class org.monte.media.AbstractPlayer

reset

public void reset()
Stops the player, sets the playhead to the start position and resets the cube and its 3D representation.


moveToCaret

public void moveToCaret(int caret)
Moves the playhead to an Node node, which is located at the specified caret.


doClosed

protected void doClosed()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the closed state.

Specified by:
doClosed in class org.monte.media.AbstractPlayer

doPrefetched

protected void doPrefetched()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the prefetched state.

Specified by:
doPrefetched in class org.monte.media.AbstractPlayer

doPrefetching

protected void doPrefetching()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the prefetching state.

Specified by:
doPrefetching in class org.monte.media.AbstractPlayer

doRealized

protected void doRealized()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the realized state.

Specified by:
doRealized in class org.monte.media.AbstractPlayer

doRealizing

protected void doRealizing()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the realizing state.

Specified by:
doRealizing in class org.monte.media.AbstractPlayer

doStarted

protected void doStarted()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the started state.

Specified by:
doStarted in class org.monte.media.AbstractPlayer

doUnrealized

protected void doUnrealized()
Description copied from class: org.monte.media.AbstractPlayer
Does the work for the unrealized state.

Specified by:
doUnrealized in class org.monte.media.AbstractPlayer

getCachingModel

public javax.swing.BoundedRangeModel getCachingModel()
Description copied from interface: org.monte.media.Player
Gets the model representing the realizing progress of the player.


getControlPanelComponent

public java.awt.Component getControlPanelComponent()

getTimeModel

public javax.swing.BoundedRangeModel getTimeModel()
Description copied from interface: org.monte.media.Player
Gets the model representing the time line of the player.


getTotalDuration

public long getTotalDuration()

setHideControlsIfNoScript

public void setHideControlsIfNoScript(boolean newValue)

isAudioAvailable

public boolean isAudioAvailable()
Description copied from interface: org.monte.media.Player
Returns true if audio is available.


isAudioEnabled

public boolean isAudioEnabled()
Description copied from interface: org.monte.media.Player
Returns true if audio is enabled.


setAudioEnabled

public void setAudioEnabled(boolean b)
Description copied from interface: org.monte.media.Player
Sets the audio enabled state.


setHandle3DEvents

public void setHandle3DEvents(boolean value)
Set this to false, if the player shall not handle 3D events. If set to true, the player twists the cube, when the user clicks on a sticker.

The default value is true.


scramble

public void scramble()

getFaceTurnCount

public int getFaceTurnCount()

getBlockTurnCount

public int getBlockTurnCount()

getLayerTurnCount

public int getLayerTurnCount()

getQuarterTurnCount

public int getQuarterTurnCount()

(c) Werner Randelshofer.
All rights reserved.