Search in sources :

Example 1 with ImageResourceHeader

use of org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader in project ovirt-engine by oVirt.

the class MainDiskView method ensureColumnsVisible.

private void ensureColumnsVisible(boolean all, boolean images, boolean luns, boolean cinder) {
    getTable().ensureColumnVisible(aliasColumn, constants.aliasDisk(), all || images || luns || cinder, // $NON-NLS-1$
    "150px");
    getTable().ensureColumnVisible(idColumn, constants.idDisk(), all || images || luns || cinder, // $NON-NLS-1$
    "150px");
    getTable().ensureColumnVisible(shareableDiskColumn, new ImageResourceHeader(shareableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.shareable())), all || images || luns || cinder, // $NON-NLS-1$
    "30px");
    getTable().ensureColumnVisible(// $NON-NLS-1$
    DisksViewColumns.diskContainersIconColumn, // $NON-NLS-1$
    "", // $NON-NLS-1$
    all || images || luns || cinder, // $NON-NLS-1$
    "30px");
    getTable().ensureColumnVisible(diskContainersColumn, constants.attachedToDisk(), all || images || luns || cinder, // $NON-NLS-1$
    "125px");
    getTable().ensureColumnVisible(storageDomainsColumn, constants.storageDomainsDisk(), images || cinder, // $NON-NLS-1$
    "180px");
    getTable().ensureColumnVisible(sizeColumn, constants.provisionedSizeDisk(), all || images || luns || cinder, // $NON-NLS-1$
    "110px");
    getTable().ensureColumnVisible(allocationColumn, constants.allocationDisk(), images, // $NON-NLS-1$
    "130px");
    getTable().ensureColumnVisible(cinderVolumeTypeColumn, constants.cinderVolumeTypeDisk(), cinder, // $NON-NLS-1$
    "80px");
    getTable().ensureColumnVisible(dateCreatedColumn, constants.creationDateDisk(), images || cinder, // $NON-NLS-1$
    "130px");
    getTable().ensureColumnVisible(statusColumn, constants.statusDisk(), images || cinder || all, // $NON-NLS-1$
    "80px");
    getTable().ensureColumnVisible(lunIdColumn, constants.lunIdSanStorage(), luns, // $NON-NLS-1$
    "100px");
    getTable().ensureColumnVisible(lunSerialColumn, constants.serialSanStorage(), luns, // $NON-NLS-1$
    "100px");
    getTable().ensureColumnVisible(lunVendorIdColumn, constants.vendorIdSanStorage(), luns, // $NON-NLS-1$
    "100px");
    getTable().ensureColumnVisible(lunProductIdColumn, constants.productIdSanStorage(), luns, // $NON-NLS-1$
    "100px");
    getTable().ensureColumnVisible(qoutaColumn, constants.quotaDisk(), images && isQuotaVisible, // $NON-NLS-1$
    "120px");
    getTable().ensureColumnVisible(diskStorageTypeColumn, constants.typeDisk(), all, // $NON-NLS-1$
    "80px");
    getTable().ensureColumnVisible(descriptionColumn, constants.descriptionDisk(), all || images || luns || cinder, // $NON-NLS-1$
    "90px");
}
Also used : ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader)

Example 2 with ImageResourceHeader

use of org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader in project ovirt-engine by oVirt.

the class ImportVmFromExportDomainPopupView method initDiskTable.

