Spectrogram
Class SpectrogramDisplay.SpectrogramPanel

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 Spectrogram.SpectrogramDisplay.SpectrogramPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, PamObserver
Enclosing class:
SpectrogramDisplay

 class SpectrogramDisplay.SpectrogramPanel
extends javax.swing.JPanel
implements PamObserver

Inner panels showing a single spectrogram display.

Author:
Doug Gillespie

Nested Class Summary
(package private)  class SpectrogramDisplay.SpectrogramPanel.DisplaySelection
           
(package private)  class SpectrogramDisplay.SpectrogramPanel.PopupListener
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
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
(package private)  javax.swing.JLabel channelLabel
           
(package private)  javax.swing.JCheckBoxMenuItem[] checkMenuItems
           
(package private)  long currentTimeMilliseconds
           
(package private)  javax.swing.JPopupMenu detectorMenu
           
private  java.awt.image.BufferedImage frozenImage
          Frozen image used when the mouse is pressed over the display
(package private)  int imagePos
           
(package private)  boolean markThis
           
(package private)  int panelId
           
(package private)  java.awt.Dimension panelSize
           
(package private)  SpectrogramDisplay.SpectrogramPanel.PopupListener popupListener
           
private  ScrollableBufferedImage specImage
           
(package private)  SpectrogramDisplay.SpecPanelMouse specPanelMouse
           
(package private)  java.util.ArrayList<PamDataBlock> viewedDataBlocks
           
private  java.awt.image.WritableRaster writableRaster
           
 
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
SpectrogramDisplay.SpectrogramPanel(int iD)
           
 
Method Summary
private  void clearImage()
          Clear the background image.
private  void createImage()
           
(package private)  void destroyPanel()
           
private  void drawBackgroundImage()
          Used offline to fill in the background image using loaded FFT data.
private  void drawOverlayData(java.awt.Graphics g)
          Draw graphic overlays (only used in offline viewer mode)
private  void drawOverlayData(java.awt.Graphics g, PamDataBlock usedDataBlock)
          Draw the overlay data for a specific data block
private  void drawSpectrogram(PamObservable obs, FFTDataUnit dataUnit, int panelNumber)
          Called when new spectrogram data arrive.
protected  void freezeImage(boolean markThis)
           
 java.lang.String getObserverName()
           
 PamObserver getObserverObject()
           
(package private)  javax.swing.JPopupMenu getPlotDetectorMenu()
           
 long getRequiredDataHistory(PamObservable o, java.lang.Object arg)
           
(package private)  double getXScale()
           
(package private)  void InitialisePlotDetectorMenu()
           
 void masterClockUpdate(long milliSeconds, long sampleNumber)
           
 void noteNewSettings()
           
 void paintComponent(java.awt.Graphics g)
           
 void removeObservable(PamObservable o)
          called when an Observable (PamDataBlock) is removed from the system
protected  void sayMousePos(java.awt.Point pt)
           
 void setSampleRate(float sampleRate, boolean notify)
          New sample rate
 void subscribeDataBlocks()
           
protected  void unFreezeImage()
           
 void update(PamObservable obs, PamDataUnit newData)
          Informs the PamObserver that new data have been added to the Observable class
 
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, 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, setEnabled, 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, isEnabled, 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

panelSize

java.awt.Dimension panelSize

panelId

int panelId

detectorMenu

javax.swing.JPopupMenu detectorMenu

checkMenuItems

javax.swing.JCheckBoxMenuItem[] checkMenuItems

popupListener

SpectrogramDisplay.SpectrogramPanel.PopupListener popupListener

viewedDataBlocks

java.util.ArrayList<PamDataBlock> viewedDataBlocks

specImage

private ScrollableBufferedImage specImage

writableRaster

private java.awt.image.WritableRaster writableRaster

specPanelMouse

SpectrogramDisplay.SpecPanelMouse specPanelMouse

imagePos

int imagePos

currentTimeMilliseconds

long currentTimeMilliseconds

channelLabel

javax.swing.JLabel channelLabel

frozenImage

private java.awt.image.BufferedImage frozenImage
Frozen image used when the mouse is pressed over the display


markThis

boolean markThis
Constructor Detail

SpectrogramDisplay.SpectrogramPanel

SpectrogramDisplay.SpectrogramPanel(int iD)
Method Detail

subscribeDataBlocks

public void subscribeDataBlocks()

destroyPanel

void destroyPanel()

getObserverObject

public PamObserver getObserverObject()
Specified by:
getObserverObject in interface PamObserver
Returns:
the actual observer. In most cases concrete classes will just return 'this' in response. The exception is the Threaded observer, which will return the single thread observer.

createImage

private void createImage()

getXScale

double getXScale()
Returns:
XScale in pixels per second

drawSpectrogram

private void drawSpectrogram(PamObservable obs,
                             FFTDataUnit dataUnit,
                             int panelNumber)
Called when new spectrogram data arrive.

Parameters:
obs - PAmDataBlock that sent the data
dataUnit - FFT Data unit
panelNumber - number of panel to update.

drawBackgroundImage

private void drawBackgroundImage()
Used offline to fill in the background image using loaded FFT data. this will happen whenever new data are loaded (when the scroller moves) or when the image resizes.


clearImage

private void clearImage()
Clear the background image.


paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

drawOverlayData

private void drawOverlayData(java.awt.Graphics g)
Draw graphic overlays (only used in offline viewer mode)

Parameters:
g -

drawOverlayData

private void drawOverlayData(java.awt.Graphics g,
                             PamDataBlock usedDataBlock)
Draw the overlay data for a specific data block

Only used in offline viewer mode

Parameters:
g - graphics handle
usedDataBlock - datablock reference.

getPlotDetectorMenu

javax.swing.JPopupMenu getPlotDetectorMenu()

getRequiredDataHistory

public long getRequiredDataHistory(PamObservable o,
                                   java.lang.Object arg)
Specified by:
getRequiredDataHistory in interface PamObserver
Parameters:
o - PamObservable class requiring the data
arg - optional argument from PamObservable
Returns:
time in milliseconds requried by data held in PamObservable

getObserverName

public java.lang.String getObserverName()
Specified by:
getObserverName in interface PamObserver

noteNewSettings

public void noteNewSettings()
Specified by:
noteNewSettings in interface PamObserver

setSampleRate

public void setSampleRate(float sampleRate,
                          boolean notify)
Description copied from interface: PamObserver
New sample rate

Specified by:
setSampleRate in interface PamObserver
notify - Notify other PamObservers and PamObservables in the chain.

masterClockUpdate

public void masterClockUpdate(long milliSeconds,
                              long sampleNumber)
Specified by:
masterClockUpdate in interface PamObserver

update

public void update(PamObservable obs,
                   PamDataUnit newData)
Description copied from interface: PamObserver
Informs the PamObserver that new data have been added to the Observable class

Specified by:
update in interface PamObserver
Parameters:
obs - Reference to the Observable (a PamDataBlock)
newData - Reference to the new PamDataUnit

InitialisePlotDetectorMenu

void InitialisePlotDetectorMenu()

removeObservable

public void removeObservable(PamObservable o)
Description copied from interface: PamObserver
called when an Observable (PamDataBlock) is removed from the system

Specified by:
removeObservable in interface PamObserver

freezeImage

protected void freezeImage(boolean markThis)

unFreezeImage

protected void unFreezeImage()

sayMousePos

protected void sayMousePos(java.awt.Point pt)