private void populateTargetFilterQuery() { final Container container = createTargetFilterComboContainer(); targetFilterQueryCombo.setContainerDataSource(container); }
private void populateDistributionSet() { final Container container = createDsComboContainer(); distributionSet.setContainerDataSource(container); }
private void populateDistributionSet() { final Container container = createDsComboContainer(); distributionSet.setContainerDataSource(container); }
private void populateTargetFilterQuery() { final Container container = createTargetFilterComboContainer(); targetFilterQueryCombo.setContainerDataSource(container); }
private void populateTargetFilterQuery() { final Container container = createTargetFilterComboContainer(); targetFilterQueryCombo.setContainerDataSource(container); }
private void populateTargetFilterQuery() { final Container container = createTargetFilterComboContainer(); targetFilterQueryCombo.setContainerDataSource(container); }
private void populateTypeNameCombo() { typeComboBox.setContainerDataSource( HawkbitCommonUtil.createLazyQueryContainer(new BeanQueryFactory<>(SoftwareModuleTypeBeanQuery.class))); typeComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); }
private void populateTypeNameCombo() { typeComboBox.setContainerDataSource( HawkbitCommonUtil.createLazyQueryContainer(new BeanQueryFactory<>(SoftwareModuleTypeBeanQuery.class))); typeComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); }
public class ComboBoxComponent extends VerticalLayout { public ComboBoxComponent() { BeanItemContainer<Person> dataSource = new BeanItemContainer<>(HasCaption.class); ComboBox comboBox = new ComboBox(); comboBox.setItemCaptionMode(AbstractSelect.ItemCaptionMode.PROPERTY); // use a fake property which will get identified by the getter comboBox.setItemCaptionPropertyId("caption"); addComponent(comboBox); comboBox.setContainerDataSource(dataSource); Random random = new Random(); for (int i = 0; i < 10; i++) { dataSource.addBean(new Person("Name " + i, "Surname " + i, random.nextInt(99) + 1)); } } }
/** * Generates the options items for the combo box using the map entry keys as values and the values as labels.<p> * * @param box the combo box to prepare * @param options the box options */ public static void prepareComboBox(ComboBox box, Map<?, String> options) { IndexedContainer container = new IndexedContainer(); container.addContainerProperty(PROPERTY_VALUE, Object.class, null); container.addContainerProperty(PROPERTY_LABEL, String.class, ""); for (Entry<?, String> entry : options.entrySet()) { Item item = container.addItem(entry.getKey()); item.getItemProperty(PROPERTY_VALUE).setValue(entry.getKey()); item.getItemProperty(PROPERTY_LABEL).setValue(entry.getValue()); } box.setContainerDataSource(container); box.setItemCaptionPropertyId(PROPERTY_LABEL); }
/** * Populate DistributionSet Type name combo. */ private void populateDistSetTypeNameCombo() { distsetTypeNameComboBox.setContainerDataSource(getDistSetTypeLazyQueryContainer()); distsetTypeNameComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); distsetTypeNameComboBox.setValue(getDefaultDistributionSetType().getId()); }
/** * Populate DistributionSet Type name combo. */ private void populateDistSetTypeNameCombo() { distsetTypeNameComboBox.setContainerDataSource(getDistSetTypeLazyQueryContainer()); distsetTypeNameComboBox.setItemCaptionPropertyId(SPUILabelDefinitions.VAR_NAME); distsetTypeNameComboBox.setValue(getDefaultDistributionSetType().getId()); }
protected AbstractField createTextField() { ComboBox out = new ComboBox(); out.setItemCaptionPropertyId("title"); out.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY); out.setFilteringMode(Filtering.FILTERINGMODE_CONTAINS); out.setNullSelectionAllowed(false); //TODO container = new IndexedContainer(); // container.addContainerProperty("id", String.class, ""); container.addContainerProperty("title", String.class, ""); out.setContainerDataSource(container); return out; }
BeanItemContainer<Person> container = new BeanItemContainer<Person>(Person.class); container.addAll(myPersonList); ComboBox combobox = new ComboBox(); combobox.setContainerDataSource(container); combobox.setItemCaptionMode(Select.ITEM_CAPTION_MODE_PROPERTY); combobox.setItemCaptionPropertyId("name"); // the person's name field will be shown on the UI // imho if you want to add a static text (String) into a container // which populated with Person objects then you have to make a fake Person object Person staticText = new Person(); staticText.setName("My static text"); combobox.addItem(staticText); // if you want to specify the index of the item, add them one by one in for cycle // and insert the static text item in the appropritate place
private void buildUI() { combo = new ComboBox(null, container); combo.setImmediate(true); combo.setNullSelectionAllowed(false); combo.setWidth(200 + "px"); combo.setId(ID.getId(Optional.empty(), this, combo)); combo.setContainerDataSource(container); // Sets the combobox to show a certain property as the item caption combo.setItemCaptionPropertyId(LocaleContainer.PropertyName.NAME); combo.setItemCaptionMode(ItemCaptionMode.PROPERTY); // Sets the icon to use with the items combo.setItemIconPropertyId(LocaleContainer.PropertyName.FLAG); combo.setValue(currentLocale.getLocale() .toLanguageTag()); combo.addValueChangeListener(this); }
private void selectType(Class<?> type, boolean force) { // Anything to do? if (type == null) return; if (!this.setNewType(!type.equals(Object.class) ? type : null, force)) return; // Get previous sort key final SortKeyContainer.SortKey previousSort = (SortKeyContainer.SortKey)this.sortComboBox.getValue(); // Rebuild the sort combobox final JClass<?> jclass = this.getJClass(); this.sortKeyContainer = jclass != null ? new SortKeyContainer(this.jdb, jclass) : new SortKeyContainer(this.jdb, this.objectContainer.getType()); this.sortComboBox.setContainerDataSource(this.sortKeyContainer); // Try to restore previous sort, otherwise default to sorting by object ID SortKeyContainer.SortKey newSort = this.sortKeyContainer.getJavaObject(previousSort); if (newSort == null) newSort = this.sortKeyContainer.new ObjectIdSortKey(); this.sortComboBox.setValue(newSort); this.selectSort(); this.showObjects(); }
private void selectType(Class<?> type, boolean force) { // Anything to do? if (type == null) return; if (!this.setNewType(!type.equals(Object.class) ? type : null, force)) return; // Get previous sort key final SortKeyContainer.SortKey previousSort = (SortKeyContainer.SortKey)this.sortComboBox.getValue(); // Rebuild the sort combobox final JClass<?> jclass = this.getJClass(); this.sortKeyContainer = jclass != null ? new SortKeyContainer(this.jdb, jclass) : new SortKeyContainer(this.jdb, this.objectContainer.getType()); this.sortComboBox.setContainerDataSource(this.sortKeyContainer); // Try to restore previous sort, otherwise default to sorting by object ID SortKeyContainer.SortKey newSort = this.sortKeyContainer.getJavaObject(previousSort); if (newSort == null) newSort = this.sortKeyContainer.new ObjectIdSortKey(); this.sortComboBox.setValue(newSort); this.selectSort(); this.showObjects(); }
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; }
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; }
protected CustomComboBoxField() { comboBox = new ComboBox(); comboBox.setContainerDataSource(getValues()); comboBox.setWidth("100%"); comboBox.setTextInputAllowed(false); comboBox.setNewItemsAllowed(false); comboBox.setNullSelectionAllowed(true); comboBox.setImmediate(true); comboBox.setWriteThrough(true); HorizontalLayout compositionRoot = new HorizontalLayout(); setCompositionRoot(compositionRoot); compositionRoot.addComponent(comboBox); compositionRoot.setExpandRatio(comboBox, 1.0f); compositionRoot.setSpacing(true); compositionRoot.setWidth("100%"); }