use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator in project ovirt-engine by oVirt.
the class ClusterPolicyListModel method fetchClusterPolicies.
private void fetchClusterPolicies() {
AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
ArrayList<ClusterPolicy> list = returnValue.getReturnValue();
Collections.sort(list, Comparator.comparing(ClusterPolicy::isLocked).reversed().thenComparing(ClusterPolicy::getName, new LexoNumericComparator()));
setItems(list);
});
QueryParametersBase parametersBase = new QueryParametersBase();
parametersBase.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetClusterPolicies, parametersBase, asyncQuery);
setIsQueryFirstTime(false);
}
use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator in project ovirt-engine by oVirt.
the class StorageDataCenterListModel method syncSearch.
@Override
protected void syncSearch() {
if (getEntity() == null) {
return;
}
super.syncSearch();
IdQueryParameters tempVar = new IdQueryParameters(getEntity().getId());
tempVar.setRefresh(getIsQueryFirstTime());
Frontend.getInstance().runQuery(QueryType.GetStorageDomainListById, tempVar, new AsyncQuery<QueryReturnValue>(returnValue -> {
ArrayList<StorageDomain> domains = returnValue.getReturnValue();
for (StorageDomain domain : domains) {
domain.setId(domain.getStoragePoolId());
}
Collections.sort(domains, Comparator.comparing(StorageDomain::getStoragePoolName, new LexoNumericComparator()));
setItems(domains);
setIsEmpty(getItems().size() == 0);
}));
}
use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator in project ovirt-engine by oVirt.
the class HostSetupNetworksModel method initNextBondName.
private void initNextBondName(List<String> bondNames) {
Collections.sort(bondNames, new LexoNumericComparator());
nextBondName = BusinessEntitiesDefinitions.BOND_NAME_PREFIX + 0;
for (int i = 0; i < bondNames.size(); ++i) {
if (nextBondName.equals(bondNames.get(i))) {
nextBondName = BusinessEntitiesDefinitions.BOND_NAME_PREFIX + (i + 1);
} else {
break;
}
}
}
use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator in project ovirt-engine by oVirt.
the class VfsNicLabelModel method initLabelModels.
protected void initLabelModels() {
Collections.sort(originalLabels, new LexoNumericComparator());
LinkedList<ListModel<String>> items = new LinkedList<>();
for (String label : originalLabels) {
ListModel<String> labelModel = new ListModel<>();
labelModel.setItems(suggestedLabels);
labelModel.setSelectedItem(label);
items.add(labelModel);
}
setItems(items);
suggestedLabelsCache = new TreeSet<>(suggestedLabels);
}
use of org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator in project ovirt-engine by oVirt.
the class ClusterNetworkListModel method createNetworkList.
private ClusterNetworkManageModel createNetworkList(List<Network> dcNetworks) {
final List<ClusterNetworkModel> networkList = new ArrayList<>();
final List<Network> clusterNetworks = new ArrayList<>(getItems());
for (Network network : dcNetworks) {
ClusterNetworkModel networkManageModel;
int index = clusterNetworks.indexOf(network);
if (index >= 0) {
Network clusterNetwork = clusterNetworks.get(index);
networkManageModel = new ClusterNetworkModel((Network) Cloner.clone(clusterNetwork));
} else {
networkManageModel = new ClusterNetworkModel((Network) Cloner.clone(network));
}
networkManageModel.setCluster((Cluster) Cloner.clone(getEntity()));
networkList.add(networkManageModel);
}
Collections.sort(networkList, Comparator.comparing(ClusterNetworkModel::isManagement).reversed().thenComparing(ClusterNetworkModel::getNetworkName, new LexoNumericComparator()));
ClusterNetworkManageModel listModel = new ClusterNetworkManageModel(this);
listModel.setItems(networkList);
return listModel;
}
Aggregations