use of org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer in project ovirt-engine by oVirt.
the class ImportVmFromExportDomainPopupView method addStorageDomainsColumn.
private void addStorageDomainsColumn() {
CustomSelectionCell customSelectionCellStorageDomain = new CustomSelectionCell(new ArrayList<String>());
customSelectionCellStorageDomain.setStyle(EMPTY_STYLE);
Column<DiskImage, String> storageDomainsColumn = new Column<DiskImage, String>(customSelectionCellStorageDomain) {
@Override
public String getValue(DiskImage disk) {
ImportDiskData importData = importModel.getDiskImportData(disk.getId());
ArrayList<String> storageDomainsNameList = new ArrayList<>();
StorageDomain selectedStorageDomain = null;
if (importData != null && importData.getStorageDomains() != null) {
for (StorageDomain storageDomain : importData.getStorageDomains()) {
storageDomainsNameList.add(new StorageDomainFreeSpaceRenderer<>().render(storageDomain));
if (importData.getSelectedStorageDomain() != null) {
if (storageDomain.getId().equals(importData.getSelectedStorageDomain().getId())) {
selectedStorageDomain = storageDomain;
}
}
}
}
((CustomSelectionCell) getCell()).setOptions(storageDomainsNameList);
if (!storageDomainsNameList.isEmpty()) {
if (selectedStorageDomain != null) {
return new StorageDomainFreeSpaceRenderer<>().render(selectedStorageDomain);
} else {
return storageDomainsNameList.get(0);
}
}
return "";
}
};
storageDomainsColumn.setFieldUpdater((index, disk, value) -> {
// $NON-NLS-1$
String storageDomainName = value.substring(0, value.lastIndexOf(" ("));
importModel.getDiskImportData(disk.getId()).setSelectedStorageDomainString(storageDomainName);
diskTable.asEditor().edit(importModel.getImportDiskListModel());
});
// $NON-NLS-1$
diskTable.addColumn(storageDomainsColumn, constants.storageDomainDisk(), "180px");
}
use of org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer in project ovirt-engine by oVirt.
the class VmDiskPopupWidget method initManualWidgets.
@SuppressWarnings({ "unchecked", "rawtypes" })
private void initManualWidgets() {
storageDomainEditor = new ListModelListBoxEditor<>(new StorageDomainFreeSpaceRenderer());
hostListEditor = new ListModelListBoxEditor<>(new NameRenderer<VDS>());
diskProfileEditor = new ListModelListBoxEditor<>(new NameRenderer<DiskProfile>());
quotaEditor = new ListModelListBoxEditor<>(new NameRenderer<Quota>());
interfaceEditor = new ListModelListBoxEditor<>(new EnumRenderer());
datacenterEditor = new ListModelListBoxEditor<>(new NameRenderer<StoragePool>());
cinderVolumeTypeEditor = new ListModelListBoxEditor<>();
volumeTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer());
storageTypeEditor = new ListModelListBoxEditor<>(new EnumRenderer());
plugDiskToVmEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
wipeAfterDeleteEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isBootableEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isShareableEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isReadOnlyEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
passDiscardEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isUsingScsiReservationEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isScsiPassthroughEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
isSgIoUnfilteredEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
interfaceInfoIcon = new InfoIcon(templates.italicText(constants.diskInterfaceInfo()));
cinderVolumeTypeInfoIcon = new InfoIcon(templates.italicText(constants.cinderVolumeTypeInfoIcon()));
scsiReservationInfoIcon = new InfoIcon(templates.italicText(constants.scsiReservationInfoIcon()));
}
use of org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderPopupView method initListBoxEditors.
private void initListBoxEditors() {
destClusterEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Cluster>() {
@Override
public String renderNullSafe(Cluster object) {
return object.getName();
}
});
destClusterQuotaEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<Quota>() {
@Override
public String renderNullSafe(Quota object) {
return object.getQuotaName();
}
});
destStorageEditor = new ListModelListBoxEditor<>(new StorageDomainFreeSpaceRenderer());
cpuProfileEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<CpuProfile>() {
@Override
protected String renderNullSafe(CpuProfile object) {
return object.getName();
}
});
disksAllocationEditor = new ListModelListBoxEditor<>(new NullSafeRenderer<VolumeType>() {
@Override
protected String renderNullSafe(VolumeType object) {
return new EnumRenderer<VolumeType>().render(object);
}
});
attachDriversEditor = new EntityModelCheckBoxEditor(Align.LEFT);
cdImageEditor = new ListModelListBoxOnlyEditor<>(new NullSafeRenderer<RepoImage>() {
@Override
protected String renderNullSafe(RepoImage object) {
return object.getRepoImageId();
}
});
}
Aggregations