Search in sources :

Example 16 with AbstractEnumColumn

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

the class MainDataCenterView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    DcStatusColumn statusIconColumn = new DcStatusColumn();
    statusIconColumn.setContextMenuTitle(constants.statusIconDc());
    // $NON-NLS-1$
    getTable().addColumn(statusIconColumn, constants.empty(), "30px");
    DcAdditionalStatusColumn additionalStatusColumn = new DcAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusDataCenter());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "30px");
    AbstractTextColumn<StoragePool> nameColumn = new AbstractLinkColumn<StoragePool>(new FieldUpdater<StoragePool, String>() {

        @Override
        public void update(int index, StoragePool storagePool, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), storagePool.getName());
            // The link was clicked, now fire an event to switch to details.
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(StoragePool object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable(StoragePoolFieldAutoCompleter.NAME);
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameDc(), "150px");
    CommentColumn<StoragePool> commentColumn = new CommentColumn<>();
    getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
    "75px");
    AbstractTextColumn<StoragePool> storageTypeColumn = new AbstractBooleanColumn<StoragePool>(constants.storageTypeLocal(), constants.storageTypeShared()) {

        @Override
        protected Boolean getRawValue(StoragePool object) {
            return object.isLocal();
        }
    };
    storageTypeColumn.makeSortable(StoragePoolFieldAutoCompleter.LOCAL);
    // $NON-NLS-1$
    getTable().addColumn(storageTypeColumn, constants.storgeTypeDc(), "150px");
    AbstractTextColumn<StoragePool> statusColumn = new AbstractEnumColumn<StoragePool, StoragePoolStatus>() {

        @Override
        public StoragePoolStatus getRawValue(StoragePool object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable(StoragePoolFieldAutoCompleter.STATUS);
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusDc(), "150px");
    AbstractTextColumn<StoragePool> versionColumn = new AbstractTextColumn<StoragePool>() {

        @Override
        public String getValue(StoragePool object) {
            return object.getCompatibilityVersion().getValue();
        }
    };
    versionColumn.makeSortable(StoragePoolFieldAutoCompleter.COMPATIBILITY_VERSION);
    // $NON-NLS-1$
    getTable().addColumn(versionColumn, constants.comptVersDc(), "150px");
    AbstractTextColumn<StoragePool> descColumn = new AbstractTextColumn<StoragePool>() {

        @Override
        public String getValue(StoragePool object) {
            return object.getdescription();
        }
    };
    descColumn.makeSortable(StoragePoolFieldAutoCompleter.DESCRIPTION);
    // $NON-NLS-1$
    getTable().addColumn(descColumn, constants.descriptionDc(), "300px");
}
Also used : DcAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.DcAdditionalStatusColumn) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractBooleanColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractBooleanColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DcStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.DcStatusColumn) CommentColumn(org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Example 17 with AbstractEnumColumn

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

the class MainHostView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    HostStatusColumn<VDS> statusIconColumn = new HostStatusColumn<>();
    statusIconColumn.setContextMenuTitle(constants.statusIconHost());
    // $NON-NLS-1$
    getTable().addColumn(statusIconColumn, constants.empty(), "35px");
    HostAdditionalStatusColumn additionalStatusColumn = new HostAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusHost());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "60px");
    AbstractTextColumn<VDS> nameColumn = new AbstractLinkColumn<VDS>(new FieldUpdater<VDS, String>() {

        @Override
        public void update(int index, VDS host, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), host.getName());
            // The link was clicked, now fire an event to switch to details.
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.hostGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(VDS object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable(VdsConditionFieldAutoCompleter.NAME);
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameHost(), "150px");
    CommentColumn<VDS> commentColumn = new CommentColumn<>();
    getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
    "75px");
    AbstractTextColumn<VDS> hostColumn = new AbstractTextColumn<VDS>() {

        @Override
        public String getValue(VDS object) {
            return object.getHostName();
        }
    };
    hostColumn.makeSortable(VdsConditionFieldAutoCompleter.ADDRESS);
    // $NON-NLS-1$
    getTable().addColumn(hostColumn, constants.ipHost(), "150px");
    AbstractTextColumn<VDS> clusterColumn = new AbstractLinkColumn<VDS>(new FieldUpdater<VDS, String>() {

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

        @Override
        public String getValue(VDS object) {
            return object.getClusterName();
        }
    };
    clusterColumn.makeSortable(VdsConditionFieldAutoCompleter.CLUSTER);
    // $NON-NLS-1$
    getTable().addColumn(clusterColumn, constants.clusterHost(), "150px");
    if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        AbstractTextColumn<VDS> dcColumn = new AbstractLinkColumn<VDS>(new FieldUpdater<VDS, String>() {

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

            @Override
            public String getValue(VDS object) {
                return object.getStoragePoolName();
            }
        };
        dcColumn.makeSortable(VdsConditionFieldAutoCompleter.DATACENTER);
        // $NON-NLS-1$
        getTable().addColumn(dcColumn, constants.dcHost(), "150px");
    }
    AbstractTextColumn<VDS> statusColumn = new AbstractEnumColumn<VDS, VDSStatus>() {

        @Override
        public VDSStatus getRawValue(VDS object) {
            return object.getStatus();
        }
    };
    ReasonColumn<VDS> reasonColumn = new ReasonColumn<VDS>() {

        @Override
        protected String getReason(VDS value) {
            return value.getMaintenanceReason();
        }
    };
    List<HasCell<VDS, ?>> list = new ArrayList<>();
    list.add(statusColumn);
    list.add(reasonColumn);
    Cell<VDS> compositeCell = new StatusCompositeCell<>(list);
    AbstractColumn<VDS, VDS> statusTextColumn = new AbstractColumn<VDS, VDS>(compositeCell) {

        @Override
        public VDS getValue(VDS object) {
            return object;
        }

        @Override
        public SafeHtml getTooltip(VDS value) {
            String maintenanceReason = value.getMaintenanceReason();
            if (maintenanceReason != null && !maintenanceReason.trim().isEmpty()) {
                return SafeHtmlUtils.fromString(maintenanceReason);
            }
            return null;
        }
    };
    statusTextColumn.makeSortable(VdsConditionFieldAutoCompleter.STATUS);
    // $NON-NLS-1$
    getTable().addColumn(statusTextColumn, constants.statusHost(), "100px");
    if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        VmCountColumn vmCountColumn = new VmCountColumn();
        vmCountColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        vmCountColumn.makeSortable(VdsConditionFieldAutoCompleter.ACTIVE_VMS);
        // $NON-NLS-1$
        getTable().addColumn(vmCountColumn, constants.vmsCount(), "110px");
    }
    AbstractPercentColumn<VDS> memColumn = new AbstractPercentColumn<VDS>() {

        @Override
        public Integer getProgressValue(VDS object) {
            return object.getUsageMemPercent();
        }
    };
    memColumn.makeSortable(VdsConditionFieldAutoCompleter.MEM_USAGE);
    // $NON-NLS-1$
    getTable().addColumn(memColumn, constants.memoryHost(), "80px");
    AbstractPercentColumn<VDS> cpuColumn = new AbstractPercentColumn<VDS>() {

        @Override
        public Integer getProgressValue(VDS object) {
            return object.getUsageCpuPercent();
        }
    };
    cpuColumn.makeSortable(VdsConditionFieldAutoCompleter.CPU_USAGE);
    // $NON-NLS-1$
    getTable().addColumn(cpuColumn, constants.cpuHost(), "80px");
    AbstractPercentColumn<VDS> netColumn = new AbstractPercentColumn<VDS>() {

        @Override
        public Integer getProgressValue(VDS object) {
            return object.getUsageNetworkPercent();
        }
    };
    netColumn.makeSortable(VdsConditionFieldAutoCompleter.NETWORK_USAGE);
    // $NON-NLS-1$
    getTable().addColumn(netColumn, constants.networkHost(), "80px");
    if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        AbstractTextColumn<VDS> spmColumn = new AbstractTextColumn<VDS>() {

            @Override
            public String getValue(VDS object) {
                int value = object.getVdsSpmPriority();
                int lowValue = defaultSpmPriority / 2;
                int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2;
                if (object.getSpmStatus() != VdsSpmStatus.None) {
                    return object.getSpmStatus().name();
                }
                if (value == -1) {
                    return constants.spmNeverText();
                } else if (value == lowValue) {
                    return constants.spmLowText();
                } else if (value == defaultSpmPriority) {
                    return constants.spmNormalText();
                } else if (value == highValue) {
                    return constants.spmHighText();
                }
                return constants.spmCustomText();
            }
        };
        // $NON-NLS-1$
        getTable().addColumn(spmColumn, constants.spmPriorityHost(), "100px");
    }
}
Also used : HasCell(com.google.gwt.cell.client.HasCell) ArrayList(java.util.ArrayList) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CommentColumn(org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn) HostStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.HostStatusColumn) VDS(org.ovirt.engine.core.common.businessentities.VDS) HostAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.HostAdditionalStatusColumn) AbstractPercentColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractPercentColumn) AbstractColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractColumn) VmCountColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmCountColumn) StatusCompositeCell(org.ovirt.engine.ui.common.widget.table.cell.StatusCompositeCell) ReasonColumn(org.ovirt.engine.ui.webadmin.widget.table.column.ReasonColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Example 18 with AbstractEnumColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn 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 19 with AbstractEnumColumn

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

the class RegisterEntityInfoPanel method initNicsTable.

protected void initNicsTable() {
    nicsTable = new EntityModelCellTable<>(false, true);
    nicsTable.enableColumnResizing();
    AbstractTextColumn<VmNetworkInterface> nameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(nameColumn, constants.nameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> networkNameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getNetworkName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(networkNameColumn, constants.networkNameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> profileNameColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getVnicProfileName();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(profileNameColumn, constants.profileNameInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> typeColumn = new AbstractEnumColumn<VmNetworkInterface, VmInterfaceType>() {

        @Override
        protected VmInterfaceType getRawValue(VmNetworkInterface object) {
            return VmInterfaceType.forValue(object.getType());
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(typeColumn, constants.typeInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> macColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            return object.getMacAddress();
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(macColumn, constants.macInterface(), "90px");
    AbstractTextColumn<VmNetworkInterface> speedColumn = new AbstractTextColumn<VmNetworkInterface>() {

        @Override
        public String getValue(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().toString();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(speedColumn, templates.sub(constants.speedInterface(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> rxColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {

        @Override
        protected Double getRate(VmNetworkInterface object) {
            return object.getStatistics().getReceiveRate();
        }

        @Override
        protected Double getSpeed(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().doubleValue();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(rxColumn, templates.sub(constants.rxRate(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> txColumn = new AbstractRxTxRateColumn<VmNetworkInterface>() {

        @Override
        protected Double getRate(VmNetworkInterface object) {
            return object.getStatistics().getTransmitRate();
        }

        @Override
        protected Double getSpeed(VmNetworkInterface object) {
            if (object.getSpeed() != null) {
                return object.getSpeed().doubleValue();
            } else {
                return null;
            }
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(txColumn, templates.sub(constants.txRate(), constants.mbps()), "90px");
    AbstractTextColumn<VmNetworkInterface> dropsColumn = new AbstractSumUpColumn<VmNetworkInterface>() {

        @Override
        protected Double[] getRawValue(VmNetworkInterface object) {
            Double receiveDropRate = object != null ? object.getStatistics().getReceiveDropRate() : null;
            Double transmitDropRate = object != null ? object.getStatistics().getTransmitDropRate() : null;
            return new Double[] { receiveDropRate, transmitDropRate };
        }
    };
    // $NON-NLS-1$
    nicsTable.addColumn(dropsColumn, templates.sub(constants.dropsInterface(), constants.pkts()), "90px");
    nicsTable.setRowData(new ArrayList<EntityModel>());
    // $NON-NLS-1$
    nicsTable.setWidth("100%");
    nicsTable.setSelectionModel(new NoSelectionModel());
    nicsTable.setEmptyTableWidget(new NoItemsLabel());
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) NoItemsLabel(org.ovirt.engine.ui.common.widget.label.NoItemsLabel) VmNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VmNetworkInterface) 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) AbstractSumUpColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractSumUpColumn) AbstractRxTxRateColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractRxTxRateColumn)

Example 20 with AbstractEnumColumn

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

Aggregations

AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)26 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)23 HashMap (java.util.HashMap)13 Map (java.util.Map)13 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)13 VM (org.ovirt.engine.core.common.businessentities.VM)6 AbstractUptimeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn)6 VmTypeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)6 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)4 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)4 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)4 VmStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn)4 HasCell (com.google.gwt.cell.client.HasCell)3 ImageResource (com.google.gwt.resources.client.ImageResource)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3