net.sf.jame.twister.swing
Class TwisterCanvas

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by net.sf.jame.twister.swing.TwisterCanvas
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, RenderContext

public class TwisterCanvas
extends java.awt.Canvas
implements RenderContext

Author:
Andrea Medeghini
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static int STATE_EDIT
           
static int STATE_INIT
           
static int STATE_PLAY
           
static int STATE_SCRIPT
           
static int SYMBOL_NONE
           
static int SYMBOL_PAUSE
           
static int SYMBOL_PLAY
           
static int SYMBOL_RECORD
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
TwisterCanvas(int hcells, int vcells, javax.swing.SingleSelectionModel model)
           
 
Method Summary
 void acquire()
           
 void addBookmark(TwisterBookmark bookmark)
           
 void addChangeListener(javax.swing.event.ChangeListener listener)
           
 void addRenderContextListener(RenderContextListener listener)
           
protected  void fireChangeEvent()
           
 TwisterClip getClip()
           
 TwisterConfig getConfig()
           
 long getFrameRate()
           
 IntegerVector2D getImageSize()
           
 RenderListener getListener()
           
 TwisterBookmark getSelectedBookmark()
           
 int getState()
           
 int getSymbol()
           
 boolean isDragEnabled()
           
 boolean isDropEnabled()
           
 boolean isShowBookmarkIcons()
           
 boolean isStarted()
           
 boolean isSuspended()
           
 void paint(java.awt.Graphics g)
           
 void refresh()
           
 void release()
           
 void removeBookmark()
           
 void removeChangeListener(javax.swing.event.ChangeListener listener)
           
 void removeRenderContextListener(RenderContextListener listener)
           
 void resume()
           
 void setDragEnabled(boolean dragEnabled)
           
 void setDropEnabled(boolean dropEnabled)
           
 void setListener(RenderListener listener)
           
 void setShowBookmarkIcons(boolean showBookmarks)
           
 void setSymbol(int symbol)
           
 void showMessage(java.lang.String message, float size, float x, float y, long time, boolean hasBackground)
           
 void start()
           
 void start(TwisterClip clip)
           
 void start(TwisterConfig config)
           
 void startRenderers()
           
 void startScript()
           
 void stop()
           
 void stopRenderers()
           
 void stopScript()
           
 void submitCommand(java.lang.Runnable command)
           
 void suspend()
           
 void update(java.awt.Graphics g)
           
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SYMBOL_NONE

public static final int SYMBOL_NONE
See Also:
Constant Field Values

SYMBOL_PLAY

public static final int SYMBOL_PLAY
See Also:
Constant Field Values

SYMBOL_PAUSE

public static final int SYMBOL_PAUSE
See Also:
Constant Field Values

SYMBOL_RECORD

public static final int SYMBOL_RECORD
See Also:
Constant Field Values

STATE_INIT

public static final int STATE_INIT
See Also:
Constant Field Values

STATE_EDIT

public static final int STATE_EDIT
See Also:
Constant Field Values

STATE_PLAY

public static final int STATE_PLAY
See Also:
Constant Field Values

STATE_SCRIPT

public static final int STATE_SCRIPT
See Also:
Constant Field Values
Constructor Detail

TwisterCanvas

public TwisterCanvas(int hcells,
                     int vcells,
                     javax.swing.SingleSelectionModel model)
              throws ExtensionException
Parameters:
hcells -
vcells -
model -
Throws:
ExtensionException
Method Detail

addChangeListener

public void addChangeListener(javax.swing.event.ChangeListener listener)
Parameters:
listener -

removeChangeListener

public void removeChangeListener(javax.swing.event.ChangeListener listener)
Parameters:
listener -

fireChangeEvent

protected void fireChangeEvent()

showMessage

public void showMessage(java.lang.String message,
                        float size,
                        float x,
                        float y,
                        long time,
                        boolean hasBackground)
Parameters:
message -
size -
x -
y -
time -
hasBackground -

submitCommand

public void submitCommand(java.lang.Runnable command)
Parameters:
command -

acquire

public void acquire()
             throws java.lang.InterruptedException
Specified by:
acquire in interface RenderContext
Throws:
java.lang.InterruptedException
See Also:
RenderContext.acquire()

release

public void release()
Specified by:
release in interface RenderContext
See Also:
RenderContext.release()

addRenderContextListener

public void addRenderContextListener(RenderContextListener listener)
Specified by:
addRenderContextListener in interface RenderContext
See Also:
RenderContext.addRenderContextListener(net.sf.jame.core.util.RenderContextListener)

removeRenderContextListener

public void removeRenderContextListener(RenderContextListener listener)
Specified by:
removeRenderContextListener in interface RenderContext
See Also:
RenderContext.removeRenderContextListener(net.sf.jame.core.util.RenderContextListener)

refresh

public void refresh()
Specified by:
refresh in interface RenderContext

getConfig

public TwisterConfig getConfig()
Returns:

getClip

public TwisterClip getClip()
Returns:

isDragEnabled

public boolean isDragEnabled()
Returns:
the dragEnabled

setDragEnabled

public void setDragEnabled(boolean dragEnabled)
Parameters:
dragEnabled - the dragEnabled to set

isDropEnabled

public boolean isDropEnabled()
Returns:
the dropEnabled

setDropEnabled

public void setDropEnabled(boolean dropEnabled)
Parameters:
dropEnabled - the dropEnabled to set

update

public void update(java.awt.Graphics g)
Overrides:
update in class java.awt.Canvas
See Also:
Canvas.update(java.awt.Graphics)

isStarted

public boolean isStarted()
Returns:

start

public void start(TwisterClip clip)

start

public void start(TwisterConfig config)

start

public void start()

stop

public void stop()

startScript

public void startScript()

stopScript

public void stopScript()

isSuspended

public boolean isSuspended()
Returns:

resume

public void resume()
Throws:
ExtensionException

suspend

public void suspend()

getImageSize

public IntegerVector2D getImageSize()
Specified by:
getImageSize in interface RenderContext
Returns:
See Also:
RenderContext.getImageSize()

getFrameRate

public long getFrameRate()
Returns:

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Canvas
See Also:
Canvas.paint(java.awt.Graphics)

startRenderers

public void startRenderers()
Specified by:
startRenderers in interface RenderContext
See Also:
RenderContext.startRenderers()

stopRenderers

public void stopRenderers()
Specified by:
stopRenderers in interface RenderContext
See Also:
RenderContext.stopRenderers()

addBookmark

public void addBookmark(TwisterBookmark bookmark)
Parameters:
bookmark -

removeBookmark

public void removeBookmark()
Parameters:
bookmark -

getSelectedBookmark

public TwisterBookmark getSelectedBookmark()
Returns:

isShowBookmarkIcons

public boolean isShowBookmarkIcons()
Returns:
the showBookmarks

setShowBookmarkIcons

public void setShowBookmarkIcons(boolean showBookmarks)
Parameters:
showBookmarks - the showBookmarks to set

getState

public int getState()
Returns:
the state

getSymbol

public int getSymbol()
Returns:
the symbol

setSymbol

public void setSymbol(int symbol)
Parameters:
symbol - the symbol to set

getListener

public RenderListener getListener()
Returns:
the listener

setListener

public void setListener(RenderListener listener)
Parameters:
listener - the listener to set