Ptidej-v5.2-master/PADL Serialiser DB4O Tests/rsc/JHotDraw v5.1/src/CH/ifa/draw/standard/DuplicateCommand.java
/*
 * @(#)DuplicateCommand.java 5.1
 *
 */

package CH.ifa.draw.standard;

import java.util.Vector;

import CH.ifa.draw.framework.DrawingView;
import CH.ifa.draw.framework.FigureSelection;

/**
 * Duplicate the selection and select the duplicates.
 */
public class DuplicateCommand extends FigureTransferCommand {

   /**
	* Constructs a duplicate command.
	* @param name the command name
	* @param view the target view
	*/
	public DuplicateCommand(String name, DrawingView view) {
		super(name, view);
	}

	public void execute() {
		FigureSelection selection = fView.getFigureSelection();

		fView.clearSelection();

		Vector figures = (Vector)selection.getData(FigureSelection.TYPE);
		insertFigures(figures, 10, 10);
		fView.checkDamage();
	}

	public boolean isExecutable() {
		return fView.selectionCount() > 0;
	}

}


