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


Java UIBuilder类代码示例

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


UIBuilder类属于org.jboss.forge.addon.ui.context包,在下文中一共展示了UIBuilder类的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() + "-int-test";
            }
            return null;
        }
    });
    builder.add(buildName);
    builder.add(mavenCommand);
    builder.add(image);
    builder.add(gitUri);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:NewIntegrationTestBuildCommand.java

示例7: initializeUI

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

    Project project = getCurrentSelectedProject(builder.getUIContext());
    if (project.hasFacet(JavaSourceFacet.class)) {
        JavaSourceFacet facet = project.getFacet(JavaSourceFacet.class);
        targetPackage.setCompleter(new TestPackageNameCompleter(facet));
    }
    targetPackage.addValidator(new PackageNameValidator());
    targetPackage.setDefaultValue("io.fabric8.itests");

    className.addValidator(new ClassNameValidator(false));
    className.setDefaultValue(new Callable<String>() {
        @Override
        public String call() throws Exception {
            return "IntegrationTestKT";
        }
    });

    builder.add(targetPackage).add(className).add(profile).add(integrationTestWildcard).add(itestPlugin);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:23,代码来源:NewIntegrationTestClassCommand.java

示例8: 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

示例9: 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

示例10: initializeUI

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

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

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

示例11: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    Map<Object, Object> attributeMap = builder.getUIContext().getAttributeMap();
    attributeMap.remove("navigationResult");

    Project project = getSelectedProject(builder.getUIContext());
    String currentFile = getSelectedFile(builder.getUIContext());

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

    // we only want components that is able to consume because this is to add a new route
    configureComponentName(project, componentName, true, false);
    configureXml(project, xml, currentFile);

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

示例12: 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

示例13: initializeUI

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

    targetPackage.setCompleter(new PackageNameCompleter(facet));
    targetPackage.addValidator(new PackageNameValidator());
    targetPackage.getFacet(HintsFacet.class).setInputType(InputType.JAVA_PACKAGE_PICKER);
    // if there is only one package then use that as default
    Set<String> packages = new RouteBuilderCompleter(facet).getPackages();
    if (packages.size() == 1) {
        targetPackage.setDefaultValue(first(packages));
    }

    name.addValidator(new ClassNameValidator(false));
    name.getFacet(HintsFacet.class).setInputType(InputType.JAVA_CLASS_PICKER);

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

示例14: initializeUI

import org.jboss.forge.addon.ui.context.UIBuilder; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
    UIContext context = builder.getUIContext();
    Map<Object, Object> attributeMap = context.getAttributeMap();
    attributeMap.remove("navigationResult");

    Project project = getSelectedProject(context);
    String currentFile = getSelectedFile(context);

    String selected = configureXml(project, xml, currentFile);
    parents = configureXmlNodes(context, project, selected, xml, parent);

    nameFilter.setValueChoices(CamelCommandsHelper.createEipLabelValues(project, getCamelCatalog()));
    nameFilter.setDefaultValue("<all>");

    name.setValueChoices(CamelCommandsHelper.createAllEipDtoValues(project, getCamelCatalog(), nameFilter));
    // include converter from string->dto
    name.setValueConverter(text -> createEipDto(getCamelCatalog(), text));

    builder.add(xml).add(parent).add(nameFilter).add(name);
}
 
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:22,代码来源:CamelAddNodeXmlCommand.java

示例15: initializeUI

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

    // filter the list of components based on consumer and producer only
    configureComponentName(project, componentName, false, false);

    targetPackage.setCompleter(new PackageNameCompleter(facet));
    targetPackage.addValidator(new PackageNameValidator());
    targetPackage.getFacet(HintsFacet.class).setInputType(InputType.JAVA_PACKAGE_PICKER);
    // if there is only one package then use that as default
    Set<String> packages = new RouteBuilderCompleter(facet).getPackages();
    if (packages.size() == 1) {
        targetPackage.setDefaultValue(first(packages));
    }

    className.addValidator(new ClassNameValidator(false));
    className.getFacet(HintsFacet.class).setInputType(InputType.JAVA_CLASS_PICKER);

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


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