use of cz.metacentrum.perun.webgui.json.usersManager.GetCompleteRichUsers 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();
}
Aggregations