use of org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn 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.AbstractEnumColumn 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.AbstractEnumColumn 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.AbstractEnumColumn 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.AbstractEnumColumn in project ovirt-engine by oVirt.
the class SubTabClusterHostView method initTable.
void initTable() {
getTable().enableColumnResizing();
HostStatusColumn statusIconColumn = new HostStatusColumn();
statusIconColumn.setContextMenuTitle(constants.statusIconClusterHost());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "35px");
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());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.hostGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VDS object) {
return object.getName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameClusterHost(), "220px");
AbstractTextColumn<VDS> hostColumn = new AbstractTextColumn<VDS>() {
@Override
public String getValue(VDS object) {
return object.getHostName();
}
};
hostColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(hostColumn, constants.hostIpClusterHost(), "220px");
AbstractTextColumn<VDS> statusColumn = new AbstractEnumColumn<VDS, VDSStatus>() {
@Override
public VDSStatus getRawValue(VDS object) {
return object.getStatus();
}
};
statusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusClusterHost(), "120px");
if (ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) {
AbstractTextColumn<VDS> loadColumn = new AbstractTextColumn<VDS>() {
@Override
public String getValue(VDS object) {
int numOfActiveVMs = object.getVmActive() != null ? object.getVmActive() : 0;
return ConstantsManager.getInstance().getMessages().numberOfVmsForHostsLoad(numOfActiveVMs);
}
};
loadColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(loadColumn, constants.loadClusterHost(), "120px");
}
if (ApplicationModeHelper.isModeSupported(ApplicationMode.VirtOnly)) {
AbstractTextColumn<VDS> consoleColumn = new AbstractTextColumn<VDS>() {
@Override
public String getValue(VDS host) {
return host.getConsoleAddress() != null ? constants.yes() : constants.no();
}
};
consoleColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(consoleColumn, constants.overriddenConsoleAddress(), "220px");
}
}
Aggregations