mil.navy.nps.awt
Class AwtPduViewer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bymil.navy.nps.awt.AwtPduViewer
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.event.ItemListener, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class AwtPduViewer
extends java.applet.Applet
implements java.lang.Runnable, java.awt.event.ItemListener, java.awt.event.ActionListener

AwtPduViewer is an applet that reads Pdus and displays their values on the screen. It is configured with a socket, which allows the applet to read data from the wire; it uses the package mil.navy.nps.dis, which implements the DIS protocol.

This file was generated by Microsquish J++, which is something of an experiment. We'll see how it works out. It's also my first applet that isn't completely trivial, so be a little gentle.

This is compliant with the JDK 1.02 spec; it makes use of deprecated aspects of that API rather than use JDK 1.1. This is primarily to get it working with Netscape 3.01. 1.1 browser implementations should be compatible, at least for the next release.

Netscape bitches & moans about doing a thread.suspend(), complaining about the possibility of deadlock. Not sure what this is all about, but it seems to work. (Note: JavaSoft has deprecated thread.suspend() and friends in 1.1 because of inherent problems w/ deadlock. This needs to be reworked.

This takes two parameters from the HTML file, "PduSocket" and"MulticastGroup". The first is the socket the applet listens on. The second is a multicast group, a feature that is not implemented right now since Netscape doesn't do multicast.

Testing: sent ESPdus to host (madison) from both madison and pinafore using mil.navy.nps.dis.Benchmark. HISTORY

10Apr97 DMcG New

Version:
1.0
Author:
Don McGregor ( http://www.npsnet.org/~mcgredo)

See Also:
UpdateThread, TextAreaStream, Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
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
 
Fields inherited from class java.applet.Applet
 
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 java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AwtPduViewer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles button presses
 void destroy()
           
 java.lang.String getAppletInfo()
           
 java.lang.String[][] getParameterInfo()
           
 void init()
          Applet initialization code
 void itemStateChanged(java.awt.event.ItemEvent ie)
          itemStateChanged is the interface for ItemListener.
 void paint(java.awt.Graphics g)
           
 void run()
           
 void start()
           
 void stop()
           
 void updateDisplay()
          Updates the display by querying the BehaviorStreamBufferUDP, returning any Pdus that have arrived since the last time we asked, and updating the display.
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
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, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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
 

Constructor Detail

AwtPduViewer

public AwtPduViewer()
Method Detail

getAppletInfo

public java.lang.String getAppletInfo()

getParameterInfo

public java.lang.String[][] getParameterInfo()

init

public void init()
Applet initialization code


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles button presses

Specified by:
actionPerformed in interface java.awt.event.ActionListener

destroy

public void destroy()

paint

public void paint(java.awt.Graphics g)

start

public void start()

stop

public void stop()

run

public void run()
Specified by:
run in interface java.lang.Runnable

updateDisplay

public void updateDisplay()
Updates the display by querying the BehaviorStreamBufferUDP, returning any Pdus that have arrived since the last time we asked, and updating the display. This is kicked off by its own thread, so it runs asyncronously from the app. the display is updated every X seconds. We need to lock access to pduPool, since this is global data used elsewhere in the applet in another thread. Not sure about the requirement to lock list, the GUI element that displays the scrolling list. This is the only place we do a _write_ to it, so I think it's OK.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent ie)
itemStateChanged is the interface for ItemListener. When this object is added as a listener to an object, such as a awt.List, this gets the event when something is selected. We act on that by dumping out the contents of the selected item.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener