Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

DocGenerator API: setting the menus



This article presents how to set the content of the wiki menus through docJGenerator API.

Overview

The DocGeneratorAPI.getMenus() method allows to access and configure the menus.

The DocGeneratorAPI.cleanGlobalLeftMenu() define the same content for the left menu on the the index and articles, then clean the default content.

For example:
   DocGeneratorAPI api = new DocGeneratorAPI();
   api.createModel();
   api.setOutputDirectory(<the wiki directory>);
         
   XMLMenu menu = api.cleanGlobalLeftMenu(); // have the same content for the left menu on the index and articles, and clean the content of the left menu

Adding an item in a menu

Adding a default item in a menu

The DocGeneratorAPI.addDefaultMenuItem(XMLMenu, short, String) and DocGeneratorAPI.addDefaultMenuItem(XMLMenu, short) add a default menu item in the left menu.

The types for the default menu items are: For example:
  DocGeneratorAPI api = new DocGeneratorAPI();
  api.createModel();
  api.setOutputDirectory(<the wiki directory>);
         
  ArticlesMenus menus = api.getMenus(); // get the menus
  XMLMenu menu = menus.cleanGlobalLeftMenu(); // have the same content for the left menu on the index and articles, and clean the content of the left menu
      
  api.addDefaultMenuItem(menu, DefaultMenuItem.DICTIONARY); // add a default menu item for the dictionary

Adding an internal item in a menu

The following methods: add a menu item which links to a specifed article.

For example:
   DocGeneratorAPI api = new DocGeneratorAPI();
   api.createModel();
   api.setOutputDirectory(<the wiki directory>);
         
   ArticlesMenus menus = api.getMenus(); // get the menus
   XMLMenu menu = menus.cleanGlobalLeftMenu(); // have the same content for the left menu on the index and articles, and clean the content of the left menu
      
   XMLArticle article = api.createArticle("the article");
   api.addInternalMenuItem(menu, article);

Adding an external item in a menu

The DocGeneratorAPI.addExternalMenuItem(XMLMenu, String, URL) add a menu item which links to a specified URL.

For example:
  DocGeneratorAPI api = new DocGeneratorAPI();
  api.createModel();
  api.setOutputDirectory(<the wiki directory>);
         
  ArticlesMenus menus = api.getMenus(); // get the menus
  XMLMenu menu = menus.cleanGlobalLeftMenu(); // have the same content for the left menu on the index and articles, and clean the content of the left menu
      
  URL url = new URL("http://sourceforge.net/projects/docjgenerator/");
  api.addExternalMenuItem(menu, "Sourceforge", url);

See also


Categories: api

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.