Class ContentPanel

    • Field Detail

      • m_Owner

        protected PlotPanel m_Owner
        the owner of the panel.
      • m_Format

        protected DecimalFormat m_Format
        for outputting the values.
      • m_ZoomingEnabled

        protected boolean m_ZoomingEnabled
        whether zooming is enabled.
      • m_ZoomBoxColor

        protected Color m_ZoomBoxColor
        the color of the zoom box.
      • m_Zooming

        protected boolean m_Zooming
        whether the zoom box is currently been drawn.
      • m_Dragged

        protected boolean m_Dragged
        whether dragging has happened at all.
      • m_ZoomTopLeft

        protected Point m_ZoomTopLeft
        the top left corner of the zoom box.
      • m_ZoomBottomRight

        protected Point m_ZoomBottomRight
        the bottom right corner of the zoom box.
      • m_PopupMenuCustomizer

        protected PopupMenuCustomizer m_PopupMenuCustomizer
        an optional customizer for the right-click popup.
      • m_PanningEnabled

        protected boolean m_PanningEnabled
        whether panning is enabled.
      • m_Panning

        protected boolean m_Panning
        whether the graph is currently moved around.
      • m_PanningStart

        protected Point m_PanningStart
        the starting mouse position of panning.
      • m_LeftPixelOffset

        protected int m_LeftPixelOffset
        the original pixel offset for the left axis.
      • m_RightPixelOffset

        protected int m_RightPixelOffset
        the original pixel offset for the right axis.
      • m_TopPixelOffset

        protected int m_TopPixelOffset
        the original pixel offset for the top axis.
      • m_BottomPixelOffset

        protected int m_BottomPixelOffset
        the original pixel offset for the bottom axis.
      • m_TipTextCustomizer

        protected TipTextCustomizer m_TipTextCustomizer
        for post-processing the tiptext.
    • Constructor Detail

      • ContentPanel

        public ContentPanel​(PlotPanel owner)
        Initializes the panel.
        Parameters:
        owner - the plot panel this panel belongs to
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • getOwner

        public PlotPanel getOwner()
        Returns the plot panel this panel belongs to.
        Returns:
        the owning panel
      • setZoomingEnabled

        public void setZoomingEnabled​(boolean value)
        Sets whether zooming is enabled or not.
        Parameters:
        value - if true then zooming is enabled
      • isZoomingEnabled

        public boolean isZoomingEnabled()
        Returns whether zooming is enabled.
        Returns:
        true if zooming is enabled
      • popZoom

        public void popZoom()
        Pops the current zoom.
      • clearZoom

        public void clearZoom()
        Clears the zoom.
      • setPanningEnabled

        public void setPanningEnabled​(boolean value)
        Sets whether panning is enabled or not.
        Parameters:
        value - if true then panning is enabled
      • isPanningEnabled

        public boolean isPanningEnabled()
        Returns whether panning is enabled.
        Returns:
        true if panning is enabled
      • clearPanning

        public void clearPanning()
        Clears the panning.
      • order

        protected int[] order​(int value1,
                              int value2)
        swaps points if necessary, s.t., first is the smaller one.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        the ordered values
      • order

        protected double[] order​(double value1,
                                 double value2)
        swaps points if necessary, s.t., first is the smaller one.
        Parameters:
        value1 - the first value
        value2 - the second value
        Returns:
        the ordered values
      • addZoom

        public void addZoom​(double top,
                            double left,
                            double bottom,
                            double right)
        Adds a zoom.
        Parameters:
        top - the top value
        left - the left value
        bottom - the bottom value
        right - the right value
      • addZoom

        public void addZoom​(int top,
                            int left,
                            int bottom,
                            int right)
        Adds a zoom.
        Parameters:
        top - the top position
        left - the left position
        bottom - the bottom position
        right - the right position
      • setZoomBoxColor

        public void setZoomBoxColor​(Color value)
        Sets the color for the zoom box.
        Parameters:
        value - the color to use
      • getZoomBoxColor

        public Color getZoomBoxColor()
        Returns the color for the zoom box currently in use.
        Returns:
        the color in use
      • setPopupMenuCustomizer

        public void setPopupMenuCustomizer​(PopupMenuCustomizer value)
        Sets the class to customize the right-click popup menu.
        Parameters:
        value - the customizer
      • getPopupMenuCustomizer

        public PopupMenuCustomizer getPopupMenuCustomizer()
        Returns the current customizer, can be null.
        Returns:
        the customizer
      • clearBackground

        protected void clearBackground​(Graphics g)
        Clears the background.
        Parameters:
        g - the graphics context
      • paintCoordinatesGrid

        protected void paintCoordinatesGrid​(Graphics g)
        Paints the coordinates grid according to the ticks of the axes.
        Parameters:
        g - the graphics context
      • paintZoomBox

        protected void paintZoomBox​(Graphics g)
        Paints the zoom box, if necessary (i.e., currently zooming/dragging).
        Parameters:
        g - the graphics context
      • doPaint

        protected void doPaint​(Graphics g)
        Performs the actual painting.
        Parameters:
        g - the graphics context
      • paintComponent

        public void paintComponent​(Graphics g)
        paints the panel and notifies all listeners.
        Overrides:
        paintComponent in class JComponent
        Parameters:
        g - the graphics context
      • printComponent

        public void printComponent​(Graphics g)
        prints the panel and notifies all listeners.
        Overrides:
        printComponent in class JComponent
        Parameters:
        g - the graphics context
      • editPaintlet

        protected void editPaintlet​(Paintlet paintlet)
        Allows the user to edit the paintlet. Only updates the options.
        Parameters:
        paintlet - the paintlet to edit
      • setTipTextCustomizer

        public void setTipTextCustomizer​(TipTextCustomizer value)
        Sets the class for customizing the tip text.
        Parameters:
        value - the customizer
      • getTipTextCustomizer

        public TipTextCustomizer getTipTextCustomizer()
        Returns the current tip text customizer, can be null.
        Returns:
        the customizer
      • getToolTipText

        public String getToolTipText​(MouseEvent event)
        Returns the values as tooltip.
        Overrides:
        getToolTipText in class JComponent
        Parameters:
        event - the event that triggered this method
        Returns:
        the tool tip
      • clearHitDetectors

        public void clearHitDetectors()
        Removes all hit detectors.
      • addHitDetector

        public void addHitDetector​(HitDetector detector)
        Adds the detector to the internal list of detectors.
        Parameters:
        detector - the detector to add
      • removeHitDetector

        public void removeHitDetector​(HitDetector detector)
        Removes the detector from the internal list of detectors.
        Parameters:
        detector - the detector to remover
      • detectHits

        protected void detectHits​(MouseEvent e)
        Runs the mouseevent through all registered hit detectors.
        Parameters:
        e - the mouse event for the detectors to analyze
      • addZoomListener

        public void addZoomListener​(PlotPanelZoomListener l)
        Adds the given listener to the internal list of zoom listeners.
        Parameters:
        l - the listener to add
      • removeZoomListener

        public void removeZoomListener​(PlotPanelZoomListener l)
        Removes the given listener from the internal list of zoom listeners.
        Parameters:
        l - the listener to remove
      • notifyZoomListeners

        public void notifyZoomListeners​(PlotPanelZoomEvent.ZoomEventType type)
        Notifies all zoom listeners.
        Parameters:
        type - the event type
      • addPanningListener

        public void addPanningListener​(PlotPanelPanningListener l)
        Adds the given listener to the internal list of panning listeners.
        Parameters:
        l - the listener to add
      • removePanningListener

        public void removePanningListener​(PlotPanelPanningListener l)
        Removes the given listener from the internal list of panning listeners.
        Parameters:
        l - the listener to remove
      • addMouseMovementTracker

        public void addMouseMovementTracker​(MouseMovementTracker l)
        Adds the given listener to the internal list of mouse movement tracking listeners.
        Parameters:
        l - the listener to add
      • removeMouseMovementTracker

        public void removeMouseMovementTracker​(MouseMovementTracker l)
        Removes the given listener from the internal list of mouse movement tracking listeners.
        Parameters:
        l - the listener to remove
      • notifyMouseMovementTrackers

        public void notifyMouseMovementTrackers​(MouseEvent e)
        Notifies all mouse movement tracking listeners.
        Parameters:
        e - the mouse event
      • stateChanged

        public void stateChanged​(ChangeEvent e)
        In case an axis changes its type, e.g., log instead of percentage.
        Specified by:
        stateChanged in interface ChangeListener
        Parameters:
        e - the event
      • copyRanges

        public void copyRanges()
        Copies the ranges to the clipboard.
      • pasteRanges

        public void pasteRanges()
        Pastes the ranges from the clipboard.
      • copyPlot

        public void copyPlot()
        Copies the plot to the clipboard.
      • savePlot

        public void savePlot()
        Displays a save dialog for saving the plot to a file.