本文整理汇总了Java中com.vaadin.ui.ComboBox.addStyleName方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.addStyleName方法的具体用法?Java ComboBox.addStyleName怎么用?Java ComboBox.addStyleName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.addStyleName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addComboBoxFilters
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Ajoute un filtre en combobox String sur une colonne
*
* @param property
* @param cb
*/
public void addComboBoxFilters(String property, ComboBox cb, String libNull) {
HeaderCell cell = getFilterCell(property);
cb.addValueChangeListener(e -> {
container.removeContainerFilters(property);
if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
&& !((String) cb.getValue()).equals(libNull)) {
container.addContainerFilter(new SimpleStringFilter(property, (String) cb.getValue(), true, true));
} else if (cb.getValue() != null && !((String) cb.getValue()).isEmpty()
&& ((String) cb.getValue()).equals(libNull)) {
container.addContainerFilter(new IsNull(property));
}
fireFilterListener();
fireFilterListener();
});
cb.setImmediate(true);
cb.setWidth(100, Unit.PERCENTAGE);
cb.addStyleName(ValoTheme.COMBOBOX_TINY);
cell.setComponent(cb);
}
示例2: 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;
}
示例3: getDsComboField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getDsComboField() {
final Container container = createContainer();
final ComboBox dsComboBox = SPUIComponentProvider.getComboBox(i18n.getMessage("bulkupload.ds.name"), "", null,
null, false, "", i18n.getMessage("bulkupload.ds.name"));
dsComboBox.setSizeUndefined();
dsComboBox.addStyleName(SPUIDefinitions.BULK_UPLOD_DS_COMBO_STYLE);
dsComboBox.setImmediate(true);
dsComboBox.setFilteringMode(FilteringMode.STARTSWITH);
dsComboBox.setPageLength(7);
dsComboBox.setContainerDataSource(container);
dsComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME_VERSION);
dsComboBox.setId(UIComponentIdProvider.BULK_UPLOAD_DS_COMBO);
dsComboBox.setWidth("100%");
return dsComboBox;
}
示例4: buildQuoteSelector
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private Component buildQuoteSelector() {
quoteSelector = new ComboBox();
// quoteSelector.setInputPrompt("Select Stock/Index...");
// quoteSelector.setItemCaptionPropertyId(Quote.PROPERTY_NAME);
// quoteSelector.setItemCaptionMode(ItemCaptionMode.PROPERTY);
// Set full width
// quoteSelector.setWidth(100.0f, Unit.PERCENTAGE);
quoteSelector.addStyleName("borderless");
// Set the appropriate filtering mode for this example
quoteSelector.setFilteringMode(FilteringMode.CONTAINS);
quoteSelector.setImmediate(true);
// Disallow null selections
quoteSelector.setNullSelectionAllowed(false);
quoteSelector.addValueChangeListener(e -> {
chart.setChartSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getChartSrc());
ticker.setSymbol(quotes.getItem(e.getProperty().getValue()).getBean().getTickerSrc());
chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.LINE.ordinal()*2).setChecked(false);
chartToolbar.getCharts().getChildren().get(LiveChart.ChartDrawType.CANDLE.ordinal()*2).setChecked(true);
});
return quoteSelector;
}
示例5: addBooleanFilter
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Ajoute un filtre de Boolean sur une liste de colonnes
*
* @param filterRow
* @param container
* @param property
* @param labelTrue
* @param labelFalse
* @param labelNull
*/
private void addBooleanFilter(String property, String labelTrue, String labelFalse, String labelNull) {
HeaderCell cell = getFilterCell(property);
ComboBox cbOuiNon = new ComboBox();
cbOuiNon.setTextInputAllowed(false);
List<BooleanPresentation> liste = new ArrayList<BooleanPresentation>();
BooleanPresentation nullObject = new BooleanPresentation(BooleanValue.ALL,
applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()), null);
liste.add(nullObject);
if (labelTrue != null) {
liste.add(new BooleanPresentation(BooleanValue.TRUE, labelTrue, FontAwesome.CHECK_SQUARE_O));
}
if (labelFalse != null) {
liste.add(new BooleanPresentation(BooleanValue.FALSE, labelFalse, FontAwesome.SQUARE_O));
}
if (labelNull != null) {
liste.add(new BooleanPresentation(BooleanValue.NULL, labelNull, FontAwesome.HOURGLASS_HALF));
}
BeanItemContainer<BooleanPresentation> containerOuiNon = new BeanItemContainer<BooleanPresentation>(
BooleanPresentation.class, liste);
cbOuiNon.setNullSelectionItemId(nullObject);
cbOuiNon.setImmediate(true);
cbOuiNon.setContainerDataSource(containerOuiNon);
cbOuiNon.setItemCaptionPropertyId("libelle");
cbOuiNon.setItemCaptionMode(ItemCaptionMode.PROPERTY);
cbOuiNon.setItemIconPropertyId("icone");
cbOuiNon.setWidth(100, Unit.PERCENTAGE);
cbOuiNon.addStyleName(ValoTheme.COMBOBOX_TINY);
cbOuiNon.addValueChangeListener(change -> {
container.removeContainerFilters(property);
if (cbOuiNon.getValue() != null) {
BooleanPresentation value = (BooleanPresentation) cbOuiNon.getValue();
if (value != null) {
BooleanValue booleanValue = value.getValeur();
switch (booleanValue) {
case TRUE:
container.addContainerFilter(new Equal(property, true));
break;
case FALSE:
container.addContainerFilter(new Equal(property, false));
break;
case NULL:
container.addContainerFilter(new Equal(property, null));
break;
default:
break;
}
}
fireFilterListener();
}
});
cell.setComponent(cbOuiNon);
}
示例6: 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;
}