/** Deletes the selected Item of the Board and creates a DeleteCommand */ public void delete() { ItemComponent[] items = board.getSelectedItems(); DeleteCommand del = new DeleteCommand(items); ArrayList<Command> actCommands = new ArrayList<Command>(); actCommands.add(del); tbe.addCommands(actCommands); board.removeItem(items); }
/** Cuts selected Iems of the Board and put it into the ClipBoard */ public void cut() { ItemComponent[] items = board.getSelectedItems(); CutCommand cut = new CutCommand(items); ArrayList<Command> actCommands = new ArrayList<Command>(); actCommands.add(cut); tbe.addCommands(actCommands); ComponentSelection contents = new ComponentSelection(this.getBoard().cloneItems(items)); tbe.getClipboard().setContents(contents, cut); board.removeItem(items); }