當前位置: 首頁>>代碼示例>>Java>>正文


Java ComboBox.setContainerDataSource方法代碼示例

本文整理匯總了Java中com.vaadin.ui.ComboBox.setContainerDataSource方法的典型用法代碼示例。如果您正苦於以下問題:Java ComboBox.setContainerDataSource方法的具體用法?Java ComboBox.setContainerDataSource怎麽用?Java ComboBox.setContainerDataSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vaadin.ui.ComboBox的用法示例。


在下文中一共展示了ComboBox.setContainerDataSource方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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;
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:22,代碼來源:CandidatureViewTemplate.java

示例2: 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);
    }
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:20,代碼來源:BaseDeploymentSpecWindow.java

示例3: 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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:22,代碼來源:BindSecurityGroupWindow.java

示例4: 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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:BaseDAWindow.java

示例5: 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;
}
 
開發者ID:opensecuritycontroller,項目名稱:osc-core,代碼行數:17,代碼來源:BaseDAWindow.java

示例6: 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;
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:23,代碼來源:FormHelper.java

示例7: setup

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
private void setup() {
  // Devices
  ComboBox devicesComboBox = new ComboBox("Actors");
  devicesComboBox.setNullSelectionItemId(false);
  devicesComboBox.setContainerDataSource(
      new BeanItemContainer<>(
          DeviceViewDTO.class,
          deviceSetupService.getAllActors().stream()
              .map(deviceDTO -> modelMapper.map(deviceDTO, DeviceViewDTO.class))
              .collect(Collectors.toList())
      )
  );

  DeviceDTO selectedDeviceDTO = deviceSetupService
      .getDeviceDtoByIdAndType(actionDTO.getDevId(), actionDTO.getDevType());
  if (selectedDeviceDTO != null) {
    devicesComboBox.select(modelMapper.map(selectedDeviceDTO, DeviceViewDTO.class));
  }

  devicesComboBox.addValueChangeListener(event -> {
    DeviceViewDTO selected = (DeviceViewDTO) event.getProperty().getValue();

    actionDTO.setDevId(selected.getDevId());
    actionDTO.setDevType(selected.getType());

    changeListener.accept(actionDTO);
  });
  mainLayout.addComponent(devicesComboBox);

  // Target
  TextField targetTextField = new TextField("Target", actionDTO.getParameter());
  targetTextField.addValueChangeListener(event -> {
    actionDTO.setParameter((String) event.getProperty().getValue());

    changeListener.accept(actionDTO);
  });
  mainLayout.addComponent(targetTextField);

}
 
開發者ID:daergoth,項目名稱:HomeWire-Server,代碼行數:40,代碼來源:SetActionWidget.java

示例8: 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;
}
 
開發者ID:eclipse,項目名稱:hawkbit,代碼行數:16,代碼來源:TargetBulkUpdateWindowLayout.java

示例9: getComboBox

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
/**
 * @param caption
 * @param bindName
 * @param container
 *            TODO
 * @return
 */
