The XdevComboBox is a combination of an input field, a button, and a drop-down list, from which the user can select a value. The drop-down list predominantly contains the values contained in a given column in the database table.
...
- Data container (model)
XdevBeanItemContainer - Standard data container. The allocation is set using the setContainerDataSource method.
Code Block language java theme Confluence // Generates a new XdevBeanItemContainer 'productList' XdevBeanItemContainer<Product> productList = new XdevBeanItemContainer<Product>(Product.class); // Sets the XdevBeanItemContainer comboBox.setContainerDataSource(productList);
- XdevLazyEntityContainer - RapidClipse exclusively uses this when the property Entity > Auto query data is selected.
Examples:
Add entries : - Manually add entries to the XdevComboBox.
Code Block language java theme Confluence comboBox.addItem("Eintrag 1"); comboBox.addItem("Eintrag 2");
Direct allocation of multiple entries.
Code Block language java theme Confluence listSelect.addItems("Eintrag 1", "Eintrag 2", "Eintrag 3", "Eintrag 4");
Selected object - Returns the selected object (entity) - Example: category entity.
Code Block language java theme Confluence Category Category = comboBox.getSelectedItem();
or
Code Block language java theme Confluence Category Category = (Category)comboBox.getValue();
Remove elements : Removes - Removes all the elements from the XdevComboBox.
Code Block language java theme Confluence comboBox.removeAllItems();
Select element - Automatic selection of an entry - Example: first entry.
Code Block language java theme Eclipse Collection<?> itemIds = comboBox.getItemIds(); comboBox.setValue(((List<Category>)itemIds).get(0));
...