Class TDGraph

java.lang.Object
dataPlots.layout.TDGraph

public class TDGraph extends Object
Panel for a data graph. A single graph may display data from multiple sources, but will only show ones that have a common axis type at any one time.
To allow for multi channels of data, each graphs may contain multiple plots. Currently the number of plots cannot be altered by the user, but can be altered by some of the TDDataInfo classes. This was primarily implemented to display spectrogram data on multiple panels. This has some advantages over putting in multiple graphs in that each plot within a graph will have the same size and basic data type.
Author:
Doug Gillespie
  • Constructor Details

    • TDGraph

      public TDGraph(TDControl tdControl, int graphNumber)
  • Method Details

    • addPlotListener

      public void addPlotListener(PlotMouseAdapter plotMouseAdapater)
      Add a mouse plot adapter to each panel on the graph.
      Parameters:
      plotMouseAdapater - - an extension of MouseAdapter desgined for primarily for picking detections on a graph, however maybe extended to many other functions.
    • addPlotZoomer

      public void addPlotZoomer(PlotZoomerAdapter plotZoomerAdapter)
      Add a plot zoomer adapter to the graph. Zoomers essentially control marking out of multiple detections using some of kind of selection tool e.g. dragging a box.
      Parameters:
      plotZoomerAdapter - - plot zoomer adapter.
    • removeAllZoomers

      public void removeAllZoomers()
      Clear all the zoomers associated with this graph
    • getPlotZoomer

      public PlotZoomerAdapter getPlotZoomer(int i)
      Get a zoomer for this graph.
      Parameters:
      i - which zoomer to get
      Returns:
      a zoomer from the list of zoomers associated with this graph.
    • getNumPlotZoomers

      public int getNumPlotZoomers()
      Get the number of PlotZoomerAdapters associated with this graph
      Returns:
      the number of PlotZoomerAdapters
    • setTopPanel

      public void setTopPanel(PamPanel topPanel)
      Set a panel at the top of the graph;
      Parameters:
      topPanel -
    • addDataItem

      public void addDataItem(TDDataProvider dataProvider)
    • addDataItem

      public void addDataItem(TDDataInfo dataInfo)
      Add a data item to be plotted on this display
      Parameters:
      dataInfo - item to add
    • removeGraph

      public void removeGraph()
    • removeDataItem

      public void removeDataItem(TDDataInfo dataInfo)
      Remove a data item from the plot list.
      Parameters:
      dataInfo - item to remove.
    • listAvailableAxisNames

      public void listAvailableAxisNames()
      Sort out the list of availableDataUnits and anything else that needs doing once data are added or removed.
    • hasAvailableAxisName

      public boolean hasAvailableAxisName(String units)
    • checkAxis

      public void checkAxis()
    • getGraphLabel

      public String getGraphLabel()
    • layoutGraph

      public void layoutGraph()
      Can be called at any time the orientation changes to re-do the layout of the graph windows.
    • getAxisExtent

      public int getAxisExtent(Graphics g)
    • getGraphOuterPanel

      public PamPanel getGraphOuterPanel()
      Returns:
      the graphOuterPanel
    • getNumPlotPanels

      public int getNumPlotPanels()
      Get the total number of graph plot panels.
      Returns:
      number of panels
    • getGraphPlotPanel

      public TDGraph.GraphPlotPanel getGraphPlotPanel(int iPanel)
      Parameters:
      iPanel - index of the panel.
      Returns:
      the graphPlotPanel
    • getGraphNumber

      public int getGraphNumber()
      Returns:
      the graphNumber
    • getGraphAxis

      public PamAxis getGraphAxis()
      Returns:
      the graphAxis
    • subscribeScrollDataBlocks

      public void subscribeScrollDataBlocks(PamScroller timeScroller)
      Subscribe data blocks to the time scroller system so their data get loaded in viewer mode.
      Parameters:
      timeScroller -
    • notifyModelChanged

      public void notifyModelChanged(int changeType)
      Get notifications from the main controller.
      Parameters:
      changeType -
    • getDataList

      public ArrayList<TDDataInfo> getDataList()
      List containing info on data units which can be displayed on the graph.
      Returns:
      the tdDataInfo data list.
    • getDataNamesForAxis

      public String getDataNamesForAxis(String axisName)
      Get a list of data sources that can provide data to the given axis name.
      Parameters:
      axisName -
      Returns:
      a list of data sources that can provide data for that axis type.
    • setAxisName

      public void setAxisName(String axisName)
      Called when the user sets the type of axis units. These may not be available in all displayed data, so when this is set, some things may stop showing !
      Parameters:
      unitsType -
    • setNumberOfPlots

      public void setNumberOfPlots(int numPlots)
      Set the number of plots within the graph. By default this is one, but some types of data will contain functinality which can change this.
      Parameters:
      numPlots - number of plots to show.
    • selectDataLine

      public void selectDataLine(TDDataInfo dataInfo, DataLineInfo dataLine)
      Called when the user selects a specific data line for a specific data type.
      Parameters:
      dataInfo -
      dataLine -
    • getGraphParameters

      public GraphParameters getGraphParameters()
      Returns:
      the graphParameters
    • prepareGraphParameters

      public GraphParameters prepareGraphParameters()
      A bit different to the standard getter in that this only gets called just before teh configuration is serialized into the psf. It's time to pull any configuration information out about every line drawn on this boomin' think !
      Returns:
      graph parameters ready to serialised.
    • setGraphParameters

      public void setGraphParameters(GraphParameters graphParameters)
      This only gets called when the serialised settings from psf file have been loaded, not at any other time !
      Parameters:
      graphParameters - the graphParameters to set
    • showOptionsDialog

      public void showOptionsDialog(TDDataInfo dataInfo)
      Show the options dialog for a particular data type
      Parameters:
      dataInfo -
    • getTdControl

      public TDControl getTdControl()
      Returns:
      the tdControl
    • getTimePixels

      public int getTimePixels()
      get the number of pixels on the time axis of a plot
      Returns:
      the number of pixels on the time axis of a plot
    • timeScrollValueChanged

      public void timeScrollValueChanged(long valueMillis)
      Called in viewer mode when the time scroller moves
      Parameters:
      valueMillis - new scroll value in millis
    • timeScrollRangeChanged

      public void timeScrollRangeChanged(long minimumMillis, long maximumMillis)
      Called in viewer mode when the time scroll range moves.
      Parameters:
      minimumMillis - new minimum in millis
      maximumMillis - new maximum in millis.
    • repaint

      public void repaint(long millis)
      Repaint all graph components.
      Parameters:
      millis - paint delay
    • timeRangeSpinnerChange

      public void timeRangeSpinnerChange(double oldValue, double newValue)
      Called when the time range spinner on the main display panel changes.
      Parameters:
      oldValue - old value (seconds)
      newValue - new value (seconds)
    • addPlotMouseListener

      public void addPlotMouseListener(PlotMouseListener plotMouseListener)
      Add a plot mouse listener. This is similar to a normal mouse listener except that as well as the mouse event it gets the graph reference, panel number and any data unit close to the mouse position.
      Parameters:
      plotMouseListener -
    • removePlotMouseListener

      public boolean removePlotMouseListener(PlotMouseListener plotMouseListener)
      Remove a plot mouse listener.
      Parameters:
      plotMouseListener -
      Returns:
    • addPlotMouseMotionListener

      public void addPlotMouseMotionListener(PlotMouseMotionListener plotMouseMotionListener)
      Add a plot mouse motion listener. This is similar to a normal mouse motion listener except that as well as the mouse event it gets the graph reference, panel number and any data unit close to the mouse position.
      Parameters:
      plotMouseMotionListener -
    • removePlotMouseMotionListener

      public boolean removePlotMouseMotionListener(PlotMouseMotionListener plotMouseMotionListener)
      Remove a plot mouse motion listener.
      Parameters:
      plotMouseMotionListener -
      Returns:
    • removeAllPlotMouseMotionListeners

      public boolean removeAllPlotMouseMotionListeners()
      Remove all plot mouse motion listeners from the tdGraph.
      Returns:
      true of removed..false if the array holding listeners is currently null
    • removeAllPlotMouseListeners

      public boolean removeAllPlotMouseListeners()
      Remove all plot mouse listeners from the tdgraph.
      Returns:
      true of removed..false if the array holding listeners is currently null
    • setShowTopLabel

      public void setShowTopLabel(boolean showTopLabel)
      Set whether to show a top label for this graph.
      Parameters:
      showTopLabel - - true to show top label
    • getSelectedDataUnits

      public ArrayList<FoundDataUnit> getSelectedDataUnits()
      Get selected data units for this graph.
      Returns:
      an array of selected data units.
    • setSelectedDataUnits

      public void setSelectedDataUnits(ArrayList<FoundDataUnit> selectedDataUnits)
      Set selected data units for the graph.
      Parameters:
      selectedDataUnits - . Data units, which, if displayed, will be highlighted.
    • clearSelectedDataUnits

      public void clearSelectedDataUnits()
      Clear all selected data units.
    • addSelectedDataUnit

      public void addSelectedDataUnit(FoundDataUnit pamDataUnit)
      Add a selected data unit to the current selected data unit list.
      Parameters:
      pamDataUnit -
    • addSelectedDataUnit

      public void addSelectedDataUnit(ArrayList<FoundDataUnit> pamDataUnits)
      Add a list of data units to the end current selected data units.
      Parameters:
      pamDataUnits -
    • removeListDuplicates

      public void removeListDuplicates(ArrayList<FoundDataUnit> selectedDataUnits)
      Check for duplicate values in the selected data units and delete.
    • getCompoundHidingDialog

      public CompoundHidingDialog getCompoundHidingDialog()
      Get the hiding panel which contains settings for all the current datablocks associated with the graph.
      Returns:
      CompoundHidingDialog for this graph.