Example #1
0
 @Override
 public Result execute(UIExecutionContext context) throws Exception {
   List<Result> results = new LinkedList<>();
   for (UICommand command : commands) {
     Result result = command.execute(context);
     results.add(result);
   }
   return Results.aggregate(results);
 }
Example #2
0
 @Override
 public String getCommandName(UIContext context, UICommand cmd) {
   String name = null;
   try {
     UICommandMetadata metadata = cmd.getMetadata(context);
     name = metadata.getName();
     if (!context.getProvider().isGUI()) {
       name = shellifyName(name);
     }
   } catch (Exception e) {
     log.log(Level.SEVERE, "Error while getting command name for " + cmd.getClass(), e);
   }
   return name;
 }
Example #3
0
 private AbstractShellInteraction findCommand(ShellContext shellContext, String commandName) {
   AbstractShellInteraction result = null;
   UICommand cmd = commandFactory.getNewCommandByName(shellContext, commandName);
   if (cmd != null && cmd.isEnabled(shellContext)) {
     CommandController controller =
         commandControllerFactory.createController(shellContext, shell, cmd);
     if (controller instanceof WizardCommandController) {
       result =
           new ShellWizard(
               (WizardCommandController) controller, shellContext, commandLineUtil, this);
     } else {
       result = new ShellSingleCommand(controller, shellContext, commandLineUtil);
     }
   }
   return result;
 }
Example #4
0
 @Override
 public void validate(UIValidationContext context) {
   for (UICommand command : commands) {
     command.validate(context);
   }
 }
Example #5
0
 @Override
 public void initializeUI(UIBuilder builder) throws Exception {
   for (UICommand command : commands) {
     command.initializeUI(builder);
   }
 }