Package com.compomics.util.gui.spectrum
Class GraphicsPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.compomics.util.gui.spectrum.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
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GraphicsPanel.DrawingStyle
An enumerator of the possible GraphicsPanel types.protected static class
GraphicsPanel.GraphicsPanelType
An enumerator of the possible GraphicsPanel types.Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields Modifier and Type Field Description protected float
alphaLevel
The opacity of the spectra.int
ANNOTATED_STATUS
This status indicates that annotation (if present) will be displayed, while limiting the user to zooming in/out.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.protected GraphicsPanel.GraphicsPanelType
currentGraphicsPanelType
Sets the current GraphicsPanel type, default to centroid spectrum.protected int
currentPadding
The current padding (distance between the axes and the border of the panel).protected int
dataSetCounter
The number of datasets currently displayed in the panel.protected int
dataSetCounterMirroredSpectra
The number of mirrored datasets currently displayed in the panel.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.protected Vector
iAnnotations
The Vector that holds a set of Annotation instances.protected Vector
iAnnotationsMirroredSpectra
The Vector that holds a set of Annotation instances for the mirrored spectra.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.protected ArrayList<Color>
iAreaUnderCurveColor
Colors in which the chromatogram polyline is rendered.protected ArrayList<Color>
iAreaUnderCurveColorMirroredSpectra
Colors in which the chromatogram polyline is rendered for the mirrored spectra.protected boolean
iClicked
Boolean that indicates whether a point has been marked by clicking.protected int
iClickedDataSetIndex
Int that indicates which dataset contains the clicked point.protected int
iClickedDataSetIndexMirrored
Int that indicates which dataset contains the clicked point in the mirrored spectra.protected int
iClickedIndex
Int that indicates which point was clicked.protected int
iClickedIndexMirrored
Int that indicates which point was clicked in the mirrored spectra.protected Vector
iClickedList
The Vector that holds all points clicked up to now.protected Vector
iClickedListDatasetIndices
The Vector that holds the dataset indices of all points clicked up to now.protected Vector
iClickedListDatasetIndicesMirrored
The Vector that holds the dataset indices of all points clicked up to now in the mirrored spectra.protected Vector
iClickedListMirrored
The Vector that holds all points clicked up to now in the mirrored spectra.protected boolean
iClickedMirrored
Boolean that indicates whether a point has been marked by clicking in the mirrored spectra.protected GraphicsPanel.DrawingStyle
iCurrentDrawStyle
This variable holds the current drawing style.protected ArrayList<Color>
iDataPointAndLineColor
Colors in which the data points and peaks are rendered.protected ArrayList<Color>
iDataPointAndLineColorMirroredSpectra
Colors in which the data points and peaks are rendered for the mirrored spectra.protected int
iDotRadius
This variable holds the dot radius; only used when drawing style is DOTS style.protected boolean
iDragged
This boolean is set to 'true' when dragging is performed.protected int
iDragXLoc
The current dragging location.protected int
iEndXLoc
When the mouse is dragged, this represents the X-coordinate of the ending location.protected String
iFilename
The spectrum or chromatogram filename.protected Color
iFilenameColor
This is the color the filename should be presented in.protected String
iFilenameMirrorredSpectrum
The spectrum or chromatogram filename for the mirrored spectrum or chromatogram.protected boolean
iHighLight
Boolean that will be 'true' when a point needs highlighting.protected int
iHighLightDatasetIndex
Index of the dataset containing the point that needs to be highlighted.protected int
iHighLightDatasetIndexMirrored
Index of the dataset containing the point that needs to be highlighted in the mirrored spectra.protected int
iHighLightIndex
Index of the point that needs to be highlighted.protected int
iHighLightIndexMirrored
Index of the point that needs to be highlighted in the mirrored spectra.protected boolean
iHighLightMirrored
Boolean that will be 'true' when a point needs highlighting in the mirrored spectra.protected static HashMap<Double,String>
iKnownMassDeltas
This HashMap instance holds all the known mass deltas (if any).protected int
iMinDrag
Minimal dragging distance in pixels.protected int
iMSLevel
The ms level of the current spectrum.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.)protected int
iPointDetectionTolerance
The deviation (both left and right) allowed for point highlighting detection.protected Integer
iPointSize
Size for the point on a polygon.protected String
iPrecursorCharge
This String holds the charge for the precursor.protected String
iPrecursorChargeMirorredSpectrum
This String holds the charge for the precursor for the mirrored spectrum.protected double
iPrecursorMZ
This variable holds the precursor M/Z.protected double
iPrecursorMZMirroredSpectrum
This variable holds the precursor M/Z for the mirrored spectrum.protected ArrayList
iSpecPanelListeners
The list of SpectrumPanelListeners.protected int
iStartXLoc
When the mouse is dragged, this represents the X-coordinate of the starting location.protected int
iStartYLoc
When the mouse is dragged, this represents the Y-coordinate of the starting location.protected Vector
iStoredSequence
The Vector that holds a set of stored points from a previously established list.protected Vector
iStoredSequenceDatasetIndices
The Vector that holds the dataset indices of stored points from a previously established list.protected Vector
iStoredSequenceDatasetIndicesMirrored
The Vector that holds the dataset indices of stored points from a previously established list in the mirrored spectra.protected Vector
iStoredSequenceMirrored
The Vector that holds a set of stored points from a previously established list in the mirrored spectra.protected int
iTopPadding
Effective distance from the panel top border to 5 pixels above the top of the highest point (or y-tick mark).protected ArrayList<double[]>
iXAxisData
All the x-axis data points.protected ArrayList<int[]>
iXAxisDataInPixels
This array will hold the x-coordinates in pixels for all the x-axis values.protected ArrayList<int[]>
iXAxisDataInPixelsMirroredSpectrum
This array will hold the x-coordinates in pixels for all the x-axis values of the mirrored spectrum.protected ArrayList<double[]>
iXAxisDataMirroredSpectrum
All the x-axis data points for the mirrored spectrum.protected String
iXAxisLabel
The label (and unit between brackets, if available) for the x-axis.protected double
iXAxisMax
The maximum x-axis value to display.protected double
iXAxisMin
The minimum x-axis value to display.protected boolean
iXAxisStartAtZero
This boolean is set to 'true' if the x-axis should start at zero.protected int
iXPadding
Effective distance from the x-axis to the panel border.protected double
iXScaleUnit
Scale unit for the X axis.protected int
iXUnit
Graphical unit for the X axis.protected ArrayList<double[]>
iYAxisData
All the y-axis values.protected ArrayList<int[]>
iYAxisDataInPixels
This array will hold the y-coordinates in pixels for all the y-axis values.protected ArrayList<int[]>
iYAxisDataInPixelsMirroredSpectrum
This array will hold the y-coordinates in pixels for all the y-axis values of the mirrored spectrum.protected ArrayList<double[]>
iYAxisDataMirroredSpectrum
All the y-axis values for the mirrored spectra.protected String
iYAxisLabel
The label (and unit between brackets, if available) for the y-axis.protected double
iYAxisMax
The maximum y-axis value to display.protected double
iYAxisMin
The minimum y-axis value to display.protected double
iYScaleUnit
Scale unit for the Y axis.protected int
iYUnit
Graphical unit for the Y axis.protected int
maxPadding
The maximum padding (distance between the axes and the border of the panel).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.protected int
padding
The padding (distance between the axes and the border of the panel).protected boolean
showAllPeaks
If false, only the annotated peaks will be shown.protected boolean
showFileName
The boolean is set to 'true' if the file name is to be shown in the panel.protected boolean
showPrecursorDetails
The boolean is set to 'true' if the precursor details is to be shown in the panel.protected boolean
showResolution
The boolean is set to 'true' if the resolution is to be shown in the panel.protected double
xAxisZoomRangeLowerValue
The lower range for the current zoom range.protected double
xAxisZoomRangeUpperValue
The upper range for the current zoom range.protected int
xTagCount
The number of X-axis tags.protected boolean
yAxisZoomExcludesBackgroundPeaks
If true, the automatic y-axis zoom excludes the background peaks.protected boolean
yDataIsPositive
If set to true, all y data is assumed to be positive.protected int
yTagCount
The number of Y-axis tags.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors Constructor Description GraphicsPanel()
Empty default constructor -
Method Summary
Modifier and Type Method Description protected void
addListeners()
This method adds the event listeners to the panel.void
addReferenceAreaXAxis(ReferenceArea referenceArea)
Add a x-axis reference area.void
addReferenceAreaYAxis(ReferenceArea referenceArea)
Add a y-axis reference area.void
addSpectrumPanelListener(SpectrumPanelListener aListener)
This method registers the specified SpectrumPanelListener with this instance and notifies it of all future events.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.protected void
annotatePeaks(Graphics g, Vector annotations, boolean mirrored)
Annotate the annotated peaks.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.protected void
drawDaisyChain(Graphics g, Vector clickedList, Vector clickedListDatasetIndices, int clickedIndex, int clickedDataSetIndex, Vector storedSequence, Vector storedSequenceDatasetIndices, boolean mirrored)
Draw daisy chains.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.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.protected void
drawMirroredPeaks(Graphics g)
This method draws all of the peaks for all datasets in the current x-axis range on the panel.protected void
drawPeaks(Graphics g)
This method draws all of the peaks for all datasets in the current x-axis range on the panel.protected void
drawXAxisReferenceAreas(Graphics g, boolean drawOnTop)
Draws the x-axis reference areas if any.protected void
drawXTags(Graphics g, int aMin, int aMax, int aXScale, int aXAxisWidth, int aPadding)
This method draws tags on the X axis.protected void
drawYAxisReferenceAreas(Graphics g, boolean drawOnTop)
Draws the y-axis reference areas if any.protected void
drawYTags(Graphics g, int aMin, int aMax, int aYAxisHeight, int aPadding)
This method draws tags on the Y axis.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.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.HashMap<String,ReferenceArea>
getAllReferenceAreasXAxis()
Returns all the x-axis references areas as a hashmap, with the labels as the keys.HashMap<String,ReferenceArea>
getAllReferenceAreasYAxis()
Returns all the y-axis references areas as a hashmap, with the labels as the keys.float
getAlphaLevel()
Returns the alpha level.ArrayList<Color>
getAreaUnderCurveColors()
Returns the list of colors used for the datasets.float
getBackgroundPeakWidth()
Returns the current width of the background peaks.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.double
getiXAxisMax()
Returns the maximum value of the x-axis.double
getiXAxisMin()
Returns the minimum value of the x-axis.double
getiYAxisMax()
Returns the maximum value of the y-axis.double
getiYAxisMin()
Returns the minimum value of the y-axis.static HashMap<Double,String>
getKnownMassDeltas()
Get all the known mass deltas (if any).int
getMaxPadding()
Returns the max padding (distance between the axes and the border of the panel).double
getMaxXAxisValue()
This method reports on the largest x-axis value in the point collection across all datasets.double
getMinXAxisValue()
This method reports on the smallest x-axis value in the point collection across all datasets.Color
getPeakWaterMarkColor()
Get the peak water mark color.float
getPeakWidth()
Returns the current width of the peaks.ArrayList<double[]>
getXAxisData()
Returns the x-axis data.double
getXAxisZoomRangeLowerValue()
Returns the lower range for the current zoom range.double
getXAxisZoomRangeUpperValue()
Returns the upper range for the current zoom range.ArrayList<double[]>
getYAxisData()
Returns the y-axis data.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.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.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.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.boolean
isMiniature()
Returns true if the graphics panel is to be drawn in a miniature form.boolean
isSubscriptAnnotationNumbers()
Returns true if the numbers in the peak annotations are to be subscripted.void
paint(Graphics g)
Invoked by Swing to draw components.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.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.void
removeAllReferenceAreasXAxis()
Removes all the x-axis reference areas.void
removeAllReferenceAreasYAxis()
Removes all the y-axis reference areas.void
removeReferenceAreaXAxis(String identifier)
Removes the x-axis reference area with the given identifier.void
removeReferenceAreaYAxis(String identifier)
Removes the y-axis reference area with the given identifier.void
rescale(double aMinXAxisValue, double aMaxXAxisValue)
This method rescales the x-axis while notifying the observers.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.void
setAlphaLevel(float alphaLevel)
Sets the alpha levelvoid
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.void
setAnnotations(List<SpectrumAnnotation> aAnnotations)
This method sets all the annotations on this instance.void
setAnnotations(List<SpectrumAnnotation> aAnnotations, boolean annotateHighestPeak)
This method sets all the annotations on this instance.void
setAnnotationsMirrored(List<SpectrumAnnotation> aAnnotations)
This method sets all the annotations for the mirrored spectra.void
setAnnotationsMirrored(List<SpectrumAnnotation> aAnnotations, boolean annotateHighestPeak)
This method sets all the annotations for the mirrored spectra.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.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.void
setBackgroundPeakWidth(float backgroundPeakWidth)
Set the backgroundPeakWidth peak width.void
setDataPointAndLineColor(Color aColor, int index)
Sets the color of data points and line for the dataset with the given dataset index.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.void
setFilenameColor(Color aFilenameColor)
This method sets the display color for the filename on the panel.void
setiXAxisMax(double aXAxisMax)
Sets the maximum value for the x-axis.void
setiXAxisMin(double aXAxisMin)
Sets the minimum value for the x-axis.void
setiYAxisMax(double aYAxisMax)
Sets the maximum value for the y-axis.void
setiYAxisMin(double aYAxisMin)
Sets the minimum value for the y-axis.static void
setKnownMassDeltas(HashMap<Double,String> aiKnownMassDeltas)
Set all the known mass deltas (if any).void
setMaxPadding(int aMaxPadding)
Set the max padding (distance between the axes and the border of the panel).void
setMiniature(boolean miniature)
Set if the graphics panel is to be drawn in a miniature form.void
setPeakWaterMarkColor(Color peakWaterMarkColor)
Set the peak water mark color.void
setPeakWidth(float peakWidth)
Set the peak width.void
setScientificXAxis(boolean scientificXAxis)
Set if the x-axis tags are to be drawn using scientific annotation.void
setScientificXAxis(String pattern)
Set if the x-axis tags are to be drawn using scientific annotation.void
setScientificYAxis(boolean scientificYAxis)
Set if the y-axis tags are to be drawn using scientific annotation.void
setScientificYAxis(String pattern)
Set if the y-axis tags are to be drawn using scientific annotation.void
setShowPrecursorDetails(boolean showPrecursorDetails)
Set whether the precursor details are to be shown.void
setShowResolution(boolean showResolution)
Set whether the resolution is to be shown.void
setSubscriptAnnotationNumbers(boolean subscriptAnnotationNumbers)
Set if the numbers in the peak annotations are to be subscripted.void
setUseMassDeltaCombinations(boolean useMassDeltaCombinations)
If true, pairs of delta mass annotations are used when doing de novo sequencing.void
setXAxisStartAtZero(boolean aXAxisStartAtZero)
This method sets the start value of the x-axis to zero.void
setYAxisZoomExcludesBackgroundPeaks(boolean yAxisZoomExcludesBackgroundPeaks)
Set if the automatic y-axis zoom only considers the annotated peaks.void
setYDataIsPositive(boolean yDataIsPositive)
Set to true of all y data values can be assumed to be positive.boolean
showPrecursorDetails()
Returns true of the precursor details are to be shown.boolean
showResolution()
Returns true if the resolution is to be shown.boolean
useMassDeltaCombinations()
If true, pairs of delta mass annotations are used when doing de novo sequencing.boolean
yAxisZoomOnlyExcludesBackgroundPeaks()
Returns true if the automatic y-axis zoom excludes background peaks.boolean
yDataIsPositive()
Returns true of all the y-data is to be assumed as positive.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
miniature
protected boolean miniatureIf 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 yDataIsPositiveIf 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 alphaLevelThe opacity of the spectra. 0 means completely see-through, 1 means opaque. -
dataSetCounter
protected int dataSetCounterThe number of datasets currently displayed in the panel. -
dataSetCounterMirroredSpectra
protected int dataSetCounterMirroredSpectraThe number of mirrored datasets currently displayed in the panel. -
INTERACTIVE_STATUS
public final int INTERACTIVE_STATUSThis 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_STATUSThis status indicates that annotation (if present) will be displayed, while limiting the user to zooming in/out.- See Also:
- Constant Field Values
-
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 deltaMassWindowThe 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
The label (and unit between brackets, if available) for the x-axis. Defaults to "m/z". -
iYAxisLabel
The label (and unit between brackets, if available) for the y-axis. Defaults to "Int". -
iFilenameColor
This is the color the filename should be presented in. -
iDataPointAndLineColor
Colors in which the data points and peaks are rendered. Indexed by dataset. -
iDataPointAndLineColorMirroredSpectra
Colors in which the data points and peaks are rendered for the mirrored spectra. Indexed by dataset. -
iAreaUnderCurveColor
Colors in which the chromatogram polyline is rendered. Indexed by dataset. -
iAreaUnderCurveColorMirroredSpectra
Colors in which the chromatogram polyline is rendered for the mirrored spectra. Indexed by dataset. -
iPointSize
Size for the point on a polygon. -
iFilename
The spectrum or chromatogram filename. -
iFilenameMirrorredSpectrum
The spectrum or chromatogram filename for the mirrored spectrum or chromatogram. -
iSpecPanelListeners
The list of SpectrumPanelListeners. -
iPointDetectionTolerance
protected int iPointDetectionToleranceThe deviation (both left and right) allowed for point highlighting detection. -
iStartXLoc
protected int iStartXLocWhen the mouse is dragged, this represents the X-coordinate of the starting location. -
iStartYLoc
protected int iStartYLocWhen the mouse is dragged, this represents the Y-coordinate of the starting location. -
iEndXLoc
protected int iEndXLocWhen the mouse is dragged, this represents the X-coordinate of the ending location. -
xAxisZoomRangeLowerValue
protected double xAxisZoomRangeLowerValueThe lower range for the current zoom range. -
xAxisZoomRangeUpperValue
protected double xAxisZoomRangeUpperValueThe upper range for the current zoom range. -
iDragXLoc
protected int iDragXLocThe current dragging location. -
iXScaleUnit
protected double iXScaleUnitScale unit for the X axis. -
iYScaleUnit
protected double iYScaleUnitScale unit for the Y axis. -
iXUnit
protected int iXUnitGraphical unit for the X axis. -
iYUnit
protected int iYUnitGraphical unit for the Y axis. -
iXPadding
protected int iXPaddingEffective distance from the x-axis to the panel border. -
iTopPadding
protected int iTopPaddingEffective distance from the panel top border to 5 pixels above the top of the highest point (or y-tick mark). -
iXAxisStartAtZero
protected boolean iXAxisStartAtZeroThis boolean is set to 'true' if the x-axis should start at zero. -
iDragged
protected boolean iDraggedThis boolean is set to 'true' when dragging is performed. -
xTagCount
protected int xTagCountThe number of X-axis tags. -
yTagCount
protected int yTagCountThe number of Y-axis tags. -
padding
protected int paddingThe padding (distance between the axes and the border of the panel). -
currentPadding
protected int currentPaddingThe current padding (distance between the axes and the border of the panel). -
maxPadding
protected int maxPaddingThe 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 showFileNameThe boolean is set to 'true' if the file name is to be shown in the panel. -
showPrecursorDetails
protected boolean showPrecursorDetailsThe boolean is set to 'true' if the precursor details is to be shown in the panel. -
showResolution
protected boolean showResolutionThe boolean is set to 'true' if the resolution is to be shown in the panel. -
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
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 iXAxisMinThe minimum x-axis value to display. -
iXAxisMax
protected double iXAxisMaxThe maximum x-axis value to display. -
iYAxisMin
protected double iYAxisMinThe minimum y-axis value to display. -
iYAxisMax
protected double iYAxisMaxThe maximum y-axis value to display. -
iAnnotationYAxisThreshold
protected double iAnnotationYAxisThresholdThe 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
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
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 iPrecursorMZThis variable holds the precursor M/Z. -
iPrecursorMZMirroredSpectrum
protected double iPrecursorMZMirroredSpectrumThis variable holds the precursor M/Z for the mirrored spectrum. -
iPrecursorCharge
This String holds the charge for the precursor. -
iPrecursorChargeMirorredSpectrum
This String holds the charge for the precursor for the mirrored spectrum. -
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
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
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
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 iHighLightBoolean that will be 'true' when a point needs highlighting. -
iHighLightMirrored
protected boolean iHighLightMirroredBoolean that will be 'true' when a point needs highlighting in the mirrored spectra. -
iHighLightIndex
protected int iHighLightIndexIndex of the point that needs to be highlighted. -
iHighLightIndexMirrored
protected int iHighLightIndexMirroredIndex of the point that needs to be highlighted in the mirrored spectra. -
iHighLightDatasetIndex
protected int iHighLightDatasetIndexIndex of the dataset containing the point that needs to be highlighted. -
iHighLightDatasetIndexMirrored
protected int iHighLightDatasetIndexMirroredIndex of the dataset containing the point that needs to be highlighted in the mirrored spectra. -
iClicked
protected boolean iClickedBoolean that indicates whether a point has been marked by clicking. -
iClickedMirrored
protected boolean iClickedMirroredBoolean that indicates whether a point has been marked by clicking in the mirrored spectra. -
iClickedIndex
protected int iClickedIndexInt that indicates which point was clicked. -
iClickedIndexMirrored
protected int iClickedIndexMirroredInt that indicates which point was clicked in the mirrored spectra. -
iClickedDataSetIndex
protected int iClickedDataSetIndexInt that indicates which dataset contains the clicked point. -
iClickedDataSetIndexMirrored
protected int iClickedDataSetIndexMirroredInt that indicates which dataset contains the clicked point in the mirrored spectra. -
iClickedList
The Vector that holds all points clicked up to now. -
iClickedListMirrored
The Vector that holds all points clicked up to now in the mirrored spectra. -
iClickedListDatasetIndices
The Vector that holds the dataset indices of all points clicked up to now. -
iClickedListDatasetIndicesMirrored
The Vector that holds the dataset indices of all points clicked up to now in the mirrored spectra. -
iStoredSequence
The Vector that holds a set of stored points from a previously established list. -
iStoredSequenceMirrored
The Vector that holds a set of stored points from a previously established list in the mirrored spectra. -
iStoredSequenceDatasetIndices
The Vector that holds the dataset indices of stored points from a previously established list. -
iStoredSequenceDatasetIndicesMirrored
The Vector that holds the dataset indices of stored points from a previously established list in the mirrored spectra. -
iAnnotations
The Vector that holds a set of Annotation instances. -
iAnnotationsMirroredSpectra
The Vector that holds a set of Annotation instances for the mirrored spectra. -
iMinDrag
protected int iMinDragMinimal dragging distance in pixels. -
iCurrentDrawStyle
This variable holds the current drawing style. -
iDotRadius
protected int iDotRadiusThis variable holds the dot radius; only used when drawing style is DOTS style. -
iMSLevel
protected int iMSLevelThe ms level of the current spectrum. O is assumed to mean no ms level given. -
showAllPeaks
protected boolean showAllPeaksIf false, only the annotated peaks will be shown. Note that this setting is ignored in profile mode! -
yAxisZoomExcludesBackgroundPeaks
protected boolean yAxisZoomExcludesBackgroundPeaksIf true, the automatic y-axis zoom excludes the background peaks. False includes all peaks in the zoom. -
annotateHighestPeak
protected boolean annotateHighestPeakIf 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
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
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
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
Returns the x-axis data.- Returns:
- the x-axis data
-
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
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
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 instancesannotateHighestPeak
- boolean indicating if the most intense peak within the accuracy range (true) or the most accurate peak (false) is to be annotated
-
setAnnotationsMirrored
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
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
Invoked by Swing to draw components. Applications should not invokepaint
directly, but should instead use therepaint
method to schedule the component for redrawing.This method actually delegates the work of painting to three protected methods:
paintComponent
,paintBorder
, andpaintChildren
. 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'spaint
method should just overridepaintComponent
.- Overrides:
paint
in classJComponent
- Parameters:
g
- theGraphics
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
Annotate the annotated peaks.- Parameters:
g
- theGraphics
context in which to paintannotations
- the annotationsmirrored
- 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
- theGraphics
context in which to paintclickedList
- vector that holds all points clicked up to nowclickedListDatasetIndices
- vector that holds the dataset indices of all points clicked up to nowclickedIndex
- int that indicates which point was clickedclickedDataSetIndex
- int that indicates which dataset contains the clicked pointstoredSequence
- vector that holds a set of stored points from a previously established liststoredSequenceDatasetIndices
- 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
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
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
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
Add a x-axis reference area.- Parameters:
referenceArea
- the reference area to add
-
removeReferenceAreaXAxis
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
Returns all the x-axis references areas as a hashmap, with the labels as the keys.- Returns:
- hashmap of all reference areas
-
addReferenceAreaYAxis
Add a y-axis reference area.- Parameters:
referenceArea
- the reference area to add
-
removeReferenceAreaYAxis
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
Returns all the y-axis references areas as a hashmap, with the labels as the keys.- Returns:
- hashmap of all reference areas
-
setDataPointAndLineColor
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 useindex
- the index of the dataset
-
setAreaUnderCurveColor
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 useindex
- the index of the dataset
-
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 lineareaUnderCurveColor
- 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 lineareaUnderCurveColor
- 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
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
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 highlightdataSetIndex
- the index of the datasetg
- Graphics object to draw the highlighting onmirrored
- if true the highlighted peak is from a mirrored spectrum
-
highlightClicked
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 highlightdataSetIndex
- the index of the datasetg
- Graphics object to draw the highlighting onmirrored
- 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 datasetg
- Graphics object to draw onaColor
- 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 peakmirrored
- 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 pointaSecondIndex
- int with the second point index to draw to.aSecondDatasetIndex
- the dataset index of the second data pointg
- 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 datasetaTotalHeight
- 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
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 foraWindow
- 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
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
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
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
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
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
Get the peak water mark color.- Returns:
- the peak water mark color
-
setPeakWaterMarkColor
Set the peak water mark color.- Parameters:
peakWaterMarkColor
- the color to set
-