Class GraphicsPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
ChromatogramPanel, IsotopicDistributionPanel, SpectrumPanel

public abstract class GraphicsPanel
extends JPanel
This class presents a JPanel that will hold and display a mass spectrum or a chromatogram.
Author:
Lennart Martens, Harald Barsnes
See Also:
Serialized Form
  • Field Details

    • miniature

      protected boolean miniature
      If set to true, the y-axis is removed, the y- and x-axis tags are removed, and any annotations are hidden. All to make the graphics panel look better in a smaller version, e.g., when put into a table cell. When turning miniature mode one it is also recommended to reduce the max padding. Note that miniature and reduced max padding is set automatically by the GraphicsPanelTableCellRenderer.
    • yDataIsPositive

      protected boolean yDataIsPositive
      If set to true, all y data is assumed to be positive. This adds a white polygon under the y-axis hiding any polygon data lines that crosses (slightly) below the y-axis.
    • alphaLevel

      protected float alphaLevel
      The opacity of the spectra. 0 means completely see-through, 1 means opaque.
    • dataSetCounter

      protected int dataSetCounter
      The number of datasets currently displayed in the panel.
    • dataSetCounterMirroredSpectra

      protected int dataSetCounterMirroredSpectra
      The number of mirrored datasets currently displayed in the panel.
    • INTERACTIVE_STATUS

      public final int INTERACTIVE_STATUS
      This status indicates that no annotation will be displayed, but the user will have a fully functional interface (point clicking, selecting, sequencing etc.)
      See Also:
      Constant Field Values
    • ANNOTATED_STATUS

      public final int ANNOTATED_STATUS
      This status indicates that annotation (if present) will be displayed, while limiting the user to zooming in/out.
      See Also:
      Constant Field Values
    • iKnownMassDeltas

      protected static HashMap<Double,​String> iKnownMassDeltas
      This HashMap instance holds all the known mass deltas (if any). The keys are the Doubles with the massdelta, the values are the descriptions.
    • deltaMassWindow

      protected double deltaMassWindow
      The size of the window to use when searching for matches in the known masses list when the user hovers over a second data point after clicking a previous data point.
    • iXAxisLabel

      protected String iXAxisLabel
      The label (and unit between brackets, if available) for the x-axis. Defaults to "m/z".
    • iYAxisLabel

      protected String iYAxisLabel
      The label (and unit between brackets, if available) for the y-axis. Defaults to "Int".
    • iFilenameColor

      protected Color iFilenameColor
      This is the color the filename should be presented in.
    • iDataPointAndLineColor

      protected ArrayList<Color> iDataPointAndLineColor
      Colors in which the data points and peaks are rendered. Indexed by dataset.
    • iDataPointAndLineColorMirroredSpectra

      protected ArrayList<Color> iDataPointAndLineColorMirroredSpectra
      Colors in which the data points and peaks are rendered for the mirrored spectra. Indexed by dataset.
    • iAreaUnderCurveColor

      protected ArrayList<Color> iAreaUnderCurveColor
      Colors in which the chromatogram polyline is rendered. Indexed by dataset.
    • iAreaUnderCurveColorMirroredSpectra

      protected ArrayList<Color> iAreaUnderCurveColorMirroredSpectra
      Colors in which the chromatogram polyline is rendered for the mirrored spectra. Indexed by dataset.
    • iPointSize

      protected Integer iPointSize
      Size for the point on a polygon.
    • iFilename

      protected String iFilename
      The spectrum or chromatogram filename.
    • iFilenameMirrorredSpectrum

      protected String iFilenameMirrorredSpectrum
      The spectrum or chromatogram filename for the mirrored spectrum or chromatogram.
    • iSpecPanelListeners

      protected ArrayList iSpecPanelListeners
      The list of SpectrumPanelListeners.
    • iPointDetectionTolerance

      protected int iPointDetectionTolerance
      The deviation (both left and right) allowed for point highlighting detection.
    • iStartXLoc

      protected int iStartXLoc
      When the mouse is dragged, this represents the X-coordinate of the starting location.
    • iStartYLoc

      protected int iStartYLoc
      When the mouse is dragged, this represents the Y-coordinate of the starting location.
    • iEndXLoc

      protected int iEndXLoc
      When the mouse is dragged, this represents the X-coordinate of the ending location.
    • xAxisZoomRangeLowerValue

      protected double xAxisZoomRangeLowerValue
      The lower range for the current zoom range.
    • xAxisZoomRangeUpperValue

      protected double xAxisZoomRangeUpperValue
      The upper range for the current zoom range.
    • iDragXLoc

      protected int iDragXLoc
      The current dragging location.
    • iXScaleUnit

      protected double iXScaleUnit
      Scale unit for the X axis.
    • iYScaleUnit

      protected double iYScaleUnit
      Scale unit for the Y axis.
    • iXUnit

      protected int iXUnit
      Graphical unit for the X axis.
    • iYUnit

      protected int iYUnit
      Graphical unit for the Y axis.
    • iXPadding

      protected int iXPadding
      Effective distance from the x-axis to the panel border.
    • iTopPadding

      protected int iTopPadding
      Effective distance from the panel top border to 5 pixels above the top of the highest point (or y-tick mark).
    • iXAxisStartAtZero

      protected boolean iXAxisStartAtZero
      This boolean is set to 'true' if the x-axis should start at zero.
    • iDragged

      protected boolean iDragged
      This boolean is set to 'true' when dragging is performed.
    • xTagCount

      protected int xTagCount
      The number of X-axis tags.
    • yTagCount

      protected int yTagCount
      The number of Y-axis tags.
    • padding

      protected int padding
      The padding (distance between the axes and the border of the panel).
    • currentPadding

      protected int currentPadding
      The current padding (distance between the axes and the border of the panel).
    • maxPadding

      protected int maxPadding
      The maximum padding (distance between the axes and the border of the panel). Increase if font size on the y-axis becomes too small.
    • showFileName

      protected boolean showFileName
      The boolean is set to 'true' if the file name is to be shown in the panel.
    • showPrecursorDetails

      protected boolean showPrecursorDetails
      The boolean is set to 'true' if the precursor details is to be shown in the panel.
    • showResolution

      protected boolean showResolution
      The boolean is set to 'true' if the resolution is to be shown in the panel.
    • iXAxisData

      protected ArrayList<double[]> iXAxisData
      All the x-axis data points. Indexed by dataset (one double[] per dataset). First dataset is the first double[], second dataset is the second double[] etc.Should at all times be sorted from high to low.
    • iXAxisDataMirroredSpectrum

      protected ArrayList<double[]> iXAxisDataMirroredSpectrum
      All the x-axis data points for the mirrored spectrum. Indexed by dataset (one double[] per dataset). First dataset is the first double[], second dataset is the second double[] etc.Should at all times be sorted from high to low.
    • iXAxisMin

      protected double iXAxisMin
      The minimum x-axis value to display.
    • iXAxisMax

      protected double iXAxisMax
      The maximum x-axis value to display.
    • iYAxisMin

      protected double iYAxisMin
      The minimum y-axis value to display.
    • iYAxisMax

      protected double iYAxisMax
      The maximum y-axis value to display.
    • iAnnotationYAxisThreshold

      protected double iAnnotationYAxisThreshold
      The percent non-inclusive, minimal y-axis value (compared to the highest point in the spectrum) a point should have before being eligible for annotation. Default is '0.0'.
    • iYAxisData

      protected ArrayList<double[]> iYAxisData
      All the y-axis values. Indexed by dataset (one double[] per dataset). First dataset is the first double[], second dataset is the second double[] etc. Y-axis values are related to the x-axis values by the table index. So the first y-axis value of the first dataset is the value for the first x-axis value in the first dataset etc.
    • iYAxisDataMirroredSpectrum

      protected ArrayList<double[]> iYAxisDataMirroredSpectrum
      All the y-axis values for the mirrored spectra. Indexed by dataset (one double[] per dataset). First dataset is the first double[], second dataset is the second double[] etc. Y-axis values are related to the x-axis values by the table index. So the first y-axis value of the first dataset is the value for the first x-axis value in the first dataset etc.
    • iPrecursorMZ

      protected double iPrecursorMZ
      This variable holds the precursor M/Z.
    • iPrecursorMZMirroredSpectrum

      protected double iPrecursorMZMirroredSpectrum
      This variable holds the precursor M/Z for the mirrored spectrum.
    • iPrecursorCharge

      protected String iPrecursorCharge
      This String holds the charge for the precursor.
    • iPrecursorChargeMirorredSpectrum

      protected String iPrecursorChargeMirorredSpectrum
      This String holds the charge for the precursor for the mirrored spectrum.
    • iXAxisDataInPixels

      protected ArrayList<int[]> iXAxisDataInPixels
      This array will hold the x-coordinates in pixels for all the x-axis values. Link is through index. Again indexed by dataset (one double[] per dataset).
    • iYAxisDataInPixels

      protected ArrayList<int[]> iYAxisDataInPixels
      This array will hold the y-coordinates in pixels for all the y-axis values. Link is through index. Again indexed by dataset (one double[] per dataset).
    • iXAxisDataInPixelsMirroredSpectrum

      protected ArrayList<int[]> iXAxisDataInPixelsMirroredSpectrum
      This array will hold the x-coordinates in pixels for all the x-axis values of the mirrored spectrum. Link is through index. Again indexed by dataset (one double[] per dataset).
    • iYAxisDataInPixelsMirroredSpectrum

      protected ArrayList<int[]> iYAxisDataInPixelsMirroredSpectrum
      This array will hold the y-coordinates in pixels for all the y-axis values of the mirrored spectrum. Link is through index. Again indexed by dataset (one double[] per dataset).
    • iHighLight

      protected boolean iHighLight
      Boolean that will be 'true' when a point needs highlighting.
    • iHighLightMirrored

      protected boolean iHighLightMirrored
      Boolean that will be 'true' when a point needs highlighting in the mirrored spectra.
    • iHighLightIndex

      protected int iHighLightIndex
      Index of the point that needs to be highlighted.
    • iHighLightIndexMirrored

      protected int iHighLightIndexMirrored
      Index of the point that needs to be highlighted in the mirrored spectra.
    • iHighLightDatasetIndex

      protected int iHighLightDatasetIndex
      Index of the dataset containing the point that needs to be highlighted.
    • iHighLightDatasetIndexMirrored

      protected int iHighLightDatasetIndexMirrored
      Index of the dataset containing the point that needs to be highlighted in the mirrored spectra.
    • iClicked

      protected boolean iClicked
      Boolean that indicates whether a point has been marked by clicking.
    • iClickedMirrored

      protected boolean iClickedMirrored
      Boolean that indicates whether a point has been marked by clicking in the mirrored spectra.
    • iClickedIndex

      protected int iClickedIndex
      Int that indicates which point was clicked.
    • iClickedIndexMirrored

      protected int iClickedIndexMirrored
      Int that indicates which point was clicked in the mirrored spectra.
    • iClickedDataSetIndex

      protected int iClickedDataSetIndex
      Int that indicates which dataset contains the clicked point.
    • iClickedDataSetIndexMirrored

      protected int iClickedDataSetIndexMirrored
      Int that indicates which dataset contains the clicked point in the mirrored spectra.
    • iClickedList

      protected Vector iClickedList
      The Vector that holds all points clicked up to now.
    • iClickedListMirrored

      protected Vector iClickedListMirrored
      The Vector that holds all points clicked up to now in the mirrored spectra.
    • iClickedListDatasetIndices

      protected Vector iClickedListDatasetIndices
      The Vector that holds the dataset indices of all points clicked up to now.
    • iClickedListDatasetIndicesMirrored

      protected Vector iClickedListDatasetIndicesMirrored
      The Vector that holds the dataset indices of all points clicked up to now in the mirrored spectra.
    • iStoredSequence

      protected Vector iStoredSequence
      The Vector that holds a set of stored points from a previously established list.
    • iStoredSequenceMirrored

      protected Vector iStoredSequenceMirrored
      The Vector that holds a set of stored points from a previously established list in the mirrored spectra.
    • iStoredSequenceDatasetIndices

      protected Vector iStoredSequenceDatasetIndices
      The Vector that holds the dataset indices of stored points from a previously established list.
    • iStoredSequenceDatasetIndicesMirrored

      protected Vector iStoredSequenceDatasetIndicesMirrored
      The Vector that holds the dataset indices of stored points from a previously established list in the mirrored spectra.
    • iAnnotations

      protected Vector iAnnotations
      The Vector that holds a set of Annotation instances.
    • iAnnotationsMirroredSpectra

      protected Vector iAnnotationsMirroredSpectra
      The Vector that holds a set of Annotation instances for the mirrored spectra.
    • iMinDrag

      protected int iMinDrag
      Minimal dragging distance in pixels.
    • iCurrentDrawStyle

      protected GraphicsPanel.DrawingStyle iCurrentDrawStyle
      This variable holds the current drawing style.
    • iDotRadius

      protected int iDotRadius
      This variable holds the dot radius; only used when drawing style is DOTS style.
    • iMSLevel

      protected int iMSLevel
      The ms level of the current spectrum. O is assumed to mean no ms level given.
    • showAllPeaks

      protected boolean showAllPeaks
      If false, only the annotated peaks will be shown. Note that this setting is ignored in profile mode!
    • yAxisZoomExcludesBackgroundPeaks

      protected boolean yAxisZoomExcludesBackgroundPeaks
      If true, the automatic y-axis zoom excludes the background peaks. False includes all peaks in the zoom.
    • annotateHighestPeak

      protected boolean annotateHighestPeak
      If more than one peak is within the accuracy range of an annotation setting this to true will always select the most intense of possible peaks. Setting this variable to false will instead select the most accurate peak.
    • currentGraphicsPanelType

      protected GraphicsPanel.GraphicsPanelType currentGraphicsPanelType
      Sets the current GraphicsPanel type, default to centroid spectrum.
  • Constructor Details

    • GraphicsPanel

      public GraphicsPanel()
      Empty default constructor
  • Method Details

    • isAnnotateHighestPeak

      public boolean isAnnotateHighestPeak()
      Returns true if the most intense of possible peaks to annotate is to be selected, false if the most accurate is to be selected.
      Returns:
      true if the most intense of possible peaks to annotate is to be selected, false if the most accurate is to be selected
    • setAnnotateHighestPeak

      public void setAnnotateHighestPeak​(boolean annotateHighestPeak)
      Set if the most intense of possible peaks to annotate is to be selected, false if the most accurate is to be selected.
      Parameters:
      annotateHighestPeak - if the most intense of possible peaks to annotate is to be selected, false if the most accurate is to be selected
    • isSubscriptAnnotationNumbers

      public boolean isSubscriptAnnotationNumbers()
      Returns true if the numbers in the peak annotations are to be subscripted.
      Returns:
      true if the numbers in the peak annotations are to be subscripted
    • setSubscriptAnnotationNumbers

      public void setSubscriptAnnotationNumbers​(boolean subscriptAnnotationNumbers)
      Set if the numbers in the peak annotations are to be subscripted.
      Parameters:
      subscriptAnnotationNumbers - set if the numbers in the peak annotations are to be subscripted
    • yAxisZoomOnlyExcludesBackgroundPeaks

      public boolean yAxisZoomOnlyExcludesBackgroundPeaks()
      Returns true if the automatic y-axis zoom excludes background peaks. False if includes all peaks.
      Returns:
      true if the automatic y-axis zoom only excludes background peaks
    • setYAxisZoomExcludesBackgroundPeaks

      public void setYAxisZoomExcludesBackgroundPeaks​(boolean yAxisZoomExcludesBackgroundPeaks)
      Set if the automatic y-axis zoom only considers the annotated peaks.
      Parameters:
      yAxisZoomExcludesBackgroundPeaks - if the automatic y-axis zoom only considers the annotated peaks
    • useMassDeltaCombinations

      public boolean useMassDeltaCombinations()
      If true, pairs of delta mass annotations are used when doing de novo sequencing. If false, only single delta masses are annotated.
      Returns:
      the useMassDeltaCombinations if pairs of delta mass annotations are used when doing de novo sequencing
    • setUseMassDeltaCombinations

      public void setUseMassDeltaCombinations​(boolean useMassDeltaCombinations)
      If true, pairs of delta mass annotations are used when doing de novo sequencing. If false, only single delta masses are annotated.
      Parameters:
      useMassDeltaCombinations - the useMassDeltaCombinations to set
    • showPrecursorDetails

      public boolean showPrecursorDetails()
      Returns true of the precursor details are to be shown.
      Returns:
      true of the precursor details are to be show
    • setShowPrecursorDetails

      public void setShowPrecursorDetails​(boolean showPrecursorDetails)
      Set whether the precursor details are to be shown.
      Parameters:
      showPrecursorDetails - the showPrecursorDetails to set
    • showResolution

      public boolean showResolution()
      Returns true if the resolution is to be shown.
      Returns:
      true of the resolution is to be shown
    • setShowResolution

      public void setShowResolution​(boolean showResolution)
      Set whether the resolution is to be shown.
      Parameters:
      showResolution - the showResolution to set
    • yDataIsPositive

      public boolean yDataIsPositive()
      Returns true of all the y-data is to be assumed as positive.
      Returns:
      true of all the y-data is to be assumed as positive
    • setYDataIsPositive

      public void setYDataIsPositive​(boolean yDataIsPositive)
      Set to true of all y data values can be assumed to be positive.
      Parameters:
      yDataIsPositive - true of all y data values can be assumed to be positive
    • isMiniature

      public boolean isMiniature()
      Returns true if the graphics panel is to be drawn in a miniature form.
      Returns:
      true if the graphics panel is to be drawn in a miniature form
    • setMiniature

      public void setMiniature​(boolean miniature)
      Set if the graphics panel is to be drawn in a miniature form.
      Parameters:
      miniature - if the spectrum is to be drawn in a miniature form
    • getXAxisZoomRangeLowerValue

      public double getXAxisZoomRangeLowerValue()
      Returns the lower range for the current zoom range.
      Returns:
      the lower range for the current zoom range
    • getXAxisZoomRangeUpperValue

      public double getXAxisZoomRangeUpperValue()
      Returns the upper range for the current zoom range.
      Returns:
      the upper range for the current zoom range
    • getDeltaMassWindow

      public double getDeltaMassWindow()
      Get the size of the window to use when searching for matches in the known masses list when the user hovers over a second data point after clicking a previous data point.
      Returns:
      the size of the delta mass window
    • setDeltaMassWindow

      public void setDeltaMassWindow​(double deltaMassWindow)
      Set the size of the window to use when searching for matches in the known masses list when the user hovers over a second data point after clicking a previous data point.
      Parameters:
      deltaMassWindow - the new size of the delta mass window
    • getKnownMassDeltas

      public static HashMap<Double,​String> getKnownMassDeltas()
      Get all the known mass deltas (if any). The keys are the Doubles with the massdelta, the values are the descriptions.
      Returns:
      HashMap of the known mass deltas
    • setKnownMassDeltas

      public static void setKnownMassDeltas​(HashMap<Double,​String> aiKnownMassDeltas)
      Set all the known mass deltas (if any). The keys are the Doubles with the massdelta, the values are the descriptions.
      Parameters:
      aiKnownMassDeltas - the HasMap of the known mass deltas
    • getXAxisData

      public ArrayList<double[]> getXAxisData()
      Returns the x-axis data.
      Returns:
      the x-axis data
    • getYAxisData

      public ArrayList<double[]> getYAxisData()
      Returns the y-axis data.
      Returns:
      the y-axis data
    • getAlphaLevel

      public float getAlphaLevel()
      Returns the alpha level.
      Returns:
      the alphaLevel
    • setAlphaLevel

      public void setAlphaLevel​(float alphaLevel)
      Sets the alpha level
      Parameters:
      alphaLevel - the alphaLevel to set
    • setXAxisStartAtZero

      public void setXAxisStartAtZero​(boolean aXAxisStartAtZero)
      This method sets the start value of the x-axis to zero.
      Parameters:
      aXAxisStartAtZero - if true the x axis starts at zero
    • setMaxPadding

      public void setMaxPadding​(int aMaxPadding)
      Set the max padding (distance between the axes and the border of the panel).
      Parameters:
      aMaxPadding - the new max padding
    • getMaxPadding

      public int getMaxPadding()
      Returns the max padding (distance between the axes and the border of the panel).
      Returns:
      the max padding
    • getPeakWidth

      public float getPeakWidth()
      Returns the current width of the peaks.
      Returns:
      the peak width
    • setPeakWidth

      public void setPeakWidth​(float peakWidth)
      Set the peak width.
      Parameters:
      peakWidth - the new peak width
    • getBackgroundPeakWidth

      public float getBackgroundPeakWidth()
      Returns the current width of the background peaks.
      Returns:
      the peak width
    • setBackgroundPeakWidth

      public void setBackgroundPeakWidth​(float backgroundPeakWidth)
      Set the backgroundPeakWidth peak width.
      Parameters:
      backgroundPeakWidth - the new backgroundPeakWidth peak width
    • setAnnotations

      public void setAnnotations​(List<SpectrumAnnotation> aAnnotations, boolean annotateHighestPeak)
      This method sets all the annotations on this instance. Passing a 'null' value for the Vector will result in simply removing all annotations. Do note that this method will attempt to remove duplicate annotations on a point by deleting any annotation for which the combination of annotation label and annotation x-axis value has been seen before!
      Parameters:
      aAnnotations - Vector with SpectrumAnnotation instances.
      annotateHighestPeak - boolean indicating if the most intense peak within the accuracy range (true) or the most accurate peak (false) is to be annotated
    • setAnnotations

      public void setAnnotations​(List<SpectrumAnnotation> aAnnotations)
      This method sets all the annotations on this instance. Passing a 'null' value for the Vector will result in simply removing all annotations. Do note that this method will attempt to remove duplicate annotations on a point by deleting any annotation for which the combination of annotation label and annotation x-axis value has been seen before!
      Parameters:
      aAnnotations - Vector with SpectrumAnnotation instances.
    • setAnnotationsMirrored

      public void setAnnotationsMirrored​(List<SpectrumAnnotation> aAnnotations, boolean annotateHighestPeak)
      This method sets all the annotations for the mirrored spectra. Passing a 'null' value for the Vector will result in simply removing all annotations. Do note that this method will attempt to remove duplicate annotations on a point by deleting any annotation for which the combination of annotation label and annotation x-axis value has been seen before!
      Parameters:
      aAnnotations - Vector with SpectrumAnnotation instances
      annotateHighestPeak - boolean indicating if the most intense peak within the accuracy range (true) or the most accurate peak (false) is to be annotated
    • setAnnotationsMirrored

      public void setAnnotationsMirrored​(List<SpectrumAnnotation> aAnnotations)
      This method sets all the annotations for the mirrored spectra. Passing a 'null' value for the Vector will result in simply removing all annotations. Do note that this method will attempt to remove duplicate annotations on a point by deleting any annotation for which the combination of annotation label and annotation x-axis value has been seen before!
      Parameters:
      aAnnotations - Vector with SpectrumAnnotation instances
    • setAnnotationYAxisThreshold

      public void setAnnotationYAxisThreshold​(double aThreshold)
      This method allows the caller to set the minimal non-inclusive y-axis value threshold in percent (compared to the highest point in the spectrum or chromatogram) a point must pass before being eligible for annotation.
      Parameters:
      aThreshold - double with the minimal y-axis value in percent (as compared to the highest point in the spectrum or chromatogram) cutoff threshold for annotation.
    • setFilenameColor

      public void setFilenameColor​(Color aFilenameColor)
      This method sets the display color for the filename on the panel. Can be 'null' for default coloring.
      Parameters:
      aFilenameColor - Color to render the filename in on the panel. Can be 'null' for default coloring.
    • getiXAxisMin

      public double getiXAxisMin()
      Returns the minimum value of the x-axis.
      Returns:
      the minimum the axis value
    • setiXAxisMin

      public void setiXAxisMin​(double aXAxisMin)
      Sets the minimum value for the x-axis.
      Parameters:
      aXAxisMin - double with the minimum x-axis value
    • getiXAxisMax

      public double getiXAxisMax()
      Returns the maximum value of the x-axis.
      Returns:
      the maximum x axis value
    • setiXAxisMax

      public void setiXAxisMax​(double aXAxisMax)
      Sets the maximum value for the x-axis.
      Parameters:
      aXAxisMax - double with the maximum x-axis value
    • getiYAxisMin

      public double getiYAxisMin()
      Returns the minimum value of the y-axis.
      Returns:
      the minimum y axis value
    • setiYAxisMin

      public void setiYAxisMin​(double aYAxisMin)
      Sets the minimum value for the y-axis.
      Parameters:
      aYAxisMin - double with the minimum y-axis value
    • getiYAxisMax

      public double getiYAxisMax()
      Returns the maximum value of the y-axis.
      Returns:
      the maximum y axis value
    • setiYAxisMax

      public void setiYAxisMax​(double aYAxisMax)
      Sets the maximum value for the y-axis.
      Parameters:
      aYAxisMax - double with the maximum y-axis value
    • paint

      public void paint​(Graphics g)
      Invoked by Swing to draw components. Applications should not invoke paint directly, but should instead use the repaint method to schedule the component for redrawing.

      This method actually delegates the work of painting to three protected methods: paintComponent, paintBorder, and paintChildren. They're called in the order listed to ensure that children appear on top of component itself. Generally speaking, the component and its children should not paint in the insets area allocated to the border. Subclasses can just override this method, as always. A subclass that just wants to specialize the UI (look and feel) delegate's paint method should just override paintComponent.

      Overrides:
      paint in class JComponent
      Parameters:
      g - the Graphics context in which to paint
      See Also:
      JComponent.paintComponent(java.awt.Graphics), JComponent.paintBorder(java.awt.Graphics), JComponent.paintChildren(java.awt.Graphics), JComponent.getComponentGraphics(java.awt.Graphics), JComponent.repaint(long, int, int, int, int)
    • annotatePeaks

      protected void annotatePeaks​(Graphics g, Vector annotations, boolean mirrored)
      Annotate the annotated peaks.
      Parameters:
      g - the Graphics context in which to paint
      annotations - the annotations
      mirrored - if the annotations are for the mirrored spectra
    • drawDaisyChain

      protected void drawDaisyChain​(Graphics g, Vector clickedList, Vector clickedListDatasetIndices, int clickedIndex, int clickedDataSetIndex, Vector storedSequence, Vector storedSequenceDatasetIndices, boolean mirrored)
      Draw daisy chains.
      Parameters:
      g - the Graphics context in which to paint
      clickedList - vector that holds all points clicked up to now
      clickedListDatasetIndices - vector that holds the dataset indices of all points clicked up to now
      clickedIndex - int that indicates which point was clicked
      clickedDataSetIndex - int that indicates which dataset contains the clicked point
      storedSequence - vector that holds a set of stored points from a previously established list
      storedSequenceDatasetIndices - vector that holds the dataset indices of stored points from a previously established list.
      mirrored - if the daisy chains are for the mirrored spectra
    • drawXAxisReferenceAreas

      protected void drawXAxisReferenceAreas​(Graphics g, boolean drawOnTop)
      Draws the x-axis reference areas if any.
      Parameters:
      g - Graphics object to draw on.
      drawOnTop - if true the areas to be drawn on top of the data are drawn, if false the areas that are to be drawn behind the data are drawn
    • drawYAxisReferenceAreas

      protected void drawYAxisReferenceAreas​(Graphics g, boolean drawOnTop)
      Draws the y-axis reference areas if any.
      Parameters:
      g - Graphics object to draw on.
      drawOnTop - if true the areas to be drawn on top of the data are drawn, if false the areas that are to be drawn behind the data are drawn
    • getMaxXAxisValue

      public double getMaxXAxisValue()
      This method reports on the largest x-axis value in the point collection across all datasets.
      Returns:
      double with the largest x-axis value in the point collection.
    • getMinXAxisValue

      public double getMinXAxisValue()
      This method reports on the smallest x-axis value in the point collection across all datasets.
      Returns:
      double with the smallest x-axis value in the point collection.
    • addSpectrumPanelListener

      public void addSpectrumPanelListener​(SpectrumPanelListener aListener)
      This method registers the specified SpectrumPanelListener with this instance and notifies it of all future events. The Listeners will be notified in order of addition (first addition is notified first).
      Parameters:
      aListener - SpectrumPanelListener to register on this instance.
    • addListeners

      protected void addListeners()
      This method adds the event listeners to the panel.
    • rescale

      public void rescale​(double aMinXAxisValue, double aMaxXAxisValue)
      This method rescales the x-axis while notifying the observers.
      Parameters:
      aMinXAxisValue - double with the new minimum x-axis value to display.
      aMaxXAxisValue - double with the new maximum x-axis value to display.
    • addReferenceAreaXAxis

      public void addReferenceAreaXAxis​(ReferenceArea referenceArea)
      Add a x-axis reference area.
      Parameters:
      referenceArea - the reference area to add
    • removeReferenceAreaXAxis

      public void removeReferenceAreaXAxis​(String identifier)
      Removes the x-axis reference area with the given identifier. Does nothing if no reference with the given identifier is found.
      Parameters:
      identifier - the identifier of the reference to remove
    • removeAllReferenceAreasXAxis

      public void removeAllReferenceAreasXAxis()
      Removes all the x-axis reference areas.
    • getAllReferenceAreasXAxis

      public HashMap<String,​ReferenceArea> getAllReferenceAreasXAxis()
      Returns all the x-axis references areas as a hashmap, with the labels as the keys.
      Returns:
      hashmap of all reference areas
    • addReferenceAreaYAxis

      public void addReferenceAreaYAxis​(ReferenceArea referenceArea)
      Add a y-axis reference area.
      Parameters:
      referenceArea - the reference area to add
    • removeReferenceAreaYAxis

      public void removeReferenceAreaYAxis​(String identifier)
      Removes the y-axis reference area with the given identifier. Does nothing if no reference with the given identifier is found.
      Parameters:
      identifier - the identifier of the reference to remove
    • removeAllReferenceAreasYAxis

      public void removeAllReferenceAreasYAxis()
      Removes all the y-axis reference areas.
    • getAllReferenceAreasYAxis

      public HashMap<String,​ReferenceArea> getAllReferenceAreasYAxis()
      Returns all the y-axis references areas as a hashmap, with the labels as the keys.
      Returns:
      hashmap of all reference areas
    • setDataPointAndLineColor

      public void setDataPointAndLineColor​(Color aColor, int index)
      Sets the color of data points and line for the dataset with the given dataset index. Index starts at 0.
      Parameters:
      aColor - the color to use
      index - the index of the dataset
    • setAreaUnderCurveColor

      public void setAreaUnderCurveColor​(Color aColor, int index)
      Sets the color of the area under the curve for profile chromatograms and spectra for the dataset with the given dataset index. Index starts at 0.
      Parameters:
      aColor - the color to use
      index - the index of the dataset
    • getAreaUnderCurveColors

      public ArrayList<Color> getAreaUnderCurveColors()
      Returns the list of colors used for the datasets. Index on dataset. Index starts at 0.
      Returns:
      the the list of colors used for the datasets
    • rescale

      public void rescale​(double aMinXAxisValue, double aMaxXAxisValue, boolean aNotifyListeners)
      This method rescales the x-axis, allowing the caller to specify whether the observers need be notified.
      Parameters:
      aMinXAxisValue - double with the new minimum x-axis value to display.
      aMaxXAxisValue - double with the new maximum x-axis value to display.
      aNotifyListeners - boolean to indicate whether the observers should be notified.
    • processXAndYData

      protected void processXAndYData​(double[] aXAxisData, double[] aYAxisData, Color dataPointAndLineColor, Color areaUnderCurveColor)
      This method reads the x and y values from the specified arrays and stores these internally for drawing. The x-axis values are sorted in this step.
      Parameters:
      aXAxisData - double[] with the x-axis values.
      aYAxisData - double[] with the corresponding y-axis values.
      dataPointAndLineColor - the color to use for the data points and line
      areaUnderCurveColor - the color to use for the area under the curve
    • processMirroredXAndYData

      protected void processMirroredXAndYData​(double[] aXAxisData, double[] aYAxisData, Color dataPointAndLineColor, Color areaUnderCurveColor)
      This method reads the x and y values from the specified arrays and stores these internally for drawing. The x-axis values are sorted in this step.
      Parameters:
      aXAxisData - double[] with the x-axis values.
      aYAxisData - double[] with the corresponding y-axis values.
      dataPointAndLineColor - the color to use for the data points and line
      areaUnderCurveColor - the color to use for the area under the curve
    • drawAxes

      protected int[] drawAxes​(Graphics g, double aXMin, double aXMax, int aXScale, double aYMin, double aYMax)
      This method draws the axes and their labels on the specified Graphics object, taking into account the padding.
      Parameters:
      g - Graphics object to draw on.
      aXMin - double with the minimal x value.
      aXMax - double with the maximum x value.
      aXScale - int with the scale to display for the X-axis labels (as used in BigDecimal's setScale).
      aYMin - double with the minimal y value.
      aYMax - double with the maximum y value.
      Returns:
      int[] with the length of the X axis and Y axis respectively.
    • drawXTags

      protected void drawXTags​(Graphics g, int aMin, int aMax, int aXScale, int aXAxisWidth, int aPadding)
      This method draws tags on the X axis.
      Parameters:
      aMin - double with the minimum value for the axis.
      aMax - double with the maximum value for the axis.
      aXScale - int with the scale to display for the X-axis labels (as used in BigDecimal's setScale).
      g - Graphics object to draw on.
      aXAxisWidth - int with the axis width in pixels.
      aPadding - int with the amount of padding to take into account.
    • drawYTags

      protected void drawYTags​(Graphics g, int aMin, int aMax, int aYAxisHeight, int aPadding)
      This method draws tags on the Y axis.
      Parameters:
      aMin - double with the minimum value for the axis.
      aMax - double with the maximum value for the axis.
      g - Graphics object to draw on.
      aYAxisHeight - int with the axis height in pixels.
      aPadding - int with the amount of padding to take into account.
    • highLightPeak

      protected void highLightPeak​(int aIndex, int dataSetIndex, Graphics g, boolean mirrored)
      This method will draw a highlighting triangle + x-value on top of the marked point.
      Parameters:
      aIndex - int with the index of the point to highlight
      dataSetIndex - the index of the dataset
      g - Graphics object to draw the highlighting on
      mirrored - if true the highlighted peak is from a mirrored spectrum
    • highlightClicked

      protected void highlightClicked​(int aIndex, int dataSetIndex, Graphics g, boolean mirrored)
      This method will draw a highlighting triangle + x-value on top of the clicked marked point.
      Parameters:
      aIndex - int with the index of the clicked point to highlight
      dataSetIndex - the index of the dataset
      g - Graphics object to draw the highlighting on
      mirrored - if true the highlighted peak is from a mirrored spectrum
    • highLight

      protected void highLight​(int aIndex, int dataSetIndex, Graphics g, Color aColor, String aComment, int aPixelsSpacer, boolean aShowArrow, int aAnnotationCounter, boolean mirrored)
      This method will highlight the specified point in the specified color by drawing a floating triangle + x-value above it.
      Parameters:
      aIndex - int with the index.
      dataSetIndex - the index of the dataset
      g - Graphics object to draw on
      aColor - Color to draw the highlighting in.
      aComment - String with an optional comment. Can be 'null' in which case it will be omitted.
      aPixelsSpacer - int that gives the vertical spacer in pixels for the highlighting.
      aShowArrow - boolean that indicates whether a downward-pointing arrow and dotted line should be drawn over the point.
      aAnnotationCounter - the number of annotation of the given peak
      mirrored - if true the highlighting is done on the mirrored spectra
    • drawMeasurementLine

      protected void drawMeasurementLine​(int aFirstIndex, int aFirstDatasetIndex, int aSecondIndex, int aSecondDatasetIndex, Graphics g, Color aColor, int aExtraPadding, boolean mirrored)
      This method draws a line, measuring the distance between two points in real mass units.
      Parameters:
      aFirstIndex - int with the first point index to draw from.
      aFirstDatasetIndex - the dataset index of the first data point
      aSecondIndex - int with the second point index to draw to.
      aSecondDatasetIndex - the dataset index of the second data point
      g - Graphics object on which to draw.
      aColor - Color object with the color for all the drawing.
      aExtraPadding - int with an optional amount of extra padding (lower on the graph if positive, higher on the graph if negative)
      mirrored - if true the line is drawn for the mirrored spectra
    • dropDottedLine

      protected void dropDottedLine​(int aPeakIndex, int aDatasetIndex, int aTotalHeight, Graphics g, boolean mirrored)
      This method drops a dotted line from the specified total height to the top of the indicated point.
      Parameters:
      aPeakIndex - int with the index of the point to draw the dotted line for.
      aDatasetIndex - the index of the dataset
      aTotalHeight - int with the height (in pixels) to drop the dotted line from.
      g - Graphics object to draw the dotted line on.
      mirrored - if true the line is drawn on the mirrored spectra
    • findDeltaMassMatches

      protected String findDeltaMassMatches​(double aDelta, double aWindow)
      This method attempts to find a list of known mass deltas, corresponding with the specified x value in the given window.
      Parameters:
      aDelta - the delta mass to search for
      aWindow - the window used for the search
      Returns:
      String with the description of the matching mass delta or empty String if none was found.
    • annotate

      protected void annotate​(SpectrumAnnotation aSA, Graphics g, HashMap<String,​Integer> aAlreadyAnnotated, boolean mirrored)
      This method attempts to find the specified SpectrumAnnotation in the current peak list and if so, annotates it correspondingly on the screen.
      Parameters:
      aSA - SpectrumAnnotation with the annotation to find.
      g - Graphics instance to annotate on.
      aAlreadyAnnotated - HashMap with the index of a point as key, and the number of times it has been annotated as value (or 'null' if not yet annotated).
      mirrored - if true the annotation is for the mirrored spectra
    • drawMirroredPeaks

      protected void drawMirroredPeaks​(Graphics g)
      This method draws all of the peaks for all datasets in the current x-axis range on the panel.
      Parameters:
      g - Graphics object to draw on.
    • drawPeaks

      protected void drawPeaks​(Graphics g)
      This method draws all of the peaks for all datasets in the current x-axis range on the panel.
      Parameters:
      g - Graphics object to draw on.
    • drawFilledPolygon

      protected void drawFilledPolygon​(Graphics g)
      This method draws filled polygons for all of the peaks for all datasets in the current x-axis range on the panel.
      Parameters:
      g - Graphics object to draw on.
    • setScientificXAxis

      public void setScientificXAxis​(boolean scientificXAxis)
      Set if the x-axis tags are to be drawn using scientific annotation. The default is false. The default pattern is "##0.#####E0".
      Parameters:
      scientificXAxis - if the x-axis tags is to be drawn using scientific annotation
    • setScientificXAxis

      public void setScientificXAxis​(String pattern)
      Set if the x-axis tags are to be drawn using scientific annotation. The default is false. For pattern details see java.text.DecimalFormat. The default pattern is "##0.#####E0".
      Parameters:
      pattern - the number format pattern to use
    • setScientificYAxis

      public void setScientificYAxis​(boolean scientificYAxis)
      Set if the y-axis tags are to be drawn using scientific annotation. The default is false. The default pattern is "##0.#####E0".
      Parameters:
      scientificYAxis - if the y-axis tags is to be drawn using scientific annotation
    • setScientificYAxis

      public void setScientificYAxis​(String pattern)
      Set if the y-axis tags are to be drawn using scientific annotation. The default is false. For pattern details see java.text.DecimalFormat. The default pattern is "##0.#####E0".
      Parameters:
      pattern - the number format pattern to use
    • getPeakWaterMarkColor

      public Color getPeakWaterMarkColor()
      Get the peak water mark color.
      Returns:
      the peak water mark color
    • setPeakWaterMarkColor

      public void setPeakWaterMarkColor​(Color peakWaterMarkColor)
      Set the peak water mark color.
      Parameters:
      peakWaterMarkColor - the color to set