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();
}
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();
}
Aggregations