本文整理汇总了Java中com.vaadin.ui.ComboBox类的典型用法代码示例。如果您正苦于以下问题:Java ComboBox类的具体用法?Java ComboBox怎么用?Java ComboBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComboBox类属于com.vaadin.ui包,在下文中一共展示了ComboBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildCombBox
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
/**
* @return a new ComboBox
*/
public ComboBox buildCombBox() {
final ComboBox targetFilter = SPUIComponentProvider.getComboBox(null, "", null, ValoTheme.COMBOBOX_SMALL, false,
"", prompt);
targetFilter.setImmediate(true);
targetFilter.setPageLength(7);
targetFilter.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME);
targetFilter.setSizeUndefined();
if (id != null) {
targetFilter.setId(id);
}
if (valueChangeListener != null) {
targetFilter.addValueChangeListener(valueChangeListener);
}
return targetFilter;
}
示例2: createEditFields
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
@Override
protected ComponentContainer createEditFields() {
final ExtaFormLayout form = new ExtaFormLayout();
appTitleField = new EditField("Заголовок приложения");
form.addComponent(appTitleField);
iconPathField = new ComboBox("Иконка приложения");
for (final String icon : lookup(UserSettingsService.class).getFaviconPathList()) {
iconPathField.addItem(icon);
iconPathField.setItemIcon(icon, new ThemeResource(getLast(Splitter.on('/').split(icon))));
}
iconPathField.setItemCaptionMode(AbstractSelect.ItemCaptionMode.ICON_ONLY);
iconPathField.setWidth(85, Unit.PIXELS);
iconPathField.setTextInputAllowed(false);
iconPathField.setNullSelectionAllowed(false);
form.addComponent(iconPathField);
isShowSalePointIdsField = new MCheckBox("Показывать раздел \"Идентификация\" в карточке торговой точки");
form.addComponent(isShowSalePointIdsField);
isDevServerField = new MCheckBox("Режим отладки");
form.addComponent(isDevServerField);
return form;
}
示例3: getComboBoxFilterComponent
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
/**
* @param propertyId
* @param libNull
* @return les filtres perso en ComboBox
*/
public ComboBox getComboBoxFilterComponent(final Object propertyId, final String libNull) {
List<String> list = new ArrayList<>();
if (propertyId.equals(Candidature_.typeTraitement.getName() + "." + TypeTraitement_.libTypTrait.getName())) {
cacheController.getListeTypeTraitement().forEach(e -> list.add(e.getLibTypTrait()));
return generateComboBox(list, libNull);
} else if (propertyId.equals(Candidature_.typeStatut.getName() + "." + TypeStatut_.libTypStatut.getName())) {
cacheController.getListeTypeStatut().forEach(e -> list.add(e.getLibTypStatut()));
return generateComboBox(list, libNull);
} else if (propertyId.equals(LAST_TYPE_DECISION_PREFIXE + TypeDecisionCandidature_.typeDecision.getName() + "."
+ TypeDecision_.libTypDec.getName())) {
typeDecisionController.getTypeDecisionsEnService().forEach(e -> list.add(e.getLibTypDec()));
return generateComboBox(list, libNull);
}
return null;
}
示例4: generateComboBox
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
/**
* @param liste
* @param libNull
* @return une combo grace a la liste
*/
private ComboBox generateComboBox(final List<String> liste, final String libNull) {
ComboBox sampleIdCB = new ComboBox();
sampleIdCB.setPageLength(20);
sampleIdCB.setTextInputAllowed(false);
BeanItemContainer<String> dataList = new BeanItemContainer<>(String.class);
dataList.addBean(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
if (libNull != null) {
dataList.addBean(libNull);
}
dataList.addAll(liste);
sampleIdCB
.setNullSelectionItemId(applicationContext.getMessage("filter.all", null, UI.getCurrent().getLocale()));
sampleIdCB.setContainerDataSource(dataList);
sampleIdCB.setImmediate(true);
return sampleIdCB;
}
示例5: 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);
}
示例6: initForm
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
@Override
public void initForm() {
this.form.addComponent(getName());
this.form.addComponent(getProjects());
this.form.addComponent(getRegion());
this.form.addComponent(getUserOptions());
this.form.addComponent(getOptionTable());
List<ComboBox> networks = getNetworkComboBoxes();
for (ComboBox combobox : networks) {
this.form.addComponent(combobox);
}
this.form.addComponent(getIPPool());
this.form.addComponent(getCount());
this.form.addComponent(getSharedCheckBox());
this.name.focus();
getCount().setEnabled(false);
}
示例7: getProjects
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
protected Component getProjects() {
try {
this.project = new ComboBox("Select Project");
this.project.setTextInputAllowed(true);
this.project.setNullSelectionAllowed(false);
this.project.setImmediate(true);
this.project.setRequired(true);
this.project.setRequiredError("Project cannot be empty");
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error populating Project List combobox", e);
}
return this.project;
}
示例8: getNetworkComboBoxes
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
protected List<ComboBox> getNetworkComboBoxes() {
List<ComboBox> networkComboBox = new ArrayList<>();
this.managementNetwork = new ComboBox("Select Management Network");
this.managementNetwork.setTextInputAllowed(false);
this.managementNetwork.setNullSelectionAllowed(false);
this.managementNetwork.setImmediate(true);
this.managementNetwork.setRequired(true);
this.managementNetwork.setRequiredError("Management Network cannot be empty");
networkComboBox.add(this.managementNetwork);
this.inspectionNetwork = new ComboBox("Select Inspection Network");
this.inspectionNetwork.setTextInputAllowed(false);
this.inspectionNetwork.setNullSelectionAllowed(false);
this.inspectionNetwork.setImmediate(true);
this.inspectionNetwork.setRequired(true);
this.inspectionNetwork.setRequiredError("Inspection Network cannot be empty");
networkComboBox.add(this.inspectionNetwork);
return networkComboBox;
}
示例9: populateNetworks
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
private void populateNetworks(ComboBox networkComboBox, List<OsNetworkDto> networkList) {
try {
networkComboBox.removeAllItems();
if (networkList != null) {
// Calling List Network Service
BeanItemContainer<OsNetworkDto> networkListContainer = new BeanItemContainer<>(OsNetworkDto.class,
networkList);
networkComboBox.setContainerDataSource(networkListContainer);
networkComboBox.setItemCaptionPropertyId("name");
if (networkList.size() > 0) {
networkComboBox.select(networkListContainer.getIdByIndex(0));
}
}
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error getting Network List", e);
}
}
示例10: getPolicy
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
protected Component getPolicy() {
try {
this.policy = new ComboBox("Select Policy");
this.policy.setTextInputAllowed(false);
this.policy.setNullSelectionAllowed(false);
this.policy.setImmediate(true);
this.policy.setRequired(true);
this.policy.setRequiredError("Policy cannot be empty");
populatePolicy();
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error populating Policy List combobox", e);
}
return this.policy;
}
示例11: 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;
}
示例12: serviceTableClicked
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
@SuppressWarnings({ "rawtypes" })
private void serviceTableClicked(long itemId) {
ComboBox policyComboBox = (ComboBox) this.serviceTable.getContainerProperty(itemId, PROPERTY_ID_POLICY)
.getValue();
ComboBox failurePolicyComboBox = (ComboBox) this.serviceTable
.getContainerProperty(itemId, PROPERTY_ID_FAILURE_POLICY).getValue();
Property itemProperty = this.serviceTable.getContainerProperty(itemId, PROPERTY_ID_ENABLED);
boolean currentValue = (boolean) itemProperty.getValue();
if (policyComboBox.getContainerDataSource().size() > 0) {
if (isBindedWithMultiplePolicies(itemId)) {
policyComboBox.setEnabled(false);
} else {
policyComboBox.setEnabled(currentValue);
}
}
if (failurePolicyComboBox.getData() != null) {
failurePolicyComboBox.setEnabled(currentValue);
}
}
示例13: getProject
import com.vaadin.ui.ComboBox; //导入依赖的package包/类
protected ComboBox getProject() {
try {
this.project = new ComboBox("Select Project");
this.project.setTextInputAllowed(true);
this.project.setNullSelectionAllowed(false);
this.project.setImmediate(true);
this.project.setRequired(true);
this.project.setRequiredError("Project cannot be empty");
} catch (Exception e) {
ViewUtil.iscNotification(e.getMessage(), Notification.Type.ERROR_MESSAGE);
log.error("Error populating Project List combobox", e);
}
return this.project;
}
示例14: 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;
}
示例15: 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;
}