Class PlotArea

  • All Implemented Interfaces:
    org.eclipse.draw2d.IFigure

    public class PlotArea
    extends org.eclipse.draw2d.Figure
    The plot area figure.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  PlotArea.PanStatus  
      (package private) class  PlotArea.PlotMouseListener
      Listener to mouse events, performs panning and some zooms Is very similar to the Axis.AxisMouseListener, but unclear how easy/useful it would be to base them on the same code.
      • Nested classes/interfaces inherited from class org.eclipse.draw2d.Figure

        org.eclipse.draw2d.Figure.FigureIterator, org.eclipse.draw2d.Figure.IdentitySearch
      • Nested classes/interfaces inherited from interface org.eclipse.draw2d.IFigure

        org.eclipse.draw2d.IFigure.NoInsets
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.List<Annotation> annotationList  
      private boolean armed  
      private java.util.Collection<org.eclipse.draw2d.MouseListener> auxilliaryClickListeners
      Alternative listener which will be notified in addition to processing the internal tools.
      private java.util.Collection<org.eclipse.draw2d.MouseMotionListener> auxilliaryMotionListeners
      Alternative listener which will be notified in addition to processing the internal tools.
      static java.lang.String BACKGROUND_COLOR  
      static int BUTTON1
      Value of left click mouse button event which is equal to 1
      static int BUTTON2
      Value of middle click / mousewheel button event which is equal to 2
      private java.beans.PropertyChangeSupport changeSupport  
      private org.eclipse.draw2d.geometry.Point dynamicStart  
      private org.eclipse.draw2d.geometry.Point end  
      private org.eclipse.swt.graphics.Cursor grabbing  
      private java.util.List<Grid> gridList  
      private ZoomType previousZoomType
      Field used to remember the previous zoom type used
      private org.eclipse.swt.graphics.Color revertBackColor  
      private boolean showBorder  
      private org.eclipse.draw2d.geometry.Point start  
      private java.util.List<Trace> traceList  
      private IXYGraph xyGraph  
      private ZoomType zoomType  
      • Fields inherited from class org.eclipse.draw2d.Figure

        bgColor, border, bounds, fgColor, flags, font, MAX_FLAG, maxSize, minSize, NO_MANAGER, prefSize, toolTip
      • Fields inherited from interface org.eclipse.draw2d.IFigure

        MAX_DIMENSION, MIN_DIMENSION, NO_INSETS
    • Constructor Summary

      Constructors 
      Constructor Description
      PlotArea​(IXYGraph xyGraph)
      Construct a plot area for the given graph with black foreground and white background
      PlotArea​(IXYGraph xyGraph, org.eclipse.swt.graphics.Color foreground, org.eclipse.swt.graphics.Color background)
      Construct a plot area for the given graph with given foreground and background colors
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAnnotation​(Annotation annotation)
      Add an annotation to the plot area.
      void addAuxilliaryClickListener​(org.eclipse.draw2d.MouseListener auxilliaryClickListener)  
      void addAuxilliaryMotionListener​(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)  
      void addGrid​(Grid grid)
      Add a grid to the plot area.
      void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      void addPropertyChangeListener​(java.lang.String property, java.beans.PropertyChangeListener listener)  
      void addTrace​(Trace trace)
      Add a trace to the plot area.
      void fireMouseDoubleClicked​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseDragged​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseEntered​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseExited​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseHover​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseMoved​(org.eclipse.draw2d.MouseEvent me)  
      void fireMousePressed​(org.eclipse.draw2d.MouseEvent me)  
      void fireMouseReleased​(org.eclipse.draw2d.MouseEvent me)  
      java.util.List<Annotation> getAnnotationList()  
      java.util.List<Trace> getTraceList()  
      IXYGraph getXYGraph()  
      ZoomType getZoomType()  
      private org.eclipse.swt.graphics.Color internalSetBackgroundColor​(org.eclipse.swt.graphics.Color bg)  
      boolean isShowBorder()  
      protected void layout()  
      protected void paintClientArea​(org.eclipse.draw2d.Graphics graphics)  
      boolean removeAnnotation​(Annotation annotation)
      Remove a annotation from the plot area.
      void removeAuxilliaryClickListener​(org.eclipse.draw2d.MouseListener auxilliaryClickListener)  
      void removeAuxilliaryMotionListener​(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)  
      boolean removeGrid​(Grid grid)
      Remove a grid from the plot area.
      void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)  
      void removePropertyChangeListener​(java.lang.String property, java.beans.PropertyChangeListener listener)  
      boolean removeTrace​(Trace trace)
      Remove a trace from the plot area.
      void setBackgroundColor​(org.eclipse.swt.graphics.Color bg)  
      void setShowBorder​(boolean showBorder)  
      void setZoomType​(ZoomType zoomType)  
      void zoomInOut​(boolean horizontally, boolean vertically, int mouseX, int mouseY, double factor)
      Zoom 'in' or 'out' by a fixed factor
      • Methods inherited from class org.eclipse.draw2d.Figure

        add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, containsPoint, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getFont, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, getPreferredSize, getPreferredSize, getSize, getToolTip, getUpdateManager, handleFocusGained, handleFocusLost, handleKeyPressed, handleKeyReleased, handleMouseDoubleClicked, handleMouseDragged, handleMouseEntered, handleMouseExited, handleMouseHover, handleMouseMoved, handleMousePressed, handleMouseReleased, hasFocus, internalGetEventDispatcher, intersects, invalidate, invalidateTree, isCoordinateSystem, isEnabled, isFocusTraversable, isMirrored, isMouseEventTarget, isOpaque, isRequestFocusEnabled, isShowing, isValid, isValidationRoot, isVisible, paint, paintBorder, paintChildren, paintFigure, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, repaint, repaint, repaint, requestFocus, revalidate, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, setFont, setForegroundColor, setLayoutManager, setLocation, setMaximumSize, setMinimumSize, setOpaque, setParent, setPreferredSize, setPreferredSize, setRequestFocusEnabled, setSize, setSize, setToolTip, setValid, setVisible, translate, translateFromParent, translateToAbsolute, translateToParent, translateToRelative, useLocalCoordinates, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • changeSupport

        private final java.beans.PropertyChangeSupport changeSupport
      • BACKGROUND_COLOR

        public static final java.lang.String BACKGROUND_COLOR
        See Also:
        Constant Field Values
      • BUTTON1

        public static final int BUTTON1
        Value of left click mouse button event which is equal to 1
        See Also:
        Constant Field Values
      • BUTTON2

        public static final int BUTTON2
        Value of middle click / mousewheel button event which is equal to 2
        See Also:
        Constant Field Values
      • xyGraph

        private final IXYGraph xyGraph
      • traceList

        private final java.util.List<Trace> traceList
      • gridList

        private final java.util.List<Grid> gridList
      • annotationList

        private final java.util.List<Annotation> annotationList
      • grabbing

        private final org.eclipse.swt.graphics.Cursor grabbing
      • showBorder

        private boolean showBorder
      • start

        private org.eclipse.draw2d.geometry.Point start
      • dynamicStart

        private org.eclipse.draw2d.geometry.Point dynamicStart
      • end

        private org.eclipse.draw2d.geometry.Point end
      • armed

        private boolean armed
      • revertBackColor

        private org.eclipse.swt.graphics.Color revertBackColor
      • auxilliaryClickListeners

        private java.util.Collection<org.eclipse.draw2d.MouseListener> auxilliaryClickListeners
        Alternative listener which will be notified in addition to processing the internal tools.
      • auxilliaryMotionListeners

        private java.util.Collection<org.eclipse.draw2d.MouseMotionListener> auxilliaryMotionListeners
        Alternative listener which will be notified in addition to processing the internal tools.
      • previousZoomType

        private ZoomType previousZoomType
        Field used to remember the previous zoom type used
    • Constructor Detail

      • PlotArea

        public PlotArea​(IXYGraph xyGraph)
        Construct a plot area for the given graph with black foreground and white background
        Parameters:
        xyGraph -
      • PlotArea

        public PlotArea​(IXYGraph xyGraph,
                        org.eclipse.swt.graphics.Color foreground,
                        org.eclipse.swt.graphics.Color background)
        Construct a plot area for the given graph with given foreground and background colors
        Parameters:
        xyGraph -
        foreground - color for foreground, can be null to inherit parent's color
        background - color for background, can be null to inherit parent's color
    • Method Detail

      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Specified by:
        addPropertyChangeListener in interface org.eclipse.draw2d.IFigure
        Overrides:
        addPropertyChangeListener in class org.eclipse.draw2d.Figure
      • addPropertyChangeListener

        public void addPropertyChangeListener​(java.lang.String property,
                                              java.beans.PropertyChangeListener listener)
        Specified by:
        addPropertyChangeListener in interface org.eclipse.draw2d.IFigure
        Overrides:
        addPropertyChangeListener in class org.eclipse.draw2d.Figure
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.beans.PropertyChangeListener listener)
        Specified by:
        removePropertyChangeListener in interface org.eclipse.draw2d.IFigure
        Overrides:
        removePropertyChangeListener in class org.eclipse.draw2d.Figure
      • removePropertyChangeListener

        public void removePropertyChangeListener​(java.lang.String property,
                                                 java.beans.PropertyChangeListener listener)
        Specified by:
        removePropertyChangeListener in interface org.eclipse.draw2d.IFigure
        Overrides:
        removePropertyChangeListener in class org.eclipse.draw2d.Figure
      • internalSetBackgroundColor

        private org.eclipse.swt.graphics.Color internalSetBackgroundColor​(org.eclipse.swt.graphics.Color bg)
      • setBackgroundColor

        public void setBackgroundColor​(org.eclipse.swt.graphics.Color bg)
        Specified by:
        setBackgroundColor in interface org.eclipse.draw2d.IFigure
        Overrides:
        setBackgroundColor in class org.eclipse.draw2d.Figure
      • addTrace

        public void addTrace​(Trace trace)
        Add a trace to the plot area.
        Parameters:
        trace - the trace to be added.
      • removeTrace

        public boolean removeTrace​(Trace trace)
        Remove a trace from the plot area.
        Parameters:
        trace -
        Returns:
        true if this plot area contained the specified trace
      • addGrid

        public void addGrid​(Grid grid)
        Add a grid to the plot area.
        Parameters:
        grid - the grid to be added.
      • removeGrid

        public boolean removeGrid​(Grid grid)
        Remove a grid from the plot area.
        Parameters:
        grid - the grid to be removed.
        Returns:
        true if this plot area contained the specified grid
      • addAnnotation

        public void addAnnotation​(Annotation annotation)
        Add an annotation to the plot area.
        Parameters:
        annotation - the annotation to be added.
      • removeAnnotation

        public boolean removeAnnotation​(Annotation annotation)
        Remove a annotation from the plot area.
        Parameters:
        annotation - the annotation to be removed.
        Returns:
        true if this plot area contained the specified annotation
      • layout

        protected void layout()
        Overrides:
        layout in class org.eclipse.draw2d.Figure
      • paintClientArea

        protected void paintClientArea​(org.eclipse.draw2d.Graphics graphics)
        Overrides:
        paintClientArea in class org.eclipse.draw2d.Figure
      • setShowBorder

        public void setShowBorder​(boolean showBorder)
        Parameters:
        showBorder - the showBorder to set
      • isShowBorder

        public boolean isShowBorder()
        Returns:
        the showBorder
      • setZoomType

        public void setZoomType​(ZoomType zoomType)
        Parameters:
        zoomType - the zoomType to set
      • getZoomType

        public ZoomType getZoomType()
        Returns:
        the active zoom type
      • getXYGraph

        public IXYGraph getXYGraph()
        Returns:
        xyGraph
      • zoomInOut

        public void zoomInOut​(boolean horizontally,
                              boolean vertically,
                              int mouseX,
                              int mouseY,
                              double factor)
        Zoom 'in' or 'out' by a fixed factor
        Parameters:
        horizontally - along x axes?
        vertically - along y axes?
        mouseX - absolute X location of the mouse cursor
        mouseY - absolute Y location of the mouse cursor
        factor - Zoom factor. Positive to zoom 'in', negative 'out'.
      • getTraceList

        public java.util.List<Trace> getTraceList()
        Returns:
        the traceList
      • getAnnotationList

        public java.util.List<Annotation> getAnnotationList()
        Returns:
        the annotationList
      • addAuxilliaryMotionListener

        public void addAuxilliaryMotionListener​(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)
      • removeAuxilliaryClickListener

        public void removeAuxilliaryClickListener​(org.eclipse.draw2d.MouseListener auxilliaryClickListener)
      • removeAuxilliaryMotionListener

        public void removeAuxilliaryMotionListener​(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)
      • addAuxilliaryClickListener

        public void addAuxilliaryClickListener​(org.eclipse.draw2d.MouseListener auxilliaryClickListener)
      • fireMouseReleased

        public void fireMouseReleased​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseDoubleClicked

        public void fireMouseDoubleClicked​(org.eclipse.draw2d.MouseEvent me)
      • fireMousePressed

        public void fireMousePressed​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseMoved

        public void fireMouseMoved​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseHover

        public void fireMouseHover​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseEntered

        public void fireMouseEntered​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseExited

        public void fireMouseExited​(org.eclipse.draw2d.MouseEvent me)
      • fireMouseDragged

        public void fireMouseDragged​(org.eclipse.draw2d.MouseEvent me)