本文整理汇总了Java中org.jboss.forge.addon.ui.input.UISelectOne类的典型用法代码示例。如果您正苦于以下问题:Java UISelectOne类的具体用法?Java UISelectOne怎么用?Java UISelectOne使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UISelectOne类属于org.jboss.forge.addon.ui.input包,在下文中一共展示了UISelectOne类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureXml
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
protected String configureXml(Project project, UISelectOne<String> xml, String currentFile) {
XmlFileCompleter xmlFileCompleter = createXmlFileCompleter(project, null);
Set<String> files = xmlFileCompleter.getFiles();
// use value choices instead of completer as that works better in web console
final String first = first(files);
String answer = first;
xml.setValueChoices(files);
if (files.size() == 1) {
// lets default the value if there's only one choice
xml.setDefaultValue(first);
} else if (currentFile != null) {
// lets default to the current file
for (String name : files) {
if (currentFile.endsWith(name)) {
xml.setDefaultValue(name);
answer = name;
break;
}
}
}
return answer;
}
示例2: populateMetadata
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
@Override
public void populateMetadata(InputComponent component, ControlMetadata meta) {
super.populateMetadata(component, meta);
if (component instanceof UISelectOne) {
UISelectOne selectOne = (UISelectOne) component;
List<String> values = new ArrayList<String>();
Converter<Object, String> converter = getConverter(selectOne);
if (selectOne.getValueChoices() != null) {
for (Object choice : selectOne.getValueChoices()) {
String itemLabel = converter.convert(choice);
values.add(itemLabel);
}
}
meta.setValueChoices(values.toArray(new String[values.size()]));
}
}
示例3: createAllComponentDtoValues
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
public static Callable<Iterable<ComponentDto>> createAllComponentDtoValues(final Project project, final CamelCatalog camelCatalog,
final UISelectOne<String> componentCategoryFilter,
final boolean excludeComponentsOnClasspath) {
// use callable so we can live update the filter
return new Callable<Iterable<ComponentDto>>() {
@Override
public Iterable<ComponentDto> call() throws Exception {
String label = componentCategoryFilter.getValue();
return new CamelComponentsCompleter(project, camelCatalog, null, excludeComponentsOnClasspath, true, false, false, false).getValueChoices(label);
}
};
}
示例4: createComponentDtoValues
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
public static Callable<Iterable<ComponentDto>> createComponentDtoValues(final Project project, final CamelCatalog camelCatalog,
final UISelectOne<String> componentCategoryFilter,
final boolean excludeComponentsOnClasspath) {
// use callable so we can live update the filter
return new Callable<Iterable<ComponentDto>>() {
@Override
public Iterable<ComponentDto> call() throws Exception {
String label = componentCategoryFilter != null ? componentCategoryFilter.getValue() : null;
return new CamelComponentsCompleter(project, camelCatalog, null, excludeComponentsOnClasspath, false, false, false, false).getValueChoices(label);
}
};
}
示例5: createAllEipDtoValues
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
public static Callable<Iterable<EipDto>> createAllEipDtoValues(final Project project, final CamelCatalog camelCatalog, final UISelectOne<String> eipCategoryFilter) {
// use callable so we can live update the filter
return new Callable<Iterable<EipDto>>() {
@Override
public Iterable<EipDto> call() throws Exception {
String label = eipCategoryFilter != null ? eipCategoryFilter.getValue() : null;
return new CamelEipsCompleter(project, camelCatalog).getValueChoices(label);
}
};
}
示例6: configureRouteBuilder
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
protected String configureRouteBuilder(Project project, UISelectOne<String> routeBuilders, String currentFile) {
RouteBuilderCompleter completer = createRouteBuilderCompleter(project);
Set<String> builders = completer.getRouteBuilders();
// use value choices instead of completer as that works better in web console
final String first = first(builders);
String answer = first;
routeBuilders.setValueChoices(builders);
if (builders.size() == 1) {
// lets default the value if there's only one choice
routeBuilders.setDefaultValue(first);
} else if (currentFile != null) {
// lets default to the current file
if (currentFile.endsWith(".java")) {
currentFile = currentFile.substring(0, currentFile.length() - 5);
}
for (String name : builders) {
if (currentFile.endsWith(name)) {
routeBuilders.setDefaultValue(name);
answer = name;
break;
}
}
}
return answer;
}
示例7: configureComponentName
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
protected void configureComponentName(Project project, final UISelectOne<ComponentDto> componentName, boolean consumerOnly, boolean producerOnly) throws Exception {
// filter the list of components based on consumer and producer only
Iterable<ComponentDto> it = CamelCommandsHelper.createComponentDtoValues(project, getCamelCatalog(), null, false, consumerOnly, producerOnly, false).call();
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(new Converter<String, ComponentDto>() {
@Override
public ComponentDto convert(String text) {
return components.get(text);
}
});
// show note about the chosen component
componentName.addValueChangeListener(new ValueChangeListener() {
@Override
public void valueChanged(ValueChangeEvent event) {
ComponentDto component = (ComponentDto) event.getNewValue();
if (component != null) {
String description = component.getDescription();
componentName.setNote(description != null ? description : "");
} else {
componentName.setNote("");
}
}
});
}
示例8: CamelProjectAddComponentStep
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
public CamelProjectAddComponentStep(UISelectOne<String> filter, UISelectOne<ComponentDto> componentName, ProjectFactory projectFactory,
DependencyInstaller dependencyInstaller, CamelCatalog camelCatalog) {
this.filter = filter;
this.componentName = componentName;
this.projectFactory = projectFactory;
this.dependencyInstaller = dependencyInstaller;
this.camelCatalog = camelCatalog;
}
示例9: NodeDtoConverter
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
public NodeDtoConverter(CamelCatalog camelCatalog, Project project, UIContext context, UISelectOne<String> xml) {
this.camelCatalog = camelCatalog;
this.project = project;
this.context = context;
this.xml = xml;
}
示例10: getSupportedInputComponentTypes
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
@Override
protected Class<?>[] getSupportedInputComponentTypes()
{
return new Class<?>[] { UISelectOne.class };
}
示例11: getSupportedInputComponentTypes
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
@Override
public Class<?>[] getSupportedInputComponentTypes()
{
return new Class<?>[] { UISelectOne.class };
}
示例12: getConverter
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
private Converter<Object, String> getConverter(UISelectOne<Object> selectOne) {
return (Converter<Object, String>) InputComponents.getItemLabelConverter(
(ConverterFactory) getFurnace().getAddonRegistry().getServices(ConverterFactory.class.getName()).get(),
selectOne);
}
示例13: initializeConfigurationOptionComponents
import org.jboss.forge.addon.ui.input.UISelectOne; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private void initializeConfigurationOptionComponents(UIBuilder builder)
{
for (final ConfigurationOption option : WindupConfiguration.getWindupConfigurationOptions())
{
InputComponent<?, ?> inputComponent = null;
switch (option.getUIType())
{
case SINGLE:
{
UIInput<?> inputSingle = componentFactory.createInput(option.getName(), option.getType());
inputSingle.setDefaultValue(new DefaultValueAdapter(option));
inputComponent = inputSingle;
break;
}
case MANY:
{
// forge can't handle "Path", so use File
Class<?> optionType = option.getType() == Path.class ? File.class : option.getType();
UIInputMany<?> inputMany = componentFactory.createInputMany(option.getName(), optionType);
inputMany.setDefaultValue(new DefaultValueAdapter(option, Iterable.class));
inputComponent = inputMany;
break;
}
case SELECT_MANY:
{
UISelectMany<?> selectMany = componentFactory.createSelectMany(option.getName(), option.getType());
selectMany.setValueChoices((Iterable) option.getAvailableValues());
selectMany.setDefaultValue(new DefaultValueAdapter(option, Iterable.class));
inputComponent = selectMany;
break;
}
case SELECT_ONE:
{
UISelectOne<?> selectOne = componentFactory.createSelectOne(option.getName(), option.getType());
selectOne.setValueChoices((Iterable) option.getAvailableValues());
selectOne.setDefaultValue(new DefaultValueAdapter(option));
inputComponent = selectOne;
break;
}
case DIRECTORY:
{
UIInput<DirectoryResource> directoryInput = componentFactory.createInput(option.getName(),
DirectoryResource.class);
directoryInput.setDefaultValue(new DefaultValueAdapter(option, DirectoryResource.class));
inputComponent = directoryInput;
break;
}
case FILE:
{
UIInput<?> fileInput = componentFactory.createInput(option.getName(), FileResource.class);
fileInput.setDefaultValue(new DefaultValueAdapter(option, FileResource.class));
inputComponent = fileInput;
break;
}
case FILE_OR_DIRECTORY:
{
UIInput<?> fileOrDirInput = componentFactory.createInput(option.getName(), FileResource.class);
fileOrDirInput.setDefaultValue(new DefaultValueAdapter(option, FileResource.class));
inputComponent = fileOrDirInput;
break;
}
}
if (inputComponent == null)
{
throw new IllegalArgumentException("Could not build input component for: " + option);
}
inputComponent.setLabel(option.getLabel());
inputComponent.setRequired(option.isRequired());
inputComponent.setDescription(option.getDescription());
builder.add(inputComponent);
inputOptions.put(option, inputComponent);
}
}