Search in sources :

Example 16 with UserDetailTabItem

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

the class MemberDetailTabItem method draw.

public Widget draw() {
    this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()));
    // main panel
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // The table
    AbsolutePanel dp = new AbsolutePanel();
    //dp.setStyleName("decoration");
    final FlexTable menu = new FlexTable();
    menu.setCellSpacing(5);
    menu.setWidget(0, 0, new Image(LargeIcons.INSTANCE.userGreenIcon()));
    Label memberName = new Label();
    memberName.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles(), 40));
    memberName.setStyleName("now-managing");
    memberName.setTitle(member.getUser().getFullNameWithTitles());
    menu.setWidget(0, 1, memberName);
    int column = 2;
    menu.setHTML(0, column, " ");
    menu.getFlexCellFormatter().setWidth(0, column, "25px");
    column++;
    if (JsonUtils.isExtendedInfoVisible()) {
        menu.setHTML(0, column, "<strong>Member ID:</strong><br/><span class=\"inputFormInlineComment\">" + member.getId() + "</span>");
        column++;
        menu.setHTML(0, column, "&nbsp;");
        menu.getFlexCellFormatter().setWidth(0, column, "25px");
        column++;
        menu.setHTML(0, column, "<strong>User ID:</strong><br/><span class=\"inputFormInlineComment\">" + member.getUser().getId() + "</span>");
        column++;
        menu.setHTML(0, column, "&nbsp;");
        menu.getFlexCellFormatter().setWidth(0, column, "25px");
        column++;
    }
    Anchor a = new Anchor("See user detail >>");
    a.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().addTab(new UserDetailTabItem(member.getUser()));
        }
    });
    if (session.isPerunAdmin()) {
        menu.setWidget(0, column, a);
    }
    dp.add(menu);
    vp.add(dp);
    vp.setCellHeight(dp, "30px");
    tabPanel.clear();
    tabPanel.add(new MemberOverviewTabItem(member, groupId), "Overview");
    tabPanel.add(new MemberGroupsTabItem(member, groupId), "Groups");
    tabPanel.add(new MemberResourcesTabItem(member, groupId), "Resources");
    tabPanel.add(new MemberApplicationsTabItem(member, groupId), "Applications");
    tabPanel.add(new MemberSettingsTabItem(member, groupId), "Settings");
    if (member.getUser().isServiceUser()) {
        tabPanel.add(new MemberServiceUsersTabItem(member, groupId), "Associated users");
    } else {
        tabPanel.add(new MemberServiceUsersTabItem(member, groupId), "Service identities");
    }
    if (member.getUser().isSponsoredUser()) {
        tabPanel.add(new MemberSponsoredUsersTabItem(member, groupId), "Sponsors");
    } else if (!member.getUser().isSponsoredUser() && !member.getUser().isServiceUser()) {
        tabPanel.add(new MemberSponsoredUsersTabItem(member, groupId), "Sponsored users");
    }
    // Resize must be called after page fully displays
    Scheduler.get().scheduleDeferred(new Command() {

        @Override
        public void execute() {
            tabPanel.finishAdding();
        }
    });
    vp.add(tabPanel);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Command(com.google.gwt.user.client.Command)

Example 17 with UserDetailTabItem

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

the class MemberServiceUsersTabItem method draw.

public Widget draw() {
    if (member.getUser().isServiceUser()) {
        this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": associated users");
    } else {
        this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": service identities");
    }
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    // MENU
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    menu.addWidget(UiElements.getRefreshButton(this));
    if (member.getUser().isServiceUser()) {
        // request
        final GetUsersBySpecificUser request = new GetUsersBySpecificUser(member.getUserId());
        request.setCheckable(false);
        // table
        CellTable<User> table;
        if (session.isPerunAdmin()) {
            table = request.getTable(new FieldUpdater<User, String>() {

                public void update(int i, User user, String s) {
                    session.getTabManager().addTab(new UserDetailTabItem(user));
                }
            });
        } else {
            table = request.getTable();
        }
        table.addStyleName("perun-table");
        table.setWidth("100%");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        vp.add(sp);
    } else {
        final GetSpecificUsersByUser request = new GetSpecificUsersByUser(member.getUserId());
        request.setCheckable(false);
        request.setHideSponsored(true);
        // table
        CellTable<User> table;
        if (session.isPerunAdmin()) {
            table = request.getTable(new FieldUpdater<User, String>() {

                public void update(int i, User user, String s) {
                    session.getTabManager().addTab(new UserDetailTabItem(user));
                }
            });
        } else {
            table = request.getTable();
        }
        table.addStyleName("perun-table");
        table.setWidth("100%");
        ScrollPanel sp = new ScrollPanel(table);
        sp.addStyleName("perun-tableScrollPanel");
        vp.add(sp);
    }
    contentWidget.setWidget(vp);
    return getWidget();
}
Also used : FieldUpdater(com.google.gwt.cell.client.FieldUpdater) GetUsersBySpecificUser(cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser) User(cz.metacentrum.perun.webgui.model.User) GetSpecificUsersByUser(cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser) GetSpecificUsersByUser(cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) GetUsersBySpecificUser(cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu)

Aggregations

UserDetailTabItem (cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem)17 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)15 User (cz.metacentrum.perun.webgui.model.User)15 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)12 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)12 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)12 ArrayList (java.util.ArrayList)12 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)11 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)10 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)8 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)6 FindCompleteRichUsers (cz.metacentrum.perun.webgui.json.usersManager.FindCompleteRichUsers)6 RemoveAdmin (cz.metacentrum.perun.webgui.json.authzResolver.RemoveAdmin)5 ExtendedTextBox (cz.metacentrum.perun.webgui.widgets.ExtendedTextBox)5 AddAdmin (cz.metacentrum.perun.webgui.json.authzResolver.AddAdmin)4 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)2 GetBlacklistWithDescription (cz.metacentrum.perun.webgui.json.securityTeamsManager.GetBlacklistWithDescription)2 GetSpecificUsersByUser (cz.metacentrum.perun.webgui.json.usersManager.GetSpecificUsersByUser)2 GetUsersBySpecificUser (cz.metacentrum.perun.webgui.json.usersManager.GetUsersBySpecificUser)2 Pair (cz.metacentrum.perun.webgui.model.Pair)2