Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.view
Class AbstractVideoViewAWT

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by ch.randelshofer.view.AbstractViewAWT
                  extended by ch.randelshofer.view.AbstractVideoViewAWT
All Implemented Interfaces:
View, java.awt.event.ActionListener, java.awt.event.ItemListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.activation.CommandObject, org.jhotdraw.app.Disposable

public abstract class AbstractVideoViewAWT
extends AbstractViewAWT
implements java.awt.event.ActionListener, java.awt.event.ItemListener

This class provides the layout and common menu items for video media content.

Version:
1.4 2008-06-15 Improved compatibility with AbstracVideoView.
1.3 2003-04-07 Automatic start of the player when the 'autoPlay' feature is enabled delegated to subclasses.
1.1 2002-02-10 Support for scroll bars added. DnD support added.
1.0 2000-10-02
Author:
Werner Randelshofer, Hausmatt 10, CH-6405 Immensee, Switzerland
See Also:
Serialized Form

Nested Class Summary
protected  class AbstractVideoViewAWT.VideoPanel
           
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
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
protected  javax.swing.JCheckBoxMenuItem audioEnabledItem
           
protected  javax.swing.JRadioButtonMenuItem backgroundBlackItem
           
protected  javax.swing.JRadioButtonMenuItem backgroundCheckerboardItem
           
protected  javax.swing.JRadioButtonMenuItem backgroundWhiteItem
           
protected static java.awt.image.BufferedImage checkerboardTexture
           
static int DOUBLE_SIZE
           
static int HALF_SIZE
           
protected  javax.swing.JCheckBoxMenuItem loopItem
           
static int NORMAL_SIZE
           
protected  javax.swing.JCheckBoxMenuItem playEveryFrameItem
           
static int SCREEN_SIZE
           
protected  AbstractVideoViewAWT.VideoPanel videoPanel
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface ch.randelshofer.view.View
REQUEST_INFO_UPDATE_PROPERTY
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AbstractVideoViewAWT()
          Initializes the Form
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
           
 void addDropTargetListener(java.awt.dnd.DropTargetListener listener)
          This method adds the given drop target listener to all components of the viewer.
protected  java.awt.Component getControllerComponent()
           
protected  java.awt.Component getVideoComponent()
           
 boolean hasScrollPane()
          Returns true if this viewer has a scrollpane of its own.
protected  boolean isAutoPlay()
           
 void itemStateChanged(java.awt.event.ItemEvent event)
           
 void mergeViewMenuItems(javax.swing.JMenu m)
          Adds menu items to the "View" menu.
protected  void packParent()
           
 void propertyChange(java.beans.PropertyChangeEvent event)
           
protected  void setControllerComponent(java.awt.Component c)
           
protected  void setVideoComponent(java.awt.Component c)
           
 void setViewSize(int size)
           
abstract  void startPlayer()
           
abstract  void stopPlayer()
           
protected  void updateApplicationProperties()
           
protected  void updateAutoPlay()
           
protected  void updateImageAspect()
           
protected  void updateInitialScaleFactor()
           
protected  void updatePixelAspect()
           
protected  void updateScaleFactor()
           
protected  void updateViewProperties()
           
 
Methods inherited from class ch.randelshofer.view.AbstractViewAWT
getApplicationProperties, getViewProperties, init, mergeSettingsMenuItems, setApplicationProperties, setViewProperties
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ch.randelshofer.view.View
dispose
 
Methods inherited from interface javax.activation.CommandObject
setCommandContext
 

Field Detail

videoPanel

protected AbstractVideoViewAWT.VideoPanel videoPanel

backgroundWhiteItem

protected javax.swing.JRadioButtonMenuItem backgroundWhiteItem

backgroundBlackItem

protected javax.swing.JRadioButtonMenuItem backgroundBlackItem

backgroundCheckerboardItem

protected javax.swing.JRadioButtonMenuItem backgroundCheckerboardItem

playEveryFrameItem

protected javax.swing.JCheckBoxMenuItem playEveryFrameItem

loopItem

protected javax.swing.JCheckBoxMenuItem loopItem

audioEnabledItem

protected javax.swing.JCheckBoxMenuItem audioEnabledItem

HALF_SIZE

public static final int HALF_SIZE
See Also:
Constant Field Values

NORMAL_SIZE

public static final int NORMAL_SIZE
See Also:
Constant Field Values

DOUBLE_SIZE

public static final int DOUBLE_SIZE
See Also:
Constant Field Values

SCREEN_SIZE

public static final int SCREEN_SIZE
See Also:
Constant Field Values

checkerboardTexture

protected static final java.awt.image.BufferedImage checkerboardTexture
Constructor Detail

AbstractVideoViewAWT

public AbstractVideoViewAWT()
Initializes the Form

Method Detail

setVideoComponent

protected void setVideoComponent(java.awt.Component c)

getVideoComponent

protected java.awt.Component getVideoComponent()

setControllerComponent

protected void setControllerComponent(java.awt.Component c)

getControllerComponent

protected java.awt.Component getControllerComponent()

mergeViewMenuItems

public void mergeViewMenuItems(javax.swing.JMenu m)
Description copied from class: AbstractViewAWT
Adds menu items to the "View" menu. When the viewer is added to a container with a JMenuBar. Then the container asks the viewer to add his menu items to the "View" menu of the container.

Specified by:
mergeViewMenuItems in interface View
Overrides:
mergeViewMenuItems in class AbstractViewAWT

updateViewProperties

protected void updateViewProperties()
Overrides:
updateViewProperties in class AbstractViewAWT

updateApplicationProperties

protected void updateApplicationProperties()
Overrides:
updateApplicationProperties in class AbstractViewAWT

updateImageAspect

protected void updateImageAspect()

updatePixelAspect

protected void updatePixelAspect()

updateInitialScaleFactor

protected void updateInitialScaleFactor()

updateAutoPlay

protected void updateAutoPlay()

isAutoPlay

protected boolean isAutoPlay()

hasScrollPane

public boolean hasScrollPane()
Description copied from interface: View
Returns true if this viewer has a scrollpane of its own. The container that contains this viewers uses this method to determine if it should wrap a scrollpane around the viewer or not.

Specified by:
hasScrollPane in interface View
Overrides:
hasScrollPane in class AbstractViewAWT
Returns:
true if this viewer has a scrollpane of its own.

setViewSize

public void setViewSize(int size)

updateScaleFactor

protected void updateScaleFactor()

startPlayer

public abstract void startPlayer()

stopPlayer

public abstract void stopPlayer()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent event)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class AbstractViewAWT

packParent

protected void packParent()

addDropTargetListener

public void addDropTargetListener(java.awt.dnd.DropTargetListener listener)
This method adds the given drop target listener to all components of the viewer.

Specified by:
addDropTargetListener in interface View

Copyright 2012-02-25 Werner Randelshofer