本文整理汇总了Java中com.vaadin.ui.ComboBox.setNullSelectionAllowed方法的典型用法代码示例。如果您正苦于以下问题:Java ComboBox.setNullSelectionAllowed方法的具体用法?Java ComboBox.setNullSelectionAllowed怎么用?Java ComboBox.setNullSelectionAllowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vaadin.ui.ComboBox
的用法示例。
在下文中一共展示了ComboBox.setNullSelectionAllowed方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPolicyComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getPolicyComboBox(List<PolicyDto> policyDtoList) {
ComboBox policy = new ComboBox("Select Policy");
policy.setTextInputAllowed(false);
policy.setNullSelectionAllowed(false);
policy.setImmediate(true);
policy.setRequired(true);
policy.setRequiredError("Policy cannot be empty");
BeanItemContainer<PolicyDto> policyListContainer = new BeanItemContainer<>(PolicyDto.class,
policyDtoList);
policy.setContainerDataSource(policyListContainer);
policy.setItemCaptionPropertyId("policyName");
if (policyListContainer.size() > 0) {
policy.select(policyListContainer.getIdByIndex(0));
}
policy.setEnabled(false);
return policy;
}
示例2: createDomainComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createDomainComboBox(List<DomainDto> dl) {
ComboBox domainComboBox = new ComboBox();
BeanItemContainer<DomainDto> domainContainer = new BeanItemContainer<DomainDto>(DomainDto.class, dl);
ApplianceManagerConnectorDto mc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();
domainComboBox.setContainerDataSource(domainContainer);
domainComboBox.setTextInputAllowed(false);
domainComboBox.setNullSelectionAllowed(false);
domainComboBox.setItemCaptionPropertyId("name");
domainComboBox.setEnabled(mc.isPolicyMappingSupported());
if (domainComboBox.getItemIds().size() > 0) {
domainComboBox.select(domainContainer.getIdByIndex(0));
}
return domainComboBox;
}
示例3: createEncapsulationTypeComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createEncapsulationTypeComboBox(VirtualizationType virtualizationType,
List<TagEncapsulationType> types) {
ComboBox encapsulationType = new ComboBox();
encapsulationType.setTextInputAllowed(false);
encapsulationType.setNullSelectionAllowed(true);
BeanItemContainer<TagEncapsulationType> encapsulationTypeContainer = new BeanItemContainer<TagEncapsulationType>(
TagEncapsulationType.class, types);
encapsulationType.setContainerDataSource(encapsulationTypeContainer);
ApplianceManagerConnectorDto currentMc = (ApplianceManagerConnectorDto) this.managerConnector.getValue();
if (!virtualizationType.isOpenstack() || (currentMc != null && !currentMc.isPolicyMappingSupported())) {
encapsulationType.setEnabled(false);
}
return encapsulationType;
}
示例4: WebSearchPickerField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public WebSearchPickerField() {
final ComboBox selectComponent = component;
WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
@Override
public void setRequired(boolean required) {
super.setRequired(required);
selectComponent.setNullSelectionAllowed(!required);
}
};
pickerField = new WebPickerField(picker);
Messages messages = AppBeans.get(Messages.class);
setInputPrompt(messages.getMainMessage("searchPickerField.inputPrompt"));
// Required for custom components in fieldgroup
initValueSync(selectComponent, picker);
}
示例5: getLogLevelComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
protected ComboBox getLogLevelComponent() {
final ComboBox combo = new ComboBox("Log Level");
combo.setNullSelectionAllowed(false);
combo.setWidth(200, Unit.PIXELS);
LogLevel[] levels = LogLevel.values();
for (LogLevel logLevel : levels) {
combo.addItem(logLevel.name());
}
combo.setValue(agentDeployment.getLogLevel());
combo.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
agentDeployment.setLogLevel((String) combo.getValue());
saveAgentDeployment(agentDeployment);
}
});
return combo;
}
示例6: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void attach() {
setHeight(TAB_HEIGHT);
setMargin(false, true, false, true);
setSpacing(false);
// サーバサイズ
sizeSelect = new ComboBox(ViewProperties.getCaption("field.serverSize"));
sizeSelect.setNullSelectionAllowed(false);
form.getLayout().addComponent(sizeSelect);
// キーペア
keySelect = new ComboBox(ViewProperties.getCaption("field.keyPair"));
keySelect.setNullSelectionAllowed(false);
form.getLayout().addComponent(keySelect);
addComponent(form);
}
示例7: attach
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
public void attach() {
// サーバ名(Prefix)
prefixField = new TextField(ViewProperties.getCaption("field.serverNamePrefix"));
getLayout().addComponent(prefixField);
// プラットフォーム
cloudTable = new SelectCloudTable();
getLayout().addComponent(cloudTable);
// サーバ台数
serverNumber = new ComboBox(ViewProperties.getCaption("field.serverNumber"));
serverNumber.setWidth("110px");
serverNumber.setMultiSelect(false);
for (int i = 1; i <= MAX_ADD_SERVER; i++) {
serverNumber.addItem(i);
}
serverNumber.setNullSelectionAllowed(false);
serverNumber.setValue(1); // 初期値は1
getLayout().addComponent(serverNumber);
initValidation();
}
示例8: initComponents
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
/**
* Setup UI.
*/
private void initComponents() {
List<User> users = UserList.INSTANCE.getUsers();
userSwitchBox = new ComboBox(Messages.getString("UserSwitchPanel.boxCaption")); //$NON-NLS-1$
setUsers(users);
User current = (User) VaadinSession.getCurrent().getAttribute(SessionStorageKey.USER.name());
userSwitchBox.setValue(current);
userSwitchBox.setDescription(
Messages.getString("UserSwitchPanel.boxDescription")); //$NON-NLS-1$
userSwitchBox.setNewItemsAllowed(false);
userSwitchBox.setNullSelectionAllowed(false);
addComponent(userSwitchBox);
btReload = new Button(Messages.getString("UserSwitchPanel.reloadCaption")); //$NON-NLS-1$
btReload.setStyleName(BaseTheme.BUTTON_LINK);
btReload.addStyleName("plain-link"); //$NON-NLS-1$
addComponent(btReload);
}
示例9: DateSelectionField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public DateSelectionField() {
cboMonth = new ComboBox();
cboMonth.setNullSelectionAllowed(true);
cboMonth.setPageLength(12);
cboMonth.setImmediate(true);
addMonthItems();
cboMonth.setWidth("117px");
cboDate = new ComboBox();
cboDate.setNullSelectionAllowed(true);
cboDate.setImmediate(true);
addDayItems();
cboDate.setWidth("80px");
cboYear = new ComboBox();
cboYear.setNullSelectionAllowed(true);
cboYear.setImmediate(true);
addYearItems();
cboYear.setWidth("80px");
}
示例10: createLanguageSelector
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox createLanguageSelector() {
ComboBox languageSelector = new ComboBox("com.vaadin.demo.dashboard.DashboardUI.Language");
languageSelector.setImmediate(true);
languageSelector.setNullSelectionAllowed(false);
addLocale(Locale.ENGLISH, languageSelector);
addLocale(Locale.FRENCH, languageSelector);
addLocale(new Locale("es"), languageSelector);
// languageSelector.setValue(I18NStaticService.getI18NServive().getLocale());
/*-languageSelector.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
@Override
public void valueChange(ValueChangeEvent event) {
Locale locale = (Locale) (event.getProperty().getValue());
I18NStaticService.getI18NServive().setLocale(locale);
getUI().requestRepaintAll();
}
});*/
return languageSelector;
}
示例11: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private void buildSelection() {
exportSelectionType = new ComboBox();
exportSelectionType.setTextInputAllowed(false);
exportSelectionType.setNullSelectionAllowed(false);
exportSelectionType.setEnabled(false);
exportSelectionType.addItem(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addItem(Messages.getString("Caption.Item.All"));
exportSelectionType.select(Messages.getString("Caption.Item.Selected"));
exportSelectionType.addValueChangeListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
allTestsSelected = exportSelectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.PackSelectionChangedEvent());
}
});
}
示例12: buildSelection
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected ComboBox buildSelection() {
final ComboBox selectionType = new ComboBox();
selectionType.setTextInputAllowed(false);
selectionType.setNullSelectionAllowed(false);
selectionType.addItem(Messages.getString("Caption.Item.Selected"));
selectionType.addItem(Messages.getString("Caption.Item.All"));
selectionType.select(Messages.getString("Caption.Item.Selected"));
selectionType.addValueChangeListener(e -> {
allSelected = selectionType.getValue().equals(Messages.getString("Caption.Item.All"));
mainEvent.fire(new MainUIEvent.UserSelectionChangedEvent());
});
return selectionType;
}
示例13: bindEnumField
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
public ComboBox bindEnumField(ComboBox comboBox, AbstractLayout form, ValidatingFieldGroup<E> group,
String fieldLabel, String fieldName, Class<?> clazz)
{
ComboBox field = comboBox;
field.setCaption(fieldLabel);
field.setContainerDataSource(createContainerFromEnumClass(fieldName, clazz));
field.setItemCaptionPropertyId(fieldName);
// field.setCaption(fieldLabel);
field.setNewItemsAllowed(false);
field.setNullSelectionAllowed(false);
field.setTextInputAllowed(true);
field.setWidth(STANDARD_COMBO_WIDTH);
field.setPopupWidth("100%");
field.setImmediate(true);
field.setId(fieldLabel.replace(" ", ""));
addValueChangeListeners(field);
doBinding(group, fieldName, field);
form.addComponent(field);
return field;
}
示例14: getFailurePolicyComboBox
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
private ComboBox getFailurePolicyComboBox() {
ComboBox failurePolicy = new ComboBox("Select Failure Policy");
failurePolicy.setTextInputAllowed(false);
failurePolicy.setNullSelectionAllowed(false);
failurePolicy.setImmediate(true);
failurePolicy.setRequired(true);
failurePolicy.setRequiredError("Failure Policy cannot be empty");
failurePolicy.addItems(FailurePolicyType.FAIL_OPEN, FailurePolicyType.FAIL_CLOSE);
failurePolicy.select(FailurePolicyType.FAIL_OPEN);
failurePolicy.setEnabled(false);
return failurePolicy;
}
示例15: createComponent
import com.vaadin.ui.ComboBox; //导入方法依赖的package包/类
@Override
protected void createComponent() {
super.createComponent();
// delegate error indication
this.componentErrorHandler = message -> {
if (message instanceof UserError) {
return false;
}
pickerField.component.setComponentError(message);
return true;
};
component.setCustomValueEquals(InstanceUtils::propertyValueEquals);
final ComboBox selectComponent = component;
final WebPickerField.Picker picker = new WebPickerField.Picker(this, component) {
@Override
public void setRequired(boolean required) {
super.setRequired(required);
selectComponent.setNullSelectionAllowed(!required);
}
};
pickerField = new WebPickerField(picker);
// Required for custom components in fieldgroup
initValueSync(selectComponent, picker);
}