01: package jimm.datavision.gui.cmd;
02:
03: import jimm.datavision.gui.Designer;
04: import jimm.datavision.gui.FieldWidget;
05: import jimm.datavision.gui.Clipboard;
06: import jimm.util.I18N;
07: import java.util.ArrayList;
08: import java.util.Iterator;
09:
10: /**
11: * Cuts (copies to the clipboard then deletes) a list of field widgets.
12: *
13: * @author Jim Menard, <a href="mailto:jimm@io.com">jimm@io.com</a>
14: */
15: public class CutCommand extends DeleteCommand {
16:
17: public CutCommand(Designer designer, ArrayList selectedFields) {
18: super (designer, selectedFields, I18N.get("CutCommand.name"));
19: }
20:
21: public void perform() {
22: ArrayList pasteables = new ArrayList();
23: for (Iterator iter = fieldWidgets.iterator(); iter.hasNext();)
24: pasteables
25: .add(new FieldClipping((FieldWidget) iter.next()));
26: Clipboard.instance().setContents(pasteables);
27:
28: super .perform();
29: }
30:
31: /**
32: * Calls <code>super.perform</code> because we don't want to copy
33: * anything to the clipboard a second time.
34: */
35: public void redo() {
36: super.perform();
37: }
38:
39: }
|