use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method onSaveVm.
private void onSaveVm() {
UnitVmModel model = (UnitVmModel) getWindow();
String name = model.getName().getEntity();
setcurrentVm(new VM());
validateVm(model, name);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel in project ovirt-engine by oVirt.
the class TemplateListModel method vmInitLoaded.
private void vmInitLoaded(VmTemplate template) {
UnitVmModel model = createModel(createBehavior(template));
model.setIsAdvancedModeLocalStorageKey(getEditTemplateAdvancedModelKey());
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().editTemplateTitle());
model.setHelpTag(HelpTag.edit_template);
// $NON-NLS-1$
model.setHashName("edit_template");
model.getVmType().setSelectedItem(template.getVmType());
model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList());
model.initialize();
VmBasedWidgetSwitchModeCommand switchModeCommand = new VmBasedWidgetSwitchModeCommand();
switchModeCommand.init(model);
model.getCommands().add(switchModeCommand);
// $NON-NLS-1$
UICommand onSaveCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(onSaveCommand);
// $NON-NLS-1$
UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(cancelCommand);
model.getIsHighlyAvailable().setEntity(template.isAutoStartup());
if (template.getDefaultDisplayType() == DisplayType.none) {
model.getIsHeadlessModeEnabled().setEntity(true);
}
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel in project ovirt-engine by oVirt.
the class InstanceTypeListModel method buildVmStatic.
private void buildVmStatic(VmBase vmBase) {
UnitVmModel model = (UnitVmModel) getWindow();
BuilderExecutor.build(model, vmBase, new HwOnlyCoreUnitToVmBaseBuilder(), new NameUnitToVmBaseBuilder(), new UsbPolicyUnitToVmBaseBuilder(), new MigrationOptionsUnitToVmBaseBuilder());
// from CommonUnitToVmBaseBuilder
vmBase.setAutoStartup(model.getIsHighlyAvailable().getEntity());
vmBase.setPriority(model.getPriority().getSelectedItem().getEntity());
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel in project ovirt-engine by oVirt.
the class InstanceTypeListModel method postInstanceTypeNameUniqueCheck.
private void postInstanceTypeNameUniqueCheck() {
UnitVmModel model = (UnitVmModel) getWindow();
VM vm = new VM();
buildVmStatic(vm.getStaticData());
vm.setVmDescription(model.getDescription().getEntity());
AddVmTemplateParameters addInstanceTypeParameters = new AddVmTemplateParameters(vm, model.getName().getEntity(), model.getDescription().getEntity());
addInstanceTypeParameters.setTemplateType(VmEntityType.INSTANCE_TYPE);
addInstanceTypeParameters.setVmTemplateId(null);
addInstanceTypeParameters.setPublicUse(true);
addInstanceTypeParameters.setSoundDeviceEnabled(model.getIsSoundcardEnabled().getEntity());
addInstanceTypeParameters.setConsoleEnabled(model.getIsConsoleDeviceEnabled().getEntity());
addInstanceTypeParameters.setBalloonEnabled(model.getMemoryBalloonDeviceEnabled().getEntity());
addInstanceTypeParameters.setVirtioScsiEnabled(model.getIsVirtioScsiEnabled().getEntity());
if (model.getIsHeadlessModeEnabled().getEntity()) {
addInstanceTypeParameters.getVm().setDefaultDisplayType(DisplayType.none);
}
setVmWatchdogToParams(model, addInstanceTypeParameters);
setRngDeviceToParams(model, addInstanceTypeParameters);
BuilderExecutor.build(model, addInstanceTypeParameters, new UnitToGraphicsDeviceParamsBuilder());
getWindow().startProgress();
Frontend.getInstance().runAction(ActionType.AddVmTemplate, addInstanceTypeParameters, new UnitVmModelNetworkAsyncCallback(model, addInstanceTypeNetworkManager), this);
}
use of org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel in project ovirt-engine by oVirt.
the class VmIconUnitAndVmToParameterBuilder method build.
@Override
protected void build(Pair<UnitVmModel, VM> source, VmManagementParametersBase destination) {
final UnitVmModel newModel = source.getFirst();
final VM oldVm = source.getSecond();
final String newIcon = newModel.getIcon().getEntity().getIcon();
final String originalIcon = IconCache.getInstance().getIcon(oldVm.getStaticData().getLargeIconId());
if (!newIcon.equals(originalIcon) && IconUtils.isCustom(newIcon)) {
destination.setVmLargeIcon(newIcon);
}
}
Aggregations