Search in sources :

Example 1 with StorageDomainFreeSpaceRenderer

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");
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) CustomSelectionCell(org.ovirt.engine.ui.webadmin.widget.table.cell.CustomSelectionCell) AbstractSafeHtmlColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSafeHtmlColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ArrayList(java.util.ArrayList) ImportDiskData(org.ovirt.engine.ui.uicommonweb.models.vms.ImportDiskData) StorageDomainFreeSpaceRenderer(org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 2 with StorageDomainFreeSpaceRenderer

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()));
}
Also used : EnumRenderer(org.ovirt.engine.ui.common.widget.renderer.EnumRenderer) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) InfoIcon(org.ovirt.engine.ui.common.widget.dialog.InfoIcon) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) StorageDomainFreeSpaceRenderer(org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer)

Example 3 with StorageDomainFreeSpaceRenderer

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();
        }
    });
}
Also used : VolumeType(org.ovirt.engine.core.common.businessentities.storage.VolumeType) Quota(org.ovirt.engine.core.common.businessentities.Quota) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) NullSafeRenderer(org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer) CpuProfile(org.ovirt.engine.core.common.businessentities.profiles.CpuProfile) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) StorageDomainFreeSpaceRenderer(org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer)

Aggregations

StorageDomainFreeSpaceRenderer (org.ovirt.engine.ui.common.widget.renderer.StorageDomainFreeSpaceRenderer)3 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2 Column (com.google.gwt.user.cellview.client.Column)1 ArrayList (java.util.ArrayList)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 Quota (org.ovirt.engine.core.common.businessentities.Quota)1 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)1 CpuProfile (org.ovirt.engine.core.common.businessentities.profiles.CpuProfile)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)1 RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)1 VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)1 InfoIcon (org.ovirt.engine.ui.common.widget.dialog.InfoIcon)1 EnumRenderer (org.ovirt.engine.ui.common.widget.renderer.EnumRenderer)1 NameRenderer (org.ovirt.engine.ui.common.widget.renderer.NameRenderer)1 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)1 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)1 AbstractColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractColumn)1 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)1 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)1 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)1