XdevOptionGroup
The XdevOptionGroup is a selection component that consists of a radio button group. Only one value can be selected. When the MultiSelect option is selected, the XdevOptionGroup becomes a check box list from which the user can select multiple values.
The XdevOptionGroup is a form component and it can be persisted via the XdevFieldGroup.
Important properties:
Important events:
Data binding:
Data container (model)
XdevBeanItemContainer - Standard data container. The allocation is set using the setContainerDataSource method.
// Generates a new XdevBeanItemContainer 'productList' XdevBeanItemContainer<Product> productList = new XdevBeanItemContainer<Product>(Product.class); // Sets the XdevBeanItemContainer listSelect.setContainerDataSource(productList);XdevLazyEntityContainer: RapidClipse exclusively uses this when the property Entity > Auto query data is selected.
Examples:
Read selection - Returns the selected object (Entity) - Example with "Product" entity
BeanItem<Product> selectedItem = this.optionGroup.getSelectedItem(); Product product = selectedItem.getBean();or - Returns a list of all selected elements
List<BeanItem<Product>> selectedItems = this.optionGroup.getSelectedItems();
Set selection
Object idByIndex = this.optionGroup.getBeanContainerDataSource().getIdByIndex(0); optionGroup.setValue(idByIndex);
Reset selection - Sets the selection to the initial state. This triggers a valueChange event.
optionGroup.clear();Enable and disable individual items with setItemEnabled()
Object firstItemId = this.optionGroup.getBeanContainerDataSource().firstItemId(); // disable item optionGroup.setItemEnabled(firstItemId, false);// enable item optionGroup.setItemEnabled(firstItemId, true);
Set focus- Allocates the focus to the XdevOptionGroup. This can trigger a focus event, if necessary.
optionGroup.focus();