Search in sources :

Example 21 with PerunSearchEvent

use of cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent in project perun by CESNET.

the class UsersTabItem method draw.

public Widget draw() {
    CustomButton searchButton = new CustomButton("Search", ButtonTranslation.INSTANCE.searchUsers(), SmallIcons.INSTANCE.findIcon());
    this.users = new FindCompleteRichUsers("", null, JsonCallbackEvents.disableButtonEvents(searchButton));
    // MAIN TAB PANEL
    VerticalPanel firstTabPanel = new VerticalPanel();
    firstTabPanel.setSize("100%", "100%");
    // HORIZONTAL MENU
    TabMenu tabMenu = new TabMenu();
    // search textbox
    ExtendedTextBox searchBox = tabMenu.addSearchWidget(new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            startSearching(text);
            searchString = text;
        }
    }, searchButton);
    // get the table
    final CellTable<User> table = users.getTable(new FieldUpdater<User, String>() {

        public void update(int index, User object, String value) {
            // opens the tab
            session.getTabManager().addTab(new UserDetailTabItem(object));
        }
    });
    // if some text has been searched before
    if (!searchString.equals("")) {
        searchBox.getTextBox().setText(searchString);
        startSearching(searchString);
    }
    /*
			 Button b1 = tabMenu.addButton("List all", SmallIcons.INSTANCE.userGrayIcon(), new ClickHandler(){
			 public void onClick(ClickEvent event) {
			 GetCompleteRichUsers callback = new GetCompleteRichUsers(new JsonCallbackEvents(){
			 public void onLoadingStart() {
			 table.setEmptyTableWidget(new AjaxLoaderImage().loadingStart());
			 }
			 public void onFinished(JavaScriptObject jso) {
			 users.setList(JsonUtils.<User>jsoAsList(jso));
			 users.sortTable();
			 table.setEmptyTableWidget(new AjaxLoaderImage().loadingFinished());
			 }
			 public void onError(PerunError error){
			 users.clearTable();
			 table.setEmptyTableWidget(new AjaxLoaderImage().loadingError(error));
			 }
			 });
			 callback.retrieveData();
			 }
			 });
			 b1.setTitle("List of all users in Perun");
			 */
    final CustomButton withoutVoButton = new CustomButton(ButtonTranslation.INSTANCE.listUsersWithoutVoButton(), ButtonTranslation.INSTANCE.listUsersWithoutVo(), SmallIcons.INSTANCE.userRedIcon());
    withoutVoButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            GetCompleteRichUsers callback = new GetCompleteRichUsers(null, new JsonCallbackEvents() {

                public void onLoadingStart() {
                    users.clearTable();
                    table.setEmptyTableWidget(new AjaxLoaderImage().loadingStart());
                    withoutVoButton.setProcessing(true);
                }

                public void onFinished(JavaScriptObject jso) {
                    users.setList(JsonUtils.<User>jsoAsList(jso));
                    users.sortTable();
                    table.setEmptyTableWidget(new AjaxLoaderImage().loadingFinished());
                    withoutVoButton.setProcessing(false);
                }

                public void onError(PerunError error) {
                    table.setEmptyTableWidget(new AjaxLoaderImage().loadingError(error));
                    withoutVoButton.setProcessing(false);
                }
            });
            callback.getWithoutVo(true);
            callback.retrieveData();
        }
    });
    tabMenu.addWidget(withoutVoButton);
    // add a class to the table and wrap it into scroll panel
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    // add menu and the table to the main panel
    firstTabPanel.add(tabMenu);
    firstTabPanel.setCellHeight(tabMenu, "30px");
    firstTabPanel.add(sp);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(firstTabPanel);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) User(cz.metacentrum.perun.webgui.model.User) AjaxLoaderImage(cz.metacentrum.perun.webgui.widgets.AjaxLoaderImage) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FindCompleteRichUsers(cz.metacentrum.perun.webgui.json.usersManager.FindCompleteRichUsers) ExtendedTextBox(cz.metacentrum.perun.webgui.widgets.ExtendedTextBox) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) PerunError(cz.metacentrum.perun.webgui.model.PerunError) GetCompleteRichUsers(cz.metacentrum.perun.webgui.json.usersManager.GetCompleteRichUsers)

Example 22 with PerunSearchEvent

use of cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent in project perun by CESNET.

the class AddUserToBlacklistTabItem method draw.

