Nevron Open Vision Documentation
Diagram / Diagram DOM / Libraries / Library Browser
In This Topic
    Library Browser
    In This Topic
     About Library Browser

    The library browser is represented by the NLibraryBrowser class. It is a widget which is designed to display the content of multiple libraries.

    To do that it aggregates a NLibraryNavigationBar (which is a customized Navigation Bar), the panes of which are NLibraryPane instances (derived from NNavigationBarPane class). The navigation bar of a library browser is exposed by the NavigationBar property. The content of each library pane is an instance of the NLibraryView class (see Library View and Library Document for more information).

     Library Panes

    As mentioned, the library navigation bar is populated with panes that derive from the NLibraryPane base abstract class.

    Essentially the base library pane class provides the library browser with the ability to load on-demand the library view that is contained inside the pane by calling the EnsureContentLoaded() abstract method. In this way library panes that can load their content on-demand, are only doing so when they are displayed inside the library browser. This increases the performance of the library browser when it has to manage many library views.

    Currently there are two subtypes of the library panes:

    • NShapeFactoryLibraryPane - this type of pane creates a library view for the shapes that a specific shape factory can create. The library view is deferly loaded, meaning that the content of the library pane may be null, until you call the EnsureContentLoaded() method. The library browser exposes the following methods that help you create shape factory library panes inside it:

      Method Description

      NShapeFactoryLibraryPane AddLibraryPane(NShapeFactory shapesFactory)

      Adds a library pane that displays the shapes produced by the specified shapes factory.

      NShapeFactoryLibraryPane AddXXXLibraryPane() methods

      The group of methods adds a library pane that displays the shapes produced by a specific shapes factory. For example AddBasicShapesLibraryPane(), AddFlowChartingShapesLibraryPane() etc.

      The user can load shape factory library panes by clicking on the New Library command in the toolbar and then selecting the Predefined Library option. If you want to customize the shape factories from which the user can choose from you can assign a function to the GetPredefinedShapeFactoriesDelegate that needs to return the shape factories from which the user can choose from. The following example lets the user choose from the basic and connector factory options:

      Customizing the Predefined Libraries from which the user can choose
      Copy Code
      libraryBrowser.GetPredefinedShapeFactoriesDelegate = delegate()
      {
          return new NShapeFactory[] { new NBasicShapesFactory(), new NConnectorShapesFactory() };
      };
      
       
    • NUserLibraryPane - this type of library pane displays a user created library view. You can use it to display any custom library. The library browser exposes the following methods that help you create user library panes:

      Method Description

      NUserLibraryPane AddLibraryPane(NLibraryView libraryView, NImage smallImage, NImage largeImage)

      Adds a user library pane the content of which is the specified library view. The small and large images are the images displayed for the two states of the navigation pane.

      NUserLibraryPane AddLibraryPane(NLibrary library, NImage smallImage, NImage largeImage)

      Adds a user library pane the content of which is a library view that displays the specified library element. The small and large images are the images displayed for the two states of the navigation pane.

      NUserLibraryPane NewLibraryPane()

      Adds a new library pane the content of which is an empty library.

      void OpenLibraryPane()

      Opens a library pane by first asking the user to select a library document file and then loading the library inside a new library pane.

      NUserLibraryPane OpenLibraryPane(string fileName)

      Opens a library pane that contains a library document loaded from the specified file name.

     

     Library Browser Toolbar

    The library browser has a toolbar that provides the user with commands that help him manage the libraries displayed by the library navigation bar. This toolbar is accessible from the ToolBar property of the NLibraryBrowser and has the following commands: 

    Commands that manage the displayed libraries

    • New Library - a command that lets you create a new custom library inside the library browser, or create a predefined library from the already existing shape factories.
    • Open Library - shows the Open File dialog and allows the user to open an already existing library from an .nlx file.
    • Save Library - shows the Save File dialog and allows the user to save the currently viewed library in an .nlx file.
    • Close Library - closes the currently viewed library (removes it from the library browser).

    Commands that control the libraries view type

    • Icons View Type - switches the view type of all libraries to Icons
    • List View Type - switches the view type of all libraries to List
    • Thumbnails View Type - switches the view type of all libraries to Thumbnails

    Commands that control the libraries display order

    • Default Display Order - switches the display order of all libraries to Default.
    • Name Ascending Display Order - switches the display order of all libraries to Name Ascending.
    • Name Descending Display Order - switches the display order of all libraries to Name Descending.

     

     Libraries View Type 

    The library browser controls the ViewType of all libraries displayed by it via the LibraryViewType property. Internally the browser sets the ViewType property of the currently selected library to the value specified by the LibraryViewType property. The following code example switches all libraries to Thumbnails view:

    Changing the library view type
    Copy Code
    libraryBrowser.LibraryViewType = ENLibraryViewType.Thumbnails;
    
    By default libraries are displayed in Icons view.
     Libraries Display Order

    The library browser controls the DisplayOrder of all libraries displayed by it via the LibraryDisplayOrder property. Internally the browser sets the DisplayOrder property of the currently selected library to the value specified by the LibraryDisplayOrder property. The following code example switches all libraries to NameAscending display order:

    Changing the library display order
    Copy Code
    libraryBrowser.LibraryDisplayOrder = ENLibraryDisplayOrder.NameAscending;