use of org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType in project ovirt-engine by oVirt.
the class ProfilesInstanceTypeEditor method createGhostValue.
@Override
protected VnicInstanceType createGhostValue() {
VmNetworkInterface vnic = new VmNetworkInterface();
vnic.setName(AsyncDataProvider.getInstance().getNewNicName(vnics));
vnics.add(vnic);
VnicInstanceType vnicWithProfile = new VnicInstanceType(vnic);
vnicWithProfile.setItems(vnicProfiles);
return vnicWithProfile;
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType in project ovirt-engine by oVirt.
the class ProfilesInstanceTypeEditor method init.
@Override
protected void init(VnicInstancesModel model) {
vnicProfiles = model.getVnicProfiles().getItems();
if (vnicProfiles == null) {
vnicProfiles = new ArrayList<>();
}
Iterable<VnicInstanceType> values = model.getItems();
vnics.clear();
if (values != null) {
for (VnicInstanceType value : values) {
vnics.add(value.getNetworkInterface());
}
}
super.init(model);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.VnicInstanceType in project ovirt-engine by oVirt.
the class VmInstanceTypeManager method updateNetworkInterfaces.
private void updateNetworkInterfaces(final ProfileBehavior behavior, final List<VmNetworkInterface> argNics) {
AsyncQuery<List<VnicProfileView>> query = new AsyncQuery<>(profiles -> {
List<VnicInstanceType> vnicInstanceTypes = new ArrayList<>();
List<VmNetworkInterface> nics = (argNics == null) ? new ArrayList<VmNetworkInterface>() : argNics;
for (VmNetworkInterface nic : nics) {
final VnicInstanceType vnicInstanceType = new VnicInstanceType(nic);
vnicInstanceType.setItems(profiles);
behavior.initSelectedProfile(vnicInstanceType, vnicInstanceType.getNetworkInterface());
vnicInstanceTypes.add(vnicInstanceType);
}
getModel().getNicsWithLogicalNetworks().getVnicProfiles().setItems(profiles);
getModel().getNicsWithLogicalNetworks().setItems(vnicInstanceTypes);
getModel().getNicsWithLogicalNetworks().setSelectedItem(Linq.firstOrNull(vnicInstanceTypes));
});
behavior.initProfiles(getModel().getSelectedCluster().getId(), getModel().getSelectedDataCenter().getId(), query);
}
Aggregations