public Widget draw() {
    titleWidget.setText("Add to blacklist");
    final CustomButton searchButton = new CustomButton("Search", ButtonTranslation.INSTANCE.searchUsers(), SmallIcons.INSTANCE.findIcon());
    this.users = new FindCompleteRichUsers("", null, JsonCallbackEvents.disableButtonEvents(searchButton, new JsonCallbackEvents() {

        @Override
        public void onFinished(JavaScriptObject jso) {
            // if found 1 item, select
            ArrayList<User> list = JsonUtils.jsoAsList(jso);
            if (list != null && list.size() == 1) {
                users.getSelectionModel().setSelected(list.get(0), true);
            }
        }
    }));
    // MAIN TAB PANEL
    VerticalPanel firstTabPanel = new VerticalPanel();
    firstTabPanel.setSize("100%", "100%");
    // HORIZONTAL MENU
    TabMenu tabMenu = new TabMenu();
    // get the table
    final CellTable<User> table;
    if (session.isPerunAdmin()) {
        table = users.getTable(new FieldUpdater<User, String>() {

            public void update(int i, User user, String s) {
                session.getTabManager().addTab(new UserDetailTabItem(user));
            }
        });
    } else {
        table = users.getTable();
    }
    rebuildAlreadyAddedWidget();
    final CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, ButtonTranslation.INSTANCE.addSelectedUsersToBlacklist());
    final TabItem tab = this;
    // search textbox
    final ExtendedTextBox searchBox = tabMenu.addSearchWidget(new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            startSearching(text);
            searchString = text;
        }
    }, searchButton);
    tabMenu.addWidget(addButton);
    tabMenu.addWidget(TabMenu.getPredefinedButton(ButtonType.CLOSE, "", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().closeTab(tab, !alreadyAddedList.isEmpty());
        }
    }));
    addButton.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent event) {
            final ArrayList<User> list = users.getTableSelectedList();
            if (UiElements.cantSaveEmptyListDialogBox(list)) {
                FlexTable layout = new FlexTable();
                layout.setStyleName("inputFormFlexTable");
                final TextArea textArea = new TextArea();
                textArea.setSize("250px", "120px");
                layout.getFlexCellFormatter().addStyleName(0, 0, "itemName");
                layout.setHTML(0, 0, "Reason:");
                layout.setWidget(1, 0, textArea);
                layout.setHTML(2, 0, "Please specify why users are blacklisted.");
                layout.getFlexCellFormatter().addStyleName(2, 0, "inputFormInlineComment");
                Confirm c = new Confirm("Add user(s) to blacklist", layout, new ClickHandler() {

                    @Override
                    public void onClick(ClickEvent event) {
                        for (int i = 0; i < list.size(); i++) {
                            // FIXME - Should have only one callback to core
                            final int n = i;
                            AddUserToBlacklist request = new AddUserToBlacklist(securityTeamId, JsonCallbackEvents.disableButtonEvents(addButton, new JsonCallbackEvents() {

                                @Override
                                public void onFinished(JavaScriptObject jso) {
                                    // put names to already added
                                    alreadyAddedList.add(list.get(n));
                                    rebuildAlreadyAddedWidget();
                                    // unselect added person
                                    users.getSelectionModel().setSelected(list.get(n), false);
                                    // clear search
                                    searchBox.getTextBox().setText("");
                                }
                            }));
                            request.addUserToBlacklist(list.get(i).getId(), textArea.getText().trim());
                        }
                    }
                }, "Add", true);
                c.show();
            }
        }
    });
    // if some text has been searched before
    if (!searchString.equals("")) {
        searchBox.getTextBox().setText(searchString);
        startSearching(searchString);
    }
    addButton.setEnabled(false);
    JsonUtils.addTableManagedButton(users, table, addButton);
    // add a class to the table and wrap it into scroll panel
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    // add menu and the table to the main panel
    firstTabPanel.add(tabMenu);
    firstTabPanel.setCellHeight(tabMenu, "30px");
    firstTabPanel.add(alreadyAdded);
    firstTabPanel.add(sp);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(firstTabPanel);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) FieldUpdater(com.google.gwt.cell.client.FieldUpdater) User(cz.metacentrum.perun.webgui.model.User) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) AddUserToBlacklist(cz.metacentrum.perun.webgui.json.securityTeamsManager.AddUserToBlacklist) FindCompleteRichUsers(cz.metacentrum.perun.webgui.json.usersManager.FindCompleteRichUsers) ArrayList(java.util.ArrayList) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) Confirm(cz.metacentrum.perun.webgui.widgets.Confirm) ExtendedTextBox(cz.metacentrum.perun.webgui.widgets.ExtendedTextBox) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) TabItem(cz.metacentrum.perun.webgui.tabs.TabItem) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton)

