@Test public void testGraphCommandAllow() { makeCommand(); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.allow(gce)); }
@Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, contextEntry); final InformationItem informationItem = contextEntry.getVariable(); informationItem.getName().setValue(name); contextEntry.setParent(context); contextEntry.getVariable().setParent(contextEntry); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(contextEntry); return GraphCommandResultBuilder.SUCCESS; } }; }
AddContextEntryCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                  VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, contextEntry); final InformationItem informationItem = contextEntry.getVariable(); informationItem.getName().setValue(name); contextEntry.setParent(context); contextEntry.getVariable().setParent(contextEntry); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(contextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } }
AddContextEntryCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                  VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, contextEntry); final InformationItem informationItem = contextEntry.getVariable(); informationItem.getName().setValue(name); contextEntry.setParent(context); contextEntry.getVariable().setParent(contextEntry); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(contextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } AddContextEntryCommand(final Context context,
                                  final ContextEntry contextEntry,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final ContextUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); }
AddContextEntryCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                  VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, contextEntry); final InformationItem informationItem = contextEntry.getVariable(); informationItem.getName().setValue(name); contextEntry.setParent(context); contextEntry.getVariable().setParent(contextEntry); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(contextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } AddContextEntryCommand(final Context context,
                                  final ContextEntry contextEntry,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final ContextUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation(); }
AddContextEntryCommand extends AbstractCanvasGraphCommand implements VetoExecutionCommand,
                                                                                  VetoUndoCommand { @Override protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler handler) { return new AbstractGraphCommand() { @Override protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext gce) { return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext gce) { context.getContextEntry().add(uiRowIndex, contextEntry); final InformationItem informationItem = contextEntry.getVariable(); informationItem.getName().setValue(name); contextEntry.setParent(context); contextEntry.getVariable().setParent(contextEntry); return GraphCommandResultBuilder.SUCCESS; } @Override public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext gce) { context.getContextEntry().remove(contextEntry); return GraphCommandResultBuilder.SUCCESS; } }; } AddContextEntryCommand(final Context context,
                                  final ContextEntry contextEntry,
                                  final GridData uiModel,
                                  final GridRow uiModelRow,
                                  final int uiRowIndex,
                                  final ContextUIModelMapper uiModelMapper,
                                  final org.uberfire.mvp.Command canvasOperation); void updateRowNumbers(); void updateParentInformation();  }