01: package org.openwfe.gpe.figures;
02:
03: import org.eclipse.draw2d.Border;
04: import org.eclipse.draw2d.Graphics;
05: import org.eclipse.draw2d.Label;
06: import org.eclipse.draw2d.MarginBorder;
07: import org.eclipse.draw2d.geometry.Rectangle;
08: import org.eclipse.swt.graphics.Image;
09:
10: public class EndTag extends Label {
11:
12: static final Border BORDER = new MarginBorder(2, 0, 2, 2);
13:
14: /**
15: * Creates a new StartTag
16: * @param name the text to display in this StartTag
17: */
18: public EndTag(Image image) {
19: setIconTextGap(8);
20: setIcon(image);
21: setBorder(BORDER);
22: }
23:
24: protected void paintFigure(Graphics g) {
25: super .paintFigure(g);
26: Rectangle r = getTextBounds();
27:
28: r.resize(0, -1).expand(1, 1);
29: g.drawLine(r.x, r.y, r.right(), r.y); //Top line
30: g.drawLine(r.x, r.bottom(), r.right(), r.bottom()); //Bottom line
31: g.drawLine(r.right(), r.bottom(), r.right(), r.y); //Right line
32:
33: g.drawLine(r.x - 7, r.y + r.height / 2, r.x, r.y);
34: g.drawLine(r.x - 7, r.y + r.height / 2, r.x, r.bottom());
35: }
36:
37: }
|