Class PlotArea
- java.lang.Object
-
- org.eclipse.draw2d.Figure
-
- org.eclipse.nebula.visualization.xygraph.figures.PlotArea
-
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
public class PlotArea extends org.eclipse.draw2d.FigureThe plot area figure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classPlotArea.PanStatus(package private) classPlotArea.PlotMouseListenerListener 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.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Annotation>annotationListprivate booleanarmedprivate java.util.Collection<org.eclipse.draw2d.MouseListener>auxilliaryClickListenersAlternative listener which will be notified in addition to processing the internal tools.private java.util.Collection<org.eclipse.draw2d.MouseMotionListener>auxilliaryMotionListenersAlternative listener which will be notified in addition to processing the internal tools.static java.lang.StringBACKGROUND_COLORstatic intBUTTON1Value of left click mouse button event which is equal to 1static intBUTTON2Value of middle click / mousewheel button event which is equal to 2private java.beans.PropertyChangeSupportchangeSupportprivate org.eclipse.draw2d.geometry.PointdynamicStartprivate org.eclipse.draw2d.geometry.Pointendprivate org.eclipse.swt.graphics.Cursorgrabbingprivate java.util.List<Grid>gridListprivate ZoomTypepreviousZoomTypeField used to remember the previous zoom type usedprivate org.eclipse.swt.graphics.ColorrevertBackColorprivate booleanshowBorderprivate org.eclipse.draw2d.geometry.Pointstartprivate java.util.List<Trace>traceListprivate IXYGraphxyGraphprivate ZoomTypezoomType
-
Constructor Summary
Constructors Constructor Description PlotArea(IXYGraph xyGraph)Construct a plot area for the given graph with black foreground and white backgroundPlotArea(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 voidaddAnnotation(Annotation annotation)Add an annotation to the plot area.voidaddAuxilliaryClickListener(org.eclipse.draw2d.MouseListener auxilliaryClickListener)voidaddAuxilliaryMotionListener(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)voidaddGrid(Grid grid)Add a grid to the plot area.voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)voidaddTrace(Trace trace)Add a trace to the plot area.voidfireMouseDoubleClicked(org.eclipse.draw2d.MouseEvent me)voidfireMouseDragged(org.eclipse.draw2d.MouseEvent me)voidfireMouseEntered(org.eclipse.draw2d.MouseEvent me)voidfireMouseExited(org.eclipse.draw2d.MouseEvent me)voidfireMouseHover(org.eclipse.draw2d.MouseEvent me)voidfireMouseMoved(org.eclipse.draw2d.MouseEvent me)voidfireMousePressed(org.eclipse.draw2d.MouseEvent me)voidfireMouseReleased(org.eclipse.draw2d.MouseEvent me)java.util.List<Annotation>getAnnotationList()java.util.List<Trace>getTraceList()IXYGraphgetXYGraph()ZoomTypegetZoomType()private org.eclipse.swt.graphics.ColorinternalSetBackgroundColor(org.eclipse.swt.graphics.Color bg)booleanisShowBorder()protected voidlayout()protected voidpaintClientArea(org.eclipse.draw2d.Graphics graphics)booleanremoveAnnotation(Annotation annotation)Remove a annotation from the plot area.voidremoveAuxilliaryClickListener(org.eclipse.draw2d.MouseListener auxilliaryClickListener)voidremoveAuxilliaryMotionListener(org.eclipse.draw2d.MouseMotionListener auxilliaryMotionListener)booleanremoveGrid(Grid grid)Remove a grid from the plot area.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)booleanremoveTrace(Trace trace)Remove a trace from the plot area.voidsetBackgroundColor(org.eclipse.swt.graphics.Color bg)voidsetShowBorder(boolean showBorder)voidsetZoomType(ZoomType zoomType)voidzoomInOut(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
-
-
-
-
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
-
zoomType
private ZoomType zoomType
-
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 colorbackground- color for background, can be null to inherit parent's color
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
addPropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addPropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
addPropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
addPropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
removePropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removePropertyChangeListenerin classorg.eclipse.draw2d.Figure
-
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)- Specified by:
removePropertyChangeListenerin interfaceorg.eclipse.draw2d.IFigure- Overrides:
removePropertyChangeListenerin classorg.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:
setBackgroundColorin interfaceorg.eclipse.draw2d.IFigure- Overrides:
setBackgroundColorin classorg.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:
layoutin classorg.eclipse.draw2d.Figure
-
paintClientArea
protected void paintClientArea(org.eclipse.draw2d.Graphics graphics)
- Overrides:
paintClientAreain classorg.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 cursormouseY- absolute Y location of the mouse cursorfactor- 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)
-
-