01: package org.drools.eclipse.editors.rete.figure;
02:
03: import org.eclipse.draw2d.Figure;
04: import org.eclipse.draw2d.Graphics;
05: import org.eclipse.draw2d.geometry.Rectangle;
06: import org.eclipse.swt.SWT;
07: import org.eclipse.swt.graphics.Color;
08:
09: /**
10: * Figure representing BaseVertex
11: *
12: */
13: public class VertexFigure extends Figure {
14:
15: final private Color backgroundColor;
16: final private Color borderColor;
17:
18: /**
19: * Initializing Figure
20: *
21: * @param backgroundColor background color
22: * @param borderColor border color
23: */
24: public VertexFigure(Color backgroundColor, Color borderColor) {
25: this .backgroundColor = backgroundColor;
26: this .borderColor = borderColor;
27: }
28:
29: /**
30: * Painting antialiased vertex
31: */
32: public void paint(Graphics g) {
33: g.setAntialias(SWT.ON);
34: Rectangle r = getBounds().getCopy();
35: g.translate(r.getLocation());
36: g.setBackgroundColor(backgroundColor);
37: g.setForegroundColor(borderColor);
38: g.fillArc(0, 0, 15, 15, 0, 360);
39: g.drawArc(0, 0, 14, 14, 0, 360);
40: super.paint(g);
41: }
42:
43: }
|