Search in sources :

Example 1 with RemoveGroupsFromAutoRegistration

use of cz.metacentrum.perun.webgui.json.registrarManager.RemoveGroupsFromAutoRegistration in project perun by CESNET.

the class AutoRegistrationGroupsTabItem method draw.

@Override
public Widget draw() {
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    menu.addWidget(UiElements.getRefreshButton(this));
    final GetAutoRegistrationGroups groups = new GetAutoRegistrationGroups(voId);
    final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(groups);
    if (!session.isVoAdmin(voId)) {
        groups.setCheckable(false);
    }
    CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, ButtonTranslation.INSTANCE.addGroupToAutoReg(), event -> session.getTabManager().addTabToCurrentTab(new AddAutoRegGroupTabItem(vo), true));
    if (!session.isVoAdmin(voId))
        addButton.setEnabled(false);
    menu.addWidget(addButton);
    // remove selected groups button
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, ButtonTranslation.INSTANCE.removeGroupFromAutoReg());
    removeButton.addClickHandler(event -> {
        final ArrayList<Group> groupsToRemove = groups.getTableSelectedList();
        String text = "Following groups will be removed from the auto registration.";
        UiElements.showDeleteConfirm(groupsToRemove, text, clickEvent -> {
            RemoveGroupsFromAutoRegistration request = new RemoveGroupsFromAutoRegistration(JsonCallbackEvents.disableButtonEvents(removeButton, events));
            request.deleteGroups(groupsToRemove);
        });
    });
    menu.addWidget(removeButton);
    // filter box
    menu.addFilterWidget(new ExtendedSuggestBox(groups.getOracle()), new PerunSearchEvent() {

        public void searchFor(String text) {
            groups.filterTable(text);
        }
    }, ButtonTranslation.INSTANCE.filterGroup());
    // add a table with a onclick
    CellTable<Group> table = groups.getTable();
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    vp.add(table);
    contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) Group(cz.metacentrum.perun.webgui.model.Group) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) RemoveGroupsFromAutoRegistration(cz.metacentrum.perun.webgui.json.registrarManager.RemoveGroupsFromAutoRegistration) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) GetAutoRegistrationGroups(cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Aggregations

ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 GetAutoRegistrationGroups (cz.metacentrum.perun.webgui.json.registrarManager.GetAutoRegistrationGroups)1 RemoveGroupsFromAutoRegistration (cz.metacentrum.perun.webgui.json.registrarManager.RemoveGroupsFromAutoRegistration)1 Group (cz.metacentrum.perun.webgui.model.Group)1 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)1 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)1 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)1