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");
}
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");
}
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");
}
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");
}
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());
}
Aggregations