Search in sources :

Example 1 with SecurityTeamSelectTabItem

use of cz.metacentrum.perun.webgui.tabs.securitytabs.SecurityTeamSelectTabItem in project perun by CESNET.

the class MainMenu method prepare.

/**
	 * This MUST be called when GUI is loading
	 */
public void prepare() {
    // Clears previous
    this.sectionsMap.clear();
    this.sectionsIds.clear();
    this.menuStackPanel.clear();
    // Stack panel settings
    menuStackPanel.setWidth(MENU_WIDTH + "px");
    menuStackPanel.addStyleName("menuStackPanel");
    LargeIcons iconsLarge = LargeIcons.INSTANCE;
    int i = 0;
    // SECTION PERUN ADMIN
    if (session.isPerunAdmin()) {
        MainMenuSection perunAdmin = new MainMenuSection("Perun admin", new VosTabItem(), iconsLarge.perunIcon(), PERUN_ADMIN);
        this.sectionsMap.put(PERUN_ADMIN, perunAdmin);
        this.sectionsIds.put(PERUN_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildPerunAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(perunAdmin.getWidget(), perunAdmin.getHeader(), true);
    }
    // SECTION PERUN ADMIN
    if (session.isSecurityAdmin()) {
        MainMenuSection secAdmin = new MainMenuSection("Security admin", new SecurityTeamSelectTabItem(), iconsLarge.userPoliceEnglandIcon(), PERUN_ADMIN);
        this.sectionsMap.put(SECURITY_ADMIN, secAdmin);
        this.sectionsIds.put(SECURITY_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildSecurityAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(secAdmin.getWidget(), secAdmin.getHeader(), true);
    }
    // SECTION VO ADMIN
    if (session.isVoAdmin() || session.isVoObserver() || session.isPerunAdmin()) {
        MainMenuSection voAdmin = new MainMenuSection("VO manager", new VosSelectTabItem(), iconsLarge.buildingIcon(), VO_ADMIN);
        this.sectionsMap.put(VO_ADMIN, voAdmin);
        this.sectionsIds.put(VO_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildVoAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(voAdmin.getWidget(), voAdmin.getHeader(), true);
    }
    // SECTION GROUP ADMIN
    if (session.isGroupAdmin() || session.isVoAdmin() || session.isPerunAdmin()) {
        MainMenuSection groupAdmin = new MainMenuSection("Group manager", new GroupsTabItem(null), iconsLarge.groupIcon(), GROUP_ADMIN);
        this.sectionsMap.put(GROUP_ADMIN, groupAdmin);
        this.sectionsIds.put(GROUP_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildGroupAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(groupAdmin.getWidget(), groupAdmin.getHeader(), true);
    }
    // SECTION FACILITY ADMIN
    if (session.isFacilityAdmin() || session.isPerunAdmin()) {
        MainMenuSection facilityAdmin = new MainMenuSection("Facility manager", new FacilitiesSelectTabItem(), iconsLarge.databaseServerIcon(), FACILITY_ADMIN);
        this.sectionsMap.put(FACILITY_ADMIN, facilityAdmin);
        this.sectionsIds.put(FACILITY_ADMIN, i);
        Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            public void execute() {
                buildFacilityAdminMenu();
            }
        });
        i++;
        menuStackPanel.add(facilityAdmin.getWidget(), facilityAdmin.getHeader(), true);
    }
    // SECTION USER - ALWAYS
    MainMenuSection user = new MainMenuSection("User", null, iconsLarge.userGrayIcon(), USER);
    this.sectionsMap.put(USER, user);
    this.sectionsIds.put(USER, i);
    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        public void execute() {
            buildUserMenu();
        }
    });
    i++;
    menuStackPanel.add(user.getWidget(), user.getHeader(), true);
}
Also used : ScheduledCommand(com.google.gwt.core.client.Scheduler.ScheduledCommand) SecurityTeamSelectTabItem(cz.metacentrum.perun.webgui.tabs.securitytabs.SecurityTeamSelectTabItem) LargeIcons(cz.metacentrum.perun.webgui.client.resources.LargeIcons)

Aggregations

ScheduledCommand (com.google.gwt.core.client.Scheduler.ScheduledCommand)1 LargeIcons (cz.metacentrum.perun.webgui.client.resources.LargeIcons)1 SecurityTeamSelectTabItem (cz.metacentrum.perun.webgui.tabs.securitytabs.SecurityTeamSelectTabItem)1