Example 23 with PerunSearchEvent

use of cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent in project perun by CESNET.

the class ServicesTabItem method draw.

public Widget draw() {
    // create widget for the whole page
    VerticalPanel mainTab = new VerticalPanel();
    mainTab.setSize("100%", "100%");
    // create widget for menu on page
    TabMenu tabMenu = new TabMenu();
    tabMenu.addWidget(UiElements.getRefreshButton(this));
    // get services
    final GetServices services = new GetServices();
    final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(services);
    // get the table of services with custom field updater (lines are clickable and open service details)
    CellTable<Service> table = services.getTable(new FieldUpdater<Service, String>() {

        // when user click on a row -> open new tab
        public void update(int index, Service object, String value) {
            session.getTabManager().addTab(new ServiceDetailTabItem(object));
        }
    });
    // create button
    tabMenu.addWidget(TabMenu.getPredefinedButton(ButtonType.CREATE, true, ButtonTranslation.INSTANCE.createService(), new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().addTabToCurrentTab(new CreateServiceTabItem());
        }
    }));
    final CustomButton deleteButton = TabMenu.getPredefinedButton(ButtonType.DELETE, ButtonTranslation.INSTANCE.deleteSelectedServices());
    deleteButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            // get selected items
            final ArrayList<Service> itemsToRemove = services.getTableSelectedList();
            UiElements.showDeleteConfirm(itemsToRemove, new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    // TODO - SHOULD HAVE ONLY ONE CALLBACK TO CORE
                    for (int i = 0; i < itemsToRemove.size(); i++) {
                        DeleteService request;
                        if (i == itemsToRemove.size() - 1) {
                            request = new DeleteService(JsonCallbackEvents.disableButtonEvents(deleteButton, events));
                        } else {
                            request = new DeleteService(JsonCallbackEvents.disableButtonEvents(deleteButton));
                        }
                        request.deleteService(itemsToRemove.get(i).getId());
                    }
                }
            });
        }
    });
    tabMenu.addWidget(deleteButton);
    tabMenu.addFilterWidget(new ExtendedSuggestBox(services.getOracle()), new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            services.filterTable(text);
        }
    }, "Filter services by name");
    // add menu to page itself
    mainTab.add(tabMenu);
    mainTab.setCellHeight(tabMenu, "30px");
    // add styling to table with services
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    mainTab.add(sp);
    deleteButton.setEnabled(false);
    JsonUtils.addTableManagedButton(services, table, deleteButton);
    session.getUiElements().resizePerunTable(sp, 350, this);
    this.contentWidget.setWidget(mainTab);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) DeleteService(cz.metacentrum.perun.webgui.json.servicesManager.DeleteService) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) Service(cz.metacentrum.perun.webgui.model.Service) DeleteService(cz.metacentrum.perun.webgui.json.servicesManager.DeleteService) GetServices(cz.metacentrum.perun.webgui.json.servicesManager.GetServices) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)

Example 24 with PerunSearchEvent

use of cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent in project perun by CESNET.

the class MemberApplicationsTabItem method draw.

