Class Annotation

All Implemented Interfaces:
org.eclipse.draw2d.IFigure, IDataProviderListener, IAxisListener
Direct Known Subclasses:
CircleAnnotation, CrossAnnotation

public class Annotation
extends org.eclipse.draw2d.Figure
implements IAxisListener, IDataProviderListener
Annotation Figure. Annotation could be used to indicate the information for a particular point.
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Annotation.CursorLineStyle  
    (package private) class  Annotation.InfoLabelDragger  
    (package private) class  Annotation.Pointer  

    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

  • Field Summary

    Modifier and Type Field Description
    protected ISample currentSnappedSample  
    protected boolean pointerDragged  
    protected Trace trace  
    protected Axis xAxis  
    protected double xValue  
    protected Axis yAxis  
    protected double yValue  

    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

  • Constructor Summary

    Constructor Description
    Annotation​(java.lang.String name, Axis xAxis, Axis yAxis)
    Construct a free annotation.
    Annotation​(java.lang.String name, Trace trace)
    Construct an annotation on a trace.
  • Method Summary

    Modifier and Type Method Description
    void addAnnotationListener​(IAnnotationListener listener)  
    void axisAutoScaleChanged​(Axis axis, boolean oldAutoScale, boolean newAutoScale)  
    void axisForegroundColorChanged​(Axis axis, oldColor, newColor)  
    void axisLogScaleChanged​(Axis axis, boolean old, boolean logScale)  
    void axisRangeChanged​(Axis axis, Range old_range, Range new_range)
    This event indicates a change in the axis' value range
    void axisRevalidated​(Axis axis)
    This method will be notified by axis whenever the axis is revalidated.
    void axisTitleChanged​(Axis axis, java.lang.String oldTitle, java.lang.String newTitle)  
    boolean containsPoint​(int x, int y)  
    void dataChanged​(IDataProvider dataProvider)
    This method will be notified by data provider whenever the data changed in data provider getAnnotationColor() getAnnotationColorRGB() getAnnotationFont()  
    Annotation.CursorLineStyle getCursorLineStyle() getFontData()  
    IAnnotationLabelProvider getLabelProvider()  
    java.lang.String getName()  
    Trace getTrace()  
    Axis getXAxis()  
    double getXValue()  
    Axis getYAxis()  
    double getYValue()  
    boolean isFree()  
    boolean isShowName()  
    boolean isShowPosition()  
    boolean isShowSampleInfo()  
    protected void layout()  
    protected void paintFigure​(org.eclipse.draw2d.Graphics graphics)  
    void remove()  
    void setAnnotationColor​( annotationColor)  
    void setAnnotationFont​( annotationFont)  
    void setCurrentPosition​(org.eclipse.draw2d.geometry.Point currentPosition, boolean keepLabelPosition)  
    void setCurrentPosition​(org.eclipse.draw2d.geometry.Point currentPosition, boolean keepLabelPosition, boolean calcValueFromPosition)  
    void setCurrentSnappedSample​(ISample currentSnappedSample, boolean keepLabelPosition)  
    void setCursorLineStyle​(Annotation.CursorLineStyle cursorLineStyle)  
    void setdxdy​(double dx, double dy)  
    void setFont​( f)  
    void setFree​(Axis xAxis, Axis yAxis)
    Make the annotation free.
    void setLabelProvider​(IAnnotationLabelProvider labelProvider)  
    void setLocation​(double x, double y)
    Sets x an y location.
    void setName​(java.lang.String name)  
    void setShowName​(boolean showName)  
    void setShowPosition​(boolean showPosition)  
    void setShowSampleInfo​(boolean showSampleInfo)  
    void setTrace​(Trace trace)  
    void setValues​(double x, double y)
    Set the position of the annotation based on plot values
    void setXAxis​(Axis axis)  
    void setXYGraph​(IXYGraph xyGraph)  
    void setYAxis​(Axis axis)  
    void toFront()
    Sets annotation order to front
    protected void updateToDefaultPosition()
    move the annotation to the center of the plot area or trace.
    void updateX0Y0Fromdxdy​(org.eclipse.draw2d.geometry.Dimension size)
    update (x0, y0) if it is unknown.

    Methods inherited from class org.eclipse.draw2d.Figure

    add, add, add, add, addAncestorListener, addCoordinateListener, addFigureListener, addFocusListener, addKeyListener, addLayoutListener, addListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, 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, paintClientArea, primTranslate, remove, removeAll, removeAncestorListener, removeCoordinateListener, removeFigureListener, removeFocusListener, removeKeyListener, removeLayoutListener, removeListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, revalidate, setBackgroundColor, setBorder, setBounds, setChildrenDirection, setChildrenEnabled, setChildrenOrientation, setClippingStrategy, setConstraint, setCursor, setEnabled, setFlag, setFocusTraversable, 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 Details

  • Constructor Details

    • Annotation

      public Annotation​(java.lang.String name, Trace trace)
      Construct an annotation on a trace.
      name - the name of the annotation.
      trace - the trace which the annotation will snap to.
    • Annotation

      public Annotation​(java.lang.String name, Axis xAxis, Axis yAxis)
      Construct a free annotation.
      xAxis - the xAxis of the annotation.
      yAxis - the yAxis of the annotation.
      name - the name of the annotation.
  • Method Details

    • remove

      public void remove()
    • addAnnotationListener

      public void addAnnotationListener​(IAnnotationListener listener)
    • containsPoint

      public boolean containsPoint​(int x, int y)
      Specified by:
      containsPoint in interface org.eclipse.draw2d.IFigure
      containsPoint in class org.eclipse.draw2d.Figure
    • layout

      protected void layout()
      layout in class org.eclipse.draw2d.Figure
    • paintFigure

      protected void paintFigure​(org.eclipse.draw2d.Graphics graphics)
      paintFigure in class org.eclipse.draw2d.Figure
    • updateX0Y0Fromdxdy

      public void updateX0Y0Fromdxdy​(org.eclipse.draw2d.geometry.Dimension size)
      update (x0, y0) if it is unknown.
      size - the label size
    • updateToDefaultPosition

      protected void updateToDefaultPosition()
      move the annotation to the center of the plot area or trace.
    • setValues

      public void setValues​(double x, double y)
      Set the position of the annotation based on plot values
      x - Position as value on the X axis
      y - Position as value on the Y axis
      See Also:
      for setting the position based on screen coordinates
    • setXAxis

      public void setXAxis​(Axis axis)
      axis - the xAxis to set
    • setYAxis

      public void setYAxis​(Axis axis)
      axis - the yAxis to set
    • setName

      public void setName​(java.lang.String name)
      name - the name to set
    • setFont

      public void setFont​( f)
      Specified by:
      setFont in interface org.eclipse.draw2d.IFigure
      setFont in class org.eclipse.draw2d.Figure
    • getFontData

      public getFontData()
    • setTrace

      public void setTrace​(Trace trace)
      trace - the trace to set
    • setFree

      public void setFree​(Axis xAxis, Axis yAxis)
      Make the annotation free.
      xAxis -
      yAxis -
    • isFree

      public boolean isFree()
      true if the annotation is free.
    • setShowName

      public void setShowName​(boolean showName)
      showName - the showName to set
    • setShowSampleInfo

      public void setShowSampleInfo​(boolean showSampleInfo)
      showSampleInfo - the showSampleInfo to set
    • setShowPosition

      public void setShowPosition​(boolean showPosition)
      showPosition - the showPosition to set
    • setAnnotationColor

      public void setAnnotationColor​( annotationColor)
      annotationColor - the annotationColor to set
    • setAnnotationFont

      public void setAnnotationFont​( annotationFont)
      annotationFont - the annotationFont to set
    • getAnnotationFont

      public getAnnotationFont()
      annotation font
    • setCursorLineStyle

      public void setCursorLineStyle​(Annotation.CursorLineStyle cursorLineStyle)
      cursorLineStyle - the cursorLineStyle to set
    • setCurrentPosition

      public void setCurrentPosition​(org.eclipse.draw2d.geometry.Point currentPosition, boolean keepLabelPosition, boolean calcValueFromPosition)
      currentPosition - the currentPosition to set
    • setCurrentPosition

      public void setCurrentPosition​(org.eclipse.draw2d.geometry.Point currentPosition, boolean keepLabelPosition)
    • setCurrentSnappedSample

      public void setCurrentSnappedSample​(ISample currentSnappedSample, boolean keepLabelPosition)
      currentSnappedSample - the currentSnappedSample to set
      keepLabelPosition -
    • axisRevalidated

      public void axisRevalidated​(Axis axis)
      Description copied from interface: IAxisListener
      This method will be notified by axis whenever the axis is revalidated.
      Specified by:
      axisRevalidated in interface IAxisListener
    • axisRangeChanged

      public void axisRangeChanged​(Axis axis, Range old_range, Range new_range)
      Description copied from interface: IAxisListener
      This event indicates a change in the axis' value range
      Specified by:
      axisRangeChanged in interface IAxisListener
    • dataChanged

      public void dataChanged​(IDataProvider dataProvider)
      Description copied from interface: IDataProviderListener
      This method will be notified by data provider whenever the data changed in data provider
      Specified by:
      dataChanged in interface IDataProviderListener
    • setXYGraph

      public void setXYGraph​(IXYGraph xyGraph)
      xyGraph - the xyGraph to set
    • setdxdy

      public void setdxdy​(double dx, double dy)
    • setLocation

      public void setLocation​(double x, double y)
      Sets x an y location.
      x -
      y -
    • getXAxis

      public Axis getXAxis()
      the xAxis
    • getYAxis

      public Axis getYAxis()
      the yAxis
    • getName

      public java.lang.String getName()
      the name
    • getXValue

      public double getXValue()
      X value, i.e. value of this annotation on the X Axis
    • getYValue

      public double getYValue()
      Y value, i.e. value of this annotation on the Y Axis
    • getCursorLineStyle

      public Annotation.CursorLineStyle getCursorLineStyle()
      the cursorLineStyle
    • getTrace

      public Trace getTrace()
      the trace
    • isShowName

      public boolean isShowName()
      the showName
    • isShowSampleInfo

      public boolean isShowSampleInfo()
      the showSampleInfo
    • isShowPosition

      public boolean isShowPosition()
      the showPosition
    • getAnnotationColor

      public getAnnotationColor()
      the annotationColor
    • getLabelProvider

      public IAnnotationLabelProvider getLabelProvider()
    • setLabelProvider

      public void setLabelProvider​(IAnnotationLabelProvider labelProvider)
    • axisForegroundColorChanged

      public void axisForegroundColorChanged​(Axis axis, oldColor, newColor)
      Specified by:
      axisForegroundColorChanged in interface IAxisListener
    • axisTitleChanged

      public void axisTitleChanged​(Axis axis, java.lang.String oldTitle, java.lang.String newTitle)
      Specified by:
      axisTitleChanged in interface IAxisListener
    • axisAutoScaleChanged

      public void axisAutoScaleChanged​(Axis axis, boolean oldAutoScale, boolean newAutoScale)
      Specified by:
      axisAutoScaleChanged in interface IAxisListener
    • axisLogScaleChanged

      public void axisLogScaleChanged​(Axis axis, boolean old, boolean logScale)
      Specified by:
      axisLogScaleChanged in interface IAxisListener
    • getAnnotationColorRGB

      public getAnnotationColorRGB()
    • toFront

      public void toFront()
      Sets annotation order to front