本文整理汇总了Java中org.jboss.forge.addon.ui.context.UIBuilder.getUIContext方法的典型用法代码示例。如果您正苦于以下问题:Java UIBuilder.getUIContext方法的具体用法?Java UIBuilder.getUIContext怎么用?Java UIBuilder.getUIContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.forge.addon.ui.context.UIBuilder
的用法示例。
在下文中一共展示了UIBuilder.getUIContext方法的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);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: 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);
}
}
示例7: 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);
}
示例8: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception
{
UIContext uiContext = builder.getUIContext();
Project project = getSelectedProject(uiContext);
JPAFacet<?> persistenceFacet = project.getFacet(JPAFacet.class);
List<JavaClassSource> allEntities = persistenceFacet.getAllEntities();
List<JavaClassSource> supportedEntities = new ArrayList<>();
for (JavaClassSource entity : allEntities)
{
for (Member<?> member : entity.getMembers())
{
// FORGE-823 Only add entities with @Id as valid entities for REST resource generation.
// Composite keys are not yet supported.
if (member.hasAnnotation(Id.class))
{
supportedEntities.add(entity);
}
}
}
targets.setValueChoices(supportedEntities);
targets.setItemLabelConverter(JavaClassSource::getQualifiedName);
builder.add(targets).add(generateRestResources);
}
示例9: 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);
}
}
示例10: 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);
}
示例11: 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);
}
示例12: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
UIContext uiContext = builder.getUIContext();
String organisationsCacheKey = CacheNames.GITHUB_ORGANISATIONS;
// TODO use different caches for organisations based on the git provider
this.organisationsCache = cacheManager.getCache(organisationsCacheKey);
this.github = gitHubFacadeFactory.createGitHubFacade(uiContext);
if (github != null && github.isDetailsValid()) {
String orgKey = github.getDetails().getUserCacheKey();
organisations = organisationsCache.computeIfAbsent(orgKey, k -> github.loadGitHubOrganisations());
}
gitOrganisation.setValueChoices(organisations);
gitOrganisation.setItemLabelConverter(GitOrganisationDTO::getName);
String userName = github.getDetails().getUsername();
if (Strings.isNotBlank(userName)) {
for (GitOrganisationDTO organisation : organisations) {
if (userName.equals(organisation.getName())) {
gitOrganisation.setDefaultValue(organisation);
break;
}
}
}
super.initializeUI(builder);
}
示例13: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
StopWatch watch = new StopWatch();
final UIContext context = builder.getUIContext();
letsChat = (LetsChatClient) builder.getUIContext().getAttributeMap().get("letsChatClient");
taigaClient = (TaigaClient) builder.getUIContext().getAttributeMap().get("taigaClient");
/* chatRoom.setCompleter(new UICompleter<String>() {
@Override
public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) {
// TODO: call only once to init getChatRoomNames
return filterCompletions(getChatRoomNames(), value);
}
});
issueProjectName.setCompleter(new UICompleter<String>() {
@Override
public Iterable<String> getCompletionProposals(UIContext context, InputComponent<?, String> input, String value) {
// TODO: call only once to init getIssueProjectNames
return filterCompletions(getIssueProjectNames(), value);
}
});*/
// lets initialise the data from the current config if it exists
ProjectConfig config = (ProjectConfig) context.getAttributeMap().get("projectConfig");
if (config != null) {
CommandHelpers.setInitialComponentValue(chatRoom, config.getChatRoom());
CommandHelpers.setInitialComponentValue(issueProjectName, config.getIssueProjectName());
CommandHelpers.setInitialComponentValue(codeReview, config.getCodeReview());
}
builder.add(chatRoom);
builder.add(issueProjectName);
builder.add(codeReview);
LOG.info("initializeUI took " + watch.taken());
}
示例14: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
StopWatch watch = new StopWatch();
final UIContext context = builder.getUIContext();
pipeline.setCompleter((context1, input, value) -> getPipelines(context1, true));
pipeline.setValueConverter(text -> getPipelineForValue(context, text));
if (getCurrentSelectedProject(context) != null) {
PipelineDTO defaultValue = getPipelineForValue(context, DEFAULT_MAVEN_FLOW);
if (defaultValue != null) {
pipeline.setDefaultValue(defaultValue);
pipeline.setValue(defaultValue);
}
}
// lets initialise the data from the current config if it exists
ProjectConfig config = null;
Project project = getCurrentSelectedProject(context);
File configFile = getProjectConfigFile(context, getSelectedProject(context));
if (configFile != null && configFile.exists()) {
config = ProjectConfigs.parseProjectConfig(configFile);
}
if (config != null) {
PipelineDTO flow = getPipelineForValue(context, config.getPipeline());
if (flow != null) {
CommandHelpers.setInitialComponentValue(this.pipeline, flow);
}
context.getAttributeMap().put("projectConfig", config);
}
hasJenkinsFile = hasLocalJenkinsFile(context, project);
if (!hasJenkinsFile) {
builder.add(pipeline);
}
log.info("initializeUI took " + watch.taken());
}
示例15: initializeUI
import org.jboss.forge.addon.ui.context.UIBuilder; //导入方法依赖的package包/类
@Override
public void initializeUI(UIBuilder builder) throws Exception {
UIContext context = builder.getUIContext();
Project project = getSelectedProject(context);
String currentFile = getSelectedFile(context);
String selected = configureXml(project, xml, currentFile);
nodes = configureXmlNodes(context, project, selected, xml, node);
builder.add(xml).add(node);
}