Class ElementSelectionDlg
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- java.awt.Window
-
- java.awt.Dialog
-
- javax.swing.JDialog
-
- com.nomagic.ui.Dialog
-
- com.nomagic.ui.SimpleBaseDialog
-
- com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionDlg
-
- All Implemented Interfaces:
Cachable
,com.nomagic.ui.CursorOwner
,HiDPIScalableComponent
,NotificationsContainer
,java.awt.event.ActionListener
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.WindowListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
,javax.swing.RootPaneContainer
,javax.swing.WindowConstants
@OpenApi public class ElementSelectionDlg extends com.nomagic.ui.SimpleBaseDialog
Element selection dialog. UseElementSelectionDlgFactory
to create the dialog.- See Also:
ElementSelectionDlgFactory
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JDialog
javax.swing.JDialog.AccessibleJDialog
-
Nested classes/interfaces inherited from class java.awt.Dialog
java.awt.Dialog.AccessibleAWTDialog, java.awt.Dialog.ModalExclusionType, java.awt.Dialog.ModalityType
-
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
disposing
If currently disposing this dialog.static java.lang.String
LIST_ID
private java.lang.Object
lock
Synchronization lock.private com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel
selectionPanel
static java.lang.String
TREE_ID
-
Fields inherited from class com.nomagic.ui.SimpleBaseDialog
ADD, APPLY, APPLY_OK_CANCEL_HELP_ARMAP, CANCEL, CANCEL_ARMAP, CANCEL_HELP_ARMAP, CANCEL_HELP_LABELS, CANCEL_LABELS, CLOSE, CLOSE_ARMAP, CLOSE_HELP_ARMAP, CLOSE_HELP_LABELS, CLOSE_LABELS, COMMIT, EMPTY_DIALOG, HELP, NO, NO_TO_ALL, NONE_ARMAP, OK, OK_ARMAP, OK_CANCEL_ARMAP, OK_CANCEL_HELP_ARMAP, OK_CANCEL_HELP_LABELS, OK_CANCEL_LABELS, OK_CLOSE_HELP_ARMAP, OK_CLOSE_HELP_LABELS, OK_HELP_ARMAP, OK_HELP_LABELS, OK_LABELS, RETRY, RETRY_CANCEL_ARMAP, RETRY_CANCEL_LABELS, SAVE, SAVE_COMMIT_CANCEL_ARMAP, SAVE_COMMIT_CANCEL_LABELS, YES, YES_NO_ALL_ARMAP, YES_NO_ALL_CANCEL_ARMAP, YES_NO_ALL_CANCEL_LABELS, YES_NO_ALL_LABELS, YES_NO_ARMAP, YES_NO_CANCEL_ARMAP, YES_NO_CANCEL_LABELS, YES_NO_HELP_ARMAP, YES_NO_HELP_LABELS, YES_NO_LABELS, YES_TO_ALL
-
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
-
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ElementSelectionDlg(java.awt.Window parent, java.lang.String title, java.lang.String helpPath)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel.AdditionalPanel
createAdditionalTopPanel()
Creates panel which will be added on top of dialog (above search field).protected com.nomagic.magicdraw.ui.dialogs.selection.list.ConfigurableElementSelectionListComponent
createElementSelectionListComponent()
protected com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel
createElementSelectionPanel(com.nomagic.magicdraw.ui.DefaultObjectFilter filter)
CreatesElementSelectionPanel
.protected com.nomagic.magicdraw.ui.dialogs.selection.tree.ConfigurableElementSelectionTreeComponent
createElementSelectionTreeComponent()
protected com.nomagic.magicdraw.ui.dialogs.selection.ObjectsModelListener<java.lang.Object>
createObjectsModelListener()
CreatesObjectsModelListener
.void
dispose()
protected java.awt.Component
getDefaultFocusable()
protected java.lang.Object
getDialogBoundsCacheKey()
com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionComponentsManager<com.nomagic.magicdraw.ui.dialogs.selection.ConfigurableElementSelectionComponent>
getElementSelectionComponentsManager()
Get selection components manager.com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel
getElementSelectionPanel()
java.awt.Dimension
getPreferredSize()
BaseElement
getSelectedElement()
Get selected element.java.util.List<BaseElement>
getSelectedElements()
Get selected elements.com.nomagic.magicdraw.ui.dialogs.selection.ConfigurableElementSelectionComponentsConfiguration
getSelectionConfiguration()
Get current selection configuration.com.nomagic.magicdraw.ui.AbstractSelectionTextField
getSelectionTextField()
void
initialize(java.util.Collection<? extends Element> roots, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, java.lang.Object[] selection)
Initialize the dialog with given data.void
internalSetSelectionMode(SelectionMode selectionMode)
Set element(s) selection mode.protected boolean
isButtonEnabled(java.lang.Object[] selection)
boolean
isMultipleSelectionState()
Get if panel is in multiple selection state.boolean
isMultipleSelectionSupported()
boolean
isOkClicked()
Check if OK button is clicked.protected boolean
onOK()
void
setAddRecursivelySupported(boolean support)
Set if support adding recursively.void
setCreatableTypes(java.util.Collection<?> creatableTypes)
Set creatable element types.void
setCreateButtonText(java.lang.String text)
Set the text for element creation button.void
setElementInitializer(com.nomagic.magicdraw.uml.ElementInitializer initializer)
Set element initializer to initialize the created element.void
setElementSelectionContext(com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
Set element selection context.void
setElementWrapperProvider(com.nomagic.magicdraw.ui.dialogs.selection.ElementWrapperProvider elementWrapperProvider)
Set element wrapper provider.void
setFilterOptionsEnabled(boolean enabled)
void
setNoneSelectionSupported(boolean supported)
Set if "None" selection is supported.void
setNoneText(java.lang.String text)
Set the text for element creation button.void
setRemoveElementValidator(java.util.function.Predicate<java.lang.Object> removeElementValidator)
Sets validator for selected elements in multiple selection panel which decide which elements could be removed.void
setSelectedElementRenderer(javax.swing.ListCellRenderer<java.lang.Object> renderer)
Sets renderer for selected elements in multiple selection panel.void
setSelectionMode(SelectionMode selectionMode)
Set element(s) selection mode.void
setShowDiagramsNode(boolean isShowDiagramsNode)
void
setSortableSelection(boolean sortableSelection)
Set if selection is sortable, affects only multiple selection.(package private) void
setUsedAsType(boolean usedAsType)
void
setUseFilterOptions(boolean useFilterOptions)
private void
superDispose()
Call super.dispose();private void
updateButtons()
Update buttons according active selection.-
Methods inherited from class com.nomagic.ui.SimpleBaseDialog
actionPerformed, addListeners, addNotify, createContents, finishEdit, getARMap, getButtonByAction, getContents, getControls, getDescriptionPanel, getHelpPath, getNotificationsContainer, getResult, handleFocus, hide, isDataValid, keyPressed, keyReleased, keyTyped, mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased, onAction, onAction, onApply, onCancel, onClose, onHelp, setARMap, setConstraintForContent, setContents, setControls, setDefaultAction, setHelpPath, setNotificationPanel, setResult, updatePreferredSizeByChildren, usePlainButtonText, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpened
-
Methods inherited from class com.nomagic.ui.Dialog
addConfigurator, adjustPreferredDialogSize, checkVisibility, fitInScreen, getCurrentCursor, getEditingState, getScreenBounds, getSpecificCursor, isHiDPIScaled, maximize, pack, recalculateLocationToFit, rememberBounds, removeConfigurator, removeNotify, reset, resetCache, resetChildren, resizeWindowByChildSizeChange, scaleForHiDPI, setEditingState, setHiDPIScaled, setMaximizeOnFirstShow, setSpecificCursor, setVisible, show, toScreenCenter, updatePreferredSizeByChild, useSimpleShowing
-
Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
-
Methods inherited from class java.awt.Dialog
getModalityType, getTitle, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, toBack
-
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
TREE_ID
public static final java.lang.String TREE_ID
- See Also:
- Constant Field Values
-
LIST_ID
public static final java.lang.String LIST_ID
- See Also:
- Constant Field Values
-
selectionPanel
private final com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel selectionPanel
-
disposing
private boolean disposing
If currently disposing this dialog.
-
lock
private final java.lang.Object lock
Synchronization lock.
-
-
Constructor Detail
-
ElementSelectionDlg
protected ElementSelectionDlg(@CheckForNull java.awt.Window parent, java.lang.String title, @CheckForNull java.lang.String helpPath)
Constructor. ElementSelectionDlgFactory should be used for creating an instances of this dialog- Parameters:
parent
- dialog parent.title
- dialog title.helpPath
- dialog help path.
-
-
Method Detail
-
createElementSelectionTreeComponent
protected com.nomagic.magicdraw.ui.dialogs.selection.tree.ConfigurableElementSelectionTreeComponent createElementSelectionTreeComponent()
-
createElementSelectionListComponent
protected com.nomagic.magicdraw.ui.dialogs.selection.list.ConfigurableElementSelectionListComponent createElementSelectionListComponent()
-
getDefaultFocusable
@CheckForNull protected java.awt.Component getDefaultFocusable()
- Overrides:
getDefaultFocusable
in classcom.nomagic.ui.SimpleBaseDialog
-
createElementSelectionPanel
protected com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel createElementSelectionPanel(com.nomagic.magicdraw.ui.DefaultObjectFilter filter)
CreatesElementSelectionPanel
.- Returns:
ElementSelectionPanel
.
-
createAdditionalTopPanel
@CheckForNull protected com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel.AdditionalPanel createAdditionalTopPanel()
Creates panel which will be added on top of dialog (above search field).- Returns:
- panel which will be added on top of dialog (above search field).
-
createObjectsModelListener
protected com.nomagic.magicdraw.ui.dialogs.selection.ObjectsModelListener<java.lang.Object> createObjectsModelListener()
CreatesObjectsModelListener
.- Returns:
ObjectsModelListener
-
getPreferredSize
public java.awt.Dimension getPreferredSize()
- Overrides:
getPreferredSize
in classjava.awt.Container
-
setElementWrapperProvider
public void setElementWrapperProvider(@CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementWrapperProvider elementWrapperProvider)
Set element wrapper provider.- Parameters:
elementWrapperProvider
- wrapper to register. Can be null.
-
setCreatableTypes
public void setCreatableTypes(@CheckForNull java.util.Collection<?> creatableTypes)
Set creatable element types.- Parameters:
creatableTypes
- types of creatable elements. Can be null.
-
setElementSelectionContext
public void setElementSelectionContext(@CheckForNull com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionContext context)
Set element selection context.- Parameters:
context
- context with element and property for selection. Can be null.
-
setElementInitializer
public void setElementInitializer(@CheckForNull com.nomagic.magicdraw.uml.ElementInitializer initializer)
Set element initializer to initialize the created element.- Parameters:
initializer
- initializer to register. Can be null.
-
setCreateButtonText
public void setCreateButtonText(@CheckForNull java.lang.String text)
Set the text for element creation button. Default is "Create".- Parameters:
text
- button text, if null the default text is used.
-
setNoneText
public void setNoneText(java.lang.String text)
Set the text for element creation button. Default is "Create".- Parameters:
text
- button text, if null the default text is used.
-
getElementSelectionComponentsManager
public com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionComponentsManager<com.nomagic.magicdraw.ui.dialogs.selection.ConfigurableElementSelectionComponent> getElementSelectionComponentsManager()
Get selection components manager.- Returns:
- element selection components manager.
-
setNoneSelectionSupported
public void setNoneSelectionSupported(boolean supported)
Set if "None" selection is supported.- Parameters:
supported
- true if it is allowed to select "None".
-
setSortableSelection
public void setSortableSelection(boolean sortableSelection)
Set if selection is sortable, affects only multiple selection.- Parameters:
sortableSelection
- true - selection is ordered, otherwise - false.
-
setShowDiagramsNode
public void setShowDiagramsNode(boolean isShowDiagramsNode)
-
initialize
public void initialize(java.util.Collection<? extends Element> roots, TypeFilter visibleElementsFilter, TypeFilter selectableElementsFilter, @CheckForNull java.lang.Object[] selection)
Initialize the dialog with given data.- Parameters:
roots
- selection root element. Can not be null.visibleElementsFilter
- filter for visible elements. Can not be null.selectableElementsFilter
- filer for selectable elements. Can not be null.selection
- initial selection. If null last element selected in the project is selected.
-
getSelectedElement
@OpenApi @CheckForNull public BaseElement getSelectedElement()
Get selected element. Available only if OK of dialog is clicked (isOkClicked()
).- Returns:
- selected element. Can be null.
-
getSelectedElements
@OpenApi public java.util.List<BaseElement> getSelectedElements()
Get selected elements. Available only if OK of dialog is clicked (isOkClicked()
).- Returns:
- selected elements.
-
isOkClicked
@OpenApi public boolean isOkClicked()
Check if OK button is clicked.- Returns:
- true - OK is clicked, otherwise false.
-
setAddRecursivelySupported
public void setAddRecursivelySupported(boolean support)
Set if support adding recursively.- Parameters:
support
- true to support, otherwise - false.
-
getSelectionConfiguration
public com.nomagic.magicdraw.ui.dialogs.selection.ConfigurableElementSelectionComponentsConfiguration getSelectionConfiguration()
Get current selection configuration.- Returns:
- selection configuration.
-
isMultipleSelectionState
public boolean isMultipleSelectionState()
Get if panel is in multiple selection state.- Returns:
- true - multiple selection state, false - single selection state.
-
dispose
public void dispose()
- Overrides:
dispose
in classcom.nomagic.ui.Dialog
-
superDispose
private void superDispose()
Call super.dispose();
-
onOK
protected boolean onOK()
- Overrides:
onOK
in classcom.nomagic.ui.SimpleBaseDialog
-
updateButtons
private void updateButtons()
Update buttons according active selection.
-
isButtonEnabled
protected boolean isButtonEnabled(@CheckForNull java.lang.Object[] selection)
-
setRemoveElementValidator
public void setRemoveElementValidator(java.util.function.Predicate<java.lang.Object> removeElementValidator)
Sets validator for selected elements in multiple selection panel which decide which elements could be removed.- Parameters:
removeElementValidator
- new validator
-
getElementSelectionPanel
public com.nomagic.magicdraw.ui.dialogs.selection.ElementSelectionPanel getElementSelectionPanel()
-
setSelectedElementRenderer
public void setSelectedElementRenderer(javax.swing.ListCellRenderer<java.lang.Object> renderer)
Sets renderer for selected elements in multiple selection panel.- Parameters:
renderer
- new renderer
-
setSelectionMode
@OpenApi public void setSelectionMode(SelectionMode selectionMode)
Set element(s) selection mode.- Parameters:
selectionMode
- selection mode.
-
internalSetSelectionMode
public void internalSetSelectionMode(SelectionMode selectionMode)
Set element(s) selection mode. Should be used only internally. Use setSelectionMode() externally.- Parameters:
selectionMode
- selection mode.
-
isMultipleSelectionSupported
public boolean isMultipleSelectionSupported()
- Returns:
- true if multiple selection mode is supported
-
getDialogBoundsCacheKey
protected java.lang.Object getDialogBoundsCacheKey()
- Overrides:
getDialogBoundsCacheKey
in classcom.nomagic.ui.Dialog
-
getSelectionTextField
public final com.nomagic.magicdraw.ui.AbstractSelectionTextField getSelectionTextField()
-
setFilterOptionsEnabled
public void setFilterOptionsEnabled(boolean enabled)
-
setUseFilterOptions
public void setUseFilterOptions(boolean useFilterOptions)
-
setUsedAsType
void setUsedAsType(boolean usedAsType)
-
-