Package org.apache.marmotta.platform.core.model.template

Examples of org.apache.marmotta.platform.core.model.template.MenuItem


    /**
     * build menu
     * @return
     */
    private MenuItem buildMenu() {
        MenuItem menu = new MenuItem("MENU", MenuItemType.ROOT);

        for(String container_string : moduleService.listSortedContainers()) {
            MenuItem container = new MenuItem(container_string, MenuItemType.CONTAINER);

            //add modules
            for(String module_string : moduleService.listSortedModules(container_string)) {
                MenuItem module = new MenuItem(module_string, MenuItemType.MODULE);
                module.set("path",moduleService.getModuleWeb(module_string));
                if(moduleService.getIcon(module_string) != null)
                    module.set("icon",moduleService.getIcon(module_string));

                //add pages
                for(HashMap<String,String> page_object : moduleService.getAdminPageObjects(module_string)) {
                    MenuItem page = new MenuItem(page_object.get("title"), MenuItemType.PAGE);
                    page.set("path",page_object.get("link"));
                    module.addItem(page);
                }

                //add webservice
                if(!moduleService.getWebservices(module_string).isEmpty()) {
                    MenuItem page = new MenuItem(TemplatingService.DEFAULT_WEBSERVICE_TITLE, MenuItemType.WEBSERVICE);
                    page.set("path",module.get("path")+TemplatingService.DEFAULT_REST_PATH+TemplatingService.DEFAULT_REST_FILE);
                    module.addItem(page);
                }

                //add if there are pages to display
                if(!module.isEmpty()) container.addItem(module);
View Full Code Here


    /**
     * build menu
     * @return
     */
    private MenuItem buildMenu() {
        MenuItem menu = new MenuItem("MENU", MenuItemType.ROOT);

        for(String container_string : moduleService.listSortedContainers()) {
            MenuItem container = new MenuItem(container_string, MenuItemType.CONTAINER);

            //add modules
            for(String module_string : moduleService.listSortedModules(container_string)) {
                MenuItem module = new MenuItem(module_string, MenuItemType.MODULE);
                module.set("path",moduleService.getModuleWeb(module_string));
                if(moduleService.getIcon(module_string) != null)
                    module.set("icon",moduleService.getIcon(module_string));

                //add pages
                for(HashMap<String,String> page_object : moduleService.getAdminPageObjects(module_string)) {
                    MenuItem page = new MenuItem(page_object.get("title"), MenuItemType.PAGE);
                    page.set("path",page_object.get("link"));
                    module.addItem(page);
                }

                //add webservice
                if(!moduleService.getWebservices(module_string).isEmpty()) {
                    MenuItem page = new MenuItem(TemplatingService.DEFAULT_WEBSERVICE_TITLE, MenuItemType.WEBSERVICE);
                    page.set("path",module.get("path")+TemplatingService.DEFAULT_REST_PATH+TemplatingService.DEFAULT_REST_FILE);
                    module.addItem(page);
                }

                //add if there are pages to display
                if(!module.isEmpty()) container.addItem(module);
View Full Code Here

            //build structure
            for(String module : menuSorted) {
                String path = configurationService.getPath() + moduleService.getModuleWeb(module);
                if(moduleHasAdminPages(module)) {
                    MenuItem menu_item = new MenuItem();
                    menu_item.getProperties().put("title",module);
                    menu_item.getProperties().put("baseurl",moduleService.getModuleConfiguration(module).getConfiguration().getString("baseurl","/"+module));
                    for(String page : moduleService.getAdminPages(module)) {
                        if(page.equals("")) {
                            continue;
                        }
                        MenuItem submenu = new MenuItem();
                        submenu.getProperties().put("title",getNameFromPath(page));
                        submenu.getProperties().put("path",path+page);
                        //test if it is active
                        menu_item.getSubmenu().add(submenu);
                        path_titles.put(path+page,page);
                    }
                    if(moduleService.getWebservices(module)!=null &&
                            !moduleService.getWebservices(module).isEmpty() &&
                            !moduleService.getWebservices(module).iterator().next().equals("")) {
                        MenuItem submenu = new MenuItem();
                        submenu.getProperties().put("title",DEFAULT_TITLE_FOR_WEBSERVICES);
                        submenu.getProperties().put("path",path+DEFAULT_REST_PATH+DEFAULT_REST_FILE);
                        //test if it is active
                        menu_item.getSubmenu().add(submenu);
                        path_titles.put(path+DEFAULT_REST_PATH+DEFAULT_REST_FILE,DEFAULT_TITLE_FOR_WEBSERVICES);
                    }
                    menuItems.add(menu_item);
View Full Code Here

TOP

Related Classes of org.apache.marmotta.platform.core.model.template.MenuItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.