Search in sources :

Example 31 with GraphicsType

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

the class UnitVmModel method initDisplayModels.

public void initDisplayModels(List<Pair<GraphicsType, DisplayType>> graphicsAndDisplays) {
    // get supported display types
    Set<DisplayType> displayTypes = new LinkedHashSet<>();
    for (Pair<GraphicsType, DisplayType> graphicsTypeDisplayTypePair : graphicsAndDisplays) {
        if (graphicsTypeDisplayTypePair.getSecond() != DisplayType.none) {
            displayTypes.add(graphicsTypeDisplayTypePair.getSecond());
        }
    }
    // set items and set selected one
    DisplayType selectedDisplayType = getDisplayType().getSelectedItem();
    if (displayTypes.contains(selectedDisplayType)) {
        getDisplayType().setItems(displayTypes, selectedDisplayType);
    } else if (displayTypes.size() > 0) {
        getDisplayType().setItems(displayTypes, displayTypes.iterator().next());
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) GraphicsType(org.ovirt.engine.core.common.businessentities.GraphicsType) DisplayType(org.ovirt.engine.core.common.businessentities.DisplayType)

Aggregations

GraphicsType (org.ovirt.engine.core.common.businessentities.GraphicsType)31 VmDevice (org.ovirt.engine.core.common.businessentities.VmDevice)13 GraphicsDevice (org.ovirt.engine.core.common.businessentities.GraphicsDevice)12 HashSet (java.util.HashSet)8 DisplayType (org.ovirt.engine.core.common.businessentities.DisplayType)8 ArrayList (java.util.ArrayList)7 Map (java.util.Map)6 GraphicsInfo (org.ovirt.engine.core.common.businessentities.GraphicsInfo)6 Guid (org.ovirt.engine.core.compat.Guid)6 HashMap (java.util.HashMap)5 List (java.util.List)5 Set (java.util.Set)5 VM (org.ovirt.engine.core.common.businessentities.VM)5 VmDeviceId (org.ovirt.engine.core.common.businessentities.VmDeviceId)5 VmRngDevice (org.ovirt.engine.core.common.businessentities.VmRngDevice)5 Collection (java.util.Collection)4 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 VmWatchdog (org.ovirt.engine.core.common.businessentities.VmWatchdog)4 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)4 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)4