Search in sources :

Example 6 with Facility

use of cz.metacentrum.perun.webgui.model.Facility in project perun by CESNET.

the class GetFacilities method setList.

public void setList(ArrayList<Facility> list) {
    clearTable();
    this.list.addAll(list);
    for (Facility object : list) {
        oracle.add(object.getName());
        if (provideRich) {
            // fill oracle with technical owners
            JsArray<Owner> owners = object.getOwners();
            for (int n = 0; n < owners.length(); n++) {
                if ("technical".equals(owners.get(n).getType())) {
                    oracle.add(owners.get(n).getName());
                }
            }
        }
    }
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : Owner(cz.metacentrum.perun.webgui.model.Owner) Facility(cz.metacentrum.perun.webgui.model.Facility)

Example 7 with Facility

use of cz.metacentrum.perun.webgui.model.Facility in project perun by CESNET.

the class GetFacilities method filterTable.

public void filterTable(String text) {
    // store list only for first time
    if (fullBackup.isEmpty() || fullBackup == null) {
        fullBackup.addAll(list);
    }
    // always clear selected items
    selectionModel.clear();
    list.clear();
    if (text.equalsIgnoreCase("")) {
        list.addAll(fullBackup);
    } else {
        for (Facility fac : fullBackup) {
            // store facility by filter
            if (fac.getName().toLowerCase().contains(text.toLowerCase())) {
                list.add(fac);
            } else if (provideRich) {
                // if name doesn't match, try to match owners
                JsArray<Owner> owners = fac.getOwners();
                for (int n = 0; n < owners.length(); n++) {
                    if ("technical".equals(owners.get(n).getType()) && owners.get(n).getName().toLowerCase().equals(text.toLowerCase())) {
                        list.add(fac);
                    }
                }
            }
        }
    }
    if (list.isEmpty() && !text.isEmpty()) {
        loaderImage.setEmptyResultMessage("No facility matching '" + text + "' found.");
    } else {
        loaderImage.setEmptyResultMessage("You are not manager of any facility.");
    }
    loaderImage.loadingFinished();
    dataProvider.flush();
    dataProvider.refresh();
}
Also used : JsArray(com.google.gwt.core.client.JsArray) Facility(cz.metacentrum.perun.webgui.model.Facility)

Aggregations

Facility (cz.metacentrum.perun.webgui.model.Facility)7 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)4 CustomButton (cz.metacentrum.perun.webgui.widgets.CustomButton)4 TabMenu (cz.metacentrum.perun.webgui.widgets.TabMenu)3 ArrayList (java.util.ArrayList)3 JavaScriptObject (com.google.gwt.core.client.JavaScriptObject)2 PerunSearchEvent (cz.metacentrum.perun.webgui.client.resources.PerunSearchEvent)2 DeleteFacility (cz.metacentrum.perun.webgui.json.facilitiesManager.DeleteFacility)2 GetFacilities (cz.metacentrum.perun.webgui.json.facilitiesManager.GetFacilities)2 PerunError (cz.metacentrum.perun.webgui.model.PerunError)2 ExtendedSuggestBox (cz.metacentrum.perun.webgui.widgets.ExtendedSuggestBox)2 JsArray (com.google.gwt.core.client.JsArray)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 JSONObject (com.google.gwt.json.client.JSONObject)1 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)1 JsonPostClient (cz.metacentrum.perun.webgui.json.JsonPostClient)1 GetAssignedFacilities (cz.metacentrum.perun.webgui.json.facilitiesManager.GetAssignedFacilities)1