Package dataPlots.layout
Class TDGraph
java.lang.Object
dataPlots.layout.TDGraph
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.
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
-
Nested Class Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataItem
(TDDataInfo dataInfo) Add a data item to be plotted on this displayvoid
addDataItem
(TDDataProvider dataProvider) void
addPlotListener
(PlotMouseAdapter plotMouseAdapater) Add a mouse plot adapter to each panel on the graph.void
addPlotMouseListener
(PlotMouseListener plotMouseListener) Add a plot mouse listener.void
addPlotMouseMotionListener
(PlotMouseMotionListener plotMouseMotionListener) Add a plot mouse motion listener.void
addPlotZoomer
(PlotZoomerAdapter plotZoomerAdapter) Add a plot zoomer adapter to the graph.void
addSelectedDataUnit
(FoundDataUnit pamDataUnit) Add a selected data unit to the current selected data unit list.void
addSelectedDataUnit
(ArrayList<FoundDataUnit> pamDataUnits) Add a list of data units to the end current selected data units.void
void
Clear all selected data units.int
Get the hiding panel which contains settings for all the current datablocks associated with the graph.List containing info on data units which can be displayed on the graph.getDataNamesForAxis
(String axisName) Get a list of data sources that can provide data to the given axis name.int
getGraphPlotPanel
(int iPanel) int
Get the total number of graph plot panels.int
Get the number of PlotZoomerAdapters associated with this graphgetPlotZoomer
(int i) Get a zoomer for this graph.Get selected data units for this graph.int
get the number of pixels on the time axis of a plotboolean
hasAvailableAxisName
(String units) void
Can be called at any time the orientation changes to re-do the layout of the graph windows.void
Sort out the list of availableDataUnits and anything else that needs doing once data are added or removed.void
notifyModelChanged
(int changeType) Get notifications from the main controller.A bit different to the standard getter in that this only gets called just before teh configuration is serialized into the psf.boolean
Remove all plot mouse listeners from the tdgraph.boolean
Remove all plot mouse motion listeners from the tdGraph.void
Clear all the zoomers associated with this graphvoid
removeDataItem
(TDDataInfo dataInfo) Remove a data item from the plot list.void
void
removeListDuplicates
(ArrayList<FoundDataUnit> selectedDataUnits) Check for duplicate values in the selected data units and delete.boolean
removePlotMouseListener
(PlotMouseListener plotMouseListener) Remove a plot mouse listener.boolean
removePlotMouseMotionListener
(PlotMouseMotionListener plotMouseMotionListener) Remove a plot mouse motion listener.void
repaint
(long millis) Repaint all graph components.void
selectDataLine
(TDDataInfo dataInfo, DataLineInfo dataLine) Called when the user selects a specific data line for a specific data type.void
setAxisName
(String axisName) Called when the user sets the type of axis units.void
setGraphParameters
(GraphParameters graphParameters) This only gets called when the serialised settings from psf file have been loaded, not at any other time !void
setNumberOfPlots
(int numPlots) Set the number of plots within the graph.void
setSelectedDataUnits
(ArrayList<FoundDataUnit> selectedDataUnits) Set selected data units for the graph.void
setShowTopLabel
(boolean showTopLabel) Set whether to show a top label for this graph.void
setTopPanel
(PamPanel topPanel) Set a panel at the top of the graph;void
showOptionsDialog
(TDDataInfo dataInfo) Show the options dialog for a particular data typevoid
subscribeScrollDataBlocks
(PamScroller timeScroller) Subscribe data blocks to the time scroller system so their data get loaded in viewer mode.void
timeRangeSpinnerChange
(double oldValue, double newValue) Called when the time range spinner on the main display panel changes.void
timeScrollRangeChanged
(long minimumMillis, long maximumMillis) Called in viewer mode when the time scroll range moves.void
timeScrollValueChanged
(long valueMillis) Called in viewer mode when the time scroller moves
-
Constructor Details
-
TDGraph
-
-
Method Details
-
addPlotListener
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
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
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
Set a panel at the top of the graph;- Parameters:
topPanel
-
-
addDataItem
-
addDataItem
Add a data item to be plotted on this display- Parameters:
dataInfo
- item to add
-
removeGraph
public void removeGraph() -
removeDataItem
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
-
checkAxis
public void checkAxis() -
getGraphLabel
-
layoutGraph
public void layoutGraph()Can be called at any time the orientation changes to re-do the layout of the graph windows. -
getAxisExtent
-
getGraphOuterPanel
- Returns:
- the graphOuterPanel
-
getNumPlotPanels
public int getNumPlotPanels()Get the total number of graph plot panels.- Returns:
- number of panels
-
getGraphPlotPanel
- Parameters:
iPanel
- index of the panel.- Returns:
- the graphPlotPanel
-
getGraphNumber
public int getGraphNumber()- Returns:
- the graphNumber
-
getGraphAxis
- Returns:
- the graphAxis
-
subscribeScrollDataBlocks
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
List containing info on data units which can be displayed on the graph.- Returns:
- the tdDataInfo data list.
-
getDataNamesForAxis
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
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
Called when the user selects a specific data line for a specific data type.- Parameters:
dataInfo
-dataLine
-
-
getGraphParameters
- Returns:
- the 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
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
Show the options dialog for a particular data type- Parameters:
dataInfo
-
-
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 millismaximumMillis
- 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
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
Remove a plot mouse listener.- Parameters:
plotMouseListener
-- Returns:
-
addPlotMouseMotionListener
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
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
Get selected data units for this graph.- Returns:
- an array of selected data units.
-
setSelectedDataUnits
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
Add a selected data unit to the current selected data unit list.- Parameters:
pamDataUnit
-
-
addSelectedDataUnit
Add a list of data units to the end current selected data units.- Parameters:
pamDataUnits
-
-
removeListDuplicates
Check for duplicate values in the selected data units and delete. -
getCompoundHidingDialog
Get the hiding panel which contains settings for all the current datablocks associated with the graph.- Returns:
- CompoundHidingDialog for this graph.
-