001    /*
002      Copyright (C) 2002 Renaud Pawlak <renaud@aopsys.com>
003    
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public
015      License along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
017    */
018    
019    package org.objectweb.jac.ide.diagrams;
020    
021    import java.awt.Graphics;
022    import java.awt.Rectangle;
023    import java.awt.Color;
024    
025    import CH.ifa.draw.framework.Figure;
026    import CH.ifa.draw.framework.DrawingView;
027    
028    import org.objectweb.jac.ide.Package;
029    import org.objectweb.jac.ide.Aspect;
030    
031    public class AspectFigure extends ClassFigure {
032    
033       public AspectFigure(org.objectweb.jac.ide.ClassFigure figure, Package pack, 
034                           DrawingView view) {
035          super(figure,pack,view);
036       }
037    
038       protected void drawBorder(Graphics g) {
039          
040          Rectangle r = displayBox();
041          
042          g.setColor(Color.orange);
043    
044          g.fillRect(r.x, r.y, r.width, r.height);
045          
046          g.setColor(Color.red);
047          
048          g.drawRect(r.x, r.y, r.width, r.height);
049          
050          
051          Figure f = figureAt(0);
052          Rectangle rf = f.displayBox();
053          
054          g.drawLine(r.x,r.y+rf.height+1,r.x+r.width,r.y+rf.height+1);
055          
056          if( fieldFigures.size() > 0 ) {
057             f = (Figure) fieldFigures.get(0);
058             rf = f.displayBox();
059             g.drawLine(r.x,rf.y,r.x+r.width,rf.y);
060          }
061          
062       }
063    
064       public Aspect getAspect() {
065          return (Aspect)getSubstance();
066       }
067    
068    }