Search in sources :

Example 16 with AsyncCallback

use of org.ovirt.engine.ui.frontend.AsyncCallback in project ovirt-engine by oVirt.

the class ClusterNetworkListModel method syncSearch.

@Override
protected void syncSearch() {
    if (getEntity() == null) {
        return;
    }
    super.syncSearch();
    Guid clusterId = getEntity().getId();
    IdQueryParameters tempVar = new IdQueryParameters(clusterId);
    tempVar.setRefresh(getIsQueryFirstTime());
    Frontend.getInstance().runQuery(QueryType.GetAllNetworksByClusterId, tempVar, new AsyncQuery<>((AsyncCallback<QueryReturnValue>) returnValue -> {
        final List<Network> newItems = returnValue.getReturnValue();
        Collections.sort(newItems, Comparator.comparing((Network n) -> n.getCluster().isManagement()).reversed().thenComparing(Network::getName, new LexoNumericComparator()));
        for (Network network : newItems) {
            network.getCluster().setId(new NetworkClusterId(clusterId, network.getId()));
        }
        setItems(newItems);
    }));
}
Also used : IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) AsyncCallback(org.ovirt.engine.ui.frontend.AsyncCallback) Network(org.ovirt.engine.core.common.businessentities.network.Network) LexoNumericComparator(org.ovirt.engine.core.common.businessentities.comparators.LexoNumericComparator) Guid(org.ovirt.engine.core.compat.Guid) NetworkClusterId(org.ovirt.engine.core.common.businessentities.network.NetworkClusterId)

Aggregations

AsyncCallback (org.ovirt.engine.ui.frontend.AsyncCallback)16 ArrayList (java.util.ArrayList)11 Guid (org.ovirt.engine.core.compat.Guid)8 List (java.util.List)7 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)7 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)6 Frontend (org.ovirt.engine.ui.frontend.Frontend)6 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)6 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)5 Collections (java.util.Collections)4 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)4 VM (org.ovirt.engine.core.common.businessentities.VM)4 QueryType (org.ovirt.engine.core.common.queries.QueryType)4 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)4 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)4 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)4 UIConstants (org.ovirt.engine.ui.uicompat.UIConstants)4 Arrays (java.util.Arrays)3 Map (java.util.Map)3 Objects (java.util.Objects)3