Selecting Elements via Element Selection Dialog
// Use ElementSelectionDlgFactory.create(...) methods to create the element selection dialog. Frame dialogParent = MDDialogParentProvider.getProvider().getDialogParent(); ElementSelectionDlg dlg = ElementSelectionDlgFactory.create(dialogParent); // Use ElementSelectionDlgFactory.initSingle(...) methods to initialize the dialog with a single element selection mode. ElementSelectionDlgFactory.initSingle(....); // Use ElementSelectionDlgFactory.initMultiple(...) methods to initialize the dialog with a multiple element selection mode. ElementSelectionDlgFactory.initMultiple(....); // Display the dialog for the user to select elements. dlg.setVisible(true); // Check if the user has clicked "Ok". if (dlg.isOkClicked()) { // Get the selected element in a single selection mode. BaseElement selected = dlg.getSelectedElement(); // Get selected elements in a multiple selection mode. BaseElement selected = dlg.getSelectedElements(); }
You can find the code examples in <programinstallation directory>/openapi/examples/elementselection