public Widget draw() {
    this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": applications");
    // main widget panel
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    menu.addWidget(UiElements.getRefreshButton(this));
    // set proper request
    if (session.isVoAdmin(member.getVoId())) {
        applicationsRequest = new GetApplicationsForMember(memberId, 0);
    } else if (session.isGroupAdmin(groupId)) {
        // group admin can see only apps for his group
        applicationsRequest = new GetApplicationsForMember(memberId, groupId);
    } else if (session.isVoObserver(member.getVoId())) {
        applicationsRequest = new GetApplicationsForMember(memberId, 0);
    }
    applicationsRequest.setCheckable(false);
    final JsonCallbackEvents events = JsonCallbackEvents.refreshTableEvents(applicationsRequest);
    /*

		// verify button
		final CustomButton verify = TabMenu.getPredefinedButton(ButtonType.VERIFY, ButtonTranslation.INSTANCE.verifyApplication());
		verify.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(verify));
							request.verifyApplication(list.get(i).getId());
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(verify, events));
							request.verifyApplication(list.get(i).getId());
						}
					}
				}
			}
		});

		// accept button
		final CustomButton approve = TabMenu.getPredefinedButton(ButtonType.APPROVE, ButtonTranslation.INSTANCE.approveApplication());
		approve.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(approve));
							request.approveApplication(list.get(i));
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(approve, events));
							request.approveApplication(list.get(i));
						}
					}
				}
			}
		});

		//reject button
		final CustomButton reject = TabMenu.getPredefinedButton(ButtonType.REJECT, ButtonTranslation.INSTANCE.rejectApplication());
		reject.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				final ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					// confirm content
					FlexTable content = new FlexTable();
					content.setCellSpacing(10);
					content.setHTML(0, 0, "Please specify reason of rejection to let user know why was application rejected.");
					content.getFlexCellFormatter().setColSpan(0, 0, 2);
					final TextArea reason = new TextArea();
					reason.setSize("300px", "150px");
					content.setHTML(1, 0, "<strong>Reason: </strong>");
					content.setWidget(1, 1, reason);

					Confirm c = new Confirm("Specify reason", content, new ClickHandler(){
						public void onClick(ClickEvent event) {
							for (int i=0; i<list.size(); i++) {
								if (i != list.size()-1) {
									HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(reject));
									request.rejectApplication(list.get(i).getId(), reason.getText());
								} else {
									// refresh table on last call
									HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(reject, events));
									request.rejectApplication(list.get(i).getId(), reason.getText());
								}
							}

						}
					}, true);
					c.show();
				}
			}
		});

		// delete button
		final CustomButton delete = TabMenu.getPredefinedButton(ButtonType.DELETE, ButtonTranslation.INSTANCE.deleteApplication());
		delete.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ArrayList<Application> list = applicationsRequest.getTableSelectedList();
				if (UiElements.cantSaveEmptyListDialogBox(list)) {
					for (int i=0; i<list.size(); i++) {
						if (i != list.size()-1) {
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(delete));
							request.deleteApplication(list.get(i).getId());
						} else {
							// refresh table on last call
							HandleApplication request = new HandleApplication(JsonCallbackEvents.disableButtonEvents(delete, events));
							request.deleteApplication(list.get(i).getId());
						}
					}
				}
			}
		});

		menu.addWidget(verify);
		menu.addWidget(approve);
		menu.addWidget(reject);
		menu.addWidget(delete);

		*/
    menu.addFilterWidget(new ExtendedSuggestBox(applicationsRequest.getOracle()), new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            applicationsRequest.filterTable(text);
        }
    }, "Filter by group");
    CellTable<Application> table = applicationsRequest.getTable(new FieldUpdater<Application, String>() {

        @Override
        public void update(int i, Application application, String s) {
            session.getTabManager().addTabToCurrentTab(new ApplicationDetailTabItem(application), true);
        }
    });
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(sp, 350, this);
    vp.add(sp);
    /*
		verify.setEnabled(false);
		approve.setEnabled(false);
		reject.setEnabled(false);
		delete.setEnabled(false);

		if (session.isVoAdmin(member.getVoId()) || session.isGroupAdmin(groupId)) {
			JsonUtils.addTableManagedButton(applicationsRequest, table, verify);
			JsonUtils.addTableManagedButton(applicationsRequest, table, approve);
			JsonUtils.addTableManagedButton(applicationsRequest, table, reject);
			JsonUtils.addTableManagedButton(applicationsRequest, table, delete);
		}
		*/
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ApplicationDetailTabItem(cz.metacentrum.perun.webgui.tabs.registrartabs.ApplicationDetailTabItem) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) GetApplicationsForMember(cz.metacentrum.perun.webgui.json.registrarManager.GetApplicationsForMember) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) Application(cz.metacentrum.perun.webgui.model.Application) HandleApplication(cz.metacentrum.perun.webgui.json.registrarManager.HandleApplication)

Example 25 with PerunSearchEvent

use of cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent in project perun by CESNET.

the class MemberGroupsTabItem method draw.

