Class InstancePanel

  • 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.PopupMenuCustomizer<MouseEvent>, adams.gui.event.DataChangeListener, adams.gui.event.PaintListener, adams.gui.scripting.ScriptingEngineHandler, adams.gui.sendto.SendToActionSupporter, adams.gui.visualization.container.ContainerListManager<InstanceContainerManager>, adams.gui.visualization.container.ContainerListPopupMenuSupplier<InstanceContainerManager,​InstanceContainer>, adams.gui.visualization.core.PaintletManager, adams.gui.visualization.core.plot.HitDetectorSupporter<InstancePointHitDetector>, adams.gui.visualization.core.plot.TipTextCustomizer, adams.gui.visualization.core.PopupMenuCustomizer, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

    public class InstancePanel
    extends adams.gui.visualization.container.DataContainerPanelWithContainerList<Instance,​InstanceContainerManager,​InstanceContainer>
    implements adams.gui.event.PaintListener, adams.gui.visualization.core.plot.TipTextCustomizer, adams.gui.core.AntiAliasingSupporter, adams.gui.visualization.core.plot.HitDetectorSupporter<InstancePointHitDetector>
    A panel for displaying instances.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_CoordinatesPaintlet

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

        protected adams.gui.core.Undo m_Undo
        the undo manager.
      • m_AdjustToVisibleData

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

        protected InstancePointHitDetector m_InstancePointHitDetector
        the hit detector for the tooltip.
      • 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.
      • m_FileChooser

        protected adams.gui.chooser.SpreadSheetFileChooser m_FileChooser
        the file chooser for saving a specific sequence.
      • m_ViewDialogs

        protected List<adams.gui.dialog.SpreadSheetDialog> m_ViewDialogs
        the dialog for displaying a sequence.
    • Constructor Detail

      • InstancePanel

        public InstancePanel()
        Initializes the panel.
      • InstancePanel

        public InstancePanel​(String title)
        Initializes the panel.
        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<Instance,​InstanceContainerManager>
        Returns:
        the default database connection
      • newContainerManager

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

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

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

        public adams.gui.visualization.container.AbstractContainerManager getSequenceManager()
        Returns the current container manager.
        Returns:
        the manager
      • setUndo

        public void setUndo​(adams.gui.core.Undo value)
        Sets the undo manager to use, can be null if no undo-support wanted.
        Parameters:
        value - the undo manager to use
      • getUndo

        public adams.gui.core.Undo getUndo()
        Returns the current undo manager, can be null.
        Returns:
        the undo manager, if any
      • isUndoSupported

        public boolean isUndoSupported()
        Returns whether an Undo manager is currently available.
        Returns:
        true if an undo manager is set
      • 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
      • 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<Instance,​InstanceContainerManager,​InstanceContainer>
        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<Instance,​InstanceContainerManager,​InstanceContainer>
        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<Instance,​InstanceContainerManager,​InstanceContainer>
        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<Instance,​InstanceContainerManager,​InstanceContainer>
        Parameters:
        indices - the indices of the containers of the container manager
        field - the field to use
        value - the value to store
      • showHistogram

        public void showHistogram​(List<InstanceContainer> data)
        Displays the histograms for the given instances.
        Parameters:
        data - the instances to display
      • saveInstance

        public void saveInstance​(InstanceContainer cont)
        Saves the specified instance as spreadsheet file.
        Parameters:
        cont - the instance to save
      • viewInstance

        public void viewInstance​(InstanceContainer cont)
        Views the specified instance in a table.
        Parameters:
        cont - the instance to view
      • 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 InstanceZoomOverviewPanel getZoomOverviewPanel()
        Returns the zoom overview panel.
        Returns:
        the panel
      • 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
      • 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<Instance,​InstanceContainerManager,​InstanceContainer>
        Parameters:
        value - the paintlet
      • 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
      • getInstances

        public weka.core.Instances getInstances()
        Returns the currently visible instances.
        Returns:
        the instances, null if none visible
      • 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
      • 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<Instance,​InstanceContainerManager>
        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<Instance,​InstanceContainerManager,​InstanceContainer>