public void paste(ListScreen source, Selection selection, CommandContext context, SelectionItem parentItem, NotificationResult notification) { CopyAndPaste dao = getDao(context.getScreen()); Object parent = getParent(parentItem, context); for (SelectionItem item : selection) { dao.pasteCopy(item.getObject(), parent); } notification.setDefaultMessage("{0,choice,1#Item has|1<{0} items have} been copied."); }
@Override protected CommandResult execute(CommandContext context, SelectionItem parent) { return new BatchResult( new RefreshListResult(), new NotificationResult(context, this) .setDefaultMessage("The list has been refreshed.")); }
public CommandResult execute(CommandContext context, Selection selection) { sessionFactory.getStatistics().clear(); return new BatchResult( new RefreshListResult(), new NotificationResult(context, this) .setDefaultMessage("The baseline has been cleared.")); } }
@Override public CommandResult execute(CommandContext context, SelectionItem parent) { NotificationResult notification = new NotificationResult(context, this) .setDefaultMessage("{0,choice,1#One item has|1<{0} items have} been pasted."); Clipboard.get(context).paste(context, parent, notification); return new BatchResult( notification, new RefreshListResult(parent.getObjectId()).refreshAll()); }
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)); }