Search in sources :

Example 1 with PerunSearchParametersWidget

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;
}
Also used : JsonCallbackEvents(cz.metacentrum.perun.webgui.json.JsonCallbackEvents) ArrayList(java.util.ArrayList) VirtualOrganization(cz.metacentrum.perun.webgui.model.VirtualOrganization) MemberDetailTabItem(cz.metacentrum.perun.webgui.tabs.memberstabs.MemberDetailTabItem) ListBoxWithObjects(cz.metacentrum.perun.webgui.widgets.ListBoxWithObjects) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Member(cz.metacentrum.perun.webgui.model.Member) PerunSearchParametersWidget(cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget) GetVos(cz.metacentrum.perun.webgui.json.vosManager.GetVos) GetMembers(cz.metacentrum.perun.webgui.json.searcher.GetMembers) TabMenu(cz.metacentrum.perun.webgui.widgets.TabMenu) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) JavaScriptObject(com.google.gwt.core.client.JavaScriptObject) PerunError(cz.metacentrum.perun.webgui.model.PerunError)

Example 2 with PerunSearchParametersWidget

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;
}
Also used : User(cz.metacentrum.perun.webgui.model.User) UserDetailTabItem(cz.metacentrum.perun.webgui.tabs.userstabs.UserDetailTabItem) GetUsers(cz.metacentrum.perun.webgui.json.searcher.GetUsers) PerunSearchParametersWidget(cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget)

Example 3 with PerunSearchParametersWidget

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;
}
Also used : GetFacilities(cz.metacentrum.perun.webgui.json.searcher.GetFacilities) FacilityDetailTabItem(cz.metacentrum.perun.webgui.tabs.facilitiestabs.FacilityDetailTabItem) Facility(cz.metacentrum.perun.webgui.model.Facility) PerunSearchParametersWidget(cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget)

Example 4 with PerunSearchParametersWidget

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;
}
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

PerunSearchParametersWidget (cz.metacentrum.perun.webgui.widgets.PerunSearchParametersWidget)4 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ImageResource (com.google.gwt.resources.client.ImageResource)1 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)1 GetFacilities (cz.metacentrum.perun.webgui.json.searcher.GetFacilities)1 GetMembers (cz.metacentrum.perun.webgui.json.searcher.GetMembers)1 GetResources (cz.metacentrum.perun.webgui.json.searcher.GetResources)1 GetUsers (cz.metacentrum.perun.webgui.json.searcher.GetUsers)1 GetVos (cz.metacentrum.perun.webgui.json.vosManager.GetVos)1 Facility (cz.metacentrum.perun.webgui.model.Facility)1 Member (cz.metacentrum.perun.webgui.model.Member)1 PerunError (cz.metacentrum.perun.webgui.model.PerunError)1 Resource (cz.metacentrum.perun.webgui.model.Resource)1 User (cz.metacentrum.perun.webgui.model.User)1 VirtualOrganization (cz.metacentrum.perun.webgui.model.VirtualOrganization)1 FacilityDetailTabItem (cz.metacentrum.perun.webgui.tabs.facilitiestabs.FacilityDetailTabItem)1 MemberDetailTabItem (cz.metacentrum.perun.webgui.tabs.memberstabs.MemberDetailTabItem)1 ResourceDetailTabItem (cz.metacentrum.perun.webgui.tabs.resourcestabs.ResourceDetailTabItem)1