Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- @(#)FigureTransferCommand.java 5.2
- */
- package CH.ifa.draw.standard;
- import java.util.*;
- import CH.ifa.draw.util.*;
- import CH.ifa.draw.framework.*;
- abstract class FigureTransferCommand extends Command {
- protected DrawingView fView;
- protected FigureTransferCommand(String name, DrawingView view) {
- super(name);
- fView = view;
- }
- protected void deleteSelection() {
- fView.drawing().removeAll(fView.selection());
- fView.clearSelection();
- }
- protected void copySelection() {
- FigureSelection selection = fView.getFigureSelection();
- Clipboard.getClipboard().setContents(selection);
- }
- public boolean isExecutable() {
- return fView.selectionCount() > 0;
- }
- protected void insertFigures(Vector figures, int dx, int dy) {
- FigureEnumeration e = new FigureEnumerator(figures);
- while (e.hasMoreElements()) {
- Figure figure = e.nextFigure();
- figure.moveBy(dx, dy);
- figure = fView.add(figure);
- fView.addToSelection(figure);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement