1 18 19 package org.objectweb.jac.ide; 20 21 import java.awt.Point ; 22 import java.util.List ; 23 import java.util.Vector ; 24 25 30 31 public class LinkFigure extends Figure { 32 33 public LinkFigure() { 34 } 35 36 public LinkFigure(Link link) { 37 super(link); 38 nameCorner = new Point (); 39 startRoleCorner = new Point (); 40 startCardinalityCorner = new Point (); 41 endRoleCorner = new Point (); 42 endCardinalityCorner = new Point (); 43 points.add(new Point (0,0)); 44 points.add(new Point (0,0)); 45 } 46 47 public LinkFigure(Link link, 48 Point nameCorner, 49 Point startRoleCorner, 50 Point startCardinalityCorner, 51 Point endRoleCorner, 52 Point endCardinalityCorner) { 53 super(link); 54 this.nameCorner = nameCorner; 55 this.startRoleCorner = startRoleCorner; 56 this.startCardinalityCorner = startCardinalityCorner; 57 this.endRoleCorner = endRoleCorner; 58 this.endCardinalityCorner = endCardinalityCorner; 59 points.add(new Point (0,0)); 60 points.add(new Point (0,0)); 61 } 62 63 public Link getLink() { 64 return (Link)element; 65 } 66 67 public void translateName(int dx,int dy) { 68 this.nameCorner.translate(dx,dy); 69 } 70 71 public void translateStartRole(int dx,int dy) { 72 this.startRoleCorner.translate(dx,dy); 73 } 74 75 public void translateEndRole(int dx,int dy) { 76 this.endRoleCorner.translate(dx,dy); 77 } 78 79 public void translateStartCardinality(int dx,int dy) { 80 this.startCardinalityCorner.translate(dx,dy); 81 } 82 83 public void translateEndCardinality(int dx,int dy) { 84 this.endCardinalityCorner.translate(dx,dy); 85 } 86 87 Point nameCorner = new Point (); 88 89 93 public Point getNameCorner() { 94 return nameCorner; 95 } 96 97 101 public void setNameCorner(Point v) { 102 this.nameCorner = v; 103 } 104 105 Point startRoleCorner; 106 107 111 public Point getStartRoleCorner() { 112 return startRoleCorner; 113 } 114 115 119 public void setStartRoleCorner(Point v) { 120 this.startRoleCorner = v; 121 } 122 123 Point endRoleCorner; 124 125 129 public Point getEndRoleCorner() { 130 return endRoleCorner; 131 } 132 133 137 public void setEndRoleCorner(Point v) { 138 this.endRoleCorner = v; 139 } 140 141 Point startCardinalityCorner; 142 143 147 public Point getStartCardinalityCorner() { 148 return startCardinalityCorner; 149 } 150 151 155 public void setStartCardinalityCorner(Point v) { 156 this.startCardinalityCorner = v; 157 } 158 159 Point endCardinalityCorner; 160 161 165 public Point getEndCardinalityCorner() { 166 return endCardinalityCorner; 167 } 168 169 173 public void setEndCardinalityCorner(Point v) { 174 this.endCardinalityCorner = v; 175 } 176 177 List points = new Vector (); 178 179 183 public List getPoints() { 184 return points; 185 } 186 187 191 public void setPoints(List v) { 192 this.points = v; 193 } 194 195 public int getPointCount() { 196 return points.size(); 197 } 198 199 public void addPoint(int index,Point p) { 200 points.add(index,p); 201 } 202 203 public void removePoint(int index) { 204 points.remove(index); 205 } 206 207 public void setPoint(int index,Point p) { 208 points.set(index,p); 209 } 210 211 public void translatePoint(int index, int dx, int dy) { 212 Point p = (Point )points.get(index); 213 p.x += dx; 214 p.y += dy; 215 } 216 217 } 218 | Popular Tags |