Package com.nomagic.magicdraw.ui.browser
Class Browser
java.lang.Object
com.nomagic.magicdraw.ui.browser.Browser
The MagicDraw application UI part with trees, documentation, zoom and search panels.
The primary purpose of this class is to manages predefined Trees and Panels in MagicDraw application Browser.
It has five trees:
- containment
- diagrams
- inheritance
- extensions
- search results
- documentation
- zoom control
Sample of accessing Swing JTree of containment tree:
getContainmentTree().getTree()
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Browser initializer is an extension point for browser creation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Activate all visible on-screen trees.static void
addBrowserInitializer
(Browser.BrowserInitializer initializer) Add new browser initializer.void
addPanel
(ExtendedPanel panel) Adds a new browser panel.Should be called during browser initialization only.void
addPanel
(ExtendedPanel panel, int index) Adds a new browser panel.Should be called during browser initialization only.Adds new browser tab tree for search resultsaddTree
(BrowserTabTree tree, boolean drag, boolean drop) Adds and does set up a new tree to the browser.addTree
(BrowserTabTree tree, boolean drag, boolean drop, int index) Adds and does set up a new tree to the browser.void
changes browser's trees decorationvoid
dispose()
Returns reference to the active tree.static WindowComponentInfo[]
Used in JIDE to create actions for these componentsgetBrowserTreeForNode
(Node node) getBrowserTreeForNode
(Node node, String group) Returns containment tree.Returns diagrams tree.com.nomagic.magicdraw.ui.browser.BrowserDocumentationPanel
Returns documentation panel.Returns extensions tree.getExtensionsTree
(boolean addIfNotExists) Returns extensions tree.Returns inheritance tree if it exists, otherwise nullgetLastActiveTree
(String group) Returns Lock view tree.com.nomagic.magicdraw.ui.browser.BrowserNodeMap
com.nomagic.magicdraw.ui.diagramoverview.DiagramOverviewPanel
Returns zoom panel.com.nomagic.magicdraw.properties.qproperties.ui.QPropertiesPanel
Returns last active or newly added search results tree.getSearchResultsTree
(boolean addIfNotExists) Returns last active or newly added search results tree.getTreeActivationHistory
(String group) getTrees()
void
initBrowser
(Project project) void
void
initTrees
(boolean activateTree) void
void
initTrees
(List<BrowserTabTree> trees, boolean activateTree) Init the browser.boolean
boolean
protected boolean
True if expand state is restored, else false.void
Loads persistent trees specified in project optionsvoid
ReInit browser treesvoid
Remembers all expanded nodes in all trees.void
Removes all removable panels.void
Removes all removable trees.static void
removeBrowserInitializer
(Browser.BrowserInitializer initializer) Remove browser initializer.void
Remove information about registered componentvoid
removePanel
(ExtendedPanel panel) Removes browser panel.void
removeTree
(BrowserTabTree tree) Removes a tree from the browser.Should be called during browser initialization only.void
removeTree
(BrowserTabTree tree, boolean saveLayout) Removes a tree from the browser.Should be called during browser initialization only.void
removeTreeFromBrowser
(BrowserTabTree tree, boolean saveLayout) Remove given tree and also close a window of tree if anyvoid
Restores all expanded nodes in all trees.void
Save information about trees layout into project optionsvoid
setActiveTree
(BrowserTabTree activeTree) Sets active tree.void
Sorts the nodes in all trees.void
updateBrowser
(boolean updateOnlyDirty) void
updateBrowser
(boolean updateOnlyDirty, String group) Updates the nodes in all trees.void
Updates the sort always flag in trees' models.void
Updates the sort always flag in trees' models.
-
Constructor Details
-
Browser
public Browser()
-
-
Method Details
-
isInitialized
public boolean isInitialized() -
initBrowser
-
getProject
-
loadTrees
public void loadTrees()Loads persistent trees specified in project options -
addPanel
Adds a new browser panel.Should be called during browser initialization only.- Parameters:
panel
- panel- See Also:
-
addPanel
Adds a new browser panel.Should be called during browser initialization only.- Parameters:
panel
- panelindex
- index- See Also:
-
removePanel
Removes browser panel. Should be called during browser initialization only.- Parameters:
panel
- panel- See Also:
-
addTree
Adds and does set up a new tree to the browser. Should be called during browser initialization only.- Parameters:
tree
- a new treedrag
- tree should be a drag operation sourcedrop
- tree should be a drop operation source- Returns:
- added tree
- See Also:
-
addTree
@OpenApi public BrowserTabTree addTree(@Nonnull BrowserTabTree tree, boolean drag, boolean drop, int index) Adds and does set up a new tree to the browser. Should be called during browser initialization only.- Parameters:
tree
- a new treedrag
- tree should be a drag operation sourcedrop
- tree should be a drop operation sourceindex
- the position of new tree among other trees- Returns:
- added tree
- See Also:
-
removeTree
Removes a tree from the browser.Should be called during browser initialization only.- Parameters:
tree
- a new tree- See Also:
-
removeTree
Removes a tree from the browser.Should be called during browser initialization only.- Parameters:
tree
- a new treesaveLayout
- save information about existing trees into project options- See Also:
-
removeComponentInfo
Remove information about registered component- Parameters:
info
- component info
-
setActiveTree
Sets active tree. Does not select this tree in TabbedPane, just changes the reference to active tree in code.- Parameters:
activeTree
- a new active tree for this browser.
-
getActiveTree
Returns reference to the active tree.- Returns:
- active tree.
-
initTrees
-
initTrees
public void initTrees() -
initTrees
public void initTrees(boolean activateTree) -
initTrees
Init the browser. Init all browser trees.- Parameters:
trees
- trees to initactivateTree
- activate tree
-
activateVisibleTrees
public void activateVisibleTrees()Activate all visible on-screen trees. -
sortAllTrees
public void sortAllTrees()Sorts the nodes in all trees. -
updateSortAlwaysFlag
public void updateSortAlwaysFlag()Updates the sort always flag in trees' models. If sort flag is true, sorts the trees. -
updateSortAlwaysFlagForDifferentTrees
public void updateSortAlwaysFlagForDifferentTrees()Updates the sort always flag in trees' models. If sort flag is true, sorts tress that had different flag. -
reInitTrees
public void reInitTrees()ReInit browser trees -
updateBrowser
Updates the nodes in all trees. Updates documentation panel also.- Parameters:
updateOnlyDirty
- true if only dirty nodes will be updated. on false all nodes will be updatedgroup
- trees group
-
updateBrowser
public void updateBrowser(boolean updateOnlyDirty) -
decorateBrowser
public void decorateBrowser()changes browser's trees decoration -
getDocPanel
@CheckForNull public com.nomagic.magicdraw.ui.browser.BrowserDocumentationPanel getDocPanel()Returns documentation panel.- Returns:
- documentation panel.
-
getOverviewPanel
public com.nomagic.magicdraw.ui.diagramoverview.DiagramOverviewPanel getOverviewPanel()Returns zoom panel.- Returns:
- zoom panel.
-
getQPanel
@CheckForNull public com.nomagic.magicdraw.properties.qproperties.ui.QPropertiesPanel getQPanel() -
getInheritanceTree
Returns inheritance tree if it exists, otherwise null- Returns:
- inheritance tree.
-
getLockViewTree
Returns Lock view tree.- Returns:
- lock view tree.
-
getLastActiveTree
-
getContainmentTree
Returns containment tree.- Returns:
- containment tree.
-
getDiagramsTree
Returns diagrams tree.- Returns:
- diagrams tree.
-
getExtensionsTree
Returns extensions tree.- Returns:
- extensions tree.
-
getExtensionsTree
Returns extensions tree.- Parameters:
addIfNotExists
- add tree if not exists and it is allowed to have extension tree- Returns:
- extensions tree.
-
getSearchResultsTree
Returns last active or newly added search results tree.- Returns:
- search results tree.
-
getSearchResultsTree
Returns last active or newly added search results tree.- Parameters:
addIfNotExists
- add search result tree if it does not exist- Returns:
- search results tree.
-
addSearchResultsTree
Adds new browser tab tree for search results- Returns:
- search results tree
-
getNodeMap
public com.nomagic.magicdraw.ui.browser.BrowserNodeMap getNodeMap() -
rememberState
public void rememberState()Remembers all expanded nodes in all trees. Later these expanded nodes can be restored with method restoreExpandedNodes().- See Also:
-
restoreState()
TreeStateManager
-
restoreState
public void restoreState()Restores all expanded nodes in all trees. Method rememberExpandedNodes must be called first.- See Also:
-
rememberState()
TreeStateManager
-
isTreeExpandStateRestored
protected boolean isTreeExpandStateRestored()True if expand state is restored, else false.- Returns:
- true if expand state is restored, else false.
-
getTrees
- Returns:
- a list of browser trees
-
getTrees
-
getSearchResultTrees
-
getPanels
- Returns:
- a list of browser panels.
-
dispose
public void dispose() -
getAllComponentInfo
Used in JIDE to create actions for these components- Returns:
- info about all windows components related to browser
-
getTreeActivationHistory
-
getTreeActivationHistory
-
removeTreeFromBrowser
Remove given tree and also close a window of tree if any- Parameters:
tree
- treesaveLayout
- save information about trees layout
-
saveTreesLayout
public void saveTreesLayout()Save information about trees layout into project options -
removeAllRemovableTrees
public void removeAllRemovableTrees()Removes all removable trees. -
removeAllRemovablePanels
public void removeAllRemovablePanels()Removes all removable panels. Removables panels are of type BrowserPanelInfo and have field showByDefault set to true. -
getBrowserTreeForNode
-
getBrowserTreeForNode
-
isExtensionTreeAllowed
public boolean isExtensionTreeAllowed()- Returns:
- true if Extensions tree can be created in a browser
-
addBrowserInitializer
Add new browser initializer.- Parameters:
initializer
- initializer
-
removeBrowserInitializer
Remove browser initializer.- Parameters:
initializer
- initializer
-