Package org.apache.rave.portal.web.model

Examples of org.apache.rave.portal.web.model.NavigationMenu


        log.debug("viewName: " + viewName);
        return viewName;
    }

    public static void addNavItemsToModel(String view, Model model, String referringPageId, User user) {
        final NavigationMenu topMenu = getTopMenu(view, referringPageId, user, true);
        model.addAttribute(topMenu.getName(), topMenu);
    }
View Full Code Here


        final NavigationMenu topMenu = getTopMenu(view, referringPageId, user, true);
        model.addAttribute(topMenu.getName(), topMenu);
    }

    public static void addNavItemsToModel(String view, Model model, String referringPageId, User user, boolean addStore) {
        final NavigationMenu topMenu = getTopMenu(view, referringPageId, user, addStore);
        model.addAttribute(topMenu.getName(), topMenu);
    }
View Full Code Here

        final NavigationMenu topMenu = getTopMenu(view, referringPageId, user, addStore);
        model.addAttribute(topMenu.getName(), topMenu);
    }
   
    public static NavigationMenu getTopMenu(String view, String referringPageId, User user, boolean addStoreLink) {
        NavigationMenu menu = new NavigationMenu("topnav");
        if(view.startsWith(ViewNames.PAGE) || view.startsWith(ViewNames.MOBILE_HOME)) {
            NavigationItem profile = new NavigationItem("page.profile.title", getDisplayName(user), "/app/person/id/" + user.getId() + "?referringPageId=" + referringPageId);
            menu.addNavigationItem(profile);

            if(addStoreLink){
                NavigationItem store = new NavigationItem("page.store.title", null, "/app/store?referringPageId=" + referringPageId);
                menu.addNavigationItem(store);
            }
            NavigationItem admin = getAdminItem(referringPageId);
            menu.addNavigationItem(admin);

            NavigationItem logout = getLogoutItem();
            menu.addNavigationItem(logout);
        } else if (view.startsWith(ViewNames.STORE)) {
            NavigationItem addWidget = new NavigationItem("page.addwidget.title", null, "/app/store/widget/add?referringPageId=" + referringPageId);
            menu.addNavigationItem(addWidget);

            NavigationItem back = getBackItem(referringPageId);
            menu.addNavigationItem(back);

            NavigationItem admin = getAdminItem(referringPageId);
            menu.addNavigationItem(admin);

            NavigationItem logout = getLogoutItem();
            menu.addNavigationItem(logout);
        } else if (view.startsWith(ViewNames.PERSON_PROFILE) || view.startsWith(ViewNames.USER_NOT_FOUND)) {
            NavigationItem back = getBackItem(referringPageId);
            menu.addNavigationItem(back);

            NavigationItem admin = getAdminItem(referringPageId);
            menu.addNavigationItem(admin);

            NavigationItem logout = getLogoutItem();
            menu.addNavigationItem(logout);
        }
        else if (view.startsWith(ViewNames.ADD_WIDGET_FORM) || view.startsWith(ViewNames.WIDGET)) {
            if(view.equals(ViewNames.WIDGET_MARKETPLACE)){
                NavigationItem addWidget = new NavigationItem("page.widget.backToMarketplace", null, "/app/marketplace?referringPageId=" + referringPageId);
                menu.addNavigationItem(addWidget);
            }
            NavigationItem addWidget = new NavigationItem("page.widget.backToStore", null, "/app/store?referringPageId=" + referringPageId);
            menu.addNavigationItem(addWidget);

            NavigationItem back = getBackItem(referringPageId);
            menu.addNavigationItem(back);

            NavigationItem admin = getAdminItem(referringPageId);
            menu.addNavigationItem(admin);

            NavigationItem logout = getLogoutItem();
            menu.addNavigationItem(logout);
        }

        return menu;
    }
View Full Code Here

      model.addAttribute(ModelKeys.REFERRING_PAGE_ID, referringPageId);
    }

    public static void addNavItemsToModel(String view, ModelMap model, String referringPageId, User user, List<Person> friendRequests) {
        String refPageId = referringPageId != null ? referringPageId : "";
        final NavigationMenu topMenu = new NavigationMenu("topnav");

        if(friendRequests != null){
            NavigationItem friendRequestItems = new NavigationItem("page.profile.friend.requests", String.valueOf(friendRequests.size()) , "#");
            for(Person request : friendRequests) {
                NavigationItem childItem = new NavigationItem((request.getDisplayName()!=null && !request.getDisplayName().isEmpty())? request.getDisplayName() : request.getUsername(), request.getUsername(), "#");
                friendRequestItems.addChildNavigationItem(childItem);
            }

            topMenu.addNavigationItem(friendRequestItems);
        }
      topMenu.getNavigationItems().addAll((ControllerUtils.getTopMenu(view, refPageId, user, false).getNavigationItems()));

      model.addAttribute(topMenu.getName(), topMenu);
    }
View Full Code Here

    static boolean isCreateDeleteOrUpdate(String action){
        return "create".equals(action) || isDeleteOrUpdate(action);
    }

    static void addNavigationMenusToModel(String selectedItem, Model model,  String referringPageId) {
        final NavigationMenu topMenu = getTopMenu(referringPageId);
        model.addAttribute(topMenu.getName(), topMenu);
        final NavigationMenu tabMenu = getTabMenu(selectedItem, referringPageId);
        model.addAttribute(tabMenu.getName(), tabMenu);
    }
