Search in sources :

Example 1 with GetResources

use of cz.metacentrum.perun.webgui.json.searcher.GetResources 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;
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) Resource(cz.metacentrum.perun.webgui.model.Resource) GetResources(cz.metacentrum.perun.webgui.json.searcher.GetResources) ResourceDetailTabItem(cz.metacentrum.perun.webgui.tabs.resourcestabs.ResourceDetailTabItem) PerunSearchParametersWidget(cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget)

Aggregations

ImageResource (com.google.gwt.resources.client.ImageResource)1 GetResources (cz.metacentrum.perun.webgui.json.searcher.GetResources)1 Resource (cz.metacentrum.perun.webgui.model.Resource)1 ResourceDetailTabItem (cz.metacentrum.perun.webgui.tabs.resourcestabs.ResourceDetailTabItem)1 PerunSearchParametersWidget (cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget)1