Search in sources :

Example 6 with AbstractDiskSizeColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn 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());
}
Also used : NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) DiskImageStatusColumn(org.ovirt.engine.ui.common.widget.table.column.DiskImageStatusColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 7 with AbstractDiskSizeColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn in project ovirt-engine by oVirt.

the class RegisterEntityInfoPanel method initDisksTable.

protected void initDisksTable() {
    disksTable = new EntityModelCellTable<>(false, true);
    disksTable.enableColumnResizing();
    AbstractTextColumn<Disk> aliasColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(aliasColumn, constants.aliasDisk(), "80px");
    AbstractDiskSizeColumn<Disk> sizeColumn = new AbstractDiskSizeColumn<Disk>() {

        @Override
        protected Long getRawValue(Disk object) {
            return object.getSize();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(sizeColumn, constants.provisionedSizeDisk(), "80px");
    AbstractDiskSizeColumn<Disk> actualSizeColumn = new AbstractDiskSizeColumn<Disk>() {

        @Override
        protected Long getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getActualSizeInBytes() : 0;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(actualSizeColumn, constants.sizeDisk(), "80px");
    AbstractTextColumn<Disk> allocationColumn = new AbstractEnumColumn<Disk, VolumeType>() {

        @Override
        protected VolumeType getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? VolumeType.forValue(((DiskImage) object).getVolumeType().getValue()) : VolumeType.Unassigned;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(allocationColumn, constants.allocationDisk(), "110px");
    AbstractTextColumn<Disk> statusColumn = new AbstractEnumColumn<Disk, ImageStatus>() {

        @Override
        protected ImageStatus getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getImageStatus() : ImageStatus.OK;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(statusColumn, constants.statusDisk(), "65px");
    AbstractTextColumn<Disk> diskStorageTypeColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskStorageType().toString();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(diskStorageTypeColumn, constants.storageTypeDisk(), "100px");
    AbstractTextColumn<Disk> dateCreatedColumn = new AbstractFullDateTimeColumn<Disk>() {

        @Override
        protected Date getRawValue(Disk object) {
            return (object.getDiskStorageType() != DiskStorageType.LUN) ? ((DiskImage) object).getCreationDate() : null;
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(dateCreatedColumn, constants.creationDateDisk(), "100px");
    AbstractTextColumn<Disk> descriptionColumn = new AbstractTextColumn<Disk>() {

        @Override
        public String getValue(Disk object) {
            return object.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    disksTable.addColumn(descriptionColumn, constants.descriptionDisk(), "100px");
    if (registerEntityModel.isQuotaEnabled()) {
        // $NON-NLS-1$
        disksTable.addColumn(getDiskQuotaColumn(), constants.quotaVm(), "100px");
    }
    disksTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    disksTable.setWidth("100%");
    disksTable.setSelectionModel(new NoSelectionModel());
    disksTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) RegisterEntityModel(org.ovirt.engine.ui.uicommonweb.models.storage.RegisterEntityModel) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 8 with AbstractDiskSizeColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn in project ovirt-engine by oVirt.

the class SubTabDataCenterStorageView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    StorageDomainStatusColumn statusIconColumn = new StorageDomainStatusColumn();
    statusIconColumn.setContextMenuTitle(constants.statusIconStorage());
    // $NON-NLS-1$
    getTable().addColumn(statusIconColumn, constants.empty(), "30px");
    StorageDomainAdditionalStatusColumn additionalStatusColumn = new StorageDomainAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusStorage());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "60px");
    AbstractTextColumn<StorageDomain> nameColumn = new AbstractLinkColumn<StorageDomain>(new FieldUpdater<StorageDomain, String>() {

        @Override
        public void update(int index, StorageDomain sd, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), sd.getName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.storageGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(StorageDomain object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.domainNameStorage(), "160px");
    AbstractTextColumn<StorageDomain> typeColumn = new AbstractEnumColumn<StorageDomain, StorageDomainType>() {

        @Override
        public StorageDomainType getRawValue(StorageDomain object) {
            return object.getStorageDomainType();
        }
    };
    typeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.domainTypeStorage(), "160px");
    AbstractTextColumn<StorageDomain> statusColumn = new AbstractEnumColumn<StorageDomain, StorageDomainStatus>() {

        @Override
        public StorageDomainStatus getRawValue(StorageDomain object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> freeColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getAvailableDiskSize() != null ? object.getAvailableDiskSize() : 0L;
        }
    };
    freeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(freeColumn, constants.freeSpaceStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> usedColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getUsedDiskSize() != null ? object.getUsedDiskSize() : 0L;
        }
    };
    usedColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(usedColumn, constants.usedSpaceStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> totalColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getTotalDiskSize() != null ? object.getTotalDiskSize() : 0L;
        }
    };
    totalColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(totalColumn, constants.totalSpaceStorage(), "160px");
    AbstractTextColumn<StorageDomain> descriptionColumn = new AbstractTextColumn<StorageDomain>() {

        @Override
        public String getValue(StorageDomain object) {
            return object.getDescription();
        }
    };
    descriptionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.domainDescriptionStorage(), "160px");
}
Also used : StorageDomainAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainAdditionalStatusColumn) StorageDomainStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainStatusColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Example 9 with AbstractDiskSizeColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn in project ovirt-engine by oVirt.

the class SubTabDiskStorageView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    StorageDomainSharedStatusColumn sharedStatusColumn = new StorageDomainSharedStatusColumn();
    sharedStatusColumn.setContextMenuTitle(constants.sharedStatusStorage());
    // $NON-NLS-1$
    getTable().addColumn(sharedStatusColumn, constants.empty(), "30px");
    StorageDomainAdditionalStatusColumn additionalStatusColumn = new StorageDomainAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusStorage());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "60px");
    AbstractTextColumn<StorageDomain> nameColumn = new AbstractTextColumn<StorageDomain>() {

        @Override
        public String getValue(StorageDomain object) {
            return object.getStorageName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.domainNameStorage(), "160px");
    AbstractTextColumn<StorageDomain> typeColumn = new AbstractEnumColumn<StorageDomain, StorageDomainType>() {

        @Override
        public StorageDomainType getRawValue(StorageDomain object) {
            return object.getStorageDomainType();
        }
    };
    typeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.domainTypeStorage(), "160px");
    AbstractTextColumn<StorageDomain> statusColumn = new AbstractEnumColumn<StorageDomain, StorageDomainStatus>() {

        @Override
        public StorageDomainStatus getRawValue(StorageDomain object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> freeColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getAvailableDiskSize() != null ? object.getAvailableDiskSize() : 0L;
        }
    };
    freeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(freeColumn, constants.freeSpaceStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> usedColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getUsedDiskSize() != null ? object.getUsedDiskSize() : 0L;
        }
    };
    usedColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(usedColumn, constants.usedSpaceStorage(), "160px");
    AbstractDiskSizeColumn<StorageDomain> totalColumn = new AbstractDiskSizeColumn<StorageDomain>(SizeConverter.SizeUnit.GiB) {

        @Override
        public Long getRawValue(StorageDomain object) {
            return object.getTotalDiskSize() != null ? object.getTotalDiskSize() : 0L;
        }
    };
    totalColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(totalColumn, constants.totalSpaceStorage(), "160px");
    AbstractTextColumn<StorageDomain> descriptionColumn = new AbstractTextColumn<StorageDomain>() {

        @Override
        public String getValue(StorageDomain object) {
            return object.getDescription();
        }
    };
    descriptionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.domainDescriptionStorage(), "160px");
}
Also used : StorageDomainAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainAdditionalStatusColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainSharedStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainSharedStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)

Aggregations

AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)9 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)9 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)5 ImageResourceHeader (org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader)5 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)4 NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)4 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)4 ImageResource (com.google.gwt.resources.client.ImageResource)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)3 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 AbstractImageResourceColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn)2 StorageDomainAdditionalStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.StorageDomainAdditionalStatusColumn)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)1