Search in sources :

Example 6 with TabItemWithUrl

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

the class MainMenuItem method build.

/**
	 * Re-build main menu item
	 * (check if item is selected)
	 */
public void build() {
    Widget widget = new Widget();
    boolean enabled = (tabItem != null);
    // if menu item enabled - show hyperlink
    if (enabled) {
        widget = new Hyperlink(title, session.getTabManager().getLinkForTab(tabItem));
        widget.removeStyleName("mainMenuNotActive");
    // else show plain text
    } else {
        widget = new HTML(title);
        widget.addStyleName("mainMenuNotActive");
    }
    if (tabItem != null && session.getTabManager().getActiveTab() != null) {
        this.active = (tabItem.getUrlWithParameters().equals(((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters()));
        // IF ACTIVE TAB IS GROUP ADMIN - GROUPS
        if (((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(GroupsTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + tabItem.getUrl() + "?vo=")) {
            this.active = ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(GroupsTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + tabItem.getUrl() + "?vo=");
        }
        // hack for services tabs
        if (((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "list")) || ((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "detail")) || ((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "exec-view"))) {
            this.active = ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "list")) || ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "detail")) || ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "exec-view"));
        }
    } else {
        this.active = false;
    }
    if (active) {
        widget.addStyleName("mainMenuActive");
    } else {
        widget.removeStyleName("mainMenuActive");
    }
    this.widget = widget;
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) TabItemWithUrl(cz.metacentrum.perun.webgui.tabs.TabItemWithUrl) HTML(com.google.gwt.user.client.ui.HTML) Hyperlink(com.google.gwt.user.client.ui.Hyperlink)

Aggregations

TabItemWithUrl (cz.metacentrum.perun.webgui.tabs.TabItemWithUrl)6 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)1 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 CellTable (com.google.gwt.user.cellview.client.CellTable)1 HTML (com.google.gwt.user.client.ui.HTML)1 Hyperlink (com.google.gwt.user.client.ui.Hyperlink)1 Widget (com.google.gwt.user.client.ui.Widget)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 GetRequiredAttributesV2 (cz.metacentrum.perun.webgui.json.attributesManager.GetRequiredAttributesV2)1 SetAttributes (cz.metacentrum.perun.webgui.json.attributesManager.SetAttributes)1 GetAdminGroups (cz.metacentrum.perun.webgui.json.authzResolver.GetAdminGroups)1 GetRichAdminsWithAttributes (cz.metacentrum.perun.webgui.json.authzResolver.GetRichAdminsWithAttributes)1 UsersPublicationsTabItem (cz.metacentrum.perun.webgui.tabs.cabinettabs.UsersPublicationsTabItem)1 CreateFacilityResourceTabItem (cz.metacentrum.perun.webgui.tabs.resourcestabs.CreateFacilityResourceTabItem)1 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1