use of cz.metacentrum.perun.webgui.json.authzResolver.AddAdmin in project perun by CESNET.
the class AddFacilityManagerGroupTabItem method fillGroupsContent.
private Widget fillGroupsContent(GetAllGroups groups, TabMenu tabMenu, final ListBoxWithObjects<VirtualOrganization> box) {
getAllGroups = groups;
getAllGroups.setCoreGroupsCheckable(true);
final CellTable<Group> table = getAllGroups.getTable();
getAllGroups.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
private boolean found = false;
@Override
public void onSelectionChange(SelectionChangeEvent event) {
for (Group g : getAllGroups.getTableSelectedList()) {
if (g.isCoreGroup()) {
if (!found) {
// display only once
UiElements.generateInfo("You have selected 'all vo members' group", "If this group will be added as 'manager group', all new members of VO " + box.getSelectedObject().getName() + " will be automatically managers of your Facility and all removed members will lose management rights.");
}
found = true;
return;
}
}
found = false;
}
});
final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedManagersGroupToGroup());
tabMenu.addWidget(0, addButton);
final TabItem tab = this;
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
ArrayList<Group> list = getAllGroups.getTableSelectedList();
if (UiElements.cantSaveEmptyListDialogBox(list)) {
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
// close tab and refresh table
if (refreshEvents != null)
refreshEvents.onFinished(null);
session.getTabManager().closeTab(tab, false);
}
}));
request.addFacilityAdminGroup(facility, list.get(i));
} else {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton));
request.addFacilityAdminGroup(facility, list.get(i));
}
}
}
}
});
addButton.setEnabled(false);
JsonUtils.addTableManagedButton(getAllGroups, table, addButton);
// add a class to the table and wrap it into scroll panel
table.addStyleName("perun-table");
return table;
}
use of cz.metacentrum.perun.webgui.json.authzResolver.AddAdmin in project perun by CESNET.
the class AddVoManagerGroupTabItem method fillGroupsContent.
private Widget fillGroupsContent(GetAllGroups groups, TabMenu tabMenu, final ListBoxWithObjects<VirtualOrganization> box) {
getAllGroups = groups;
getAllGroups.setCoreGroupsCheckable(true);
final CellTable<Group> table = getAllGroups.getTable();
getAllGroups.getSelectionModel().addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
private boolean found = false;
@Override
public void onSelectionChange(SelectionChangeEvent event) {
for (Group g : getAllGroups.getTableSelectedList()) {
if (g.isCoreGroup()) {
if (!found) {
// display only once
UiElements.generateInfo("You have selected 'all vo members' group", "If this group will be added as 'manager group', all new members of VO " + box.getSelectedObject().getName() + " will be automatically managers of your VO and all removed members will lose management rights.");
}
found = true;
return;
}
}
found = false;
}
});
final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedManagersGroupToVo());
tabMenu.addWidget(0, addButton);
final TabItem tab = this;
addButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
ArrayList<Group> list = getAllGroups.getTableSelectedList();
if (UiElements.cantSaveEmptyListDialogBox(list)) {
for (int i = 0; i < list.size(); i++) {
if (i == list.size() - 1) {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton, new JsonCallbackEvents() {
public void onFinished(JavaScriptObject jso) {
// close tab and refresh table
if (refreshEvents != null)
refreshEvents.onFinished(null);
session.getTabManager().closeTab(tab, false);
}
}));
request.addVoAdminGroup(vo, list.get(i));
} else {
AddAdmin request = new AddAdmin(JsonCallbackEvents.disableButtonEvents(addButton));
request.addVoAdminGroup(vo, list.get(i));
}
}
}
}
});
addButton.setEnabled(false);
JsonUtils.addTableManagedButton(getAllGroups, table, addButton);
// add a class to the table and wrap it into scroll panel
table.addStyleName("perun-table");
return table;
}
Aggregations