use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmSnapshotCustomPreviewPopupWidget method createPreviewTable.
private void createPreviewTable() {
previewTable.addColumn(new AbstractFullDateTimeColumn<SnapshotModel>() {
@Override
protected Date getRawValue(SnapshotModel snapshotModel) {
return snapshotModel.getEntity().getCreationDate();
}
}, constants.dateSnapshot(), // $NON-NLS-1$
"140px");
previewTable.addColumn(new AbstractTextColumn<SnapshotModel>() {
@Override
public String getValue(SnapshotModel snapshotModel) {
return snapshotModel.getEntity().getDescription();
}
}, constants.descriptionSnapshot(), // $NON-NLS-1$
"100px");
previewTable.setSelectionModel(new NoSelectionModel());
Column<SnapshotModel, Boolean> vmConfColumn = new Column<SnapshotModel, Boolean>(new RadioboxCell()) {
@Override
public Boolean getValue(SnapshotModel model) {
Snapshot snapshotVmConf = model.getEntity();
Snapshot toPreviewVmConf = previewSnapshotModel.getSnapshotModel().getEntity();
if (snapshotVmConf == null && toPreviewVmConf == null) {
return true;
}
return snapshotVmConf != null && snapshotVmConf.equals(toPreviewVmConf);
}
@Override
public void render(Context context, SnapshotModel snapshotModel, SafeHtmlBuilder sb) {
if (!snapshotModel.getEntity().isVmConfigurationBroken()) {
super.render(context, snapshotModel, sb);
} else {
sb.appendEscaped(constants.notAvailableLabel());
}
}
};
vmConfColumn.setFieldUpdater((index, snapshotModel, value) -> {
previewSnapshotModel.setSnapshotModel(snapshotModel);
previewSnapshotModel.clearMemorySelection();
updateWarnings();
refreshTable(previewTable);
if (snapshotModel.getVm() == null) {
snapshotModel.updateVmConfiguration(returnValue -> updateInfoPanel());
} else {
updateInfoPanel();
}
});
previewTable.addColumn(vmConfColumn, new ImageResourceHeader(resources.vmConfIcon(), SafeHtmlUtils.fromTrustedString(constants.vmConfiguration())), // $NON-NLS-1$
"30px");
AbstractCheckboxColumn<SnapshotModel> memoryColumn = new AbstractCheckboxColumn<SnapshotModel>((index, snapshotModel, value) -> {
previewSnapshotModel.getSnapshotModel().getMemory().setEntity(value);
refreshTable(previewTable);
updateWarnings();
}) {
@Override
public Boolean getValue(SnapshotModel snapshotModel) {
return snapshotModel.getMemory().getEntity();
}
@Override
protected boolean canEdit(SnapshotModel snapshotModel) {
boolean containsMemory = snapshotModel.getEntity().containsMemory();
SnapshotModel selectedSnapshotModel = previewSnapshotModel.getSnapshotModel();
return containsMemory && snapshotModel == selectedSnapshotModel;
}
@Override
public void render(Context context, SnapshotModel snapshotModel, SafeHtmlBuilder sb) {
if (snapshotModel.getEntity().containsMemory()) {
super.render(context, snapshotModel, sb);
} else {
sb.appendEscaped(constants.notAvailableLabel());
}
}
};
previewTable.addColumn(memoryColumn, templates.iconWithText(imageResourceToSafeHtml(resources.memorySmallIcon()), constants.memorySnapshot()), // $NON-NLS-1$
"100px");
AbstractCheckboxColumn<SnapshotModel> vmLeaseColumn = new AbstractCheckboxColumn<SnapshotModel>((index, snapshotModel, value) -> {
snapshotModel.getLeaseExists().setEntity(value);
refreshTable(previewTable);
updateWarnings();
}) {
@Override
public Boolean getValue(SnapshotModel model) {
if (model.getLeaseExists() != null) {
return model.getLeaseExists().getEntity();
}
return false;
}
@Override
protected boolean canEdit(SnapshotModel snapshotModel) {
// prevent from selecting more then one leases in case many snapshots have leases
if (snapshotModel.getLeaseExists() != null) {
SnapshotModel result = previewSnapshotModel.getSnapshots().getItems().stream().filter(model -> model.getEntity().getId() != snapshotModel.getEntity().getId()).filter(model -> model.getLeaseExists().getEntity() != null).filter(model -> model.getLeaseExists().getEntity()).findFirst().orElse(null);
return result == null;
}
return false;
}
@Override
public void render(Context context, SnapshotModel snapshotModel, SafeHtmlBuilder sb) {
if (snapshotModel.getLeaseExists().getEntity() != null) {
super.render(context, snapshotModel, sb);
} else {
sb.appendEscaped(constants.notAvailableLabel());
}
}
};
// $NON-NLS-1$
previewTable.addColumn(vmLeaseColumn, constants.leaseSnapshot(), "80px");
List<DiskImage> disks = previewSnapshotModel.getAllDisks();
Collections.sort(disks, new DiskByDiskAliasComparator());
for (final DiskImage disk : disks) {
previewTable.addColumn(new AbstractCheckboxColumn<SnapshotModel>((index, snapshotModel, value) -> {
ListModel diskListModel = previewSnapshotModel.getDiskSnapshotsMap().get(disk.getId());
DiskImage image = snapshotModel.getImageByDiskId(disk.getId());
diskListModel.setSelectedItem(Boolean.TRUE.equals(value) ? image : null);
refreshTable(previewTable);
updateWarnings();
updateInfoPanel();
}) {
@Override
public Boolean getValue(SnapshotModel snapshotModel) {
ListModel diskListModel = previewSnapshotModel.getDiskSnapshotsMap().get(disk.getId());
DiskImage image = snapshotModel.getImageByDiskId(disk.getId());
return image != null ? image.equals(diskListModel.getSelectedItem()) : false;
}
@Override
protected boolean canEdit(SnapshotModel model) {
return true;
}
@Override
public void render(Context context, SnapshotModel snapshotModel, SafeHtmlBuilder sb) {
DiskImage image = snapshotModel.getImageByDiskId(disk.getId());
if (image == null) {
sb.appendEscaped(constants.notAvailableLabel());
} else if (image.getImageStatus() == ImageStatus.ILLEGAL) {
sb.append(templates.text(constants.notAvailableLabel()));
} else {
super.render(context, snapshotModel, sb);
}
}
@Override
public SafeHtml getTooltip(SnapshotModel model) {
if (disk != null && disk.getId() != null) {
DiskImage image = model.getImageByDiskId(disk.getId());
if (image != null && image.getImageStatus() == ImageStatus.ILLEGAL) {
return SafeHtmlUtils.fromSafeConstant(constants.illegalStatus());
}
}
return null;
}
}, new SafeHtmlHeader(templates.iconWithText(imageResourceToSafeHtml(resources.diskIcon()), disk.getDiskAlias()), SafeHtmlUtils.fromString(disk.getId().toString())), // $NON-NLS-1$
"120px");
// Edit preview table
previewTable.asEditor().edit(previewSnapshotModel.getSnapshots());
}
previewTable.addCellPreviewHandler(new CellPreviewEvent.Handler<EntityModel>() {
long lastClick = -1000;
@Override
public void onCellPreview(CellPreviewEvent<EntityModel> event) {
NativeEvent nativeEvent = event.getNativeEvent();
long clickAt = System.currentTimeMillis();
if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
if (clickAt - lastClick < 300) {
// double click: 2 clicks detected within 300 ms
SnapshotModel selectedSnapshotModel = (SnapshotModel) event.getValue();
if (!selectedSnapshotModel.getEntity().isVmConfigurationBroken()) {
previewSnapshotModel.clearSelection(selectedSnapshotModel.getEntity().getId());
previewSnapshotModel.selectSnapshot(selectedSnapshotModel.getEntity().getId());
updateWarnings();
refreshTable(previewTable);
}
}
lastClick = System.currentTimeMillis();
}
}
});
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class AbstractVmPopupWidget method initListBoxEditors.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void initListBoxEditors() {
// General tab
dataCenterWithClusterEditor = new GroupedListModelListBoxEditor<>(new GroupedListModelListBox<DataCenterWithCluster>(new NameRenderer<>()) {
@Override
public String getModelLabel(DataCenterWithCluster model) {
return model.getCluster().getName();
}
@Override
public String getGroupLabel(DataCenterWithCluster model) {
return messages.hostDataCenter(model.getDataCenter().getName());
}
public Comparator<DataCenterWithCluster> getComparator() {
return Comparator.comparing((DataCenterWithCluster d) -> d.getDataCenter().getName(), Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER)).thenComparing(d -> d.getCluster().getName(), Comparator.nullsLast(String.CASE_INSENSITIVE_ORDER));
}
});
quotaEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<Quota>() {
@Override
public String getReplacementStringNullSafe(Quota data) {
return data.getQuotaName();
}
@Override
public String getDisplayStringNullSafe(Quota data) {
return typeAheadNameDescriptionTemplateNullSafe(data.getQuotaName(), data.getDescription());
}
}, new ModeSwitchingVisibilityRenderer());
baseTemplateEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<VmTemplate>() {
@Override
public String getReplacementStringNullSafe(VmTemplate data) {
return data.getName();
}
@Override
public String getDisplayStringNullSafe(VmTemplate data) {
return typeAheadNameDescriptionTemplateNullSafe(data.getName(), data.getDescription());
}
}, new ModeSwitchingVisibilityRenderer());
templateWithVersionEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<TemplateWithVersion>() {
@Override
public String getReplacementStringNullSafe(TemplateWithVersion templateWithVersion) {
return getFirstColumn(templateWithVersion) + // $NON-NLS-1$
" | " + getSecondColumn(templateWithVersion);
}
@Override
public String getDisplayStringNullSafe(TemplateWithVersion templateWithVersion) {
return typeAheadNameDescriptionTemplateNullSafe(getFirstColumn(templateWithVersion), getSecondColumn(templateWithVersion));
}
private String getFirstColumn(TemplateWithVersion templateWithVersion) {
return templateWithVersion.getBaseTemplate().getName();
}
private String getSecondColumn(TemplateWithVersion templateWithVersion) {
final VmTemplate versionTemplate = templateWithVersion.getTemplateVersion();
final String versionName = versionTemplate.getTemplateVersionName() == null ? // $NON-NLS-1$
"" : // $NON-NLS-1$
versionTemplate.getTemplateVersionName() + " ";
return templateWithVersion.isLatest() ? constants.latest() : // $NON-NLS-1$
versionName + "(" + versionTemplate.getTemplateVersionNumber() + // $NON-NLS-1$
")";
}
}, new ModeSwitchingVisibilityRenderer(), new SuggestionMatcher.ContainsSuggestionMatcher());
oSTypeEditor = new ListModelListBoxEditor<>(new AbstractRenderer<Integer>() {
@Override
public String render(Integer object) {
return AsyncDataProvider.getInstance().getOsName(object);
}
}, new ModeSwitchingVisibilityRenderer());
vmTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<VmType>(), new ModeSwitchingVisibilityRenderer());
instanceTypesEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<InstanceType>() {
@Override
public String getReplacementStringNullSafe(InstanceType data) {
return data.getName();
}
@Override
public String getDisplayStringNullSafe(InstanceType data) {
return typeAheadNameDescriptionTemplateNullSafe(data.getName(), data.getDescription());
}
}, new ModeSwitchingVisibilityRenderer());
emulatedMachine = new ListModelTypeAheadChangeableListBoxEditor(new ListModelTypeAheadChangeableListBoxEditor.NullSafeSuggestBoxRenderer() {
@Override
public String getDisplayStringNullSafe(String data) {
if (data == null || data.trim().isEmpty()) {
data = getDefaultEmulatedMachineLabel();
}
return typeAheadNameTemplateNullSafe(data);
}
}, false, new ModeSwitchingVisibilityRenderer(), constants.clusterDefaultOption());
customCpu = new ListModelTypeAheadChangeableListBoxEditor(new ListModelTypeAheadChangeableListBoxEditor.NullSafeSuggestBoxRenderer() {
@Override
public String getDisplayStringNullSafe(String data) {
if (data == null || data.trim().isEmpty()) {
data = getDefaultCpuTypeLabel();
}
return typeAheadNameTemplateNullSafe(data);
}
}, false, new ModeSwitchingVisibilityRenderer(), constants.clusterDefaultOption());
numOfSocketsEditor = new ListModelListBoxEditor<>(new ModeSwitchingVisibilityRenderer());
numOfSocketsEditorWithDetachable = new EntityModelDetachableWidgetWithLabel(numOfSocketsEditor);
corePerSocketEditor = new ListModelListBoxEditor<>(new ModeSwitchingVisibilityRenderer());
corePerSocketEditorWithDetachable = new EntityModelDetachableWidgetWithLabel(corePerSocketEditor);
initThreadsPerCore();
// Pools
poolTypeEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<VmPoolType>>() {
@Override
public String renderNullSafe(EntityModel<VmPoolType> object) {
return object.getTitle();
}
}, new ModeSwitchingVisibilityRenderer());
timeZoneEditor = new ListModelListBoxOnlyEditor<>(new NullSafeRenderer<TimeZoneModel>() {
@Override
public String renderNullSafe(TimeZoneModel timeZone) {
if (timeZone.isDefault()) {
return messages.defaultTimeZoneCaption(timeZone.getDisplayValue());
} else {
return timeZone.getDisplayValue();
}
}
}, new ModeSwitchingVisibilityRenderer());
EnableableFormLabel label = new EnableableFormLabel();
label.setText(constants.timeZoneVm());
timeZoneEditorWithInfo = new EntityModelWidgetWithInfo(label, timeZoneEditor);
timeZoneEditorWithInfo.setExplanation(templates.italicText(constants.timeZoneInfo()));
// Console tab
displayTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<DisplayType>(), new ModeSwitchingVisibilityRenderer());
graphicsTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer<UnitVmModel.GraphicsTypes>());
usbSupportEditor = new ListModelListBoxEditor<>(new EnumRenderer<UsbPolicy>(), new ModeSwitchingVisibilityRenderer());
consoleDisconnectActionEditor = new ListModelListBoxEditor<>(new EnumRenderer<ConsoleDisconnectAction>(), new ModeSwitchingVisibilityRenderer());
numOfMonitorsEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Integer>() {
@Override
public String renderNullSafe(Integer object) {
return object.toString();
}
}, new ModeSwitchingVisibilityRenderer());
numOfMonitorsEditor.hideLabel();
vncKeyboardLayoutEditor = new ListModelListBoxEditor<>(new VncKeyMapRenderer(), new ModeSwitchingVisibilityRenderer());
// Host Tab
// $NON-NLS-1$
specificHost = new EntityModelRadioButtonEditor("runVmOnHostGroup", new ModeSwitchingVisibilityRenderer());
isAutoAssignEditor = // $NON-NLS-1$
new EntityModelRadioButtonEditor("runVmOnHostGroup", new ModeSwitchingVisibilityRenderer());
defaultHostEditor = new ListModelMultipleSelectListBoxEditor<>(new NameRenderer<VDS>(), new ModeSwitchingVisibilityRenderer());
defaultHostEditor.hideLabel();
migrationModeEditor = new ListModelListBoxEditor<>(new EnumRenderer<MigrationSupport>(), new ModeSwitchingVisibilityRenderer());
migrationModeEditor.hideLabel();
overrideMigrationDowntimeEditor = new EntityModelCheckBoxEditor(Align.RIGHT, new ModeSwitchingVisibilityRenderer());
migrationDowntimeEditor = new IntegerEntityModelTextBoxOnlyEditor(new ModeSwitchingVisibilityRenderer());
overrideMigrationPolicyEditor = new EntityModelCheckBoxEditor(Align.RIGHT, new ModeSwitchingVisibilityRenderer());
migrationPolicyEditor = new ListModelListBoxOnlyEditor<>(new NameRenderer<MigrationPolicy>(), new ModeSwitchingVisibilityRenderer());
autoConvergeEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.autoConverge(), constants.dontAutoConverge(), constants.inheritFromCluster()), new ModeSwitchingVisibilityRenderer());
migrateCompressedEditor = new ListModelListBoxEditor<>(new BooleanRendererWithNullText(constants.compress(), constants.dontCompress(), constants.inheritFromCluster()), new ModeSwitchingVisibilityRenderer());
// Resource Allocation
provisioningThinEditor = // $NON-NLS-1$
new EntityModelRadioButtonEditor("provisioningGroup", new ModeSwitchingVisibilityRenderer());
provisioningCloneEditor = // $NON-NLS-1$
new EntityModelRadioButtonEditor("provisioningGroup", new ModeSwitchingVisibilityRenderer());
// Boot Options Tab
firstBootDeviceEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<BootSequence>>() {
@Override
public String renderNullSafe(EntityModel<BootSequence> object) {
return object.getTitle();
}
}, new ModeSwitchingVisibilityRenderer());
secondBootDeviceEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<EntityModel<BootSequence>>() {
@Override
public String renderNullSafe(EntityModel<BootSequence> object) {
return object.getTitle();
}
}, new ModeSwitchingVisibilityRenderer());
cdImageEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<RepoImage>() {
@Override
public String renderNullSafe(RepoImage object) {
// For old ISO images from an ISO domain the image name is empty
if (StringHelper.isNullOrEmpty(object.getRepoImageName())) {
return object.getRepoImageId();
}
return object.getRepoImageName();
}
}, new ModeSwitchingVisibilityRenderer());
cdImageEditor.hideLabel();
cpuProfilesEditor = new ListModelListBoxEditor<>(new NameRenderer<CpuProfile>());
cpuSharesAmountSelectionEditor = new ListModelListBoxOnlyEditor<>(new EnumRenderer<UnitVmModel.CpuSharesAmount>(), new ModeSwitchingVisibilityRenderer());
numaTuneMode = new ListModelListBoxEditor<>(new EnumRenderer(), new ModeSwitchingVisibilityRenderer());
providersEditor = new ListModelListBoxEditor<>(new NameRenderer<Provider<OpenstackNetworkProviderProperties>>());
providersEditor.setLabel(constants.providerLabel());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmSnapshotInfoPanel method initAppsTable.
private void initAppsTable() {
appsTable = new EntityModelCellTable<>(false, true);
AbstractTextColumn<String> appNameColumn = new AbstractTextColumn<String>() {
@Override
public String getValue(String appName) {
return appName;
}
};
appsTable.addColumn(appNameColumn, constants.nameSnapshot());
appsTable.setRowData(new ArrayList<EntityModel>());
// $NON-NLS-1$
appsTable.setWidth("100%");
appsTable.setSelectionModel(new NoSelectionModel());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmSnapshotInfoPanel method initDisksTable.
private void initDisksTable() {
disksTable = new EntityModelCellTable<>(false, true);
disksTable.enableColumnResizing();
// $NON-NLS-1$
disksTable.addColumn(new DiskImageStatusColumn(), constants.empty(), "30px");
AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage object) {
return object.getDiskAlias();
}
};
// $NON-NLS-1$
disksTable.addColumn(aliasColumn, constants.aliasDisk(), "70px");
AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getSize();
}
};
// $NON-NLS-1$
disksTable.addColumn(sizeColumn, constants.provisionedSizeDisk(), "70px");
AbstractDiskSizeColumn<DiskImage> actualSizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getActualSizeInBytes();
}
};
// $NON-NLS-1$
disksTable.addColumn(actualSizeColumn, constants.sizeDisk(), "70px");
AbstractTextColumn<DiskImage> allocationColumn = new AbstractEnumColumn<DiskImage, VolumeType>() {
@Override
protected VolumeType getRawValue(DiskImage object) {
return VolumeType.forValue(object.getVolumeType().getValue());
}
};
// $NON-NLS-1$
disksTable.addColumn(allocationColumn, constants.allocationDisk(), "110px");
AbstractTextColumn<DiskImage> interfaceColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage object) {
if (object.getDiskVmElements().size() == 1) {
return object.getDiskVmElements().iterator().next().getDiskInterface().toString();
}
return null;
}
};
// $NON-NLS-1$
disksTable.addColumn(interfaceColumn, constants.interfaceDisk(), "95px");
AbstractTextColumn<DiskImage> statusColumn = new AbstractEnumColumn<DiskImage, ImageStatus>() {
@Override
protected ImageStatus getRawValue(DiskImage object) {
return object.getImageStatus();
}
};
// $NON-NLS-1$
disksTable.addColumn(statusColumn, constants.statusDisk(), "65px");
AbstractTextColumn<DiskImage> dateCreatedColumn = new AbstractFullDateTimeColumn<DiskImage>() {
@Override
protected Date getRawValue(DiskImage object) {
return object.getCreationDate();
}
};
// $NON-NLS-1$
disksTable.addColumn(dateCreatedColumn, constants.creationDateDisk(), "80px");
AbstractTextColumn<DiskImage> diskSnapshotIDColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage diskImage) {
return diskImage.getImageId().toString();
}
};
// $NON-NLS-1$
disksTable.addColumn(diskSnapshotIDColumn, constants.diskSnapshotIDDisk(), "260px");
AbstractTextColumn<Disk> diskStorageTypeColumn = new AbstractEnumColumn<Disk, DiskStorageType>() {
@Override
protected DiskStorageType getRawValue(Disk object) {
return object.getDiskStorageType();
}
};
// $NON-NLS-1$
disksTable.addColumn(diskStorageTypeColumn, constants.typeDisk(), "80px");
AbstractTextColumn<DiskImage> descriptionColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage object) {
return object.getDiskDescription();
}
};
// $NON-NLS-1$
disksTable.addColumn(descriptionColumn, constants.descriptionDisk(), "80px");
disksTable.setRowData(new ArrayList<EntityModel>());
// $NON-NLS-1$
disksTable.setWidth("100%");
disksTable.setSelectionModel(new NoSelectionModel());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmListModel method remove.
private void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel window = new ConfirmationModel();
setWindow(window);
window.setTitle(ConstantsManager.getInstance().getConstants().removeVirtualMachinesTitle());
window.setHelpTag(HelpTag.remove_virtual_machine);
// $NON-NLS-1$
window.setHashName("remove_virtual_machine");
vmsRemoveMap = new HashMap<>();
for (Object selectedItem : getSelectedItems()) {
VM vm = (VM) selectedItem;
if (ActionUtils.canExecute(Arrays.asList(vm), VM.class, ActionType.RemoveVm)) {
EntityModel removeDisksCheckbox = new EntityModel(true);
removeDisksCheckbox.setTitle(ConstantsManager.getInstance().getConstants().removeDisksTitle());
removeDisksCheckbox.setMessage(vm.getName());
if (!Guid.Empty.equals(vm.getVmtGuid())) {
updateRemoveDisksCheckBox(removeDisksCheckbox, true, false, ConstantsManager.getInstance().getConstants().removeVmDisksTemplateMsg());
}
vmsRemoveMap.put(vm.getId(), removeDisksCheckbox);
}
}
window.setItems(vmsRemoveMap.entrySet());
initRemoveDisksCheckboxes(vmsRemoveMap);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
window.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
window.getCommands().add(tempVar2);
}
Aggregations