本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIBuilder类的典型用法代码示例。如果您正苦于以下问题:Java UIBuilder类的具体用法?Java UIBuilder怎么用?Java UIBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIBuilder类属于org.jboss.forge.addon.ui.context包,在下文中一共展示了UIBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
final Project project = getSelectedProject(builder);
Iterable<ComponentDto> it = CamelCommandsHelper.createAllComponentDtoValues(project, getCamelCatalog(), filter, true).call();
// flattern the choices to a map so the UI is more responsive, as we can do a direct lookup
// in the map from the value converter
final Map<String, ComponentDto> components = new LinkedHashMap<>();
for (ComponentDto dto : it) {
components.put(dto.getScheme(), dto);
}
componentName.setValueChoices(components.values());
// include converter from string->dto
componentName.setValueConverter(components::get);
builder.add(componentName);
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:19,代码来源:CamelProjectAddComponentStep.java
示例17: 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);
// include custom components
discoverCustomCamelComponentsOnClasspathAndAddToCatalog(camelCatalog, project);
configureComponentName(project, componentName, false, false);
String selected = configureXml(project, xml, currentFile);
nodes = configureXmlNodes(context, project, selected, xml, node);
builder.add(xml).add(node).add(componentName);
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:20,代码来源:CamelAddEndpointXmlCommand.java
示例18: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
Project project = getSelectedProject(builder.getUIContext());
boolean blueprint = CamelCommandsHelper.isBlueprintProject(project);
boolean spring = CamelCommandsHelper.isSpringProject(project);
directory.getFacet(HintsFacet.class).setInputType(InputType.DIRECTORY_PICKER);
if (blueprint) {
directory.setDefaultValue("OSGI-INF/blueprint");
} else if (spring) {
directory.setDefaultValue("META-INF/spring");
}
XmlFileCompleter xmlFileCompleter = createXmlFileCompleter(builder.getUIContext(), null);
Set<String> directories = xmlFileCompleter.getDirectories();
if (directories.size() == 1) {
directory.setDefaultValue(first(directories));
}
if (!directories.isEmpty()) {
directory.setCompleter(new StringCompleter(directories));
}
name.addValidator(new ResourceNameValidator("xml"));
name.getFacet(HintsFacet.class).setInputType(InputType.FILE_PICKER);
builder.add(directory).add(name);
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:27,代码来源:CamelNewCamelContextXmlCommand.java
示例19: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
/*
className.setCompleter(new UICompleter<String>() {
@Override
public Iterable<String> getCompletionProposals(UIContext uiContext, InputComponent<?, String> inputComponent, String s) {
Project project = getSelectedProject(uiContext);
ClassScanner local = ClassScanner.newInstance(project);
SortedSet<String> answer = local.findClassNames("", 0);
local.dispose();
return answer;
}
});
*/
inputComponents = CommandHelpers.addInputComponents(builder, classNames);
}
开发者ID:fabric8io,项目名称:fabric8-forge,代码行数:17,代码来源:GetPropertiesCommand.java
示例20: 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
注:本文中的org.jboss.forge.addon.ui.context.UIBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论