Package Layout
Class DisplayPanel
java.lang.Object
Layout.DisplayPanel
- Direct Known Subclasses:
 FFTPluginPanelProvider.FFTPluginPanel,GPLDisplayPanel,RawDataDisplay.RawDisplayPanel,VetoPluginPanelProvider.VetoPluginPanel
A standard display panel that can be incorporated into other displays, eg. the
 Spectorgram window. Provides a JPanel and optionally axis to be drawn around it. 
 
The programmer must always implement the function containerNotification in order to clear the display panel ahead of where the spectrogram is currently drawing.
There are two principle ways of drawing new data on the panel:
- For data which are continuous in nature, such as waveforms or data calculated from the spectrgram data itself, the new data can be drawn from within containerNotification.
 - For data which arrive intermittently, such as detected clicks, it is better to draw those data as and when they arrive by subscribing to the appropriate PamDataBlock and implementing code in the update function in the PamObserver interface.
 
- Author:
 - Doug Gillespie
 - See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DisplayPanelContainerprotected DisplayPanelProviderprotected Color - 
Constructor Summary
ConstructorsConstructorDescriptionDisplayPanel(DisplayPanelProvider displayPanelProvider, DisplayPanelContainer displayPanelContainer) Standard Display panel constructor - 
Method Summary
Modifier and TypeMethodDescriptionvoidClear the entire imagevoidclearImage(int x1, int x2) Clear part of the image between x1 and x2voidclearImage(int x1, int x2, boolean drawLine) Clear part of the image and draw a line just to the right of the cleared sectionabstract voidcontainerNotification(DisplayPanelContainer displayContainer, int noteType) Called by the DisplayPanelContainer whenever the scales change - e.g.protected JPopupMenuCreate a popup menu.abstract voidThe displayPanelContainer should call destroyPanel when the panel is no longer required so that the displayPanel can unsubscribe to any data it was observing.intintfinal JPanelgetPanel()Each display panel must be able to provide a JPanel for incoropation into the display.voidCalled just before the image is drawn so that it can be drawn on.voidrepaint()repaints the display - needs to be called after any changes to the imagevoidrepaint(int t) repaints the display - needs to be called after any changes to the imagevoidsetPanelBorder(Insets panelInsets) voidspectrogramMousePosition(int chan, Point point, long mouseTime, double mouseFreq) Called when the mouse is clicked or dragged on a spectrogram display during viewer operation. 
- 
Field Details
- 
displayPanelProvider
 - 
displayPanelContainer
 - 
plotBackground
 
 - 
 - 
Constructor Details
- 
DisplayPanel
public DisplayPanel(DisplayPanelProvider displayPanelProvider, DisplayPanelContainer displayPanelContainer) Standard Display panel constructorCreates two J Panels, one nested inside the other with a small border. The inner panel also has a BufferedImage drawn in it which can be used for any graphics.
- Parameters:
 displayPanelProvider-displayPanelContainer-
 
 - 
 - 
Method Details
- 
createPopupMenu
Create a popup menu.This should be overridden in any sub classes that want to present a menu for setting any display options.
- Returns:
 - reference to the popup menu for the display panel
 
 - 
clearImage
public void clearImage()Clear the entire image - 
clearImage
public void clearImage(int x1, int x2) Clear part of the image between x1 and x2- Parameters:
 x1-x2-
 - 
clearImage
public void clearImage(int x1, int x2, boolean drawLine) Clear part of the image and draw a line just to the right of the cleared section- Parameters:
 x1- x position of start of clearx2- x position of end of cleardrawLine- draw a vertical line to show cleared region
 - 
getInnerWidth
public int getInnerWidth()- Returns:
 - the width in pixels of the image
 
 - 
getInnerHeight
public int getInnerHeight()- Returns:
 - the height in pixels of the image
 
 - 
getDisplayImage
- Returns:
 - The display image
 
 - 
getPanelBorder
 - 
setPanelBorder
 - 
getPanel
Each display panel must be able to provide a JPanel for incoropation into the display.- Returns:
 - the outer panel
 
 - 
getInnerPanel
 - 
repaint
public void repaint()repaints the display - needs to be called after any changes to the image - 
repaint
public void repaint(int t) repaints the display - needs to be called after any changes to the image- Parameters:
 t- time delay
 - 
destroyPanel
public abstract void destroyPanel()The displayPanelContainer should call destroyPanel when the panel is no longer required so that the displayPanel can unsubscribe to any data it was observing. - 
containerNotification
Called by the DisplayPanelContainer whenever the scales change - e.g. every time new data is drawn on the spectrogram.The display panel can use this information in two ways:
Firstly, it should clear the region of the display just ahead of the current spectrogram x coordinate. Secondly, it may draw additional data on the display.
- Parameters:
 displayContainer-noteType-
 - 
getNorthAxis
 - 
getSouthAxis
 - 
getEastAxis
 - 
getWestAxis
 - 
getDisplayPanelContainer
 - 
getDisplayPanelProvider
 - 
spectrogramMousePosition
Called when the mouse is clicked or dragged on a spectrogram display during viewer operation.- Parameters:
 chan- channel for that panelpoint- point on the screen (from the mouse adapter)mouseTime- time of the mouse position in millisecondsmouseFreq- frequency of the mouse position in Hz.
 - 
prepareImage
public void prepareImage()Called just before the image is drawn so that it can be drawn on. 
 -