Search in sources :

Example 6 with VmWatchdogType

use of org.ovirt.engine.core.common.businessentities.VmWatchdogType in project ovirt-engine by oVirt.

the class UnitVmModel method updateWatchdogItems.

public void updateWatchdogItems(Set<VmWatchdogType> vmWatchdogTypes) {
    List<VmWatchdogType> watchDogModels = new ArrayList<>();
    for (VmWatchdogType vmWatchdogType : vmWatchdogTypes) {
        watchDogModels.add(vmWatchdogType);
    }
    watchDogModels.add(0, null);
    VmWatchdogType oldWatchdogSelected = getWatchdogModel().getSelectedItem();
    if (watchDogModels.contains(getWatchdogModel().getSelectedItem())) {
        getWatchdogModel().setItems(watchDogModels, getWatchdogModel().getSelectedItem());
    } else {
        getWatchdogModel().setItems(watchDogModels);
    }
    if (watchDogModels.contains(oldWatchdogSelected)) {
        getWatchdogModel().setSelectedItem(oldWatchdogSelected);
    }
}
Also used : ArrayList(java.util.ArrayList) VmWatchdogType(org.ovirt.engine.core.common.businessentities.VmWatchdogType)

Aggregations

VmWatchdogType (org.ovirt.engine.core.common.businessentities.VmWatchdogType)6 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)3 Test (org.junit.Test)2 WatchdogModel (org.ovirt.engine.api.model.WatchdogModel)2 ArrayList (java.util.ArrayList)1