Search in sources :

Example 41 with RepoImage

use of org.ovirt.engine.core.common.businessentities.storage.RepoImage in project ovirt-engine by oVirt.

the class ImportExportImagePopupView method initTable.

private void initTable(ImportExportRepoImageBaseModel model) {
    imageList = new EntityModelCellTable<>(SelectionMode.NONE, true);
    imageList.enableColumnResizing();
    if (model.isImportModel()) {
        imageList.addColumn(new AbstractEntityModelTextColumn<RepoImage>() {

            @Override
            public String getText(RepoImage image) {
                return image.getRepoImageTitle();
            }
        }, constants.fileNameIso(), // $NON-NLS-1$
        "100%");
        imageList.addColumn(new DiskAliasTextColumn(new DiskAliasFieldUpdater()), templates.sub(constants.diskSnapshotAlias(), constants.clickToEdit()), // $NON-NLS-1$
        "150px");
        imageList.addColumn(new AbstractEntityModelTextColumn<RepoImage>() {

            @Override
            public String getText(RepoImage image) {
                return image.getFileType().toString();
            }
        }, constants.typeIso(), // $NON-NLS-1$
        "75px");
        imageList.addColumn(new AbstractDiskSizeColumn<EntityModel<RepoImage>>(SizeConverter.SizeUnit.BYTES) {

            @Override
            protected Long getRawValue(EntityModel<RepoImage> image) {
                return image.getEntity().getSize();
            }
        }, constants.size(), // $NON-NLS-1$
        "75px");
    } else {
        imageList.addColumn(new AbstractEntityModelTextColumn<DiskImage>() {

            @Override
            public String getText(DiskImage image) {
                return image.getDiskAlias();
            }
        }, constants.fileNameIso(), // $NON-NLS-1$
        "100%");
        imageList.addColumn(new AbstractEntityModelTextColumn<DiskImage>() {

            @Override
            public String getText(DiskImage image) {
                return ImageFileType.Disk.toString();
            }
        }, constants.typeIso(), // $NON-NLS-1$
        "75px");
        imageList.addColumn(new AbstractDiskSizeColumn<EntityModel<DiskImage>>(SizeConverter.SizeUnit.BYTES) {

            @Override
            protected Long getRawValue(EntityModel<DiskImage> image) {
                return image.getEntity().getSize();
            }
        }, constants.provisionedSizeTemplate(), // $NON-NLS-1$
        "75px");
    }
    // $NON-NLS-1$
    imageList.setWidth("100%");
    imageList.setEmptyTableWidget(new NoItemsLabel());
    imageListPanel.setWidget(imageList);
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RepoImage(org.ovirt.engine.core.common.businessentities.storage.RepoImage) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

RepoImage (org.ovirt.engine.core.common.businessentities.storage.RepoImage)41 ArrayList (java.util.ArrayList)8 Test (org.junit.Test)5 Guid (org.ovirt.engine.core.compat.Guid)5 VmTemplate (org.ovirt.engine.core.common.businessentities.VmTemplate)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 InstanceType (org.ovirt.engine.core.common.businessentities.InstanceType)3 Quota (org.ovirt.engine.core.common.businessentities.Quota)3 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)3 NullSafeRenderer (org.ovirt.engine.ui.common.widget.renderer.NullSafeRenderer)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Lock (java.util.concurrent.locks.Lock)2 ReentrantLock (java.util.concurrent.locks.ReentrantLock)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StoragePoolIsoMap (org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap)2 ListModelTypeAheadChangeableListBoxEditor (org.ovirt.engine.ui.common.widget.editor.ListModelTypeAheadChangeableListBoxEditor)2 VncKeyMapRenderer (org.ovirt.engine.ui.common.widget.editor.VncKeyMapRenderer)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2