KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jac > ide > diagrams > AspectFigure


1 /*
2   Copyright (C) 2002 Renaud Pawlak <renaud@aopsys.com>
3
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU Lesser General Public License as
6   published by the Free Software Foundation; either version 2 of the
7   License, or (at your option) any later version.
8
9   This program is distributed in the hope that it will be useful,
10   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12   GNU Lesser General Public License for more details.
13
14   You should have received a copy of the GNU Lesser General Public
15   License along with this program; if not, write to the Free Software
16   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
17 */

18
19 package org.objectweb.jac.ide.diagrams;
20
21 import java.awt.Graphics JavaDoc;
22 import java.awt.Rectangle JavaDoc;
23 import java.awt.Color JavaDoc;
24
25 import CH.ifa.draw.framework.Figure;
26 import CH.ifa.draw.framework.DrawingView;
27
28 import org.objectweb.jac.ide.Package;
29 import org.objectweb.jac.ide.Aspect;
30
31 public class AspectFigure extends ClassFigure {
32
33    public AspectFigure(org.objectweb.jac.ide.ClassFigure figure, Package JavaDoc pack,
34                        DrawingView view) {
35       super(figure,pack,view);
36    }
37
38    protected void drawBorder(Graphics JavaDoc g) {
39       
40       Rectangle JavaDoc r = displayBox();
41       
42       g.setColor(Color.orange);
43
44       g.fillRect(r.x, r.y, r.width, r.height);
45       
46       g.setColor(Color.red);
47       
48       g.drawRect(r.x, r.y, r.width, r.height);
49       
50       
51       Figure f = figureAt(0);
52       Rectangle JavaDoc rf = f.displayBox();
53       
54       g.drawLine(r.x,r.y+rf.height+1,r.x+r.width,r.y+rf.height+1);
55       
56       if( fieldFigures.size() > 0 ) {
57          f = (Figure) fieldFigures.get(0);
58          rf = f.displayBox();
59          g.drawLine(r.x,rf.y,r.x+r.width,rf.y);
60       }
61       
62    }
63
64    public Aspect getAspect() {
65       return (Aspect)getSubstance();
66    }
67
68 }
69
Popular Tags