Search in sources :

Example 51 with AbstractTextColumn

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

the class QuotaPopupView method initQuotaStorageTable.

private void initQuotaStorageTable() {
    quotaStorageTable = new ListModelObjectCellTable<>();
    storageQuotaTableContainer.add(quotaStorageTable);
    isStorageInQuotaColumn = new Column<QuotaStorage, Boolean>(new CheckboxCell(true, true)) {

        @Override
        public Boolean getValue(QuotaStorage object) {
            if (selectedStorageGuid.contains(object.getStorageId()) || object.getStorageSizeGB() != null) {
                if (!selectedStorageGuid.contains(object.getStorageId())) {
                    selectedStorageGuid.add(object.getStorageId());
                }
                return true;
            }
            return false;
        }
    };
    isStorageInQuotaColumn.setFieldUpdater((index, object, value) -> {
        if (value) {
            selectedStorageGuid.add(object.getStorageId());
            object.setStorageSizeGB(QuotaStorage.UNLIMITED);
        } else {
            selectedStorageGuid.remove(object.getStorageId());
            object.setStorageSizeGB(null);
        }
        if (model.getGlobalStorageQuota().getEntity()) {
            quotaStorageTable.asEditor().edit(model.getQuotaStorages());
        } else {
            quotaStorageTable.asEditor().edit(model.getAllDataCenterStorages());
        }
    });
    quotaStorageTable.addColumn(new AbstractTextColumn<QuotaStorage>() {

        @Override
        public String getValue(QuotaStorage object) {
            if (object.getStorageName() == null || object.getStorageName().length() == 0) {
                return constants.utlQuotaAllStoragesQuotaPopup();
            }
            return object.getStorageName();
        }
    }, constants.storageNameQuota(), // $NON-NLS-1$
    "200px");
    // $NON-NLS-1$
    quotaStorageTable.addColumn(new QuotaUtilizationStatusColumn<QuotaStorage>(), constants.empty(), "1px");
    quotaStorageTable.addColumn(new AbstractTextColumn<QuotaStorage>() {

        @Override
        public String getValue(QuotaStorage object) {
            if (object.getStorageSizeGB() == null) {
                // $NON-NLS-1$
                return "";
            } else if (object.getStorageSizeGB().equals(QuotaStorage.UNLIMITED)) {
                return messages.unlimitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? // $NON-NLS-1$
                "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage()));
            } else {
                return messages.limitedStorageConsumption(object.getStorageSizeGBUsage() == 0 ? // $NON-NLS-1$
                "0" : diskSizeRenderer.render(object.getStorageSizeGBUsage()), object.getStorageSizeGB());
            }
        }
    }, constants.quota());
    Column<QuotaStorage, String> editColumn = new Column<QuotaStorage, String>(new NullableButtonCell()) {

        @Override
        public String getValue(QuotaStorage object) {
            if (model.getGlobalStorageQuota().getEntity() || (model.getSpecificStorageQuota().getEntity() && selectedStorageGuid.contains(object.getStorageId()))) {
                return constants.editCellQuota();
            }
            return null;
        }
    };
    editColumn.setFieldUpdater((index, object, value) -> model.editQuotaStorage(object));
    // $NON-NLS-1$
    quotaStorageTable.addColumn(editColumn, constants.empty(), "50px");
}
Also used : NullableButtonCell(org.ovirt.engine.ui.webadmin.widget.table.cell.NullableButtonCell) QuotaStorage(org.ovirt.engine.core.common.businessentities.QuotaStorage) QuotaUtilizationStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.QuotaUtilizationStatusColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) CheckboxCell(org.ovirt.engine.ui.common.widget.table.cell.CheckboxCell)

Example 52 with AbstractTextColumn

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

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

Example 54 with AbstractTextColumn

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

