RemoveLinePoint.java :  » UML » umlet » com » umlet » control » Java Open Source

Java Open Source » UML » umlet 
umlet » com » umlet » control » RemoveLinePoint.java
// The UMLet source code is distributed under the terms of the GPL; see license.txt
package com.umlet.control;

import java.awt.*;
import java.util.*;

import com.umlet.element.base.*;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2001</p>
 * <p>Company: </p>
 * @author unascribed
 * @version 1.0
 */

public class RemoveLinePoint extends Command {
  private Relation _relation; public Relation getRelation() { return _relation; }
  private int _where; public int getWhere() { return _where; }
  private int _x; public int getX() { return _x; }
  private int _y; public int getY() { return _y; }

  public RemoveLinePoint(Relation r, int i) {
    _relation=r;
    _where=i;
    Point p=r.getLinePoints().elementAt(i);
    _x=p.x;
    _y=p.y;
  }

  public void execute() {
  super.execute();
    Vector<Point> tmp=_relation.getLinePoints();
    tmp.removeElementAt(_where);
    _relation.repaint();
  }
  public void undo() {
  super.undo();
    Vector<Point> tmp=_relation.getLinePoints();
    tmp.insertElementAt(new Point(_x,_y), _where);
    _relation.repaint();
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.