Class SpectrumPanel

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.core.StatusMessageHandler, adams.db.DatabaseConnectionHandler, adams.db.DatabaseConnectionProvider, adams.db.DatabaseConnectionUser, adams.event.DatabaseConnectionChangeListener, adams.gui.core.AntiAliasingSupporter, adams.gui.core.HelpSupporter, adams.gui.core.PopupMenuCustomizer<MouseEvent>, adams.gui.event.DataChangeListener, adams.gui.event.PaintListener, adams.gui.scripting.ScriptingEngineHandler, adams.gui.sendto.SendToActionSupporter, adams.gui.visualization.container.ContainerListManager<SpectrumContainerManager>, adams.gui.visualization.container.ContainerListPopupMenuSupplier<SpectrumContainerManager,​SpectrumContainer>, adams.gui.visualization.core.PaintletManager, adams.gui.visualization.core.plot.HitDetectorSupporter<SpectrumPointHitDetector>, adams.gui.visualization.core.plot.TipTextCustomizer, adams.gui.visualization.core.PopupMenuCustomizer, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

    public class SpectrumPanel
    extends adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
    implements adams.gui.event.PaintListener, adams.gui.visualization.core.plot.TipTextCustomizer, adams.gui.core.AntiAliasingSupporter, adams.gui.visualization.core.plot.HitDetectorSupporter<SpectrumPointHitDetector>
    Special panel for displaying the spectral data.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_AdjustToVisibleData

        protected boolean m_AdjustToVisibleData
        whether to adjust to visible data or not.
      • m_CoordinatesPaintlet

        protected adams.gui.visualization.core.CoordinatesPaintlet m_CoordinatesPaintlet
        paintlet for drawing the X-axis.
      • m_CrossHairTracker

        protected adams.gui.visualization.core.CrossHairTracker m_CrossHairTracker
        the cross-hair paintlet.
      • m_SelectedWaveNumberPaintlet

        protected SelectedWaveNumberPaintlet m_SelectedWaveNumberPaintlet
        paintlet for drawing the selected wave number.
      • m_ToolTipMaxColumns

        protected int m_ToolTipMaxColumns
        the maximum number of columns for the tooltip.
      • m_ToolTipMaxRows

        protected int m_ToolTipMaxRows
        the maximum number of rows for the tooltip.
    • Constructor Detail

      • SpectrumPanel

        public SpectrumPanel()
        Initializes the panel without title.
      • SpectrumPanel

        public SpectrumPanel​(String title)
        Initializes the panel with the given title.
        Parameters:
        title - the title for the panel
    • Method Detail

      • getDefaultDatabaseConnection

        protected adams.db.AbstractDatabaseConnection getDefaultDatabaseConnection()
        Returns the default database connection.
        Specified by:
        getDefaultDatabaseConnection in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
        Returns:
        the default database connection
      • newContainerManager

        protected SpectrumContainerManager newContainerManager()
        Returns the container manager to use.
        Specified by:
        newContainerManager in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
        Returns:
        the container manager
      • getContainerPaintlet

        public AbstractSpectrumPaintlet getContainerPaintlet()
        Returns the paintlet used for painting the containers.
        Specified by:
        getContainerPaintlet in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
        Returns:
        the paintlet
      • getHitDetector

        public SpectrumPointHitDetector getHitDetector()
        Returns the hit detector.
        Specified by:
        getHitDetector in interface adams.gui.visualization.core.plot.HitDetectorSupporter<SpectrumPointHitDetector>
        Returns:
        the hit detector
      • hasSidePanel

        protected boolean hasSidePanel()
        Returns whether the panel has a side panel. If that is the case, a JSplitPanel is used.
        Returns:
        true if a side panel is to be added
      • finishInit

        protected void finishInit()
        Finishes up the initialization.
        Overrides:
        finishInit in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
      • getSelectedWaveNumberPaintlet

        public SelectedWaveNumberPaintlet getSelectedWaveNumberPaintlet()
        Returns the paintlet for painting the selected wave number.
        Returns:
        the paintlet
      • getCrossHairTracker

        public adams.gui.visualization.core.CrossHairTracker getCrossHairTracker()
        Returns the cross-hair tracker.
        Returns:
        the tracker
      • setAdjustToVisibleData

        public void setAdjustToVisibleData​(boolean value)
        Sets whether the display is adjusted to only the visible data or everything currently loaded.
        Parameters:
        value - if true then plot is adjusted to visible data
      • getAdjustToVisibleData

        public boolean getAdjustToVisibleData()
        Returns whether the display is adjusted to only the visible spectrums or all of them.
        Returns:
        true if the plot is adjusted to only the visible data
      • setZoomOverviewPanelVisible

        public void setZoomOverviewPanelVisible​(boolean value)
        Sets the zoom overview panel visible or hides it.
        Parameters:
        value - if true then the panel is displayed
      • isZoomOverviewPanelVisible

        public boolean isZoomOverviewPanelVisible()
        Returns whether the zoom overview panel is visible or not.
        Returns:
        true if visible
      • getZoomOverviewPanel

        public SpectrumZoomOverviewPanel getZoomOverviewPanel()
        Returns the zoom overview panel.
        Returns:
        the panel
      • canPaint

        protected boolean canPaint​(Graphics g)
        Returns true if the paintlets can be executed.
        Specified by:
        canPaint in class adams.gui.visualization.core.PaintablePanel
        Parameters:
        g - the graphics context
        Returns:
        true if painting can go ahead
      • prepareUpdate

        public void prepareUpdate()
        Updates the axes with the min/max of the new data.
        Specified by:
        prepareUpdate in class adams.gui.visualization.core.PaintablePanel
      • getDataPaintlet

        public adams.gui.visualization.core.Paintlet getDataPaintlet()
        Returns the paintlet used for painting the data.
        Specified by:
        getDataPaintlet in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Returns:
        the paintlet
      • setDataPaintlet

        public void setDataPaintlet​(adams.gui.visualization.core.Paintlet value)
        Sets the paintlet to use for painting the data.
        Specified by:
        setDataPaintlet in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Parameters:
        value - the paintlet
      • saveVisibleSpectra

        public void saveVisibleSpectra()
        Saves the visible spectra to a directory.
      • exportVisibleSpectra

        public void exportVisibleSpectra()
        Exports the visible spectra to an ARFF file.
      • processTipText

        public String processTipText​(adams.gui.visualization.core.PlotPanel panel,
                                     Point mouse,
                                     String tiptext)
        Processes the given tip text. Among the current mouse position, the panel that initiated the call are also provided.
        Specified by:
        processTipText in interface adams.gui.visualization.core.plot.TipTextCustomizer
        Parameters:
        panel - the content panel that initiated this call
        mouse - the mouse position
        tiptext - the tiptext so far
        Returns:
        the processed tiptext
      • supportsStoreColorInReport

        public boolean supportsStoreColorInReport()
        Returns true if storing the color in the report of container's data object is supported.
        Specified by:
        supportsStoreColorInReport in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Returns:
        true if supported
      • storeColorInReport

        public void storeColorInReport​(int[] indices,
                                       String name)
        Stores the color of the container in the report of container's data object.
        Specified by:
        storeColorInReport in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Parameters:
        indices - the indices of the containers of the container manager
        name - the field name to use
      • supportsStoreValueInReport

        public boolean supportsStoreValueInReport()
        Returns true if storing a value in the report of container's data object is supported.
        Specified by:
        supportsStoreValueInReport in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Returns:
        true if supported
      • storeValueInReport

        public void storeValueInReport​(int[] indices,
                                       adams.data.report.AbstractField field,
                                       Object value)
        Stores the value in the report of container's data object.
        Specified by:
        storeValueInReport in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>
        Parameters:
        indices - the indices of the containers of the container manager
        field - the field to use
        value - the value to store
      • showStatistics

        public void showStatistics​(List<adams.data.statistics.InformativeStatistic> stats)
        Displays a dialog with the given statistics.
        Parameters:
        stats - the statistics to display
      • showHistogram

        public void showHistogram​(List<SpectrumContainer> data)
        Displays the histograms for the given spectrums.
        Parameters:
        data - the spectrums to display
      • showSpectralData

        public void showSpectralData​(SpectrumContainer cont)
        Displays a dialog with the given spectral data.
        Parameters:
        cont - the container to display the raw data for
      • showSampleData

        public void showSampleData​(List<SpectrumContainer> data)
        Displays a dialog with the given sample data.
        Parameters:
        data - the spectrums to display the sample data for
      • selectWaveNumber

        public void selectWaveNumber()
        Selects the spectrum point based on the wave number.
      • getSelectedIndices

        public int[] getSelectedIndices()
        Returns the indices of the selected spectra.
        Returns:
        the indices
      • getSelectedSpectra

        public Spectrum[] getSelectedSpectra()
        Returns the selected spectra.
        Returns:
        the spectra
      • setAntiAliasingEnabled

        public void setAntiAliasingEnabled​(boolean value)
        Sets whether to use anti-aliasing.
        Specified by:
        setAntiAliasingEnabled in interface adams.gui.core.AntiAliasingSupporter
        Parameters:
        value - if true then anti-aliasing is used
      • isAntiAliasingEnabled

        public boolean isAntiAliasingEnabled()
        Returns whether anti-aliasing is used.
        Specified by:
        isAntiAliasingEnabled in interface adams.gui.core.AntiAliasingSupporter
        Returns:
        true if anti-aliasing is used
      • databaseConnectionStateChanged

        public void databaseConnectionStateChanged​(adams.event.DatabaseConnectionChangeEvent e)
        A change in the database connection occurred.
        Specified by:
        databaseConnectionStateChanged in interface adams.event.DatabaseConnectionChangeListener
        Overrides:
        databaseConnectionStateChanged in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
        Parameters:
        e - the event
      • getScriptingEngine

        public adams.gui.scripting.AbstractScriptingEngine getScriptingEngine()
        Returns the current scripting engine, can be null.
        Specified by:
        getScriptingEngine in interface adams.gui.scripting.ScriptingEngineHandler
        Specified by:
        getScriptingEngine in class adams.gui.visualization.container.DataContainerPanel<Spectrum,​SpectrumContainerManager>
        Returns:
        the current engine
      • postUpdate

        protected void postUpdate()
        Hook method, called after the update was performed.
        Overrides:
        postUpdate in class adams.gui.visualization.core.PaintablePanel
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface adams.core.CleanUpHandler
        Overrides:
        cleanUp in class adams.gui.visualization.container.DataContainerPanelWithContainerList<Spectrum,​SpectrumContainerManager,​SpectrumContainer>