use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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());
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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());
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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());
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class RegisterTemplatePopupView method createEntityTable.
@Override
protected void createEntityTable(RegisterTemplateModel model) {
AbstractTextColumn<Object> nameColumn = new AbstractTextColumn<Object>() {
@Override
public String getValue(Object object) {
return getEntity(object).getName();
}
};
// $NON-NLS-1$
entityTable.addColumn(nameColumn, constants.nameVm(), "150px");
AbstractTextColumn<Object> originColumn = new AbstractEnumColumn<Object, OriginType>() {
@Override
protected OriginType getRawValue(Object object) {
return getEntity(object).getOrigin();
}
};
// $NON-NLS-1$
entityTable.addColumn(originColumn, constants.originVm(), "100px");
AbstractTextColumn<Object> memoryColumn = new AbstractTextColumn<Object>() {
@Override
public String getValue(Object object) {
int size = getEntity(object).getMemSizeMb();
return messages.megabytes(String.valueOf(size));
}
};
// $NON-NLS-1$
entityTable.addColumn(memoryColumn, constants.memoryVm(), "100px");
AbstractTextColumn<Object> cpuColumn = new AbstractTextColumn<Object>() {
@Override
public String getValue(Object object) {
int numOfCpus = getEntity(object).getNumOfCpus();
return String.valueOf(numOfCpus);
}
};
// $NON-NLS-1$
entityTable.addColumn(cpuColumn, constants.cpusVm(), "50px");
AbstractTextColumn<Object> archColumn = new AbstractTextColumn<Object>() {
@Override
public String getValue(Object object) {
ArchitectureType clusterArch = getEntity(object).getClusterArch();
return String.valueOf(clusterArch);
}
};
// $NON-NLS-1$
entityTable.addColumn(archColumn, constants.architectureVm(), "100px");
AbstractTextColumn<Object> diskColumn = new AbstractTextColumn<Object>() {
@Override
public String getValue(Object object) {
int numOfDisks = getEntity(object).getDiskTemplateMap().size();
return String.valueOf(numOfDisks);
}
};
// $NON-NLS-1$
entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
// $NON-NLS-1$
entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
if (model.isQuotaEnabled()) {
// $NON-NLS-1$
entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
}
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class QuotaPopupView method initQuotaClusterTable.
private void initQuotaClusterTable() {
quotaClusterTable = new ListModelObjectCellTable<>();
clusterQuotaTableContainer.add(quotaClusterTable);
isClusterInQuotaColumn = new Column<QuotaCluster, Boolean>(new CheckboxCell(true, true)) {
@Override
public Boolean getValue(QuotaCluster object) {
if (selectedClusterGuid.contains(object.getClusterId()) || (object.getMemSizeMB() != null && object.getVirtualCpu() != null)) {
if (!selectedClusterGuid.contains(object.getClusterId())) {
selectedClusterGuid.add(object.getClusterId());
}
return true;
}
return false;
}
};
isClusterInQuotaColumn.setFieldUpdater((index, object, value) -> {
if (value) {
selectedClusterGuid.add(object.getClusterId());
object.setVirtualCpu(QuotaCluster.UNLIMITED_VCPU);
object.setMemSizeMB(QuotaCluster.UNLIMITED_MEM);
} else {
selectedClusterGuid.remove(object.getClusterId());
object.setVirtualCpu(null);
object.setMemSizeMB(null);
}
if (model.getGlobalClusterQuota().getEntity()) {
quotaClusterTable.asEditor().edit(model.getQuotaClusters());
} else {
quotaClusterTable.asEditor().edit(model.getAllDataCenterClusters());
}
});
quotaClusterTable.addColumn(new AbstractTextColumn<QuotaCluster>() {
@Override
public String getValue(QuotaCluster object) {
if (object.getClusterName() == null || object.getClusterName().length() == 0) {
return constants.ultQuotaForAllClustersQuotaPopup();
}
return object.getClusterName();
}
}, constants.clusterNameQuota(), // $NON-NLS-1$
"200px");
// $NON-NLS-1$
quotaClusterTable.addColumn(new QuotaUtilizationStatusColumn<QuotaCluster>(), constants.empty(), "1px");
quotaClusterTable.addColumn(new AbstractTextColumn<QuotaCluster>() {
@Override
public String getValue(QuotaCluster object) {
if (object.getMemSizeMB() == null) {
// $NON-NLS-1$
return "";
} else if (object.getMemSizeMB().equals(QuotaCluster.UNLIMITED_MEM)) {
return messages.unlimitedMemConsumption(object.getMemSizeMBUsage());
} else {
return messages.limitedMemConsumption(object.getMemSizeMBUsage(), object.getMemSizeMB());
}
}
}, constants.quotaOfMemQuota());
quotaClusterTable.addColumn(new AbstractTextColumn<QuotaCluster>() {
@Override
public String getValue(QuotaCluster object) {
if (object.getVirtualCpu() == null) {
// $NON-NLS-1$
return "";
} else if (object.getVirtualCpu().equals(QuotaCluster.UNLIMITED_VCPU)) {
return messages.unlimitedVcpuConsumption(object.getVirtualCpuUsage());
} else {
return messages.limitedVcpuConsumption(object.getVirtualCpuUsage(), object.getVirtualCpu());
}
}
}, constants.quotaOfVcpuQuota());
NullableButtonCell editCellButton = new NullableButtonCell();
Column<QuotaCluster, String> editColumn = new Column<QuotaCluster, String>(editCellButton) {
@Override
public String getValue(QuotaCluster object) {
if (model.getGlobalClusterQuota().getEntity() || (model.getSpecificClusterQuota().getEntity() && selectedClusterGuid.contains(object.getClusterId()))) {
return constants.editCellQuota();
}
return null;
}
};
// $NON-NLS-1$
quotaClusterTable.addColumn(editColumn, constants.empty(), "50px");
editColumn.setFieldUpdater((index, object, value) -> model.editQuotaCluster(object));
}
Aggregations