Class PlotPanel

    • Field Detail

      • m_AxisBottom

        protected AxisPanel m_AxisBottom
        the bottom axis panel.
      • m_AxisTop

        protected AxisPanel m_AxisTop
        the top axis panel.
      • m_AxisLeft

        protected AxisPanel m_AxisLeft
        the left axis panel.
      • m_AxisRight

        protected AxisPanel m_AxisRight
        the right axis panel.
      • m_PanelContent

        protected ContentPanel m_PanelContent
        the content panel for drawing.
      • m_AxisWidth

        protected int m_AxisWidth
        the width of the axes.
      • m_CornerTopLeft

        protected JPanel m_CornerTopLeft
        the top-left corner panel.
      • m_CornerTopRight

        protected JPanel m_CornerTopRight
        the top-right corner panel.
      • m_CornerBottomLeft

        protected JPanel m_CornerBottomLeft
        the bottom-left corner panel.
      • m_CornerBottomRight

        protected JPanel m_CornerBottomRight
        the bottom-right corner panel.
      • m_PaintListeners

        protected Set<PaintListener> m_PaintListeners
        the paint listeners.
      • m_MouseClickListeners

        protected Set<MouseListener> m_MouseClickListeners
        the mouse click listeners.
      • m_ToolTipAxes

        protected List<Axis> m_ToolTipAxes
        the vector with the axes that make up the values in the tooltip.
      • m_Debug

        protected Boolean m_Debug
        whether debug mode is on.
      • m_GridColor

        protected Color m_GridColor
        the color for the grid.
      • m_BackgroundColor

        protected Color m_BackgroundColor
        the background color.
      • m_ForegroundColor

        protected Color m_ForegroundColor
        the foregorund color.
    • Constructor Detail

      • PlotPanel

        public PlotPanel()
        Initializes the panel.
      • PlotPanel

        public PlotPanel​(boolean debug)
        Initializes the panel.
        Parameters:
        debug - if true then some debugging is turned on.
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
      • createCornerPanel

        protected JPanel createCornerPanel()
        Creates a corner panel (square panel that cannot be resized).
        Returns:
        the corner panel
      • updateCornerPanel

        protected void updateCornerPanel​(JPanel panel,
                                         int width,
                                         int height)
        updates the dimensions of the corner panel.
        Parameters:
        panel - the panel to updated
        width - the new width
        height - the new height
      • initGUI

        protected void initGUI()
        Initializes the GUI components.
      • addPrintScreenListener

        protected void addPrintScreenListener​(JComponent comp)
        Adds a "print screen" listener to the container.
        Parameters:
        comp - the component to add the listener to
      • setForegroundColor

        public void setForegroundColor​(Color value)
        Sets the foreground color to use.
        Parameters:
        value - the color to use
      • getForegroundColor

        public Color getForegroundColor()
        Returns the current foreground color in use.
        Returns:
        the color in use
      • setBackgroundColor

        public void setBackgroundColor​(Color value)
        Sets the background color to use.
        Parameters:
        value - the color to use
      • getBackgroundColor

        public Color getBackgroundColor()
        Returns the current background color in use.
        Returns:
        the color in use
      • setAxisWidths

        public void setAxisWidths​(int value)
        Sets the widht of all the axes.
        Parameters:
        value - the width to set
      • setAxisWidth

        public void setAxisWidth​(Axis axis,
                                 int width)
        Sets the size of the specified axis.
        Parameters:
        axis - the axis to set the width for
        width - the width
      • updateCorner

        protected void updateCorner​(Axis axis)
        Updates the dimensions of the corner panels.
        Parameters:
        axis - the axis to update
      • updateCorners

        public void updateCorners()
        Updates all the corners
      • getAxisWidth

        public int getAxisWidth​(Axis axis)
        Returns the size of the specified axis.
        Parameters:
        axis - the axis to get the width for
        Returns:
        the width
      • getActualAxisWidth

        public int getActualAxisWidth​(Axis axis)
        Returns the actual size of the specified axis, depending on visibility.
        Parameters:
        axis - the axis to get the width for
        Returns:
        the actual width
      • getAxis

        public AxisPanel getAxis​(Axis axis)
        Returns the specified axis.
        Parameters:
        axis - the axis to return
        Returns:
        the corresponding axis
      • setAxisVisibility

        public void setAxisVisibility​(Axis axis,
                                      Visibility visible)
        Sets the visibility state of the specified axis.
        Parameters:
        axis - the axis to hide/show
        visible - the state
      • getAxisVisibility

        public Visibility getAxisVisibility​(Axis axis)
        Returns the visibility of the specified axis.
        Parameters:
        axis - the axis to retrieve the visibility state for
        Returns:
        the state
      • 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
      • isZoomed

        public boolean isZoomed()
        Returns true if any of the axis is zoomed.
        Returns:
        true if the graph was zoomed
      • 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
      • isPanned

        public boolean isPanned()
        Returns true if any of the axis has a pixel offset != 0.
        Returns:
        true if the graph was panned
      • clearPanning

        public void clearPanning()
        Clears the panning.
      • getContent

        public ContentPanel getContent()
        Returns the content panel.
        Returns:
        the panel to draw on
      • addPaintListener

        public void addPaintListener​(PaintListener l)
        Adds the given listener to the internal list of paint listeners.
        Parameters:
        l - the listener to add
      • removePaintListener

        public void removePaintListener​(PaintListener l)
        Removes the given listener from the internal list of paint listeners.
        Parameters:
        l - the listener to remove
      • notifyPaintListeners

        public void notifyPaintListeners​(Graphics g,
                                         PaintEvent.PaintMoment moment)
        Notifies all paint listeners.
        Parameters:
        g - the graphics context of the paint update
        moment - the paint moment, indicating which paintlets are to be executed
      • addMouseClickListener

        public void addMouseClickListener​(MouseListener l)
        Adds the given listener to the internal list of mouse click listeners.
        Parameters:
        l - the listener to add
      • removeMouseClickListener

        public void removeMouseClickListener​(MouseListener l)
        Removes the given listener from the internal list of mouse click listeners.
        Parameters:
        l - the listener to remove
      • notifyMouseClickListeners

        public void notifyMouseClickListeners​(MouseEvent e)
        Notifies all mouse click listeners.
        Parameters:
        e - the event
      • 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
      • 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
      • clearToolTipAxes

        public void clearToolTipAxes()
        Removes display of tool tips for all axis.
      • addToolTipAxis

        public void addToolTipAxis​(Axis axis)
        Adds the axis at the end of the vector with the axes making up the tooltip of values of the content panel. If the axis already existed, then it will be deleted first before added at the end.
        Parameters:
        axis - the axis to add
      • removeToolTipAxis

        public void removeToolTipAxis​(Axis axis)
        Removes the axis from the vector with the axes making up the tooltip of values of the content panel.
        Parameters:
        axis - the axis to remove
      • hasToolTipAxis

        public boolean hasToolTipAxis​(Axis axis)
        Checks whether the specified axis is used in making up the tooltip.
        Parameters:
        axis - the axis to check
        Returns:
        true if the axis is used in making up the toolip
      • setGridColor

        public void setGridColor​(Color value)
        Sets the color to use for painting the coordinates grid.
        Parameters:
        value - the color to use
      • getGridColor

        public Color getGridColor()
        Returns the color used for painting the coordinates grid.
        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
      • setAxisPopupMenuCustomizer

        public void setAxisPopupMenuCustomizer​(Axis axis,
                                               PopupMenuCustomizer value)
        Sets the class to customize the right-click popup menu of an axis.
        Parameters:
        axis - the axis to set the customizer for
        value - the customizer
      • getAxisPopupMenuCustomizer

        public PopupMenuCustomizer getAxisPopupMenuCustomizer​(Axis axis)
        Returns the current axis customizer, can be null.
        Parameters:
        axis - the axis to get the customizer for
        Returns:
        the customizer
      • 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
      • 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
      • 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
      • toString

        public String toString()
        Returns a short description of the panel.
        Overrides:
        toString in class Component
        Returns:
        the description