The XdevListSelect is a drop-down list from which the user can select a value. Multiple selections are possible. The drop-down list usually contains the values contained within a column of a database table.
The XdevNativeSelect XdevListSelect is a form component and can be persisted via the XdevFieldGroup.
Important properties:
Include Page Property Auto query data Property Auto query data Include Page Property ConnectedForm Property ConnectedForm Include Page Property Entity Property Entity Include Page Property ItemCaptionFromAnnotation Property ItemCaptionFromAnnotation Include Page Property ItemCaptionValue Property ItemCaptionValue Include Page Property Master component Property Master component Include Page Property MultiSelect Property MultiSelect - ReadOnly
Include Page Property Required Property Required Include Page Property RequiredError Property RequiredError Include Page Property Rows Property Rows Include Page Property TabIndex Property TabIndex
...
Include Page Event valueChange Event valueChange
Data binding:
- Daten-Container (Model) Data container (model)
XdevBeanItemContainer - Standard Daten-Container. Die Zuweisung erfolgt mit der Methode setContainerDataSource 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 listSelect.setContainerDataSource(productList);
- XdevLazyEntityContainer - Wird ausschließlich von RapidClipse verwendet, wenn die Property Entity > Auto query data selektiert istRapidClipse exclusively uses this when the property Entity > Auto query data is selected.
Examples:
Selektierung zurücksetzen - Setzt die Selektierung auf den Ausgangszustand. Dies löst ein valueChange Event ausReset selection - Sets the selection to the initial state. This triggers a valueChange event.
Code Block language java theme Confluence listSelect.clear();
Fokus setzen - Weist dem XdevListSelect den Focus zu. Dies kann ggf. ein focus Event auslösenSet focus - Allocates the focus to the XdevListSelect. This can trigger a focus event.
Code Block language java theme Confluence listSelect.focus();
Einträge hinzufügen - Weist dem XdevListSelect manuell Einträge hinzuAdd entries - Manually adds entries to the XdevListSelect.
Code Block language java theme Confluence listSelect.addItem("Eintrag 1"); listSelect.addItem("Eintrag 2");
Direkte Zuweisung mehrerer EinträgeDirect allocation of multiple entries.
Code Block language java theme Confluence listSelect.addItems("Eintrag 1", "Eintrag 2", "Eintrag 3", "Eintrag 4");
Selektiertes Objekt - Liefert das selektierte Objekt zurück (Entity) - Beispiel mit Category EntitySelected object - Returns the selected object (entity) - Example: category entity.
Code Block language java theme Confluence BeanItem<Category> selectedItem = listSelect.getSelectedItem(); Category category = selectedItem.getBean();
oderor
Code Block language java theme Confluence Category Category = (Category)listSelect.getValue();
oder - Liefert eine Liste aller selektierten Elemente or - Delivers a list of all selected elements
Code Block language java theme Confluence List<BeanItem<Category>> selectedItems = listSelect.getSelectedItems();
Elemente entfernen - Entfernt alle Elemente aus der XdevListSelectRemove elements - Removes all the elements from the XdevListSelect.
Code Block language java theme Confluence listSelect.removeAllItems();
Element selektieren - Automatisches Selektieren eines Eintrages - Beispiel: erster EintragSelect element - Automatic selection of an entry - Example: first entry.
Code Block language java theme Eclipse Collection<?> itemIds = listSelect.getItemIds(); listSelect.setValue(((List<Category>)itemIds).get(0));