Java Code Examples for org.jboss.forge.addon.ui.result.navigation.NavigationResultBuilder#add()

The following examples show how to use org.jboss.forge.addon.ui.result.navigation.NavigationResultBuilder#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DevOpsEditCommand.java    From fabric8-forge with Apache License 2.0 5 votes vote down vote up
@Override
public NavigationResult next(UINavigationContext context) throws Exception {
    NavigationResultBuilder builder = NavigationResultBuilder.create();
    if (needFabric8Setup) {
        builder.add(Fabric8SetupStep.class);
    }
    if (needOptionalStep) {
        builder.add(DevOpsEditOptionalStep.class);
    }
    builder.add(DevOpsEditStep.class);
    return builder.build();
}
 
Example 2
Source File: ThorntailSetupFlow.java    From thorntail-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public NavigationResult next(UINavigationContext context) throws Exception
{
   NavigationResultBuilder builder = NavigationResultBuilder.create();
   builder.add(Metadata.forCommand(SetupCommand.class).name("Thorntail: Setup")
            .description("Setup Thorntail in your web application"),
            Arrays.asList(SetupCommand.class, AddFractionCommand.class));
   builder.add(SetupFractionsStep.class);
   return builder.build();
}
 
Example 3
Source File: AngularScaffoldProvider.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public NavigationResult getSetupFlow(ScaffoldSetupContext setupContext)
{
   Project project = setupContext.getProject();
   NavigationResultBuilder builder = NavigationResultBuilder.create();
   List<Class<? extends UICommand>> setupCommands = new ArrayList<>();
   if (!project.hasFacet(JPAFacet.class))
   {
      builder.add(JPASetupWizard.class);
   }
   if (!project.hasFacet(CDIFacet.class))
   {
      setupCommands.add(CDISetupCommand.class);
   }
   if (!project.hasFacet(EJBFacet.class))
   {
      setupCommands.add(EJBSetupWizard.class);
   }
   if (!project.hasFacet(ServletFacet.class))
   {
      // TODO: FORGE-1296. Ensure that this wizard only sets up Servlet 3.0+
      setupCommands.add(ServletSetupWizard.class);
   }
   if (!project.hasFacet(RestFacet.class))
   {
      setupCommands.add(RestSetupWizard.class);
   }

   if (setupCommands.size() > 0)
   {
      Metadata compositeSetupMetadata = Metadata.forCommand(setupCommands.get(0))
               .name("Setup Facets")
               .description("Setup all dependent facets for the AngularJS scaffold.");
      builder.add(compositeSetupMetadata, setupCommands);
   }
   return builder.build();
}
 
Example 4
Source File: AngularScaffoldProvider.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public NavigationResult getGenerationFlow(ScaffoldGenerationContext generationContext)
{
   NavigationResultBuilder builder = NavigationResultBuilder.create();
   builder.add(ScaffoldableEntitySelectionWizard.class);
   return builder.build();
}
 
Example 5
Source File: DevOpsPipelineCommand.java    From fabric8-forge with Apache License 2.0 4 votes vote down vote up
@Override
public NavigationResult next(UINavigationContext context) throws Exception {
    NavigationResultBuilder builder = NavigationResultBuilder.create();
    builder.add(DevOpsEditStep.class);
    return builder.build();
}
 
Example 6
Source File: CamelEditNodeXmlCommand.java    From fabric8-forge with Apache License 2.0 4 votes vote down vote up
private NavigationResult nextEditEndpoint(UINavigationContext context, String xmlResourceName, String key, NodeDto editNode) throws Exception {
    Map<Object, Object> attributeMap = context.getUIContext().getAttributeMap();

    // find all endpoints
    xmlCompleter = createXmlEndpointsCompleter(context.getUIContext(), xmlResourceName::equals);

    String uri = editNode.getProperty("uri");
    LOG.info("Endpoint uri " + uri);

    CamelEndpointDetails detail = xmlCompleter.getEndpointDetail(uri);
    LOG.info("Endpoint detail " + detail);

    if (detail == null) {
        return null;
    }

    attributeMap.put("componentName", detail.getEndpointComponentName());
    attributeMap.put("instanceName", detail.getEndpointInstance());
    attributeMap.put("endpointUri", detail.getEndpointUri());
    attributeMap.put("lineNumber", detail.getLineNumber());
    attributeMap.put("lineNumberEnd", detail.getLineNumberEnd());
    attributeMap.put("mode", "edit");
    attributeMap.put("xml", detail.getFileName());
    attributeMap.put("kind", "xml");

    // we need to figure out how many options there is so we can as many steps we need
    String camelComponentName = detail.getEndpointComponentName();
    uri = detail.getEndpointUri();

    String json = getCamelCatalog().componentJSonSchema(camelComponentName);
    if (json == null) {
        throw new IllegalArgumentException("Could not find catalog entry for component name: " + camelComponentName);
    }

    LOG.info("Component json: " + json);

    boolean consumerOnly = detail.isConsumerOnly();
    boolean producerOnly = detail.isProducerOnly();

    UIContext ui = context.getUIContext();
    List<InputOptionByGroup> groups = createUIInputsForCamelEndpoint(camelComponentName, uri, MAX_OPTIONS, consumerOnly, producerOnly,
            getCamelCatalog(), componentFactory, converterFactory, ui);

    // need all inputs in a list as well
    List<InputComponent> allInputs = new ArrayList<>();
    for (InputOptionByGroup group : groups) {
        allInputs.addAll(group.getInputs());
    }

    LOG.info(allInputs.size() + " input fields in the UI wizard");

    NavigationResultBuilder builder = Results.navigationBuilder();
    int pages = groups.size();
    for (int i = 0; i < pages; i++) {
        boolean last = i == pages - 1;
        InputOptionByGroup current = groups.get(i);
        ConfigureEndpointPropertiesStep step = new ConfigureEndpointPropertiesStep(projectFactory, dependencyInstaller, getCamelCatalog(),
                camelComponentName, current.getGroup(), allInputs, current.getInputs(), last, i, pages);
        builder.add(step);
    }

    NavigationResult navigationResult = builder.build();
    attributeMap.put("navigationResult", navigationResult);
    return navigationResult;
}
 
Example 7
Source File: CamelProjectAddComponentCommand.java    From fabric8-forge with Apache License 2.0 4 votes vote down vote up
@Override
public NavigationResult next(UINavigationContext context) throws Exception {
    NavigationResultBuilder builder = Results.navigationBuilder();
    builder.add(new CamelProjectAddComponentStep(filter, componentName, projectFactory, dependencyInstaller, getCamelCatalog()));
    return builder.build();
}