本文整理汇总了Java中com.vaadin.ui.AbstractSelect.setItemCaption方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractSelect.setItemCaption方法的具体用法?Java AbstractSelect.setItemCaption怎么用?Java AbstractSelect.setItemCaption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.AbstractSelect
的用法示例。
在下文中一共展示了AbstractSelect.setItemCaption方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: populateWIdsSkip
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
public static void populateWIdsSkip(AbstractSelect as, String[] s,
Integer[] skip) {
Set<Integer> se = new HashSet<Integer>(Arrays.asList(skip));
as.removeAllItems();
int i = 0;
for (String sp : s) {
if (!se.contains(i)) {
as.addItem(i);
as.setItemCaption(i, sp);
}
i++;
}
as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
}
示例2: getValueChangeListener
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
private Property.ValueChangeListener getValueChangeListener(final AbstractSelect templateComboBox,
final AbstractSelect supplierPageSelect) {
final Map<String, String> parentTemplates = utils.getParentTemplates();
return new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
String templateId = (String) templateComboBox.getValue();
boolean requiresSupplierPage = parentTemplates.containsKey(templateId);
if (requiresSupplierPage) {
supplierPageSelect.removeAllItems();
String parentTemplateId = parentTemplates.get(templateId);
final Map<String, String> pages = utils.findPagesUsingTemplate(parentTemplateId);
for (Map.Entry<String, String> entry : pages.entrySet()) {
supplierPageSelect.addItem(entry.getValue());
supplierPageSelect.setItemCaption(entry.getValue(), entry.getKey());
}
supplierPageSelect.setRequired(true);
supplierPageSelect.setVisible(true);
} else {
supplierPageSelect.setValue(null);
supplierPageSelect.setRequired(false);
supplierPageSelect.setVisible(false);
}
}
};
}
示例3: populateWIds
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
* Populate the AbstractSelect component with strings.<br>
* The Itemid is an integer = the index of the string in the sequence ,
* starting from 0
*
* @param as
* component
* @param s
* comma separated string list or array of strings
*/
static public void populateWIds(AbstractSelect as, String... s) {
int i = 0;
as.removeAllItems();
for (String sp : s) {
as.addItem(i);
as.setItemCaption(i, sp);
i++;
}
as.setItemCaptionMode(ItemCaptionMode.EXPLICIT_DEFAULTS_ID);
}
示例4: applyI18N
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
public void applyI18N(Component component, Locale locale) {
super.applyI18N(component, locale);
AbstractSelect select = ((AbstractSelect)component);
for (Entry<Object, String> entry : i18NItemCaptions.entrySet()) {
if (StringHelper.isNotEmptyWithTrim(entry.getValue())) {
String value = provider.getTitle(locale, entry.getValue());
select.setItemCaption(entry.getKey(), value);
}
}
}
示例5: createResourceCombo
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
protected AbstractSelect createResourceCombo(XMLSetting definition,
AbstractObjectWithSettings obj, ResourceCategory category) {
IConfigurationService configurationService = context.getConfigurationService();
FlowStep step = getSingleFlowStep();
String projectVersionId = step.getComponent().getProjectVersionId();
final AbstractSelect combo = new ComboBox(definition.getName());
combo.setImmediate(true);
combo.setDescription(definition.getDescription());
combo.setNullSelectionAllowed(false);
combo.setRequired(definition.isRequired());
Set<XMLResourceDefinition> types = context.getDefinitionFactory()
.getResourceDefinitions(projectVersionId, category);
if (types != null) {
String[] typeStrings = new String[types.size()];
int i = 0;
for (XMLResourceDefinition type : types) {
typeStrings[i++] = type.getId();
}
List<Resource> resources =
configurationService.findResourcesByTypes(projectVersionId, true, typeStrings);
if (resources != null) {
for (Resource resource : resources) {
combo.addItem(resource.getId());
combo.setItemCaption(resource.getId(), resource.getName());
}
combo.setValue(obj.get(definition.getId()));
}
}
combo.addValueChangeListener(
event -> saveSetting(definition.getId(), (String) combo.getValue(), obj));
combo.setReadOnly(readOnly);
return combo;
}
示例6: fillSelectByEnum
import com.vaadin.ui.AbstractSelect; //导入方法依赖的package包/类
/**
* Заполняем поле выбора элементами перечисления
*
* @param component поле выбора
* @param cls тип перечисления
*/
public static <TEnum extends Enum<TEnum>> void fillSelectByEnum(final AbstractSelect component,
final Class<TEnum> cls) {
final Converter<String, TEnum> converter = VaadinSession.getCurrent().getConverterFactory()
.createConverter(String.class, cls);
for (final TEnum en : EnumSet.allOf(cls)) {
component.addItem(en);
component.setItemCaption(en, converter.convertToPresentation(en, null, null));
}
}