use of cz.metacentrum.perun.webgui.tabs.cabinettabs.UsersPublicationsTabItem in project perun by CESNET.
the class SelfDetailTabItem method draw.
public Widget draw() {
this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(user.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);
if (user.isServiceUser()) {
menu.setWidget(0, 0, new Image(LargeIcons.INSTANCE.userRedIcon()));
} else {
menu.setWidget(0, 0, new Image(LargeIcons.INSTANCE.userGrayIcon()));
}
Label userName = new Label();
userName.setText(Utils.getStrippedStringWithEllipsis(user.getFullNameWithTitles(), 40));
userName.setStyleName("now-managing");
userName.setTitle(user.getFullNameWithTitles());
menu.setWidget(0, 1, userName);
menu.setHTML(0, 2, " ");
menu.getFlexCellFormatter().setWidth(0, 2, "25px");
int column = 3;
final TabItem tab = this;
final JsonCallbackEvents events = new JsonCallbackEvents() {
@Override
public void onFinished(JavaScriptObject jso) {
user = jso.cast();
tab.open();
tab.draw();
}
};
CustomButton change = new CustomButton("", "Edit user", SmallIcons.INSTANCE.applicationFormEditIcon());
change.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
session.getTabManager().addTabToCurrentTab(new EditUserDetailsTabItem(user, events));
}
});
menu.setWidget(0, column, change);
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
if (JsonUtils.isExtendedInfoVisible()) {
menu.setHTML(0, column, "<strong>ID:</strong><br/><span class=\"inputFormInlineComment\">" + user.getId() + "</span>");
column++;
menu.setHTML(0, column, " ");
menu.getFlexCellFormatter().setWidth(0, column, "25px");
column++;
}
String type = "Person";
type = user.isServiceUser() ? "Service" : "Person";
type = user.isSponsoredUser() ? "Sponsored" : "Person";
menu.setHTML(0, column, "<strong>User type:</strong><br/><span class=\"inputFormInlineComment\">" + type + "</span>");
dp.add(menu);
vp.add(dp);
vp.setCellHeight(dp, "30px");
tabPanel.clear();
SelfPersonalTabItem item = new SelfPersonalTabItem(user);
item.setParentPanel(tabPanel);
tabPanel.add(item, "Overview");
SelfVosTabItem vosTab = new SelfVosTabItem(user);
vosTab.setParentPanel(tabPanel);
tabPanel.add(vosTab, "VO settings");
tabPanel.add(new SelfResourcesSettingsTabItem(user), "Resources settings");
tabPanel.add(new SelfAuthenticationsTabItem(user), "Authentication");
if (!user.isServiceUser()) {
tabPanel.add(new UsersPublicationsTabItem(user), "Publications");
}
tabPanel.add(new SelfApplicationsTabItem(user), "Applications");
if (!user.isServiceUser()) {
tabPanel.add(new SelfServiceUsersTabItem(user), "Service identities");
} else {
tabPanel.add(new SelfServiceUsersTabItem(user), "Associated 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();
}
use of cz.metacentrum.perun.webgui.tabs.cabinettabs.UsersPublicationsTabItem in project perun by CESNET.
the class UserDetailTabItem method draw.
public Widget draw() {
titleWidget.setText(Utils.getStrippedStringWithEllipsis(user.getFullNameWithTitles().trim()) + ": Full details");
// main widget panel
VerticalPanel vp = new VerticalPanel();
vp.setWidth("100%");
// tab panel
tabPanel = new TabLayoutPanel(33, Unit.PX);
tabPanel.addStyleName("smallTabPanel");
final TabItem tab = this;
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
public void onSelection(SelectionEvent<Integer> event) {
UiElements.runResizeCommands(tab);
}
});
// information overview
final SimplePanel sp0 = new SimplePanel();
// VOs / Groups / active accounts
final SimplePanel sp1 = new SimplePanel();
// Resources
final SimplePanel sp2 = new SimplePanel();
// Facilities
final SimplePanel sp3 = new SimplePanel();
// Ext identities
final SimplePanel sp4 = new SimplePanel();
// Publications
final SimplePanel sp5 = new SimplePanel();
// Certificates, logins, passwords
final SimplePanel sp6 = new SimplePanel();
// Service identities
final SimplePanel sp7 = new SimplePanel();
// Sponsored users
final SimplePanel sp8 = new SimplePanel();
session.getUiElements().resizeSmallTabPanel(tabPanel, 100, this);
tabPanel.add(sp0, "Information overview");
tabPanel.add(sp1, "Vos, Groups, Accounts");
tabPanel.add(sp2, "Resources");
tabPanel.add(sp3, "Facilities");
tabPanel.add(sp4, "External identity");
tabPanel.add(sp5, "Publications");
tabPanel.add(sp6, "Certificates, Logins, Passwords");
if (user.isServiceUser()) {
tabPanel.add(sp7, "Associated users");
} else {
tabPanel.add(sp7, "Service identities");
}
if (user.isSponsoredUser()) {
tabPanel.add(sp8, "Sponsors");
} else if (!user.isServiceUser()) {
tabPanel.add(sp8, "Sponsored users");
}
sp0.setWidget(loadInformationOverview());
final TabItem publications = new UsersPublicationsTabItem(user);
tabPanel.addSelectionHandler(new SelectionHandler<Integer>() {
public void onSelection(SelectionEvent<Integer> event) {
UiElements.runResizeCommands(tab);
setLastTabId(event.getSelectedItem());
if (0 == event.getSelectedItem()) {
if (sp0.getWidget() == null) {
sp0.setWidget(loadInformationOverview());
}
} else if (1 == event.getSelectedItem()) {
if (sp1.getWidget() == null) {
sp1.setWidget(loadVosGroupsAccounts());
}
} else if (2 == event.getSelectedItem()) {
if (sp2.getWidget() == null) {
sp2.setWidget(loadResources());
}
} else if (3 == event.getSelectedItem()) {
if (sp3.getWidget() == null) {
sp3.setWidget(loadFacilities());
}
} else if (4 == event.getSelectedItem()) {
if (sp4.getWidget() == null) {
sp4.setWidget(loadExternalIdentities());
}
} else if (5 == event.getSelectedItem()) {
if (sp5.getWidget() == null) {
sp5.setWidget(publications.draw());
}
} else if (6 == event.getSelectedItem()) {
if (sp6.getWidget() == null) {
sp6.setWidget(loadCertificatesLoginsPasswords());
}
} else if (7 == event.getSelectedItem()) {
if (sp7.getWidget() == null) {
sp7.setWidget(loadServiceIdentities());
}
} else if (8 == event.getSelectedItem()) {
if (sp8.getWidget() == null) {
sp8.setWidget(loadSponsoredUsers());
}
}
;
}
});
// TODO remove after replacement to TabPanelForTabItems
UiElements.addResizeCommand(new Command() {
public void execute() {
UiElements.runResizeCommands(publications);
}
}, this);
// select and trigger onSelect event
tabPanel.selectTab(getLastTabId(), true);
session.getUiElements().resizePerunTable(tabPanel, 100, this);
// add tabs to the main panel
vp.add(tabPanel);
this.contentWidget.setWidget(vp);
return getWidget();
}
use of cz.metacentrum.perun.webgui.tabs.cabinettabs.UsersPublicationsTabItem in project perun by CESNET.
the class MainMenu method buildUserMenu.
/**
* Rebuild whole USER menu
*/
private void buildUserMenu() {
MainMenuSection menu = sectionsMap.get(USER);
if (menu == null)
return;
// !! menu link must lead always only to "OWN ROLE" of logged user !!
User user = session.getActiveUser();
menu.clear();
TabItemWithUrl changer = null;
TabItemWithUrl detail = null;
TabItemWithUrl settings = null;
TabItemWithUrl resources = null;
TabItemWithUrl authentications = null;
TabItemWithUrl applications = null;
TabItemWithUrl publications = null;
TabItemWithUrl services = null;
TabItemWithUrl sponsored = null;
if (user != null) {
detail = new SelfDetailTabItem(user);
settings = new SelfVosTabItem(user);
resources = new SelfResourcesSettingsTabItem(user);
authentications = new SelfAuthenticationsTabItem(user);
if (!user.isServiceUser()) {
// publications can be reported by normal people only
publications = new UsersPublicationsTabItem(user);
}
applications = new SelfApplicationsTabItem(user);
if (session.getEditableUsers().size() > 1) {
services = new SelfServiceUsersTabItem(user);
}
if (session.getEditableSponsoredUsers().size() > 0) {
sponsored = new SelfSponsoredUsersTabItem(user);
}
} else {
detail = new IdentitySelectorTabItem();
}
// display user changer for PerunAdmin or user with service identities
if (session.isPerunAdmin() || session.getEditableUsers().size() > 1) {
changer = new IdentitySelectorTabItem();
}
menu.addItem(new MainMenuItem("Select identity", changer, SmallIcons.INSTANCE.userGrayIcon()));
menu.addSplitter();
menu.setTabItem(detail);
menu.addItem(new MainMenuItem((user != null) ? user.getFullNameWithTitles() : "My profile", detail, SmallIcons.INSTANCE.userGrayIcon()));
menu.addItem(new MainMenuItem("VO settings", settings, SmallIcons.INSTANCE.buildingIcon()));
menu.addItem(new MainMenuItem("Resources settings", resources, SmallIcons.INSTANCE.settingToolsIcon()));
menu.addItem(new MainMenuItem("Authentication", authentications, SmallIcons.INSTANCE.keyIcon()));
menu.addItem(new MainMenuItem("Publications", publications, SmallIcons.INSTANCE.booksIcon()));
menu.addItem(new MainMenuItem("Applications", applications, SmallIcons.INSTANCE.applicationFromStorageIcon()));
if (user.isServiceUser()) {
menu.addItem(new MainMenuItem("Associated users", services, SmallIcons.INSTANCE.userRedIcon()));
if (user.isSponsoredUser()) {
menu.addItem(new MainMenuItem("Sponsors", sponsored, SmallIcons.INSTANCE.userGrayIcon()));
}
} else {
menu.addItem(new MainMenuItem("Service identities", services, SmallIcons.INSTANCE.userRedIcon()));
if (user.isSponsoredUser()) {
menu.addItem(new MainMenuItem("Sponsors", sponsored, SmallIcons.INSTANCE.userGrayIcon()));
} else {
menu.addItem(new MainMenuItem("Sponsored users", sponsored, SmallIcons.INSTANCE.userGrayIcon()));
}
}
menuStackPanel.setStackText(sectionsIds.get(USER), menu.getHeader(), true);
}
Aggregations