mil.navy.nps.logger
Class PduPlayer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended bymil.navy.nps.logger.PduPlayer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class PduPlayer
extends javax.swing.JFrame

Main class for the PduPlayer application. Creates user interface. Calls the appropriate methods for each button - play, fast forward, rewind, stop, record.

Version:
Version 3.0

Invocation:

   java mil.navy.nps.logger.PduPlayer
or
   c:\vrtp\demo\pduRecordings> PduPlayer.bat
or
   unix/vrtp/demo/pduRecordings> PduPlayer.sh

Author:
Millie Ives, David Holland, DMcG
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.MenuItem aboutMenuItem
           
protected  javax.swing.JToggleButton autoButton
           
protected  Play autoObject
           
static int AUTOREPEAT
           
protected  javax.swing.ButtonGroup buttonGroup
           
protected  boolean changedFromMethod
           
protected  java.awt.MenuItem clearPdusMenuItem
           
static java.lang.String DEFAULT_FILENAME
           
static java.lang.String DEFAULT_MULTICAST_ADDRESS
           
static int DEFAULT_PORT
           
static int DEFAULT_TTL
           
protected  javax.swing.JPanel drawArea
           
protected  java.awt.Frame drawFrame
           
protected  java.awt.MenuItem editMenuItem
           
static int FFWD
           
protected  javax.swing.JToggleButton ffwdButton
           
protected  FFwd ffwdObject
           
(package private)  java.awt.FileDialog file
           
protected  BehaviorStreamBufferInfo fileInfo
           
protected  java.awt.MenuItem fileInfoMenuItem
           
(package private)  java.awt.Menu fileMenu
           
protected  java.lang.String filename
           
(package private)  java.awt.Menu helpMenu
           
(package private) static java.awt.Scrollbar horizontal
           
(package private)  int mode
           
(package private)  java.lang.String msg
           
protected  java.lang.String multicastAddress
           
protected  java.awt.MenuItem networkParamsMenuItem
           
protected  java.awt.MenuItem newMenuItem
           
protected  java.awt.MenuItem openMenuItem
           
(package private)  java.awt.Menu optionsMenu
           
(package private) static java.util.Vector pduBuffer
           
protected  int pduCount
           
protected  int pduIndex
           
protected  javax.swing.JSlider pduSlider
           
static int PLAY
           
protected  javax.swing.JToggleButton playButton
           
protected  Play playObject
           
protected  int portNo
           
protected  java.awt.MenuItem quitMenuItem
           
protected  javax.swing.JToggleButton recButton
           
static int RECORD
           
protected  Record recordObject
           
protected  javax.swing.JToggleButton rewButton
           
static int REWIND
           
protected  Rewind rewindObject
           
protected  java.awt.MenuItem saveAsMenuItem
           
protected  java.awt.MenuItem saveMenuItem
           
(package private)  int state
           
static int STOP
           
protected  javax.swing.JToggleButton stopButton
           
protected  java.awt.MenuItem supportMenuItem
           
protected  int timeToLive
           
protected  java.awt.MenuItem toggleModeMenuItem
           
protected  javax.swing.JTextField totalPdus
           
protected  java.awt.MenuItem usersGuideMenuItem
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
PduPlayer()
          Constructor for the PDU logger.
 
Method Summary
 void addPdu(ProtocolDataUnit pPdu)
           
 void autoButtonHit()
          Automatic looping of the play button.
 void ffwdButtonHit()
           
static java.util.Vector getPduBuffer()
          Returns the pdu buffer used to record pdus.
 int getPduIndex()
          Returns the current index of PDUs, the index of the next PDU in memory.
 void helpMenu()
          Action handler for the help menu, called from an anonymous inner class in the constructor.
static void main(java.lang.String[] args)
          Entry point for program.
 void openFile()
          Handles an "openFile" event.
 void performStopButtonHit()
          Stop button hit.
 void playButtonHit()
          Handles a play button hit.
 void recordButtonHit()
          The record button was hit; launch a thread to save the data to a buffer.
 void rewindButtonHit()
          Rewind button hit.
 void runPropertiesDialog()
          Opens a dialog box with various properites from the prepend data in the file displayed, for editing.
 void saveAsFile()
          SaveAs menu operation.
 void saveFile()
          Save file menu selection action.
 void setPduIndex(int pNewIndex)
          Sets the current index of PDUs, the next PDU to be read.
 void syncPduCount()
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, 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, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

DEFAULT_MULTICAST_ADDRESS

public static final java.lang.String DEFAULT_MULTICAST_ADDRESS
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values

DEFAULT_TTL

public static final int DEFAULT_TTL
See Also:
Constant Field Values

DEFAULT_FILENAME

public static final java.lang.String DEFAULT_FILENAME
See Also:
Constant Field Values

drawArea

protected javax.swing.JPanel drawArea

drawFrame

protected java.awt.Frame drawFrame

autoObject

protected Play autoObject

playObject

protected Play playObject

recordObject

protected Record recordObject

rewindObject

protected Rewind rewindObject

ffwdObject

protected FFwd ffwdObject

pduSlider

protected javax.swing.JSlider pduSlider

