Class Browser

java.lang.Object
com.nomagic.magicdraw.ui.browser.Browser

@OpenApi public class Browser extends Object
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

Also it has two panels:

  • documentation
  • zoom control

Sample of accessing Swing JTree of containment tree:

getContainmentTree().getTree()
  • Constructor Details

    • Browser

      public Browser()
  • Method Details

    • isInitialized

      public boolean isInitialized()
    • initBrowser

      public void initBrowser(Project project)
    • getProject

      public Project getProject()
    • loadTrees

      public void loadTrees()
      Loads persistent trees specified in project options
    • addPanel

      @OpenApi public void addPanel(ExtendedPanel panel)
      Adds a new browser panel.Should be called during browser initialization only.
      Parameters:
      panel - panel
      See Also:
    • addPanel

      @OpenApi public void addPanel(ExtendedPanel panel, int index)
      Adds a new browser panel.Should be called during browser initialization only.
      Parameters:
      panel - panel
      index - index
      See Also:
    • removePanel

      @OpenApi public void removePanel(ExtendedPanel panel)
      Removes browser panel. Should be called during browser initialization only.
      Parameters:
      panel - panel
      See Also:
    • addTree

      @OpenApi public BrowserTabTree addTree(BrowserTabTree tree, boolean drag, boolean drop)
      Adds and does set up a new tree to the browser. Should be called during browser initialization only.
      Parameters:
      tree - a new tree
      drag - tree should be a drag operation source
      drop - 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 tree
      drag - tree should be a drag operation source
      drop - tree should be a drop operation source
      index - the position of new tree among other trees
      Returns:
      added tree
      See Also:
    • removeTree

      @OpenApi public void removeTree(BrowserTabTree tree)
      Removes a tree from the browser.Should be called during browser initialization only.
      Parameters:
      tree - a new tree
      See Also:
    • removeTree

      @OpenApi public void removeTree(BrowserTabTree tree, boolean saveLayout)
      Removes a tree from the browser.Should be called during browser initialization only.
      Parameters:
      tree - a new tree
      saveLayout - save information about existing trees into project options
      See Also:
    • removeComponentInfo

      public void removeComponentInfo(WindowComponentInfo info)
      Remove information about registered component
      Parameters:
      info - component info
    • setActiveTree

      public void setActiveTree(BrowserTabTree activeTree)
      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

      @CheckForNull @OpenApi public BrowserTabTree getActiveTree()
      Returns reference to the active tree.
      Returns:
      active tree.
    • initTrees

      public void initTrees(String group, boolean activateTree)
    • initTrees

      public void initTrees()
    • initTrees

      public void initTrees(boolean activateTree)
    • initTrees

      public void initTrees(List<BrowserTabTree> trees, boolean activateTree)
      Init the browser. Init all browser trees.
      Parameters:
      trees - trees to init
      activateTree - 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

      public void updateBrowser(boolean updateOnlyDirty, String group)
      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 updated
      group - 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

      @OpenApi @CheckForNull public InheritanceTree getInheritanceTree()
      Returns inheritance tree if it exists, otherwise null
      Returns:
      inheritance tree.
    • getLockViewTree

      @CheckForNull @OpenApi public LockViewTree getLockViewTree()
      Returns Lock view tree.
      Returns:
      lock view tree.
    • getLastActiveTree

      @CheckForNull public BrowserTabTree getLastActiveTree(String group)
    • getContainmentTree

      @OpenApi public ContainmentTree getContainmentTree()
      Returns containment tree.
      Returns:
      containment tree.
    • getDiagramsTree

      @OpenApi public DiagramsTree getDiagramsTree()
      Returns diagrams tree.
      Returns:
      diagrams tree.
    • getExtensionsTree

      @OpenApi @CheckForNull public ExtensionsTree getExtensionsTree()
      Returns extensions tree.
      Returns:
      extensions tree.
    • getExtensionsTree

      @OpenApi @CheckForNull public ExtensionsTree getExtensionsTree(boolean addIfNotExists)
      Returns extensions tree.
      Parameters:
      addIfNotExists - add tree if not exists and it is allowed to have extension tree
      Returns:
      extensions tree.
    • getSearchResultsTree

      @OpenApi public SearchResultsTree getSearchResultsTree()
      Returns last active or newly added search results tree.
      Returns:
      search results tree.
    • getSearchResultsTree

      @CheckForNull @OpenApi public SearchResultsTree getSearchResultsTree(boolean addIfNotExists)
      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

      @CheckForNull public SearchResultsTree 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

      public void restoreState()
      Restores all expanded nodes in all trees. Method rememberExpandedNodes must be called first.
      See Also:
    • isTreeExpandStateRestored

      protected boolean isTreeExpandStateRestored()
      True if expand state is restored, else false.
      Returns:
      true if expand state is restored, else false.
    • getTrees

      @OpenApi public List<BrowserTabTree> getTrees()
      Returns:
      a list of browser trees
    • getTrees

      public List<BrowserTabTree> getTrees(String group)
    • getSearchResultTrees

      public List<SearchResultsTree> getSearchResultTrees()
    • getPanels

      @OpenApi public List<ExtendedPanel> getPanels()
      Returns:
      a list of browser panels.
    • dispose

      public void dispose()
    • getAllComponentInfo

      public static WindowComponentInfo[] getAllComponentInfo()
      Used in JIDE to create actions for these components
      Returns:
      info about all windows components related to browser
    • getTreeActivationHistory

      public List<BrowserTabTree> getTreeActivationHistory()
    • getTreeActivationHistory

      public List<BrowserTabTree> getTreeActivationHistory(String group)
    • removeTreeFromBrowser

      public void removeTreeFromBrowser(BrowserTabTree tree, boolean saveLayout)
      Remove given tree and also close a window of tree if any
      Parameters:
      tree - tree
      saveLayout - 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

      @CheckForNull public BrowserTabTree getBrowserTreeForNode(Node node)
    • getBrowserTreeForNode

      @CheckForNull public BrowserTabTree getBrowserTreeForNode(Node node, String group)
    • isExtensionTreeAllowed

      public boolean isExtensionTreeAllowed()
      Returns:
      true if Extensions tree can be created in a browser
    • addBrowserInitializer

      @OpenApi public static void addBrowserInitializer(Browser.BrowserInitializer initializer)
      Add new browser initializer.
      Parameters:
      initializer - initializer
    • removeBrowserInitializer

      @OpenApi public static void removeBrowserInitializer(Browser.BrowserInitializer initializer)
      Remove browser initializer.
      Parameters:
      initializer - initializer