1 18 19 package org.objectweb.jac.ide.diagrams; 20 21 import CH.ifa.draw.figures.ArrowTip; 22 import org.objectweb.jac.ide.RelationLink; 23 import java.awt.Color ; 24 import org.objectweb.jac.aspects.gui.DisplayContext; 25 import org.objectweb.jac.core.rtti.CollectionItem; 26 import org.objectweb.jac.core.rtti.ClassRepository; 27 import org.objectweb.jac.aspects.gui.EventHandler; 28 29 30 public class RelationLinkFigure extends LinkFigure { 31 32 public RelationLinkFigure(org.objectweb.jac.ide.LinkFigure figure) { 33 super(figure); 34 } 35 public RelationLinkFigure() { 36 } 37 38 void setDecorations() { 39 if (linkFig==null) { 40 setStartDecoration(null); 41 setEndDecoration(null); 42 return; 43 } 44 RelationLink link = (RelationLink)linkFig.getLink(); 45 switch (link.getOrientation()) { 46 case RelationLink.ORIENTATION_STRAIGHT: 47 setStartDecoration(null); 48 setEndDecoration(new ArrowTip()); 49 break; 50 case RelationLink.ORIENTATION_REVERSE: 51 setStartDecoration(new ArrowTip()); 52 setEndDecoration(null); 53 break; 54 default: 55 setStartDecoration(null); 56 setEndDecoration(null); 57 } 58 if (link.isAggregation()) { 59 ArrowTip arrow = new ArrowTip(0.50, 15, 28); 60 arrow.setFillColor(Color.white); 61 setStartDecoration(arrow); 62 } 63 } 64 65 public void onSelect(DisplayContext context) { 67 CollectionItem coll = ClassRepository.get().getClass(Class .class) 68 .getCollection("links"); 69 EventHandler.get().onSelection( 70 context,coll,getSubstance(),null,null); 71 } 72 } 73 | Popular Tags |