Package org.jboss.forge.addon.ui.result

Examples of org.jboss.forge.addon.ui.result.NavigationResult


   private Class<? extends UICommand>[] getNextFrom(UICommand command)
   {
      Class<? extends UICommand>[] result = null;
      if (command instanceof UIWizard)
      {
         NavigationResult next;
         try
         {
            next = ((UIWizard) command).next(new UINavigationContextImpl(context));
         }
         catch (Exception e)
         {
            logger.log(Level.SEVERE, "Cannot fetch the next steps from " + command, e);
            next = null;
         }
         if (next != null)
         {
            result = next.getNext();
         }
      }
      return result;
   }
View Full Code Here


      ScaffoldProvider selectedProvider = provider.getValue();
      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      attributeMap.put(ScaffoldSetupContext.class, createSetupContext());

      // Get the navigation result entries from the selected scaffold provider
      NavigationResult setupFlow = selectedProvider.getSetupFlow(getSelectedProject(uiContext));

      // Add the execution logic step in the end so that the scaffold setup step is executed last after all other steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow);
      NavigationResult navigationResult = builder.add(ScaffoldExecuteSetupStep.class).build();

      return navigationResult;
   }
View Full Code Here

      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      attributeMap.put(ScaffoldGenerationContext.class, populateGenerationContext(uiContext));

      // Get the step sequence from the selected scaffold provider
      Project project = getSelectedProject(uiContext);
      NavigationResult generationFlow = selectedProvider.getGenerationFlow(project);

      // Add the execution logic step in the end so that the scaffold generation step is executed last after all other
      // steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(generationFlow);
      NavigationResult navigationResult = builder.add(ScaffoldExecuteGenerationStep.class).build();

      return navigationResult;
   }
View Full Code Here

      if (!canFlipToNextPage())
      {
         throw new IllegalStateException("Wizard is already on the last page");
      }
      UIBuilderImpl currentBuilder = getCurrentBuilder();
      NavigationResult result = ((UIWizard) currentBuilder.getCommand()).next(context);
      Class<? extends UICommand>[] successors = result.getNext();
      final Class<? extends UICommand> successor;
      if (successors == null)
      {
         successor = subflows.pop();
      }
      else
      {
         successor = successors[0];
         for (int i = 1; i < successors.length; i++)
         {
            subflows.push(successors[i]);
         }
      }
      UIBuilderImpl nextBuilder = createBuilder((Class<W>) successor);
      pages.add(nextBuilder);
      return result.getMessage();
   }
View Full Code Here

   {
      UIBuilderImpl currentBuilder = getCurrentBuilder();
      try
      {
         boolean result;
         NavigationResult next = ((UIWizard) currentBuilder.getCommand()).next(context);
         if (next == null)
         {
            result = !subflows.isEmpty();
         }
         else
View Full Code Here

   private Class<? extends UICommand>[] getNextFrom(UICommand command)
   {
      Class<? extends UICommand>[] result = null;
      if (command instanceof UIWizard)
      {
         NavigationResult next;
         try
         {
            next = ((UIWizard) command).next(new UINavigationContextImpl(context));
         }
         catch (Exception e)
         {
            logger.log(Level.SEVERE, "Cannot fetch the next steps from " + command, e);
            next = null;
         }
         if (next != null)
         {
            result = next.getNext();
         }
      }
      return result;
   }
View Full Code Here

      CommandLine cmdLine = parser.parse(line, lenient, lenient);
      commandLineUtil.populateUIInputs(cmdLine, inputs);
      List<String> errors = validate();
      if (errors.isEmpty())
      {
         NavigationResult next = current.next(getContext());
         // Proceed to next input
         if (next != null && next.getNext() != null)
         {
            // It should always be a UIWizardStep
            Class<? extends UIWizardStep> nextWizardStep = (Class<? extends UIWizardStep>) next.getNext();
            UIWizardStep step = commandManager.lookup(nextWizardStep);
            parser = populate(root, step, line, lenient);
         }
      }
      return parser;
View Full Code Here

      ScaffoldSetupContext setupContext = createSetupContext(uiContext);
      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      attributeMap.put(ScaffoldSetupContext.class, setupContext);

      // Get the navigation result entries from the selected scaffold provider
      NavigationResult setupFlow = selectedProvider.getSetupFlow(setupContext);

      // Add the execution logic step in the end so that the scaffold setup step is executed last after all other steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow);
      NavigationResult navigationResult = builder.add(ScaffoldExecuteSetupStep.class).build();

      return navigationResult;
   }
View Full Code Here

      attributeMap.put(ScaffoldProvider.class, selectedProvider);
      ScaffoldGenerationContext generationContext = populateGenerationContext(uiContext);
      attributeMap.put(ScaffoldGenerationContext.class, generationContext);

      NavigationResult setupFlow = null;
      Project project = getSelectedProject(uiContext);

      // Verify if the selected provider is installed
      // If not, add the setup flow and inform the generation step to setup the scaffold.
      ScaffoldSetupContext setupContext = populateSetupContext(uiContext);
      if (!selectedProvider.isSetup(setupContext))
      {
         setupFlow = selectedProvider.getSetupFlow(setupContext);
         attributeMap.put(REQUIRES_SCAFFOLD_SETUP, true);
         attributeMap.put(ScaffoldSetupContext.class, setupContext);
      }

      // Get the step sequence from the selected scaffold provider
      NavigationResult generationFlow = selectedProvider.getGenerationFlow(generationContext);

      // Add the execution logic step in the end so that the scaffold generation step is executed last after all other
      // steps
      NavigationResultBuilder builder = NavigationResultBuilder.create(setupFlow);
      NavigationResult navigationResult = builder.add(generationFlow).add(ScaffoldExecuteGenerationStep.class).build();

      return navigationResult;
   }
View Full Code Here

               currentCommand.getContext().setConsoleOutput(output);

               // so now the options are parsed and added to the uicontext of that command
               // try to get next command in the wizard
               UIWizard wizard = (UIWizard) wizardSteps.get(0).getCommand();
               NavigationResult navResult = wizard.next(wizardSteps.get(0).getContext());
               // we have another step, lets add it to the list
               // this will be processed next
               if (navResult != null)
               {
                  Object cmd = navResult.getNext();
                  wizardSteps.add(new ShellCommand(registry, getForgeShell(), (UICommand) cmd));
               }
               // we have come to the final step, execute the wizard
               else
                  return executeWizardSteps(output);
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.ui.result.NavigationResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.