01: // The UMLet source code is distributed under the terms of the GPL; see license.txt
02: package com.umlet.control;
03:
04: import java.awt.Point;
05: import java.util.Vector;
06:
07: import com.umlet.element.base.*;
08:
09: /**
10: * <p>Title: </p>
11: * <p>Description: </p>
12: * <p>Copyright: Copyright (c) 2001</p>
13: * <p>Company: </p>
14: * @author unascribed
15: * @version 1.0
16: */
17:
18: public class AddEntity extends Command {
19: Entity _entity;
20: int _x;
21: int _y;
22:
23: public AddEntity(Entity e, int x, int y) {
24: _entity = e;
25: _x = x;
26: _y = y;
27: }
28:
29: public void execute() {
30: super .execute();
31: Umlet.getInstance().getPanel().add(_entity);
32: _entity.setLocation(_x, _y);
33: if (_entity instanceof Relation)
34: ((Relation) _entity).reLocate(); //LME: workaround for misplaced relations
35: Umlet.getInstance().getPanel().repaint();
36: }
37:
38: public void undo() {
39: super.undo();
40: Umlet.getInstance().getPanel().remove(_entity);
41: Umlet.getInstance().getPanel().repaint();
42: }
43: }
|