totalPdus

protected javax.swing.JTextField totalPdus

multicastAddress

protected java.lang.String multicastAddress

portNo

protected int portNo

timeToLive

protected int timeToLive

filename

protected java.lang.String filename

fileInfo

protected BehaviorStreamBufferInfo fileInfo

state

transient int state

mode

transient int mode

msg

transient java.lang.String msg

newMenuItem

protected java.awt.MenuItem newMenuItem

quitMenuItem

protected java.awt.MenuItem quitMenuItem

openMenuItem

protected java.awt.MenuItem openMenuItem

saveMenuItem

protected java.awt.MenuItem saveMenuItem

saveAsMenuItem

protected java.awt.MenuItem saveAsMenuItem

fileInfoMenuItem

protected java.awt.MenuItem fileInfoMenuItem

usersGuideMenuItem

protected java.awt.MenuItem usersGuideMenuItem

aboutMenuItem

protected java.awt.MenuItem aboutMenuItem

supportMenuItem

protected java.awt.MenuItem supportMenuItem

toggleModeMenuItem

protected java.awt.MenuItem toggleModeMenuItem

clearPdusMenuItem

protected java.awt.MenuItem clearPdusMenuItem

networkParamsMenuItem

protected java.awt.MenuItem networkParamsMenuItem

editMenuItem

protected java.awt.MenuItem editMenuItem

fileMenu

transient java.awt.Menu fileMenu

optionsMenu

transient java.awt.Menu optionsMenu

helpMenu

transient java.awt.Menu helpMenu

file

transient java.awt.FileDialog file

pduBuffer

static java.util.Vector pduBuffer

horizontal

static java.awt.Scrollbar horizontal

rewButton

protected javax.swing.JToggleButton rewButton

playButton

protected javax.swing.JToggleButton playButton

ffwdButton

protected javax.swing.JToggleButton ffwdButton

recButton

protected javax.swing.JToggleButton recButton

stopButton

protected javax.swing.JToggleButton stopButton

autoButton

protected javax.swing.JToggleButton autoButton

buttonGroup

protected javax.swing.ButtonGroup buttonGroup

pduIndex

protected int pduIndex

pduCount

protected int pduCount

changedFromMethod

protected boolean changedFromMethod

STOP

public static final int STOP
See Also:
Constant Field Values

REWIND

public static final int REWIND
See Also:
Constant Field Values

PLAY

public static final int PLAY
See Also:
Constant Field Values

FFWD

public static final int FFWD
See Also:
Constant Field Values

RECORD

public static final int RECORD
See Also:
Constant Field Values

AUTOREPEAT

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

PduPlayer

public PduPlayer()
Constructor for the PDU logger.

Method Detail

getPduBuffer

public static java.util.Vector getPduBuffer()
Returns the pdu buffer used to record pdus. Contains any type of PDU, not limited to just ESPDUs. Any access to the variable should be through this method.


addPdu

public void addPdu(ProtocolDataUnit pPdu)

syncPduCount

public void syncPduCount()

setPduIndex

public void setPduIndex(int pNewIndex)
Sets the current index of PDUs, the next PDU to be read. Also updates the display of the current PDU.


getPduIndex

public int getPduIndex()
Returns the current index of PDUs, the index of the next PDU in memory.


openFile

public void openFile()
Handles an "openFile" event. Called from the anonymous inner class created in the constructor.


saveFile

public void saveFile()
Save file menu selection action. Called from the anonymous inner class action handler.


saveAsFile

public void saveAsFile()
SaveAs menu operation. Open up a file dialog, then write out the contents of the pduBuffer to the file.


helpMenu

public void helpMenu()
Action handler for the help menu, called from an anonymous inner class in the constructor. Launches the default web browser, with an argument that includes the help HTML file.


performStopButtonHit

public void performStopButtonHit()
Stop button hit. This calls code to perform the click on the stop button. A thread doing some operation, such as playing or rewinding, should call this method after finishing its task, just before exiting. It selects the stop button, and de-selects the current button.


rewindButtonHit

public void rewindButtonHit()
Rewind button hit. Checks the state and toggles intelligently. The rewind operation actually replays the PDUs in reverse order, from the current position. So if we're at PDU 42 currently, IN THE PDU LIST IN MEMORY, the pdus would be replayed back as 42, 41, 40, etc.

This has to launch a new thread (we can't process the lengthy rewind action inside the action handler; that would stop the GUI.)


playButtonHit

public void playButtonHit()
Handles a play button hit. Replays the pdus in memory, possibly augmented by pdus from the file.


autoButtonHit

public void autoButtonHit()
Automatic looping of the play button. This goes to the end of the play, then loops back to the start of the in-memory pdus.


ffwdButtonHit

public void ffwdButtonHit()

recordButtonHit

public void recordButtonHit()
The record button was hit; launch a thread to save the data to a buffer.


runPropertiesDialog

public void runPropertiesDialog()
Opens a dialog box with various properites from the prepend data in the file displayed, for editing.


main

public static void main(java.lang.String[] args)
Entry point for program. Lots of options ripped out here. In fact, all options ripped out. Then the location salted, and no two stones left on top of each other.