private ComboBox getComboBox(String caption, String bindName,
		Container container) {
	ComboBox comboBox = new ComboBox(caption);
	comboBox.setImmediate(true);
	comboBox.setValidationVisible(false);
	comboBox.setNewItemsAllowed(false);
	comboBox.setFilteringMode(FilteringMode.CONTAINS);
	comboBox.setNullSelectionAllowed(false);
	fieldGroup.bind(comboBox, bindName);
	comboBox.setContainerDataSource(container);
	return comboBox;
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:20,代碼來源:BasicFormImpl.java

示例10: setCategoryFilter

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
/**
 * @param filterRow
 * @return
 */
private HeaderCell setCategoryFilter(HeaderRow filterRow) {
	HeaderCell categoryFilter = filterRow.getCell(CATEGORY);
	ComboBox comboBox = new ComboBox();
	comboBox.setHeight(100, Unit.PERCENTAGE);
	comboBox.setImmediate(true);
	comboBox.setNewItemsAllowed(false);
	comboBox.setTextInputAllowed(false);
	comboBox.addValueChangeListener(getCategoryFilterListener());
	comboBox.setContainerDataSource(getCategoryDataSource());
	categoryFilter.setComponent(comboBox);
	return categoryFilter;
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:17,代碼來源:FilterGrid.java

示例11: getComboBox

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
/**
 * @return
 */
private Field<?> getComboBox(String requiredErrorMsg, Collection<?> items) {
	ComboBox comboBox = new ComboBox();
	comboBox.setNullSelectionAllowed(true);
	IndexedContainer container = new IndexedContainer(items);
	comboBox.setContainerDataSource(container);
	comboBox.setRequired(true);
	comboBox.setRequiredError(requiredErrorMsg);
	return comboBox;
}
 
開發者ID:KrishnaPhani,項目名稱:KrishnasSpace,代碼行數:13,代碼來源:EditableGrid.java

示例12: ReportParameterReportChooser

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterReportChooser(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:19,代碼來源:ReportParameterReportChooser.java

示例13: ReportParameterEnum

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
/**
 * 
 * @param caption
 * @param defaultValue
 * @param parameterName
 * @param enumClass
 */
public ReportParameterEnum(String caption, T defaultValue, String parameterName, Class<T> enumClass)
{
	super(caption, parameterName);
	field = new ComboBox(caption);
	this.enumClass = enumClass;
	field.setContainerDataSource(FormHelper.createContainerFromEnumClass("value", enumClass));
	field.setNewItemsAllowed(false);
	field.setNullSelectionAllowed(false);
	field.setTextInputAllowed(false);
	field.setValue(defaultValue);
}
 
開發者ID:rlsutton1,項目名稱:VaadinUtils,代碼行數:19,代碼來源:ReportParameterEnum.java

示例14: 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);
}
 
開發者ID:EsupPortail,項目名稱:esup-ecandidat,代碼行數:67,代碼來源:GridFormatting.java

示例15: getExportWindow

import com.vaadin.ui.ComboBox; //導入方法依賴的package包/類
private Window getExportWindow() {
  final String[] fileName = {""};

  Window selectWindow = new Window("Export data");
  selectWindow.setClosable(true);
  selectWindow.setDraggable(false);
  selectWindow.setModal(true);
  selectWindow.setResizable(false);
  selectWindow.setWidth(300, Unit.PIXELS);
  selectWindow.addCloseListener(e -> {
    if (!fileName[0].isEmpty()) {
      new File(fileName[0]).delete();
    }
  });

  VerticalLayout windowRoot = new VerticalLayout();

  ComboBox devicesComboBox = new ComboBox("Devices");
  devicesComboBox.setWidth(100, Unit.PERCENTAGE);
  devicesComboBox.setNullSelectionItemId(false);
  devicesComboBox.setContainerDataSource(
      new BeanItemContainer<>(
          DeviceViewDTO.class,
          deviceSetupService.getAllDeviceDtos().stream()
              .map(deviceDTO ->
                  new DeviceViewDTO(deviceDTO.getDevId(), deviceDTO.getType(),
                      deviceDTO.getName()))
              .collect(Collectors.toList())
      )
  );
  windowRoot.addComponent(devicesComboBox);

  Button toExportButton = new Button("Export", event -> {
    DeviceViewDTO selectedDto = (DeviceViewDTO) devicesComboBox.getValue();
    fileName[0] =
        statisticDeviceDataService.exportDataToCsv(selectedDto.getDevId(), selectedDto.getType(),
            selectedDto.getName());

    if (!fileName[0].isEmpty()) {
      windowRoot
          .addComponent(new Link("Download CSV", new FileResource(new File(fileName[0]))));
    } else {
      windowRoot.addComponent(new Label("Export failed! Please Try again!"));
    }

  });
  windowRoot.addComponent(toExportButton);

  selectWindow.setContent(windowRoot);

  return selectWindow;
}
 
開發者ID:daergoth,項目名稱:HomeWire-Server,代碼行數:53,代碼來源:StatisticView.java


注:本文中的com.vaadin.ui.ComboBox.setContainerDataSource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。