Package Layout

Class DisplayPanel

java.lang.Object
Layout.DisplayPanel
Direct Known Subclasses:
FFTPluginPanelProvider.FFTPluginPanel, GPLDisplayPanel, RawDataDisplay.RawDisplayPanel, VetoPluginPanelProvider.VetoPluginPanel

public abstract class DisplayPanel extends Object
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:

  1. 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.
  2. 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:
  • Constructor Details

    • DisplayPanel

      public DisplayPanel(DisplayPanelProvider displayPanelProvider, DisplayPanelContainer displayPanelContainer)
      Standard Display panel constructor

      Creates 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

    • 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 clear
      x2 - x position of end of clear
      drawLine - 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

      public BufferedImage getDisplayImage()
      Returns:
      The display image
    • getPanelBorder

      public Insets getPanelBorder()
    • setPanelBorder

      public void setPanelBorder(Insets panelInsets)
    • getPanel

      public final JPanel getPanel()
      Each display panel must be able to provide a JPanel for incoropation into the display.
      Returns:
      the outer panel
    • getInnerPanel

      public JPanel 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

      public abstract void containerNotification(DisplayPanelContainer displayContainer, int noteType)
      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

      public PamAxis getNorthAxis()
    • getSouthAxis

      public PamAxis getSouthAxis()
    • getEastAxis

      public PamAxis getEastAxis()
    • getWestAxis

      public PamAxis getWestAxis()
    • getDisplayPanelContainer

      public DisplayPanelContainer getDisplayPanelContainer()
    • getDisplayPanelProvider

      public DisplayPanelProvider getDisplayPanelProvider()
    • spectrogramMousePosition

      public void spectrogramMousePosition(int chan, Point point, long mouseTime, double mouseFreq)
      Called when the mouse is clicked or dragged on a spectrogram display during viewer operation.
      Parameters:
      chan - channel for that panel
      point - point on the screen (from the mouse adapter)
      mouseTime - time of the mouse position in milliseconds
      mouseFreq - 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.