use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class SubTabHostVmView method initTable.
void initTable() {
getTable().enableColumnResizing();
VmStatusColumn<VM> statusIconColumn = new VmStatusColumn<>();
statusIconColumn.setContextMenuTitle(constants.statusIconVm());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "30px");
AbstractTextColumn<VM> nameColumn = new AbstractLinkColumn<VM>(new FieldUpdater<VM, String>() {
@Override
public void update(int index, VM vm, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), vm.getName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.virtualMachineGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VM object) {
return object.getName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameVm(), "160px");
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(), "160px");
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(), "200px");
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(), "200px");
getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {
@Override
protected Integer extractValue(VM vm) {
return vm.getUsageMemPercent();
}
}) {
@Override
protected List<Integer> getProgressValues(VM object) {
return object.getMemoryUsageHistory();
}
}, constants.memoryVm(), // $NON-NLS-1$
"120px");
getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {
@Override
protected Integer extractValue(VM vm) {
return vm.getUsageCpuPercent();
}
}) {
@Override
protected List<Integer> getProgressValues(VM object) {
return object.getCpuUsageHistory();
}
}, constants.cpuVm(), // $NON-NLS-1$
"120px");
getTable().addColumn(new ColumnResizeTableLineChartProgressBar<VM>(getTable(), new ResourceConsumptionComparator() {
@Override
protected Integer extractValue(VM vm) {
return vm.getUsageNetworkPercent();
}
}) {
@Override
protected List<Integer> getProgressValues(VM object) {
return object.getNetworkUsageHistory();
}
}, constants.networkVm(), // $NON-NLS-1$
"120px");
AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {
@Override
protected VMStatus getRawValue(VM object) {
// check, if the current host is a target for the migration, then override status
final VDS vds = getDetailModel().getEntity();
if (object.getStatus().equals(VMStatus.MigratingFrom) && vds != null && vds.getId().equals(object.getMigratingToVds())) {
return VMStatus.MigratingTo;
}
return object.getStatus();
}
};
statusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusVm(), "130px");
AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {
@Override
protected Double getRawValue(VM object) {
return object.getElapsedTime();
}
};
uptimeColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(uptimeColumn, constants.uptimeVm(), "110px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class SubTabNetworkClusterView method initTable.
private void initTable() {
getTable().enableColumnResizing();
AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> nameColumn = new AbstractLinkColumn<PairQueryable<Cluster, NetworkCluster>>(new FieldUpdater<PairQueryable<Cluster, NetworkCluster>, String>() {
@Override
public void update(int index, PairQueryable<Cluster, NetworkCluster> cluster, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), cluster.getFirst().getName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.clusterGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
return object.getFirst().getName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameCluster(), "400px");
AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> versionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {
@Override
public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
return object.getFirst().getCompatibilityVersion().getValue();
}
};
versionColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(versionColumn, constants.comptVersCluster(), "130px");
AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> attachedColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {
@Override
public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
return object.getSecond() != null;
}
@Override
protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
return false;
}
};
attachedColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(attachedColumn, constants.attachedNetworkCluster(), "120px");
NetworkClusterStatusColumn statusColumn = new NetworkClusterStatusColumn();
statusColumn.makeSortable(new SimpleStatusColumnComparator<>(statusColumn));
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.networkStatus(), "120px");
AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> netRequiredColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {
@Override
public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
if (object.getSecond() != null) {
return object.getSecond().isRequired();
}
return false;
}
@Override
protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
return false;
}
};
netRequiredColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(netRequiredColumn, constants.requiredNetCluster(), "120px");
AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> netRoleColumn = createNetRoleColumn();
netRoleColumn.makeSortable(new NetRoleColumnComparator());
// $NON-NLS-1$
getTable().addColumn(netRoleColumn, constants.roleNetCluster(), "120px");
AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> descriptionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {
@Override
public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
return object.getFirst().getDescription();
}
};
descriptionColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(descriptionColumn, constants.descriptionCluster(), "400px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class SubTabTemplateVmView method initTable.
void initTable() {
getTable().enableColumnResizing();
VmStatusColumn<VM> statusIconColumn = new VmStatusColumn<>();
statusIconColumn.setContextMenuTitle(constants.statusIconVm());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "30px");
AbstractTextColumn<VM> nameColumn = new AbstractLinkColumn<VM>(new FieldUpdater<VM, String>() {
@Override
public void update(int index, VM vm, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), vm.getName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.virtualMachineGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VM object) {
return object.getName();
}
};
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameVm(), "200px");
VmTypeColumn typeColumn = new VmTypeColumn();
typeColumn.setContextMenuTitle(constants.typeVm());
// $NON-NLS-1$
getTable().addColumn(typeColumn, constants.empty(), "60px");
AbstractTextColumn<VM> hostColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getRunOnVdsName();
}
};
// $NON-NLS-1$
getTable().addColumn(hostColumn, constants.hostVm(), "200px");
AbstractTextColumn<VM> ipColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getIp();
}
};
// $NON-NLS-1$
getTable().addColumn(ipColumn, constants.ipVm(), "200px");
AbstractTextColumn<VM> fqdnColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getFqdn();
}
};
// $NON-NLS-1$
getTable().addColumn(fqdnColumn, constants.fqdn(), "200px");
AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {
@Override
protected VMStatus getRawValue(VM object) {
return object.getStatus();
}
};
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusVm(), "200px");
AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {
@Override
protected Double getRawValue(VM object) {
return object.getElapsedTime();
}
};
// $NON-NLS-1$
getTable().addColumn(uptimeColumn, constants.uptimeVm(), "200px");
AbstractTextColumn<VM> consoleConnectedUserColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM vm) {
return StringHelper.isNotNullOrEmpty(vm.getClientIp()) ? vm.getConsoleCurentUserName() : null;
}
};
// $NON-NLS-1$
getTable().addColumn(consoleConnectedUserColumn, constants.consoleConnectedUserVm(), "200px");
AbstractTextColumn<VM> loggedInUserColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getGuestCurentUserName();
}
};
// $NON-NLS-1$
getTable().addColumn(loggedInUserColumn, constants.loggedInUserVm(), "200px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class SubTabPoolVmView method initTable.
void initTable() {
getTable().showPagingButtons();
getTable().enableColumnResizing();
VmStatusColumn<VM> statusIconColumn = new VmStatusColumn<>();
statusIconColumn.setContextMenuTitle(constants.statusIconVm());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "30px");
AbstractTextColumn<VM> nameColumn = new AbstractLinkColumn<VM>(new FieldUpdater<VM, String>() {
@Override
public void update(int index, VM vm, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), vm.getName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.virtualMachineGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VM object) {
return object.getName();
}
};
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameVm(), "200px");
VmTypeColumn typeColumn = new VmTypeColumn();
typeColumn.setContextMenuTitle(constants.typeVm());
// $NON-NLS-1$
getTable().addColumn(typeColumn, constants.empty(), "60px");
AbstractTextColumn<VM> hostColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getRunOnVdsName();
}
};
// $NON-NLS-1$
getTable().addColumn(hostColumn, constants.hostVm(), "200px");
AbstractTextColumn<VM> ipColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getIp();
}
};
// $NON-NLS-1$
getTable().addColumn(ipColumn, constants.ipVm(), "200px");
AbstractTextColumn<VM> fqdnColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getFqdn();
}
};
// $NON-NLS-1$
getTable().addColumn(fqdnColumn, constants.fqdn(), "200px");
AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {
@Override
protected VMStatus getRawValue(VM object) {
return object.getStatus();
}
};
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusVm(), "200px");
AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {
@Override
protected Double getRawValue(VM object) {
return object.getElapsedTime();
}
};
// $NON-NLS-1$
getTable().addColumn(uptimeColumn, constants.uptimeVm(), "200px");
AbstractTextColumn<VM> consoleConnectedUserColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM vm) {
return StringHelper.isNotNullOrEmpty(vm.getClientIp()) ? vm.getConsoleCurentUserName() : null;
}
};
// $NON-NLS-1$
getTable().addColumn(consoleConnectedUserColumn, constants.consoleConnectedUserVm(), "200px");
AbstractTextColumn<VM> loggedInUserColumn = new AbstractTextColumn<VM>() {
@Override
public String getValue(VM object) {
return object.getGuestCurentUserName();
}
};
// $NON-NLS-1$
getTable().addColumn(loggedInUserColumn, constants.loggedInUserVm(), "200px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class MainStorageView 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 AbstractLinkColumn<StorageDomain>(new FieldUpdater<StorageDomain, String>() {
@Override
public void update(int index, StorageDomain storageDomain, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), storageDomain.getName());
// The link was clicked, now fire an event to switch to details.
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.storageGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(StorageDomain object) {
return object.getName();
}
};
nameColumn.makeSortable(StorageDomainFieldAutoCompleter.NAME);
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.domainNameStorage(), "150px");
CommentColumn<StorageDomain> commentColumn = new CommentColumn<>();
getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
"75px");
AbstractTextColumn<StorageDomain> domainTypeColumn = new AbstractEnumColumn<StorageDomain, StorageDomainType>() {
@Override
protected StorageDomainType getRawValue(StorageDomain object) {
return object.getStorageDomainType();
}
};
// $NON-NLS-1$
getTable().addColumn(domainTypeColumn, constants.domainTypeStorage(), "150px");
AbstractTextColumn<StorageDomain> storageTypeColumn = new AbstractEnumColumn<StorageDomain, StorageType>() {
@Override
protected StorageType getRawValue(StorageDomain object) {
return object.getStorageType();
}
};
storageTypeColumn.makeSortable(StorageDomainFieldAutoCompleter.TYPE);
// $NON-NLS-1$
getTable().addColumn(storageTypeColumn, constants.storageTypeStorage(), "150px");
AbstractTextColumn<StorageDomain> formatColumn = new AbstractEnumColumn<StorageDomain, StorageFormatType>() {
@Override
protected StorageFormatType getRawValue(StorageDomain object) {
return object.getStorageFormat();
}
};
// $NON-NLS-1$
getTable().addColumn(formatColumn, constants.formatStorage(), "140px");
AbstractTextColumn<StorageDomain> crossDataCenterStatusColumn = new AbstractTextColumn<StorageDomain>() {
@Override
public String getValue(StorageDomain object) {
if (object.getStorageDomainType() == StorageDomainType.ISO) {
return EnumTranslator.getInstance().translate(object.getStorageDomainSharedStatus());
} else {
return EnumTranslator.getInstance().translate(object.getStatus());
}
}
};
crossDataCenterStatusColumn.makeSortable(StorageDomainFieldAutoCompleter.STATUS);
// $NON-NLS-1$
getTable().addColumn(crossDataCenterStatusColumn, constants.crossDcStatusStorage(), "210px");
AbstractStorageSizeColumn<StorageDomain> totalSpaceColumn = new AbstractStorageSizeColumn<StorageDomain>() {
@Override
public Long getRawValue(StorageDomain object) {
Integer totalSpace = object.getTotalDiskSize();
return totalSpace == null ? null : Long.valueOf(totalSpace);
}
};
// $NON-NLS-1$
getTable().addColumn(totalSpaceColumn, constants.totalSpaceStorage(), "130px");
AbstractStorageSizeColumn<StorageDomain> freeSpaceColumn = new AbstractStorageSizeColumn<StorageDomain>() {
@Override
public Long getRawValue(StorageDomain object) {
Integer availableDiskSize = object.getAvailableDiskSize();
return availableDiskSize == null ? null : Long.valueOf(availableDiskSize);
}
};
freeSpaceColumn.makeSortable(StorageDomainFieldAutoCompleter.SIZE);
// $NON-NLS-1$
getTable().addColumn(freeSpaceColumn, constants.freeSpaceStorage(), "130px");
AbstractTextColumn<StorageDomain> descriptionColumn = new AbstractTextColumn<StorageDomain>() {
@Override
public String getValue(StorageDomain object) {
return object.getDescription();
}
};
descriptionColumn.makeSortable(StorageDomainFieldAutoCompleter.DESCRIPTION);
// $NON-NLS-1$
getTable().addColumn(descriptionColumn, constants.domainDescriptionStorage(), "200px");
}
Aggregations