当前位置: 首页>>代码示例>>Java>>正文


Java UIBuilder.add方法代码示例

本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIBuilder.add方法的典型用法代码示例。如果您正苦于以下问题:Java UIBuilder.add方法的具体用法?Java UIBuilder.add怎么用?Java UIBuilder.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jboss.forge.addon.ui.context.UIBuilder的用法示例。


在下文中一共展示了UIBuilder.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    UIContext context = builder.getUIContext();
    if (context.getProvider().isGUI()) {
        mission.setItemLabelConverter(Mission::getName);
    } else {
        mission.setItemLabelConverter(Mission::getId);
    }
    DeploymentType deploymentType = (DeploymentType) context.getAttributeMap().get(DeploymentType.class);
    String[] filterLabels = catalogServiceFactory.getFilterLabels(context);
    Set<Mission> missions = catalogServiceFactory.getCatalog(context).selector()
            .deploymentType(deploymentType)
            .labels(filterLabels)
            .getMissions();
    mission.setValueChoices(missions);
    mission.setDefaultValue(() -> {
        Iterator<Mission> iterator = mission.getValueChoices().iterator();
        return (iterator.hasNext()) ? iterator.next() : null;
    });
    builder.add(mission);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:22,代码来源:ChooseMissionStep.java

示例2: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
public void initializeUI(final UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    this.gitProviderCache = cacheManager.getCache(CacheNames.GIT_PROVIDERS);

    KubernetesClientHelper kubernetesClientHelper = kubernetesClientFactory.createKubernetesClient(builder.getUIContext());
    String key = kubernetesClientHelper.getUserCacheKey();
    List<GitProvider> gitServices = gitProviderCache.computeIfAbsent(key, k -> GitProvider.loadGitProviders());
    int size = gitServices.size();
    if (size > 0) {
        gitProvider.setDefaultValue(pickDefaultGitProvider(gitServices));
    }
    if (size > 1) {
        gitProvider.setValueChoices(gitServices);
        gitProvider.setItemLabelConverter(GitProvider::getName);
        builder.add(gitProvider);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:19,代码来源:AbstractPickGitAccountStep.java

示例3: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
public void initializeUI(final UIBuilder builder) throws Exception {
    super.initializeUI(builder);
    kubernetesClientHelper = kubernetesClientFactory.createKubernetesClient(builder.getUIContext());
    namespacesCache = cacheManager.getCache(CacheNames.USER_NAMESPACES);
    final String key = kubernetesClientHelper.getUserCacheKey();
    namespaces = namespacesCache.computeIfAbsent(key, k -> Tenants.loadNamespaces(getMandatoryAuthHeader(builder.getUIContext())));

    repositoriesCache = cacheManager.getCache(CacheNames.GITHUB_REPOSITORIES_FOR_ORGANISATION);

    github = gitHubFacadeFactory.createGitHubFacade(builder.getUIContext());

    Map<Object, Object> attributeMap = builder.getUIContext().getAttributeMap();
    final String gitOrganisation = (String) attributeMap.get(AttributeMapKeys.GIT_ORGANISATION);

    String userKey = github.getDetails().getUserCacheKey();
    String orgKey = userKey + "/" + gitOrganisation;

    Collection<GitRepositoryDTO> repositoryNames = repositoriesCache.computeIfAbsent(orgKey, k -> github.getRepositoriesForOrganisation(gitOrganisation));

    gitRepositoryPattern.setValueChoices(repositoryNames);
    gitRepositoryPattern.setItemLabelConverter(GitRepositoryDTO::getId);
    builder.add(gitRepositoryPattern);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:24,代码来源:GitHubImportPickRepositoriesStep.java

示例4: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
public void initializeUI(final UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    this.github = gitHubFacadeFactory.createGitHubFacade(builder.getUIContext());

    // TODO cache this per user every say 30 seconds!
    Collection<GitOrganisationDTO> organisations = new ArrayList<>();
    if (github != null && github.isDetailsValid()) {
        String orgKey = github.getDetails().getUserCacheKey();
        organisations = organisationsCache.computeIfAbsent(orgKey, k -> github.loadGitHubOrganisations());
    }
    gitOrganisation.setValueChoices(organisations);
    gitOrganisation.setItemLabelConverter(GitOrganisationDTO::getId);
    String userName = github.getDetails().getUsername();
    if (Strings.isNotBlank(userName)) {
        for (GitOrganisationDTO organisation : organisations) {
            if (userName.equals(organisation.getName())) {
                gitOrganisation.setDefaultValue(organisation);
                break;
            }
        }
    }
    if (organisations.size() > 1) {
        builder.add(gitOrganisation);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:27,代码来源:GitHubImportPickOrganisationStep.java

示例5: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
public void initializeUI(final UIBuilder builder) {
    this.kubernetesClientHelper = kubernetesClientFactory.createKubernetesClient(builder.getUIContext());
    this.namespacesCache = cacheManager.getCache(CacheNames.USER_NAMESPACES);
    final String key = kubernetesClientHelper.getUserCacheKey();
    this.namespaces = namespacesCache.computeIfAbsent(key, k -> Tenants.loadNamespaces(getMandatoryAuthHeader(builder.getUIContext())));

    jenkinsSpace.setValueChoices(Tenants.jenkinsNamespaces(namespaces));
    if (!namespaces.isEmpty()) {
        jenkinsSpace.setDefaultValue(Tenants.findDefaultJenkinsNamespace(namespaces));
    }

    triggerBuild.setDefaultValue(true);
    addCIWebHooks.setDefaultValue(true);

    if (namespaces.size() > 1) {
        builder.add(jenkinsSpace);
    }
    builder.add(triggerBuild);
    builder.add(addCIWebHooks);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:21,代码来源:CreateBuildConfigStep.java

示例6: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(final UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    buildName.setDefaultValue(new Callable<String>() {
        @Override
        public String call() throws Exception {
            Model mavenModel = getMavenModel(builder);
            if (mavenModel != null) {
                return mavenModel.getArtifactId();
            }
            return null;
        }
    });
    builder.add(buildName);
    builder.add(imageName);
    builder.add(gitUri);
    builder.add(outputImage);
    builder.add(webHookSecret);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:21,代码来源:NewBuildCommand.java

示例7: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    InputComponentFactory factory = builder.getInputComponentFactory();
    dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
        .setLabel("Dependency List")
        .setDescription("Dependency list");

    UIContext uiContext = builder.getUIContext();
    if (uiContext.getProvider().isGUI()) {
        dependencies.setItemLabelConverter(VertxDependency::getName);
    } else {
        dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
    }
    Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
    final Collection<VertxDependency> deps;
    if (project != null && project.hasFacet(VertxMavenFacet.class)) {
        deps = project.getFacet(VertxMavenFacet.class).getNotUsedDependencies();
    } else {
        deps = VertxMavenFacet.getAllDependencies();
    }

    dependencies.setValueChoices(deps);

    builder.add(dependencies);
}
 
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:26,代码来源:AddDependencyCommand.java

示例8: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    super.initializeUI(builder);

    // populate autocompletion options
    serviceId.setCompleter(new UICompleter<String>() {
        @Override
        public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) {
            List<String> list = new ArrayList<String>();
            ServiceList services = getKubernetes().services().inNamespace(getNamespace()).list();
            if (services != null) {
                List<Service> items = services.getItems();
                if (items != null) {
                    for (Service item : items) {
                        String id = KubernetesHelper.getName(item);
                        list.add(id);
                    }
                }
            }
            Collections.sort(list);
            return list;
        }
    });

    builder.add(serviceId);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:27,代码来源:ServiceDelete.java

示例9: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    final Project project = getSelectedProject(builder);

    Map<Object, Object> attributeMap = builder.getUIContext().getAttributeMap();
    attributeMap.remove("navigationResult");

    // include custom components
    discoverCustomCamelComponentsOnClasspathAndAddToCatalog(camelCatalog, project);

    // find all components in project (and filter out components without options)
    Iterable<ComponentDto> it = CamelCommandsHelper.createComponentDtoValues(project, getCamelCatalog(), null, false, false, false, true).call();
    componentName.setValueChoices(it);

    builder.add(componentName);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:CamelEditComponentCommand.java

示例10: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    InputComponentFactory factory = builder.getInputComponentFactory();
    dependencies = factory.createSelectMany("dependencies", VertxDependency.class)
        .setLabel("Dependency List")
        .setDescription("Dependency list");

    UIContext uiContext = builder.getUIContext();
    if (uiContext.getProvider().isGUI()) {
        dependencies.setItemLabelConverter(VertxDependency::getName);
    } else {
        dependencies.setItemLabelConverter(VertxDependency::getArtifactId);
    }

    Project project = Projects.getSelectedProject(getProjectFactory(), uiContext);
    final Collection<VertxDependency> deps;
    if (project != null && project.hasFacet(VertxMavenFacet.class)) {
        deps = project.getFacet(VertxMavenFacet.class).getUsedDependencies();
    } else {
        deps = VertxMavenFacet.getAllDependencies();
    }

    dependencies.setValueChoices(deps);

    builder.add(dependencies);
}
 
开发者ID:cescoffier,项目名称:vertx-forge-addon,代码行数:27,代码来源:RemoveDependencyCommand.java

示例11: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
   UIContext context = builder.getUIContext();
   if (context.getProvider().isGUI())
   {
      mission.setItemLabelConverter(Mission::getName);
   }
   else
   {
      mission.setItemLabelConverter(Mission::getId);
   }
   DeploymentType deploymentType = (DeploymentType) context.getAttributeMap().get(DeploymentType.class);
   String[] filterLabels = catalogServiceFactory.getFilterLabels(context);
   Set<Mission> missions = catalogServiceFactory.getCatalog(context).selector()
           .deploymentType(deploymentType)
           .labels(filterLabels)
           .getMissions();
   mission.setValueChoices(missions);
   mission.setDefaultValue(() -> {
      Iterator<Mission> iterator = mission.getValueChoices().iterator();
      return (iterator.hasNext()) ? iterator.next() : null;
   });
   builder.add(mission);
}
 
开发者ID:fabric8-launcher,项目名称:launchpad-addon,代码行数:26,代码来源:ChooseMissionStep.java

示例12: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    UIContext context = builder.getUIContext();
    if (context.getProvider().isGUI()) {
        deploymentType.setItemLabelConverter(DeploymentType::getDescription);
    }
    deploymentType.setValueChoices(EnumSet.of(DeploymentType.CD, DeploymentType.ZIP));
    builder.add(deploymentType);
    List<String> openShiftClusters = missionControlValidator.getOpenShiftClusters(builder.getUIContext());
    openShiftCluster.setValueChoices(openShiftClusters).setEnabled(openShiftClusters.size() > 1);
    if (openShiftClusters.size() > 0) {
        openShiftCluster.setDefaultValue(openShiftClusters.get(0));
        builder.add(openShiftCluster);
    }
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:16,代码来源:ChooseDeploymentTypeStep.java

示例13: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    UIContext context = builder.getUIContext();
    if (context.getProvider().isGUI()) {
        runtime.setItemLabelConverter(Runtime::getName);
    } else {
        runtime.setItemLabelConverter(Runtime::getId);
    }

    runtime.setValueChoices(() -> {
        DeploymentType deploymentType = (DeploymentType) context.getAttributeMap().get(DeploymentType.class);
        Mission mission = (Mission) context.getAttributeMap().get(Mission.class);
        String[] filterLabels = catalogServiceFactory.getFilterLabels(builder.getUIContext());
        return catalogServiceFactory.getCatalog(context).selector()
                .deploymentType(deploymentType)
                .mission(mission)
                .labels(filterLabels)
                .getRuntimes();
    });

    runtime.setDefaultValue(() -> {
        Iterator<Runtime> iterator = runtime.getValueChoices().iterator();
        return (iterator.hasNext()) ? iterator.next() : null;
    });

    builder.add(runtime);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:28,代码来源:ChooseRuntimeStep.java

示例14: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) {
    UIContext context = builder.getUIContext();
    BoosterCatalog catalog = catalogFactory.getCatalog(context);
    Collection<Booster> boosters = catalog.getBoosters();

    Map<String, BoosterDTO> map = new HashMap<>();
    boolean customBoosterCatalog = hasCustomBoosterCatalog(context);
    for (Booster booster : boosters) {
        if (customBoosterCatalog || ValidBoosters.validRhoarBooster(booster)) {
            // TODO lets filter out duplicate named boosters for now
            // as they break the combo box UX
            // once we move away from combo box we can return all versions of all boosters
            // with the same name though!
            String key = booster.getName();
            if (!map.containsKey(key)) {
                map.put(key, new BoosterDTO(booster));
            }
        }
    }
    List<BoosterDTO> boosterList = new ArrayList<>(map.values());
    Collections.sort(boosterList);

    if (context.getProvider().isGUI()) {
        quickstart.setItemLabelConverter(BoosterDTO::getName);
    } else {
        quickstart.setItemLabelConverter(BoosterDTO::getId);
    }

    quickstart.setValueChoices(boosterList);

    if (!boosterList.isEmpty()) {
        quickstart.setDefaultValue(pickDefaultBooster(boosterList));
    }
    builder.add(quickstart);
}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:37,代码来源:ChooseBoosterStep.java

示例15: addDeploymentProperties

import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
protected void addDeploymentProperties(UIBuilder builder, DeploymentType deploymentType) {
    if (organisations.size() > 1) {
        builder.add(gitOrganisation);
    }
    // there's no need for github repo and name really - its just confusing and users may make mistakes?
    //builder.add(getGitHubRepositoryName());
    builder.add(getNamed());

}
 
开发者ID:fabric8-launcher,项目名称:launcher-backend,代码行数:11,代码来源:Fabric8ProjectInfoStep.java


注:本文中的org.jboss.forge.addon.ui.context.UIBuilder.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。