Class ElementSelectionDlgFactory
- java.lang.Object
-
- com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory
-
@OpenApi public class ElementSelectionDlgFactory extends java.lang.Object
Element Selection dialog factory class. This factory should be used to create instances of ElementSelectionDlg and also configure dialog initial settings.Selecting elements via element Selection dialog
// Use ElementSelectionDlgFactory.create(...) methods to create element selection dialog. Frame dialogParent = MDDialogParentProvider.getProvider().getDialogParent(); ElementSelectionDlg dlg = ElementSelectionDlgFactory.create(dialogParent); // Use ElementSelectionDlgFactory.initSingle(...) methods to initialize the dialog with single element selection mode. ElementSelectionDlgFactory.initSingle(....); // Use ElementSelectionDlgFactory.initMultiple(...) methods to initialize the dialog with multiple element selection mode. ElementSelectionDlgFactory.initMultiple(....); // Display dialog for the user to select elements. dlg.show(); // Check if the user has clicked "Ok". if (dlg.isOkClicked()) { // Get selected element in single selection mode.a BaseElement selected = dlg.getSelectedElement(); // Get selected elements in multiple selection mode. BaseElement selected = dlg.getSelectedElements(); }
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory.PresentationElementFilter
A wrapper filter for appending PresentationElement to any other given filter.private static class
com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory.TagsFilter
A wrapper for filtering elements used for profiling (like tagged values)private static class
com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory.TypesFilterWrapper
private static class
com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlgFactory.UsedAsTypeFilter
A wrapper for filtering elements by DSL "doNotSuggestAsType"
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HELP_PATH
private static javax.swing.Icon
ICON
Default selection dialog iconstatic java.lang.String
SELECT_ELEMENT_TITLE
static java.lang.String
SELECT_ELEMENTS_TITLE
-
Constructor Summary
Constructors Constructor Description ElementSelectionDlgFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Collection
collectDisplayable(java.util.Collection displayable, java.util.Collection selectable)
Collect displayable types for a given selectable types if given displayable is nullprivate static void
commonInit(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, java.util.Collection<?> creatableTypes, java.lang.Object[] selection)
private static void
commonInit(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, java.lang.Object[] selection)
static ElementSelectionDlg
create()
Create an instance of the dialogstatic ElementSelectionDlg
create(java.awt.Dialog parent)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Dialog parent, java.lang.String title, java.lang.String helpPath)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Frame parent)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Frame parent, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
static ElementSelectionDlg
create(java.awt.Frame parent, java.lang.String title, java.lang.String helpPath)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Frame parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
static ElementSelectionDlg
create(java.awt.Frame parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter)
static ElementSelectionDlg
create(java.awt.Frame parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter defaultFilter)
static ElementSelectionDlg
create(java.awt.Window parent)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Window parent, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
static ElementSelectionDlg
create(java.awt.Window parent, java.lang.String title, java.lang.String helpPath)
Create an instance of dialogstatic ElementSelectionDlg
create(java.awt.Window parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
static ElementSelectionDlg
create(java.awt.Window parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter)
static ElementSelectionDlg
create(java.awt.Window parent, java.lang.String title, java.lang.String helpPath, com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter, com.nomagic.magicdraw.ui.DefaultObjectFilter defaultFilter)
static TypeFilter
createDisplayableForSelectable(TypeFilter selectable)
Create displayable types filter for a given selectable types filter.static TypeFilter
createDisplayableForSelectable(java.util.Collection selectable)
Create displayable types filter for a given selectable types.static TypeFilter
createDisplayableForSelectable(java.util.Collection displayable, TypeFilter selectable)
Create displayable types filter for a given selectable types filter if given displayable is nullprivate static java.util.Collection<? extends Element>
initBySelectElementInfo(ElementSelectionDlg dlg, SelectElementInfo info)
static void
initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, java.util.Collection<?> creatableTypes, java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, java.util.Collection<?> creatableTypes, java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, java.util.Collection<?> creatableTypes, java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, java.util.Collection<?> creatableTypes, java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultiple(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultiple(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, java.util.List selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initMultipleAsMultipleInitial(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, java.util.Collection<?> creatableTypes, java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode.static void
initSingle(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, java.util.Collection<?> creatableTypes, java.lang.Object selection)
Initializes given dialog with a "single element" selection mode.static void
initSingle(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, java.util.Collection<?> creatableTypes, java.lang.Object selection)
Initializes given dialog with a "single element" selection mode.static void
initSingle(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, java.lang.Object selection)
Initializes given dialog with a "single element" selection mode.private static void
initWithFilters(ElementSelectionDlg dlg, SelectElementInfo info, java.lang.Object[] selection, java.util.Collection<? extends Element> roots, TypeFilter elementFilter, TypeFilter selectFilter, boolean usedAsType)
private static void
setSelectionMode(ElementSelectionDlg dlg, SelectionMode selectionMode)
static TypeFilter
wrapWithTagsFilter(TypeFilter inner)
Creates tags filter from given type filter.
-
-
-
Field Detail
-
SELECT_ELEMENT_TITLE
public static final java.lang.String SELECT_ELEMENT_TITLE
-
SELECT_ELEMENTS_TITLE
public static final java.lang.String SELECT_ELEMENTS_TITLE
-
HELP_PATH
public static final java.lang.String HELP_PATH
- See Also:
- Constant Field Values
-
ICON
private static final javax.swing.Icon ICON
Default selection dialog icon
-
-
Method Detail
-
create
@OpenApi public static ElementSelectionDlg create()
Create an instance of the dialog- Returns:
- dialog instance
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent)
Create an instance of dialog- Parameters:
parent
- dialog parent- Returns:
- dialog instance
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath)
Create an instance of dialog- Parameters:
parent
- dialog parenttitle
- dialog titlehelpPath
- help id- Returns:
- dialog instance
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter)
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Frame parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter defaultFilter)
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent)
Create an instance of dialog- Parameters:
parent
- dialog parent- Returns:
- dialog instance
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath)
Create an instance of dialog- Parameters:
parent
- dialog parenttitle
- dialog titlehelpPath
- help id- Returns:
- dialog instance
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter)
-
create
public static ElementSelectionDlg create(@CheckForNull java.awt.Window parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath, @CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter treeComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter listComponentFilter, @CheckForNull com.nomagic.magicdraw.ui.DefaultObjectFilter defaultFilter)
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Dialog parent)
Create an instance of dialog- Parameters:
parent
- dialog parent- Returns:
- dialog instance
-
create
@OpenApi public static ElementSelectionDlg create(@CheckForNull java.awt.Dialog parent, @CheckForNull java.lang.String title, @CheckForNull java.lang.String helpPath)
Create an instance of dialog- Parameters:
parent
- dialog parenttitle
- dialog titlehelpPath
- help id- Returns:
- dialog instance
-
initBySelectElementInfo
private static java.util.Collection<? extends Element> initBySelectElementInfo(ElementSelectionDlg dlg, SelectElementInfo info)
-
commonInit
private static void commonInit(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, @CheckForNull java.lang.Object[] selection)
-
collectDisplayable
@OpenApi public static java.util.Collection collectDisplayable(@CheckForNull java.util.Collection displayable, java.util.Collection selectable)
Collect displayable types for a given selectable types if given displayable is null- Parameters:
displayable
- displayable typesselectable
- selectable types- Returns:
- displayable types
-
createDisplayableForSelectable
@OpenApi public static TypeFilter createDisplayableForSelectable(@CheckForNull java.util.Collection displayable, TypeFilter selectable)
Create displayable types filter for a given selectable types filter if given displayable is null- Parameters:
displayable
- displayable typesselectable
- selectable types- Returns:
- displayable types
-
createDisplayableForSelectable
@OpenApi public static TypeFilter createDisplayableForSelectable(TypeFilter selectable)
Create displayable types filter for a given selectable types filter.- Parameters:
selectable
- selectable types- Returns:
- displayable types
-
createDisplayableForSelectable
@OpenApi public static TypeFilter createDisplayableForSelectable(java.util.Collection selectable)
Create displayable types filter for a given selectable types.- Parameters:
selectable
- selectable types- Returns:
- displayable types
-
initWithFilters
private static void initWithFilters(ElementSelectionDlg dlg, SelectElementInfo info, @CheckForNull java.lang.Object[] selection, java.util.Collection<? extends Element> roots, TypeFilter elementFilter, TypeFilter selectFilter, boolean usedAsType)
-
initSingle
@OpenApi public static void initSingle(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, @CheckForNull java.lang.Object selection)
Initializes given dialog with a "single element" selection mode. It means dialog will allow to select just a single element.- Parameters:
dlg
- dialogtypes
- element selection informationinfo
- dialog settingsselection
- initially selected element
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, @CheckForNull java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialogtypes
- element selection informationinfo
- dialog settingsselection
- initially selected elements
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementTypes types, SelectElementInfo info, @CheckForNull java.util.List selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialogtypes
- element selection informationinfo
- dialog settingsselection
- initially selected elements
-
commonInit
private static void commonInit(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.lang.Object[] selection)
-
setSelectionMode
private static void setSelectionMode(ElementSelectionDlg dlg, SelectionMode selectionMode)
-
initSingle
@OpenApi public static void initSingle(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.lang.Object selection)
Initializes given dialog with a "single element" selection mode. It means dialog will allow to select just a single element.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initSingle
@OpenApi public static void initSingle(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.lang.Object selection)
Initializes given dialog with a "single element" selection mode. It means dialog will allow to select just a single element.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogusedAsType
- is this dialog instance is used to select some UML Type. If true, some special filters from DSL will be used for elements filteringcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogusedAsType
- is this dialog instance is used to select some UML Type. If true, some special filters from DSL will be used for elements filteringcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.lang.Object[] selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initMultiple
@OpenApi public static void initMultiple(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, boolean usedAsType, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements.- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogusedAsType
- is this dialog instance is used to select some UML Type. If true, some special filters from DSL will be used for elements filteringcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
initMultipleAsMultipleInitial
@OpenApi public static void initMultipleAsMultipleInitial(ElementSelectionDlg dlg, SelectElementInfo info, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, @CheckForNull java.util.Collection<?> creatableTypes, @CheckForNull java.util.List<?> selection)
Initializes given dialog with a "multiple elements" selection mode. It means dialog will allow to select several elements. Allows to set Multiple as mode initial multiple, (All initMultiple only use SINGLE_INITIAL)- Parameters:
dlg
- dialoginfo
- dialog settingsvisibleElementsFilter
- filter providing visible elements in the dialogselectableElementsFilter
- filter providing selectable elements in the dialogcreatableTypes
- collection of creatable types (choice on Create button)selection
- initially selected element
-
wrapWithTagsFilter
public static TypeFilter wrapWithTagsFilter(TypeFilter inner)
Creates tags filter from given type filter. Tags filter in some cases are much faster than simple filter.- Parameters:
inner
- type filter.- Returns:
- created tags filter, or passed filter if it is already is tags filter.
-
-