Examples of NavigationResult


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

{
   @Test
   public void testBuilderBuildShouldBeNullForNoEntries()
   {
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      NavigationResult result = builder.build();
      Assert.assertNull(result);
   }
View Full Code Here

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

   @Test
   public void testBuilderCreateFromNullNavigationResult()
   {
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      NavigationResult result = builder.build();
      NavigationResultBuilder builder2 = NavigationResultBuilder.create(result);
      Assert.assertNotNull(builder2);
      Assert.assertNotSame(builder2, builder);
      NavigationResult result2 = builder2.build();
      Assert.assertNull(result2);
   }
View Full Code Here

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

   @Test
   public void testBuilderCreateFromExistingNavigationResult()
   {
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      builder.add(MockCommand.class);
      NavigationResult result = builder.build();
      NavigationResultBuilder builder2 = NavigationResultBuilder.create(result);
      Assert.assertNotNull(builder2);
      Assert.assertNotSame(builder2, builder);
      NavigationResult result2 = builder2.build();
      Assert.assertNotNull(result2);
      Assert.assertNotNull(result2.getNext());
      Assert.assertEquals(1, result2.getNext().length);
   }
View Full Code Here

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

   @Test
   public void testBuilderEntriesSizeMatch()
   {
      NavigationResultBuilder builder = NavigationResultBuilder.create();
      builder.add(MockCommand.class).add(MockCommand2.class).add(MockCommand3.class).add(new MockCommand());
      NavigationResult result = builder.build();
      Assert.assertNotNull(result);
      Assert.assertNotNull(result.getNext());
      Assert.assertEquals(4, result.getNext().length);
   }
View Full Code Here

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

   public UICommand transform(UIContext context, UICommand original)
   {
      final UICommand result;
      if (original instanceof PrerequisiteCommandsProvider)
      {
         NavigationResult navigationResult = ((PrerequisiteCommandsProvider) original).getPrerequisiteCommands(context);
         if (navigationResult == null || navigationResult.getNext().length == 0)
         {
            result = original;
         }
         else
         {
View Full Code Here

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

   private NavigationResultEntry[] getNextFrom(UICommand command)
   {
      NavigationResultEntry[] 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

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

      if (!canFlipToNextPage())
      {
         throw new IllegalStateException("Wizard is already on the last page");
      }
      UIBuilderImpl currentBuilder = getCurrentBuilder();
      NavigationResult result = currentBuilder.getWizard().next(context);
      UIBuilderImpl nextBuilder = createBuilder((Class<W>) result.getNext());
      pages.add(nextBuilder);
      return result.getMessage();
   }
View Full Code Here

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

      if (!canFlipToNextPage())
      {
         throw new IllegalStateException("Wizard is already on the last page");
      }
      UIBuilderImpl currentBuilder = getCurrentBuilder();
      NavigationResult result = currentBuilder.getWizard().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

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

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

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

      List<String> errors = validationContext.getErrors();
      if (errors.isEmpty())
      {
         if (current instanceof UIWizard)
         {
            NavigationResult next = ((UIWizard) current).next(getContext());
            final Class<? extends UICommand> successor;
            // Proceed to next input
            if (next != null && next.getNext() != null)
            {
               Class<? extends UICommand>[] successors = next.getNext();
               successor = successors[0];
               for (int i = 1; i < successors.length; i++)
               {
                  if (successors[i] != null)
                  {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.