本文整理汇总了Java中com.vaadin.ui.ComboBox.setInputPrompt方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setInputPrompt方法的具体用法?Java ComboBox.setInputPrompt怎么用?Java ComboBox.setInputPrompt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.setInputPrompt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: decorate
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Decorate.
*
* @param caption
* caption of the combobox
* @param height
* as H
* @param width
* as W
* @param style
* as style
* @param styleName
* as style name
* @param required
* as T|F
* @param data
* as data
* @param prompt
* as promt
* @return ComboBox as comp
*/
public static ComboBox decorate(final String caption, final String width, final String style,
final String styleName, final boolean required, final String data, final String prompt) {
final ComboBox spUICombo = new ComboBox();
// Default settings
spUICombo.setRequired(required);
spUICombo.addStyleName(ValoTheme.COMBOBOX_TINY);
if (!StringUtils.isEmpty(caption)) {
spUICombo.setCaption(caption);
}
// Add style
if (!StringUtils.isEmpty(style)) {
spUICombo.setStyleName(style);
}
// Add style Name
if (!StringUtils.isEmpty(styleName)) {
spUICombo.addStyleName(styleName);
}
// AddWidth
if (!StringUtils.isEmpty(width)) {
spUICombo.setWidth(width);
}
// Set prompt
if (!StringUtils.isEmpty(prompt)) {
spUICombo.setInputPrompt(prompt);
}
// Set Data
if (!StringUtils.isEmpty(data)) {
spUICombo.setData(data);
}
return spUICombo;
}
示例2: initContent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected Component initContent() {
// A vertical layout with undefined width
final VerticalLayout box = new VerticalLayout();
box.setSizeUndefined();
final ComboBox productSelect = new ComboBox();
productSelect.setInputPrompt("Выберите продукт...");
productSelect.setImmediate(true);
productSelect.setNullSelectionAllowed(false);
// Инициализация контейнера
final ExtaDbContainer<TProduct> clientsCont = new ExtaDbContainer<>(productCls);
clientsCont.addContainerFilter(new Compare.Equal("active", true));
clientsCont.sort(new Object[]{"name"}, new boolean[]{true});
// Устанавливаем контент выбора
productSelect.setFilteringMode(FilteringMode.CONTAINS);
productSelect.setContainerDataSource(clientsCont);
productSelect.setItemCaptionMode(ItemCaptionMode.PROPERTY);
productSelect.setItemCaptionPropertyId("name");
productSelect.addStyleName(ExtaTheme.COMBOBOX_BORDERLESS);
productSelect.setPropertyDataSource(getPropertyDataSource());
productSelect.addValueChangeListener(e -> setValue((TProduct) productSelect.getConvertedValue()));
// productSelect.setValue(getValue());
clientsCont.setSingleSelectConverter(productSelect);
productSelect.setWidth(100, Unit.PERCENTAGE);
box.addComponent(productSelect);
// The layout shrinks to fit this label
final Label label = new Label(getFieldTextLabel());
label.addStyleName("ea-widthfittin-label");
label.setWidthUndefined();
label.setHeight("0px"); // Hide: Could be 0px
box.addComponent(label);
addValueChangeListener(e -> label.setValue(getFieldTextLabel()));
return box;
}
示例3: getContent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public Component getContent()
{
try
{
if (this.reset)
{
this.reset = false;
this.layout = new GridLayout(3, 1);
this.layout.setMargin(true);
this.layout.setSpacing(true);
// layout.setSizeFull();
final String[] headers = getHeaders();
final Class<? extends Importable> importable = this.importView.getType().getEntityClass();
final EntityAdaptor<?> adaptor = EntityAdaptor.create(importable);
final ArrayList<FormFieldImpl> fields = adaptor.getFields();
for (final String header : headers)
{
final Label headerLabel = new Label(header);
this.layout.addComponent(headerLabel);
headerLabel.setWidth("" + 160);
final Label mapToLabel = new Label("--Maps to-->");
this.layout.addComponent(mapToLabel);
mapToLabel.setWidth("" + 100);
final ComboBox box = new ComboBox(null, fields);
box.setNullSelectionAllowed(true);
box.setInputPrompt("--Please Select--");
box.setNullSelectionItemId("--Please Select--");
box.setTextInputAllowed(false);
// ComboBox box = layout.addComponent("", fields);
this.layout.addComponent(box);
this.mappings.add(box);
this.layout.newLine();
}
}
}
catch (final IOException e)
{
Notification.show("An error occured trying to read the CSV file: " + e.getMessage(), Type.ERROR_MESSAGE);
}
return this.layout;
}