the class SubTabDiskVmView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractImageResourceColumn<VM> pluggedColumn = new AbstractImageResourceColumn<VM>() {

        @Override
        public ImageResource getValue(VM object) {
            boolean isDiskPlugged = getDetailModel().isDiskPluggedToVm(object);
            return isDiskPlugged ? resources.upImage() : resources.downImage();
        }

        @Override
        public SafeHtml getTooltip(VM object) {
            if (getDetailModel().isDiskPluggedToVm(object)) {
                return SafeHtmlUtils.fromSafeConstant(constants.active());
            }
            return SafeHtmlUtils.fromSafeConstant(constants.inactive());
        }
    };
    pluggedColumn.setContextMenuTitle(constants.pluggedVm());
    // $NON-NLS-1$
    getTable().addColumn(pluggedColumn, constants.empty(), "30px");
    AbstractTextColumn<VM> nameColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameVm(), "140px");
    VmTypeColumn typeColumn = new VmTypeColumn();
    typeColumn.setContextMenuTitle(constants.typeVm());
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.empty(), "60px");
    AbstractTextColumn<VM> clusterColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getClusterName();
        }
    };
    clusterColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(clusterColumn, constants.clusterVm(), "140px");
    AbstractTextColumn<VM> ipColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getIp();
        }
    };
    ipColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(ipColumn, constants.ipVm(), "140px");
    AbstractTextColumn<VM> fqdnColumn = new AbstractTextColumn<VM>() {

        @Override
        public String getValue(VM object) {
            return object.getFqdn();
        }
    };
    fqdnColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(fqdnColumn, constants.fqdn(), "140px");
    AbstractPercentColumn<VM> memColumn = new AbstractPercentColumn<VM>() {

        @Override
        public Integer getProgressValue(VM object) {
            return object.getUsageMemPercent();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(memColumn, constants.memoryVm(), "140px");
    AbstractPercentColumn<VM> cpuColumn = new AbstractPercentColumn<VM>() {

        @Override
        public Integer getProgressValue(VM object) {
            return object.getUsageCpuPercent();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(cpuColumn, constants.cpuVm(), "140px");
    AbstractPercentColumn<VM> netColumn = new AbstractPercentColumn<VM>() {

        @Override
        public Integer getProgressValue(VM object) {
            return object.getUsageNetworkPercent();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(netColumn, constants.networkVm(), "140px");
    AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {

        @Override
        protected VMStatus getRawValue(VM object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusVm(), "140px");
    AbstractTextColumn<VM> hostColumn = new AbstractUptimeColumn<VM>() {

        @Override
        protected Double getRawValue(VM object) {
            return object.getElapsedTime();
        }
    };
    hostColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(hostColumn, constants.uptimeVm(), "140px");
}
Also used : AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractImageResourceColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractImageResourceColumn) VM(org.ovirt.engine.core.common.businessentities.VM) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) AbstractPercentColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractPercentColumn) AbstractUptimeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)

Example 55 with AbstractTextColumn

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

the class DiskProfilesListModelTable method initTable.

@Override
public void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<DiskProfile> nameColumn = new AbstractTextColumn<DiskProfile>() {

        @Override
        public String getValue(DiskProfile object) {
            return object.getName();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.profileNameLabel(), "200px");
    nameColumn.makeSortable();
    AbstractTextColumn<DiskProfile> descriptionColumn = new AbstractTextColumn<DiskProfile>() {

        @Override
        public String getValue(DiskProfile object) {
            return object.getDescription();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.profileDescriptionLabel(), "200px");
    descriptionColumn.makeSortable();
    AbstractTextColumn<DiskProfile> qosColumn = new AbstractTextColumn<DiskProfile>() {

        @Override
        public String getValue(DiskProfile object) {
            String name = constants.unlimitedQos();
            if (object.getQosId() != null) {
                StorageQos storageQos = getModel().getQos(object.getQosId());
                if (storageQos != null) {
                    name = storageQos.getName();
                }
            }
            return name;
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(qosColumn, constants.qosName(), "200px");
    qosColumn.makeSortable();
    // Add selection listener
    getModel().getSelectedItemChangedEvent().addListener((ev, sender, args) -> updatePermissionPanel());
    getModel().getItemsChangedEvent().addListener((ev, sender, args) -> updatePermissionPanel());
}
Also used : StorageQos(org.ovirt.engine.core.common.businessentities.qos.StorageQos) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DiskProfile(org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)

Aggregations

AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)57 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)23 HashMap (java.util.HashMap)15 Map (java.util.Map)14 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)14 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)10 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)9 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)9 ImageResource (com.google.gwt.resources.client.ImageResource)8 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)7 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)7 Column (com.google.gwt.user.cellview.client.Column)6 ArrayList (java.util.ArrayList)6 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)6 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 NoItemsLabel (org.ovirt.engine.ui.common.widget.label.NoItemsLabel)6 AbstractFullDateTimeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractFullDateTimeColumn)6 List (java.util.List)5 GWT (com.google.gwt.core.client.GWT)4 VM (org.ovirt.engine.core.common.businessentities.VM)4