public Widget draw() {
    this.titleWidget.setText(Utils.getStrippedStringWithEllipsis(member.getUser().getFullNameWithTitles().trim()) + ": groups");
    // main widget panel
    VerticalPanel vp = new VerticalPanel();
    vp.setSize("100%", "100%");
    TabMenu menu = new TabMenu();
    vp.add(menu);
    vp.setCellHeight(menu, "30px");
    final GetMemberGroups groupsCall = new GetMemberGroups(memberId);
    menu.addWidget(UiElements.getRefreshButton(this));
    CustomButton addButton = TabMenu.getPredefinedButton(ButtonType.ADD, true, "Add member to new group", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            session.getTabManager().addTabToCurrentTab(new MemberAddToGroupTabItem(member), true);
        }
    });
    if (session.isVoObserver(member.getVoId()) && !session.isVoAdmin(member.getVoId())) {
        addButton.setEnabled(false);
        groupsCall.setCheckable(false);
    }
    menu.addWidget(addButton);
    final CustomButton removeButton = TabMenu.getPredefinedButton(ButtonType.REMOVE, "Remove member from selected group(s)", new ClickHandler() {

        @Override
        public void onClick(ClickEvent clickEvent) {
            final ArrayList<Group> list = groupsCall.getTableSelectedList();
            String confirmText = member.getUser().getFullName() + " will be removed from following groups.";
            UiElements.showDeleteConfirm(list, confirmText, new ClickHandler() {

                @Override
                public void onClick(ClickEvent clickEvent) {
                    // TODO - should have only one callback to core
                    for (int i = 0; i < list.size(); i++) {
                        if (i == list.size() - 1) {
                            RemoveMember request = new RemoveMember(JsonCallbackEvents.refreshTableEvents(groupsCall));
                            request.removeMemberFromGroup(list.get(i), member);
                        } else {
                            RemoveMember request = new RemoveMember();
                            request.removeMemberFromGroup(list.get(i), member);
                        }
                    }
                }
            });
        }
    });
    removeButton.setEnabled(false);
    menu.addWidget(removeButton);
    menu.addFilterWidget(new ExtendedSuggestBox(groupsCall.getOracle()), new PerunSearchEvent() {

        @Override
        public void searchFor(String text) {
            groupsCall.filterTable(text);
        }
    }, ButtonTranslation.INSTANCE.filterGroup());
    CellTable<Group> table = groupsCall.getTable(new FieldUpdater<Group, String>() {

        @Override
        public void update(int i, Group group, String s) {
            if (session.isVoAdmin(group.getVoId()) || session.isVoObserver(group.getVoId()) || session.isGroupAdmin(group.getId())) {
                session.getTabManager().addTab(new GroupDetailTabItem(group));
            } else {
                UiElements.generateInfo("Not privileged", "You are not manager of selected group or it's VO.");
            }
        }
    });
    if (session.isVoAdmin(member.getVoId()) || session.isGroupAdmin(groupId))
        JsonUtils.addTableManagedButton(groupsCall, table, removeButton);
    table.addStyleName("perun-table");
    ScrollPanel sp = new ScrollPanel(table);
    sp.addStyleName("perun-tableScrollPanel");
    session.getUiElements().resizePerunTable(sp, 350, this);
    vp.add(sp);
    this.contentWidget.setWidget(vp);
    return getWidget();
}
Also used : Group(cz.metacentrum.perun.webgui.model.Group) RemoveMember(cz.metacentrum.perun.webgui.json.groupsManager.RemoveMember) PerunSearchEvent(cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) GroupDetailTabItem(cz.metacentrum.perun.webgui.tabs.groupstabs.GroupDetailTabItem) CustomButton(cz.metacentrum.perun.webgui.widgets.CustomButton) ExtendedSuggestBox(cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox) GetMemberGroups(cz.metacentrum.perun.webgui.json.groupsManager.GetMemberGroups)

Aggregations

PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)28 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)27 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)24 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)23 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)23 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)21 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)21 ArrayList (java.util.ArrayList)21 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)12 TabItem (cz.metacentrum.perun.webgui.tabs.TabItem)10 GetVos (cz.metacentrum.perun.webgui.json.vosManager.GetVos)4 Group (cz.metacentrum.perun.webgui.model.Group)4 VirtualOrganization (cz.metacentrum.perun.webgui.model.VirtualOrganization)4 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)2 JsArray (com.google.gwt.core.client.JsArray)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 HTML (com.google.gwt.user.client.ui.HTML)2 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2