public void paste(CommandContext context, SelectionItem parent, NotificationResult notification) { if (selection != null) { selection.resetObjects(); notification.setArgs(selection.size()); } else { notification.setArgs(0); } command.paste(source, selection, context, parent, notification); clear(); }
public CommandResult execute(CommandContext context, Selection selection) { Clipboard.get(context).set(context.getScreen(), selection, this); return new BatchResult( new UpdateCommandsResult(), new NotificationResult(context, this) .setArgs(selection.size()) .setDefaultMessage("{0,choice,1#Item|1<{0} items} put into the clipboard")); }
public CommandResult execute(CommandContext context, Selection selection) { Clipboard.get(context).set(context.getScreen(), selection, this); return new BatchResult( new UpdateCommandsResult(), new NotificationResult(context, this) .setArgs(selection.size()) .setDefaultMessage("{0,choice,1#Item|1<{0} items} put into the clipboard")); }
public void paste(ListScreen source, Selection selection, CommandContext context, SelectionItem parentItem, NotificationResult notification) { CutAndPaste sourceDao = getDao(source); CutAndPaste targetDao = getDao(context.getScreen()); Object newParent = getNewParent(parentItem, context); int count = 0; for (SelectionItem item : selection) { Object obj = item.getObject(); Object oldParent = getOldParent(obj, sourceDao); if (!ObjectUtils.nullSafeEquals(oldParent, newParent)) { if (cutBeforePaste) { sourceDao.cut(obj, oldParent); targetDao.pasteCut(obj, newParent); } else { targetDao.pasteCut(obj, newParent); sourceDao.cut(obj, oldParent); } count++; } } notification.setArgs(count).setDefaultMessage( "{0,choice,0#No items have|1#Item has|1<{0} items have} been moved."); }
@Override protected CommandResult handleYes(CommandContext context, Selection selection, Object input) { Object[] args = getArgs(context, selection); for (SelectionItem item : selection) { context.getScreen().getDao().delete(item.getObject(), context.getParent()); } return new BatchResult( new RefreshListResult(), new NotificationResult(context, this) .setDefaultMessage("{0,choice,1#Item \"{1}\"|1<{0} items} successfully deleted.") .setArgs(args)); }