Search in sources :

Example 1 with DiskImageStatusColumn

use of org.ovirt.engine.ui.common.widget.table.column.DiskImageStatusColumn 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)

Aggregations

NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)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 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 DiskImageStatusColumn (org.ovirt.engine.ui.common.widget.table.column.DiskImageStatusColumn)1 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)1