Class Browser


  • @OpenApi
    public class Browser
    extends java.lang.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()
    • Method Detail

      • addPanel

        @OpenApi
        public void addPanel​(ExtendedPanel panel)
        Adds a new browser panel.Should be called during browser initialization only.
        Parameters:
        panel - panel
        See Also:
        Browser.BrowserInitializer
      • 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:
        Browser.BrowserInitializer
      • removePanel

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

        @OpenApi
        public BrowserTabTree addTree​(BrowserTabTree tree,
                                      boolean drag,
                                      boolean drop)
        Adds and does setup 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:
        Browser.BrowserInitializer
      • addTree

        @OpenApi
        public BrowserTabTree addTree​(@Nonnull
                                      BrowserTabTree tree,
                                      boolean drag,
                                      boolean drop,
                                      int index)
        Adds and does setup 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:
        Browser.BrowserInitializer
      • 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:
        Browser.BrowserInitializer
      • 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:
        Browser.BrowserInitializer
      • getActiveTree

        @CheckForNull
        @OpenApi
        public BrowserTabTree getActiveTree()
        Returns reference to the active tree.
        Returns:
        active tree.
      • 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.
      • 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.
      • getTrees

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

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

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

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