View Full Code Here

        model.addAttribute(tabMenu.getName(), tabMenu);
    }

    // For the time being hard coded NavigationMenu's
    private static NavigationMenu getTopMenu(String referringPageId) {
        NavigationMenu menu = new NavigationMenu("topnav");

        NavigationItem logout = new NavigationItem("page.general.logout", null, "/j_spring_security_logout");
        menu.addNavigationItem(logout);

        NavigationItem raveHome = new NavigationItem();
        raveHome.setName("page.general.back");

        if (referringPageId != null && !referringPageId.isEmpty()) {
            raveHome.setUrl("/app/page/view/" + referringPageId);
        } else {
            raveHome.setUrl("/");
        }
        menu.addNavigationItem(raveHome);

        return menu;
    }
View Full Code Here

        return menu;
    }

    private static NavigationMenu getTabMenu(String selectedItem, String referringPageId) {
        NavigationMenu menu = new NavigationMenu("tabs");

        NavigationItem home = new NavigationItem("admin.home.shorttitle", null, null);
        home.setSelected("home".equals(selectedItem));


        NavigationItem users = new NavigationItem("admin.users.shorttitle", null, null);
        users.setSelected("users".equals(selectedItem));


        NavigationItem widgets = new NavigationItem("admin.widgets.shorttitle", null, null);
        widgets.setSelected("widgets".equals(selectedItem));


        NavigationItem preferences = new NavigationItem("admin.preferences.shorttitle", null, null);
        preferences.setSelected("preferences".equals(selectedItem));


        NavigationItem categories = new NavigationItem("admin.category.shortTitle", null, null);
        categories.setSelected("categories".equals(selectedItem));

        // set url of nav items with or without the referring page id
        if (referringPageId != null && !referringPageId.isEmpty()) {
            home.setUrl("/app/admin?referringPageId=" + referringPageId);
            users.setUrl("/app/admin/users?referringPageId=" + referringPageId);
            widgets.setUrl("/app/admin/widgets?referringPageId=" + referringPageId);
            preferences.setUrl("/app/admin/preferences?referringPageId=" + referringPageId);
            categories.setUrl("/app/admin/categories?referringPageId=" + referringPageId);
        } else {
            home.setUrl("/app/admin");
            users.setUrl("/app/admin/users");
            widgets.setUrl("/app/admin/widgets");
            preferences.setUrl("/app/admin/preferences");
            categories.setUrl("/app/admin/categories");
        }

        // add nav items to menu
        menu.addNavigationItem(home);
        menu.addNavigationItem(users);
        menu.addNavigationItem(widgets);
        menu.addNavigationItem(preferences);
        menu.addNavigationItem(categories);

        return menu;
    }
View Full Code Here

    static boolean isCreateDeleteOrUpdate(String action){
        return "create".equals(action) || isDeleteOrUpdate(action);
    }

    static void addNavigationMenusToModel(String selectedItem, Model model) {
        final NavigationMenu topMenu = getTopMenu();
        model.addAttribute(topMenu.getName(), topMenu);
        final NavigationMenu tabMenu = getTabMenu(selectedItem);
        model.addAttribute(tabMenu.getName(), tabMenu);
    }
View Full Code Here

        model.addAttribute(tabMenu.getName(), tabMenu);
    }

    // For the time being hard coded NavigationMenu's
    private static NavigationMenu getTopMenu() {
        NavigationMenu menu = new NavigationMenu("topnav");

        NavigationItem raveHome = new NavigationItem("page.general.back", "/");
        menu.addNavigationItem(raveHome);

        NavigationItem logout = new NavigationItem("page.general.logout", "/j_spring_security_logout");
        menu.addNavigationItem(logout);

        return menu;
    }
View Full Code Here

        return menu;
    }

    private static NavigationMenu getTabMenu(String selectedItem) {
        NavigationMenu menu = new NavigationMenu("tabs");

        NavigationItem home = new NavigationItem("admin.home.shorttitle", "/app/admin/");
        home.setSelected("home".equals(selectedItem));
        menu.addNavigationItem(home);

        NavigationItem users = new NavigationItem("admin.users.shorttitle", "/app/admin/users");
        users.setSelected("users".equals(selectedItem));
        menu.addNavigationItem(users);

        NavigationItem widgets = new NavigationItem("admin.widgets.shorttitle", "/app/admin/widgets");
        widgets.setSelected("widgets".equals(selectedItem));
        menu.addNavigationItem(widgets);

        NavigationItem preferences = new NavigationItem("admin.preferences.shorttitle", "/app/admin/preferences");
        preferences.setSelected("preferences".equals(selectedItem));
        menu.addNavigationItem(preferences);

        NavigationItem categories = new NavigationItem("admin.category.shortTitle", "/app/admin/categories");
        categories.setSelected("categories".equals(selectedItem));
        menu.addNavigationItem(categories);

        return menu;
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.web.model.NavigationMenu

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.