Class SpecificationDialogManager
- java.lang.Object
-
- com.nomagic.magicdraw.core.project.ProjectEventListenerAdapter
-
- com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager
-
- All Implemented Interfaces:
ProjectEventListener
@OpenApi public final class SpecificationDialogManager extends ProjectEventListenerAdapter
The manager of specification windows for all types of model elements. This manager knows exactly what specification dialog to open for every specific element.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.util.List<ISpecificationNodeConfigurator>>
configurators
private java.util.Map<Project,java.util.List<SpecificationRecord>>
deactivated
private java.util.Map<Project,java.util.Map<Element,com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog>>
dialogs
private static SpecificationDialogManager
instance
private java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator>
mComponentFactoryCreators
Registered specification general component factory creatorsprivate java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog>
modalDialogs
private static com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode
openModalMode
private SpecificationTitleCreator
titleCreator
private java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator>
valueOwnerEditorConfigurators
private java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor>
valueOwnerEditors
-
Constructor Summary
Constructors Modifier Constructor Description private
SpecificationDialogManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConfigurator(java.lang.Class<?> elementClass, ISpecificationNodeConfigurator configurator)
Adds specification node configurator for given Element typeprivate void
addElementValueEditors()
void
addSpecificationGeneralComponentFactoryCreator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator factoryCreator)
Adds component factory creatorvoid
addValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor editor)
void
addValueOwnerEditorConfigurator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator configurator)
void
closeDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Project project)
void
configure(com.nomagic.magicdraw.ui.dialogs.specifications.tree.node.SpecificationNode node, Element element)
private com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog
createDialog(SpecificationRecord record, boolean modal)
void
disposeDialogs(Project project)
Closes all specification dialogs opened in particular project.private void
disposeModalDialogs()
void
editSpecification(SpecificationRecord record)
Opens non-modal specification dialog activated pane specified by record.void
editSpecification(SpecificationRecord record, boolean modal)
Opens specification dialog and activated pane specified by record.void
editSpecification(Element element)
Opens specification dialog for given ModelElement.void
editSpecification(Element element, boolean modal)
Opens specification dialog for given ModelElement.private java.util.List<ISpecificationNodeConfigurator>
getConfigurators(Element element)
com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog
getDialog(Element element)
static SpecificationDialogManager
getManager()
Returns shared instance of this manager.java.util.Map<Element,com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog>
getProjectDialogs(Project project, boolean create)
com.nomagic.ui.SimpleBaseDialog
getSimpleBaseDialog(Element element)
SpecificationTitleCreator
getTitleCreator()
Returns current specification dialog title creator.com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor
getValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerWrapper valueOwnerWrapper)
java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator>
getValueOwnerEditorConfigurators()
private java.util.Collection<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor>
getValueOwnerEditors()
private void
invokeOnDialogs(Project project, java.util.function.Consumer<com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog> invoker)
private void
open(SpecificationRecord record, boolean modal)
private void
openModal(SpecificationRecord record)
void
projectActivated(Project project)
Method is called when inactive project became active project.void
projectDeActivated(Project project)
Method is called when active project becomes not active.void
projectOpened(Project project)
Method is called when project was opened, created or loaded from teamwork server.void
projectPreClosed(Project project)
Method is called before closing the project.private void
putDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Element element)
java.util.Iterator<com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator>
registeredSpecificationGeneralComponentFactoryCreators()
Returns iterator of registered specification general factory creatorsvoid
removeConfigurator(java.lang.Class<?> elementClass, ISpecificationNodeConfigurator configurator)
Removes specification dialog node configurator for given Element type.private void
removeDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Project project)
void
removeValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor editor)
void
removeValueOwnerEditorConfigurator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator configurator)
void
reuseDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Element element)
static com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode
setOpenModalMode(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode value)
void
setTitleCreator(SpecificationTitleCreator titleCreator)
Sets specification dialog title creatorvoid
updateDialogs()
-
Methods inherited from class com.nomagic.magicdraw.core.project.ProjectEventListenerAdapter
projectActivatedFromGUI, projectClosed, projectCreated, projectOpenedFromGUI, projectPreActivated, projectPreClosedFinal, projectPreDeActivated, projectPreSaved, projectReplaced, projectSaved
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.nomagic.magicdraw.core.project.ProjectEventListener
projectPreOpenedFromGUI
-
-
-
-
Field Detail
-
instance
private static final SpecificationDialogManager instance
-
valueOwnerEditors
private java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor> valueOwnerEditors
-
configurators
private final java.util.Map<java.lang.String,java.util.List<ISpecificationNodeConfigurator>> configurators
-
valueOwnerEditorConfigurators
private final java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator> valueOwnerEditorConfigurators
-
dialogs
private final java.util.Map<Project,java.util.Map<Element,com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog>> dialogs
-
deactivated
private final java.util.Map<Project,java.util.List<SpecificationRecord>> deactivated
-
modalDialogs
private final java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog> modalDialogs
-
titleCreator
private SpecificationTitleCreator titleCreator
-
mComponentFactoryCreators
private final java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator> mComponentFactoryCreators
Registered specification general component factory creators
-
openModalMode
private static volatile com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode openModalMode
-
-
Method Detail
-
setOpenModalMode
public static com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode setOpenModalMode(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialogManager.OpenMode value)
-
addElementValueEditors
private void addElementValueEditors()
-
getManager
@OpenApi public static SpecificationDialogManager getManager()
Returns shared instance of this manager.- Returns:
- instance of this manager.
-
registeredSpecificationGeneralComponentFactoryCreators
public java.util.Iterator<com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator> registeredSpecificationGeneralComponentFactoryCreators()
Returns iterator of registered specification general factory creators- Returns:
- iterator
-
addSpecificationGeneralComponentFactoryCreator
public final void addSpecificationGeneralComponentFactoryCreator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.SpecificationGeneralComponentFactoryCreator factoryCreator)
Adds component factory creator- Parameters:
factoryCreator
- creator
-
editSpecification
@OpenApi public void editSpecification(Element element)
Opens specification dialog for given ModelElement. Dialog is not modal.- Parameters:
element
- the given Element.
-
editSpecification
@OpenApi public void editSpecification(Element element, boolean modal)
Opens specification dialog for given ModelElement.- Parameters:
element
- the given Element.modal
- open modal specification window
-
editSpecification
@OpenApi public void editSpecification(SpecificationRecord record)
Opens non-modal specification dialog activated pane specified by record.- Parameters:
record
- specification dialog record containing a reference to element and pane to activate
-
editSpecification
@OpenApi public void editSpecification(SpecificationRecord record, boolean modal)
Opens specification dialog and activated pane specified by record.- Parameters:
record
- specification dialog record containing a reference to element and pane to activatemodal
- open modal specification window
-
addValueOwnerEditor
public void addValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor editor)
-
removeValueOwnerEditor
public void removeValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor editor)
-
getValueOwnerEditor
@CheckForNull public com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor getValueOwnerEditor(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerWrapper valueOwnerWrapper)
-
openModal
private void openModal(SpecificationRecord record)
-
open
private void open(SpecificationRecord record, boolean modal)
-
putDialog
private void putDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Element element)
-
getProjectDialogs
public java.util.Map<Element,com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog> getProjectDialogs(Project project, boolean create)
-
getDialog
@CheckForNull public com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog getDialog(Element element)
-
getSimpleBaseDialog
@CheckForNull public com.nomagic.ui.SimpleBaseDialog getSimpleBaseDialog(Element element)
-
createDialog
private com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog createDialog(SpecificationRecord record, boolean modal)
-
reuseDialog
public void reuseDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Element element)
-
removeDialog
private void removeDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Project project)
-
closeDialog
public void closeDialog(com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog dialog, Project project)
-
addConfigurator
@OpenApi public void addConfigurator(java.lang.Class<?> elementClass, ISpecificationNodeConfigurator configurator)
Adds specification node configurator for given Element type- Parameters:
elementClass
- the specific class of Element(for example com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier)configurator
- the given configurator.
-
removeConfigurator
@OpenApi public void removeConfigurator(java.lang.Class<?> elementClass, ISpecificationNodeConfigurator configurator)
Removes specification dialog node configurator for given Element type.- Parameters:
elementClass
- the specific class of Element(for example com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Classifier)configurator
- the given configurator.
-
configure
public void configure(com.nomagic.magicdraw.ui.dialogs.specifications.tree.node.SpecificationNode node, Element element)
-
getConfigurators
private java.util.List<ISpecificationNodeConfigurator> getConfigurators(Element element)
-
disposeDialogs
public void disposeDialogs(Project project)
Closes all specification dialogs opened in particular project. Method is used for performance testing purposes (SpecificationDialogPerformanceTest).- Parameters:
project
- project
-
disposeModalDialogs
private void disposeModalDialogs()
-
updateDialogs
public final void updateDialogs()
-
getTitleCreator
@OpenApi public SpecificationTitleCreator getTitleCreator()
Returns current specification dialog title creator.- Returns:
- title creator
-
setTitleCreator
@OpenApi public final void setTitleCreator(SpecificationTitleCreator titleCreator)
Sets specification dialog title creator- Parameters:
titleCreator
- title creator.
-
projectOpened
public void projectOpened(Project project)
Description copied from interface:ProjectEventListener
Method is called when project was opened, created or loaded from teamwork server. Opened project is active project and no projectActivated(Project) is called for this project.- Specified by:
projectOpened
in interfaceProjectEventListener
- Overrides:
projectOpened
in classProjectEventListenerAdapter
- Parameters:
project
- project which was opened.- See Also:
ProjectEventListener.projectActivated(Project)
-
projectPreClosed
public void projectPreClosed(Project project)
Description copied from interface:ProjectEventListener
Method is called before closing the project. Close operation has three steps - preClose, preCloseFinal and projectClosed. Project is not marked as "closing" in this step.- Specified by:
projectPreClosed
in interfaceProjectEventListener
- Overrides:
projectPreClosed
in classProjectEventListenerAdapter
- Parameters:
project
- project which will be closed.- See Also:
ProjectEventListener.projectPreClosed(com.nomagic.magicdraw.core.Project)
-
projectActivated
public void projectActivated(Project project)
Description copied from interface:ProjectEventListener
Method is called when inactive project became active project.- Specified by:
projectActivated
in interfaceProjectEventListener
- Overrides:
projectActivated
in classProjectEventListenerAdapter
- Parameters:
project
- new active project.- See Also:
ProjectEventListener.projectActivated(Project)
-
projectDeActivated
public void projectDeActivated(Project project)
Description copied from interface:ProjectEventListener
Method is called when active project becomes not active.- Specified by:
projectDeActivated
in interfaceProjectEventListener
- Overrides:
projectDeActivated
in classProjectEventListenerAdapter
- Parameters:
project
- inactive project.- See Also:
ProjectEventListener.projectDeActivated(Project)
-
getValueOwnerEditors
private java.util.Collection<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditor> getValueOwnerEditors()
-
invokeOnDialogs
private void invokeOnDialogs(Project project, java.util.function.Consumer<com.nomagic.magicdraw.ui.dialogs.specifications.SpecificationDialog> invoker)
-
getValueOwnerEditorConfigurators
public java.util.List<com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator> getValueOwnerEditorConfigurators()
-
addValueOwnerEditorConfigurator
public void addValueOwnerEditorConfigurator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator configurator)
-
removeValueOwnerEditorConfigurator
public void removeValueOwnerEditorConfigurator(com.nomagic.magicdraw.ui.dialogs.specifications.panels.slots.ValueOwnerEditorConfigurator configurator)
-
-