Class Legend
- java.lang.Object
-
- org.eclipse.draw2d.Figure
-
- org.eclipse.draw2d.Shape
-
- org.eclipse.draw2d.RectangleFigure
-
- org.eclipse.nebula.visualization.xygraph.figures.Legend
-
- All Implemented Interfaces:
org.eclipse.draw2d.IFigure
public class Legend extends org.eclipse.draw2d.RectangleFigureThe legend to indicate the style and size of the trace line and point. The border color of the legend is same as the traces' Y-Axis color.
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.graphics.ColorBLACK_COLORprivate booleandrawBorderprivate org.eclipse.swt.graphics.Fontfontprivate static intICON_WIDTHprivate static intINNER_GAPprivate static intOUT_GAPprivate intpreferredHeightprivate java.util.List<Trace>traceList
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTrace(Trace trace)Add a trace to the axis.private intdrawLegendOrComputeHeight(org.eclipse.draw2d.Graphics graphics, int upperMargin, boolean draw)private voiddrawTraceLegend(Trace trace, org.eclipse.draw2d.Graphics graphics, int hPos, int vPos)protected voidfillShape(org.eclipse.draw2d.Graphics graphics)org.eclipse.swt.graphics.FontgetFont()intgetPreferredHeight()org.eclipse.draw2d.geometry.DimensiongetPreferredSize(int wHint, int hHint)java.util.List<Trace>getTraceList()booleanisDrawBorder()protected voidoutlineShape(org.eclipse.draw2d.Graphics graphics)booleanremoveTrace(Trace trace)Remove a trace from the axis.voidsetDrawBorder(boolean displayDrawBorderAround)voidsetPreferredHeight(int preferredHeight)voidsetTextFont(org.eclipse.swt.graphics.Font textFont)-
Methods inherited from class org.eclipse.draw2d.Shape
getAlpha, getAntialias, getLineAttributes, getLineCap, getLineDash, getLineDashOffset, getLineJoin, getLineMiterLimit, getLineStyle, getLineWidth, getLineWidthFloat, paintFigure, setAlpha, setAlpha, setAntialias, setAntialias, setFill, setFillXOR, setLineAttributes, setLineCap, setLineDash, setLineDashOffset, setLineJoin, setLineMiterLimit, setLineStyle, setLineWidth, setLineWidthFloat, setOutline, setOutlineXOR, setXOR
-
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, containsPoint, erase, findDescendantAtExcluding, findFigureAt, findFigureAt, findFigureAt, findFigureAtExcluding, findMouseEventTargetAt, findMouseEventTargetInDescendantsAt, fireCoordinateSystemChanged, fireFigureMoved, fireMoved, firePropertyChange, firePropertyChange, firePropertyChange, getBackgroundColor, getBorder, getBounds, getChildren, getClientArea, getClientArea, getClippingStrategy, getCursor, getFlag, getForegroundColor, getInsets, getLayoutManager, getListeners, getLocalBackgroundColor, getLocalFont, getLocalForegroundColor, getLocation, getMaximumSize, getMinimumSize, getMinimumSize, getParent, 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, layout, 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, 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
-
ICON_WIDTH
private static final int ICON_WIDTH
- See Also:
- Constant Field Values
-
INNER_GAP
private static final int INNER_GAP
- See Also:
- Constant Field Values
-
OUT_GAP
private static final int OUT_GAP
- See Also:
- Constant Field Values
-
BLACK_COLOR
private final org.eclipse.swt.graphics.Color BLACK_COLOR
-
traceList
private final java.util.List<Trace> traceList
-
drawBorder
private boolean drawBorder
-
preferredHeight
private int preferredHeight
-
font
private org.eclipse.swt.graphics.Font font
-
-
Constructor Detail
-
Legend
public Legend(IXYGraph xyGraph)
Construct a legend- Parameters:
xyGraph- the graph for which the legend is created
-
-
Method Detail
-
addTrace
public void addTrace(Trace trace)
Add a trace to the axis.- Parameters:
trace- the trace to be added.
-
removeTrace
public boolean removeTrace(Trace trace)
Remove a trace from the axis.- Parameters:
trace-- Returns:
- true if this axis contained the specified trace
-
outlineShape
protected void outlineShape(org.eclipse.draw2d.Graphics graphics)
- Overrides:
outlineShapein classorg.eclipse.draw2d.RectangleFigure
-
fillShape
protected void fillShape(org.eclipse.draw2d.Graphics graphics)
- Overrides:
fillShapein classorg.eclipse.draw2d.RectangleFigure
-
drawLegendOrComputeHeight
private int drawLegendOrComputeHeight(org.eclipse.draw2d.Graphics graphics, int upperMargin, boolean draw)
-
drawTraceLegend
private void drawTraceLegend(Trace trace, org.eclipse.draw2d.Graphics graphics, int hPos, int vPos)
-
getPreferredSize
public org.eclipse.draw2d.geometry.Dimension getPreferredSize(int wHint, int hHint)- Specified by:
getPreferredSizein interfaceorg.eclipse.draw2d.IFigure- Overrides:
getPreferredSizein classorg.eclipse.draw2d.Figure
-
getTraceList
public java.util.List<Trace> getTraceList()
- Returns:
- the traceList
-
isDrawBorder
public boolean isDrawBorder()
- Returns:
trueif a border is displayed around the legend
-
setDrawBorder
public void setDrawBorder(boolean displayDrawBorderAround)
- Parameters:
displayDrawBorderAround- iftruea border is displayed around the legend
-
getPreferredHeight
public int getPreferredHeight()
- Returns:
- the preferred height of this legend. If this value is -1, the height will be computed with the elements
-
setPreferredHeight
public void setPreferredHeight(int preferredHeight)
- Parameters:
preferredHeight- the preferred height of this legend. If this value is -1, the height will be computed with default values
-
getFont
public org.eclipse.swt.graphics.Font getFont()
- Specified by:
getFontin interfaceorg.eclipse.draw2d.IFigure- Overrides:
getFontin classorg.eclipse.draw2d.Figure- Returns:
- the initialised text font
-
setTextFont
public void setTextFont(org.eclipse.swt.graphics.Font textFont)
- Parameters:
textFont- new font used for the text
-
-