private void initDiskTable() {
    diskTable = new ListModelObjectCellTable<>();
    diskTable.enableColumnResizing();
    AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {

        @Override
        public String getValue(DiskImage object) {
            return object.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(aliasColumn, constants.aliasDisk(), "100px");
    AbstractImageResourceColumn<DiskImage> bootableDiskColumn = new AbstractImageResourceColumn<DiskImage>() {

        @Override
        public ImageResource getValue(DiskImage object) {
            return object.getDiskVmElements().iterator().next().isBoot() ? getDefaultImage() : null;
        }

        @Override
        public ImageResource getDefaultImage() {
            return resources.bootableDiskIcon();
        }

        @Override
        public SafeHtml getTooltip(DiskImage object) {
            if (object.getDiskVmElements().iterator().next().isBoot()) {
                return SafeHtmlUtils.fromSafeConstant(constants.bootableDisk());
            }
            return null;
        }
    };
    diskTable.addColumn(bootableDiskColumn, new ImageResourceHeader(DisksViewColumns.bootableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {

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

        @Override
        protected Long getRawValue(DiskImage object) {
            return object.getActualSizeInBytes();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(actualSizeColumn, constants.sizeDisk(), "130px");
    AbstractTextColumn<DiskImage> dateCreatedColumn = new AbstractFullDateTimeColumn<DiskImage>() {

        @Override
        protected Date getRawValue(DiskImage object) {
            return object.getCreationDate();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(dateCreatedColumn, constants.dateCreatedInterface(), "120px");
    diskTable.setSelectionModel(new NoSelectionModel<DiskImage>());
    addAllocationColumn();
    diskTable.getElement().getStyle().setPosition(Position.RELATIVE);
}
Also used : AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AbstractFullDateTimeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 3 with ImageResourceHeader

use of org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader in project ovirt-engine by oVirt.

the class VmDiskAttachPopupWidget method initLunDisksTable.

private void initLunDisksTable() {
    lunDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "60px");
    AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "85px");
    AbstractTextColumn<EntityModel> lunIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getLUNId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(lunIdColumn, constants.lunIdSanStorage(), "60px");
    AbstractTextColumn<EntityModel> idColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getId().toString();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "60px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {

        @Override
        protected Long getRawValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return (long) disk.getLun().getDeviceSize();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(sizeColumn, constants.devSizeSanStorage(), "70px");
    AbstractTextColumn<EntityModel> pathColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return String.valueOf(disk.getLun().getPathCount());
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(pathColumn, constants.pathSanStorage(), "40px");
    AbstractTextColumn<EntityModel> vendorIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getVendorId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(vendorIdColumn, constants.vendorIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> productIdColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getProductId();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(productIdColumn, constants.productIdSanStorage(), "70px");
    AbstractTextColumn<EntityModel> serialColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            LunDisk disk = (LunDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getLun().getSerial();
        }
    };
    // $NON-NLS-1$
    lunDiskTable.addColumn(serialColumn, constants.serialSanStorage(), "70px");
    // $NON-NLS-1$
    lunDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    lunDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    lunDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {

        @Override
        public ImageResource getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.isShareable() ? resources.shareableDiskIcon() : null;
        }

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            if (disk.isShareable()) {
                return SafeHtmlUtils.fromSafeConstant(constants.shareable());
            }
            return null;
        }
    }, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
    "30px");
    // $NON-NLS-1$
    lunDiskTable.setWidth("100%");
    lunDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 4 with ImageResourceHeader

use of org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader in project ovirt-engine by oVirt.

the class VmDiskAttachPopupWidget method initCinderDisksTable.

private void initCinderDisksTable() {
    cinderDiskTable.enableColumnResizing();
    AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "100px");
    AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getDiskDescription();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "100px");
    AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>(SizeConverter.SizeUnit.GiB) {

        @Override
        protected Long getRawValue(EntityModel object) {
            CinderDisk disk = (CinderDisk) ((DiskModel) object.getEntity()).getDisk();
            return disk.getSizeInGigabytes();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(sizeColumn, constants.provisionedSizeVmDiskTable(), "100px");
    // $NON-NLS-1$
    cinderDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
    AbstractTextColumn<EntityModel> cinderVolumeTypeColumn = new AbstractTextColumn<EntityModel>() {

        @Override
        public String getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.getCinderVolumeType();
        }
    };
    // $NON-NLS-1$
    cinderDiskTable.addColumn(cinderVolumeTypeColumn, constants.cinderVolumeTypeDisk(), "90px");
    cinderDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
    "30px");
    cinderDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    cinderDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {

        @Override
        public ImageResource getValue(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            return disk.isShareable() ? resources.shareableDiskIcon() : null;
        }

        @Override
        public SafeHtml getTooltip(EntityModel object) {
            Disk disk = ((DiskModel) object.getEntity()).getDisk();
            if (disk.isShareable()) {
                return SafeHtmlUtils.fromSafeConstant(constants.shareable());
            }
            return null;
        }
    }, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
    "30px");
    // $NON-NLS-1$
    cinderDiskTable.setWidth("100%");
    cinderDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) AttachDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) ImageResource(com.google.gwt.resources.client.ImageResource) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) LunDisk(org.ovirt.engine.core.common.businessentities.storage.LunDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk)

Example 5 with ImageResourceHeader

use of org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader in project ovirt-engine by oVirt.

the class ImportVmFromExternalProviderPopupView method initDiskTable.

private void initDiskTable() {
    diskTable = new ListModelObjectCellTable<>();
    diskTable.enableColumnResizing();
    AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {

        @Override
        public String getValue(DiskImage object) {
            return object.getDiskAlias();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(aliasColumn, constants.aliasDisk(), "300px");
    AbstractImageResourceColumn<DiskImage> bootableDiskColumn = new AbstractImageResourceColumn<DiskImage>() {

        @Override
        public ImageResource getValue(DiskImage object) {
            boolean isBoot = !object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot();
            return isBoot ? getDefaultImage() : null;
        }

        @Override
        public ImageResource getDefaultImage() {
            return resources.bootableDiskIcon();
        }

        @Override
        public SafeHtml getTooltip(DiskImage object) {
            if (!object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot()) {
                return SafeHtmlUtils.fromSafeConstant(constants.bootableDisk());
            }
            return null;
        }
    };
    diskTable.addColumn(bootableDiskColumn, new ImageResourceHeader(DisksViewColumns.bootableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.bootableDisk())), // $NON-NLS-1$
    "30px");
    AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {

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

        @Override
        protected Long getRawValue(DiskImage object) {
            return object.getActualSizeInBytes();
        }
    };
    // $NON-NLS-1$
    diskTable.addColumn(actualSizeColumn, constants.sizeDisk(), "130px");
    diskTable.setSelectionModel(new NoSelectionModel<DiskImage>());
    diskTable.getElement().getStyle().setPosition(Position.RELATIVE);
}
Also used : AbstractDiskSizeColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn) ImageResourceHeader(org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

ImageResourceHeader (org.ovirt.engine.ui.common.widget.table.header.ImageResourceHeader)10 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)6 ImageResource (com.google.gwt.resources.client.ImageResource)4 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)4 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)4 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)3 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)3 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)3 NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)2 AbstractImageResourceColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn)2 Context (com.google.gwt.cell.client.Cell.Context)1 GWT (com.google.gwt.core.client.GWT)1 BrowserEvents (com.google.gwt.dom.client.BrowserEvents)1 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)1 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)1 UiBinder (com.google.gwt.uibinder.client.UiBinder)1 UiField (com.google.gwt.uibinder.client.UiField)1