dLife Home Page

dlife.vision
Class VideoSourceGUI

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by dlife.gui.GUIPanel
                      extended by dlife.robot.gui.DeviceDisplay
                          extended by dlife.vision.VideoSourceGUI
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Observer, Accessible

public class VideoSourceGUI
extends DeviceDisplay
implements Observer

This class provides GUI components for controlling a VideoSource (e.g. play/rewind etc...). Each VideoSource implementation will create a VideoPlayerGUI that can control it. The Camera will use that VideoSourceGUI to allow the user to control the video.

Version:
Jun 27, 2009
Author:
Grant Braught, Dickinson College
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static byte ALL_CONTROLS
          Convenience flag that indicates that all of the controls should be displayed, enabled or disabled.
static byte LOOP_CONTROL
          Flag indicating that the "loop video" control should be displayed, enabled or disabled.
static byte NO_CONTROLS
          Convenience flag that indicates that none of the controls should be displayed, enabled or disabled.
static byte PLAY_BUTTON
          Flag indicating that the play button should be displayed, enabled or disabled.
static byte REWIND_BUTTON
          Flag indicating that the rewind button should be displayed, enabled or disabled.
static byte SEEK_BAR
          Flag indicating that the seek bar should be displayed, enabled or disabled.
static byte STEP_BACK_BUTTON
          Flag indicating that the step back button should be displayed, enabled or disabled.
static byte STEP_FORWARD_BUTTON
          Flag indicating that the step forward button should be displayed, enabled or disabled.
 
Fields inherited from class dlife.robot.gui.DeviceDisplay
myDevice
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
VideoSourceGUI(VideoSource mySource, byte buttonMask)
          Construct a new VideoSourceGUI for the specified VideoSource.
 
Method Summary
protected  void buildGUI()
          Build the GUI for the VideoPlayer.
protected  void disableGUI()
          Disable the seek bar, all of the buttons and the loop control.
protected  void enableGUI()
          Enable the seek bar, buttons and loop control as appropriate given the current state of the VisionSource associated with this VideoSourceGUI.
 String getGUIName()
          Return "Video Controls" as the name of this GUI.
static void main(String[] args)
          Pop a VideoSourceGUI up in a window.
 void update(Observable o, Object arg)
          Adjust the seek location, button states and icons as appropriate given the current state of the VideoSource associated with this VideoSourceGUI.
protected  void updateGUIFromDevice()
          Does nothing.
 
Methods inherited from class dlife.robot.gui.DeviceDisplay
getContentPanel, isActive, isEnabled, replaceContentPanel, setActive, setEnabled
 
Methods inherited from class dlife.gui.GUIPanel
invokeBuildGUI
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PLAY_BUTTON

public static byte PLAY_BUTTON
Flag indicating that the play button should be displayed, enabled or disabled.


STEP_BACK_BUTTON

public static byte STEP_BACK_BUTTON
Flag indicating that the step back button should be displayed, enabled or disabled.


STEP_FORWARD_BUTTON

public static byte STEP_FORWARD_BUTTON
Flag indicating that the step forward button should be displayed, enabled or disabled.


REWIND_BUTTON

public static byte REWIND_BUTTON
Flag indicating that the rewind button should be displayed, enabled or disabled.


SEEK_BAR

public static byte SEEK_BAR
Flag indicating that the seek bar should be displayed, enabled or disabled.


LOOP_CONTROL

public static byte LOOP_CONTROL
Flag indicating that the "loop video" control should be displayed, enabled or disabled.


ALL_CONTROLS

public static byte ALL_CONTROLS
Convenience flag that indicates that all of the controls should be displayed, enabled or disabled.


NO_CONTROLS

public static byte NO_CONTROLS
Convenience flag that indicates that none of the controls should be displayed, enabled or disabled.

Constructor Detail

VideoSourceGUI

public VideoSourceGUI(VideoSource mySource,
                      byte buttonMask)
Construct a new VideoSourceGUI for the specified VideoSource.

Parameters:
mySource - The VideoSource to control with this VideoSourceGUI.
buttonMask - an ORed combination of the flags indicating which buttons should be displayed in this VideoPlayerGUI. E.g. PLAY_BUTTON | REWIND_BUTTON will display a play and rewind button but neither step button nor the seek bar.
Method Detail

buildGUI

protected void buildGUI()
Build the GUI for the VideoPlayer.

Specified by:
buildGUI in class GUIPanel

disableGUI

protected void disableGUI()
Disable the seek bar, all of the buttons and the loop control.

Specified by:
disableGUI in class DeviceDisplay

enableGUI

protected void enableGUI()
Enable the seek bar, buttons and loop control as appropriate given the current state of the VisionSource associated with this VideoSourceGUI.

Specified by:
enableGUI in class DeviceDisplay

updateGUIFromDevice

protected void updateGUIFromDevice()
Does nothing. The updates here are done only when notified by the VideoSource that the state has changed. See update below.

Specified by:
updateGUIFromDevice in class DeviceDisplay

getGUIName

public String getGUIName()
Return "Video Controls" as the name of this GUI.

Specified by:
getGUIName in class DeviceDisplay
Returns:
"Video Controls"

update

public void update(Observable o,
                   Object arg)
Adjust the seek location, button states and icons as appropriate given the current state of the VideoSource associated with this VideoSourceGUI.

Specified by:
update in interface Observer
Overrides:
update in class DeviceDisplay

main

public static void main(String[] args)
Pop a VideoSourceGUI up in a window. The player does not actually control anything. It is simply displayed for checking the layout.

Parameters:
args - none

dLife Home Page