use of cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget in project perun by CESNET.
the class SearcherTabItem method loadMembersTab.
private Widget loadMembersTab() {
// request
final GetMembers request = new GetMembers(0);
// MAIN TAB PANEL
VerticalPanel firstTabPanel = new VerticalPanel();
firstTabPanel.setSize("100%", "100%");
PerunSearchParametersWidget params = new PerunSearchParametersWidget(PerunEntity.MEMBER, new PerunSearchParametersWidget.SearchEvent() {
public void search(Map<String, String> map) {
request.clearParameters();
for (Map.Entry<String, String> entry : map.entrySet()) {
request.addSearchParameter(entry.getKey(), entry.getValue());
}
request.search();
}
});
final ListBoxWithObjects<VirtualOrganization> vos = new ListBoxWithObjects<VirtualOrganization>();
vos.addChangeHandler(new ChangeHandler() {
@Override
public void onChange(ChangeEvent changeEvent) {
request.setVoId(vos.getSelectedObject().getId());
}
});
// initial fill listbox and trigger groups loading
GetVos vosCall = new GetVos(new JsonCallbackEvents() {
public void onLoadingStart() {
vos.clear();
vos.addItem("Loading...");
}
public void onFinished(JavaScriptObject jso) {
vos.clear();
ArrayList<VirtualOrganization> returnedVos = JsonUtils.jsoAsList(jso);
returnedVos = new TableSorter<VirtualOrganization>().sortByName(returnedVos);
if (returnedVos == null || returnedVos.isEmpty()) {
vos.addItem("No VO available");
return;
}
vos.addAllItems(returnedVos);
request.setVoId(vos.getSelectedObject().getId());
}
public void onError(PerunError error) {
vos.clear();
vos.addItem("Error while loading");
}
});
vosCall.retrieveData();
TabMenu menu = new TabMenu();
menu.addWidget(new HTML("<strong>Selected VO:</strong>"));
menu.addWidget(vos);
firstTabPanel.add(menu);
firstTabPanel.add(params);
// get the table
final CellTable<Member> table = request.getEmptyTable(new FieldUpdater<Member, String>() {
public void update(int index, Member object, String value) {
// opens the tab
session.getTabManager().addTab(new MemberDetailTabItem(object.getId(), object.getSourceGroupId()));
}
});
// 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");
firstTabPanel.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
return firstTabPanel;
}
use of cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget in project perun by CESNET.
the class SearcherTabItem method loadUsersTab.
private Widget loadUsersTab() {
// request
final GetUsers request = new GetUsers();
// MAIN TAB PANEL
VerticalPanel firstTabPanel = new VerticalPanel();
firstTabPanel.setSize("100%", "100%");
PerunSearchParametersWidget params = new PerunSearchParametersWidget(PerunEntity.USER, new PerunSearchParametersWidget.SearchEvent() {
public void search(Map<String, String> map) {
request.clearParameters();
for (Map.Entry<String, String> entry : map.entrySet()) {
request.addSearchParameter(entry.getKey(), entry.getValue());
}
request.search();
}
});
firstTabPanel.add(params);
// get the table
final CellTable<User> table = request.getEmptyTable(new FieldUpdater<User, String>() {
public void update(int index, User object, String value) {
// opens the tab
session.getTabManager().addTab(new UserDetailTabItem(object));
}
});
// 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");
firstTabPanel.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
return firstTabPanel;
}
use of cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget in project perun by CESNET.
the class SearcherTabItem method loadFacilitiesTab.
private Widget loadFacilitiesTab() {
// request
final GetFacilities request = new GetFacilities();
// MAIN TAB PANEL
VerticalPanel firstTabPanel = new VerticalPanel();
firstTabPanel.setSize("100%", "100%");
PerunSearchParametersWidget params = new PerunSearchParametersWidget(PerunEntity.FACILITY, new PerunSearchParametersWidget.SearchEvent() {
public void search(Map<String, String> map) {
request.clearParameters();
for (Map.Entry<String, String> entry : map.entrySet()) {
request.addSearchParameter(entry.getKey(), entry.getValue());
}
request.search();
}
});
firstTabPanel.add(params);
// get the table
final CellTable<Facility> table = request.getEmptyTable(new FieldUpdater<Facility, String>() {
public void update(int index, Facility object, String value) {
// opens the tab
session.getTabManager().addTab(new FacilityDetailTabItem(object));
}
});
// 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");
firstTabPanel.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
return firstTabPanel;
}
use of cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget in project perun by CESNET.
the class SearcherTabItem method loadResourcesTab.
private Widget loadResourcesTab() {
// request
final GetResources request = new GetResources();
// MAIN TAB PANEL
VerticalPanel firstTabPanel = new VerticalPanel();
firstTabPanel.setSize("100%", "100%");
PerunSearchParametersWidget params = new PerunSearchParametersWidget(PerunEntity.RESOURCE, new PerunSearchParametersWidget.SearchEvent() {
public void search(Map<String, String> map) {
request.clearParameters();
for (Map.Entry<String, String> entry : map.entrySet()) {
request.addSearchParameter(entry.getKey(), entry.getValue());
}
request.search();
}
});
firstTabPanel.add(params);
// get the table
final CellTable<Resource> table = request.getEmptyTable(new FieldUpdater<Resource, String>() {
public void update(int index, Resource object, String value) {
// opens the tab
session.getTabManager().addTab(new ResourceDetailTabItem(object.getId(), object.getFacilityId()));
}
});
// 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");
firstTabPanel.add(sp);
session.getUiElements().resizePerunTable(sp, 350, this);
return firstTabPanel;
}
Aggregations