use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class MainClusterView method initTable.
void initTable() {
getTable().enableColumnResizing();
AbstractTextColumn<Cluster> nameColumn = new AbstractLinkColumn<Cluster>(new FieldUpdater<Cluster, String>() {
@Override
public void update(int index, Cluster cluster, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), cluster.getName());
// The link was clicked, now fire an event to switch to details.
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.clusterGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(Cluster object) {
return object.getName();
}
};
nameColumn.makeSortable(ClusterConditionFieldAutoCompleter.NAME);
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameCluster(), "150px");
ClusterAdditionalStatusColumn additionalStatusColumn = new ClusterAdditionalStatusColumn();
additionalStatusColumn.setContextMenuTitle(constants.additionalStatusCluster());
// $NON-NLS-1$
getTable().addColumn(additionalStatusColumn, constants.empty(), "30px");
CommentColumn<Cluster> commentColumn = new CommentColumn<>();
getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
"75px");
if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
AbstractTextColumn<Cluster> dataCenterColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
return object.getStoragePoolName();
}
};
// $NON-NLS-1$
getTable().addColumn(dataCenterColumn, constants.dcCluster(), "150px");
}
AbstractTextColumn<Cluster> versionColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
return object.getCompatibilityVersion().getValue();
}
};
// $NON-NLS-1$
getTable().addColumn(versionColumn, constants.comptVersCluster(), "150px");
AbstractTextColumn<Cluster> descColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
return object.getDescription();
}
};
descColumn.makeSortable(ClusterConditionFieldAutoCompleter.DESCRIPTION);
// $NON-NLS-1$
getTable().addColumn(descColumn, constants.descriptionCluster(), "300px");
if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
AbstractTextColumn<Cluster> cpuTypeColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
return object.getCpuName();
}
};
// $NON-NLS-1$
getTable().addColumn(cpuTypeColumn, constants.cpuTypeCluster(), "150px");
}
AbstractTextColumn<Cluster> hostCountColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
if (object.getClusterHostsAndVms() == null) {
// $NON-NLS-1$
return "";
}
// $NON-NLS-1$
return object.getClusterHostsAndVms().getHosts() + "";
}
};
// $NON-NLS-1$
getTable().addColumn(hostCountColumn, constants.hostCount(), "150px");
AbstractTextColumn<Cluster> vmCountColumn = new AbstractTextColumn<Cluster>() {
@Override
public String getValue(Cluster object) {
if (object.getClusterHostsAndVms() == null) {
// $NON-NLS-1$
return "";
}
// $NON-NLS-1$
return object.getClusterHostsAndVms().getVms() + "";
}
};
// $NON-NLS-1$
getTable().addColumn(vmCountColumn, constants.vmCount(), "150px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class MainDataCenterView method initTable.
void initTable() {
getTable().enableColumnResizing();
DcStatusColumn statusIconColumn = new DcStatusColumn();
statusIconColumn.setContextMenuTitle(constants.statusIconDc());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "30px");
DcAdditionalStatusColumn additionalStatusColumn = new DcAdditionalStatusColumn();
additionalStatusColumn.setContextMenuTitle(constants.additionalStatusDataCenter());
// $NON-NLS-1$
getTable().addColumn(additionalStatusColumn, constants.empty(), "30px");
AbstractTextColumn<StoragePool> nameColumn = new AbstractLinkColumn<StoragePool>(new FieldUpdater<StoragePool, String>() {
@Override
public void update(int index, StoragePool storagePool, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), storagePool.getName());
// The link was clicked, now fire an event to switch to details.
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
}
}) {
@Override
public String getValue(StoragePool object) {
return object.getName();
}
};
nameColumn.makeSortable(StoragePoolFieldAutoCompleter.NAME);
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameDc(), "150px");
CommentColumn<StoragePool> commentColumn = new CommentColumn<>();
getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
"75px");
AbstractTextColumn<StoragePool> storageTypeColumn = new AbstractBooleanColumn<StoragePool>(constants.storageTypeLocal(), constants.storageTypeShared()) {
@Override
protected Boolean getRawValue(StoragePool object) {
return object.isLocal();
}
};
storageTypeColumn.makeSortable(StoragePoolFieldAutoCompleter.LOCAL);
// $NON-NLS-1$
getTable().addColumn(storageTypeColumn, constants.storgeTypeDc(), "150px");
AbstractTextColumn<StoragePool> statusColumn = new AbstractEnumColumn<StoragePool, StoragePoolStatus>() {
@Override
public StoragePoolStatus getRawValue(StoragePool object) {
return object.getStatus();
}
};
statusColumn.makeSortable(StoragePoolFieldAutoCompleter.STATUS);
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusDc(), "150px");
AbstractTextColumn<StoragePool> versionColumn = new AbstractTextColumn<StoragePool>() {
@Override
public String getValue(StoragePool object) {
return object.getCompatibilityVersion().getValue();
}
};
versionColumn.makeSortable(StoragePoolFieldAutoCompleter.COMPATIBILITY_VERSION);
// $NON-NLS-1$
getTable().addColumn(versionColumn, constants.comptVersDc(), "150px");
AbstractTextColumn<StoragePool> descColumn = new AbstractTextColumn<StoragePool>() {
@Override
public String getValue(StoragePool object) {
return object.getdescription();
}
};
descColumn.makeSortable(StoragePoolFieldAutoCompleter.DESCRIPTION);
// $NON-NLS-1$
getTable().addColumn(descColumn, constants.descriptionDc(), "300px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn in project ovirt-engine by oVirt.
the class MainHostView method initTable.
void initTable() {
getTable().enableColumnResizing();
HostStatusColumn<VDS> statusIconColumn = new HostStatusColumn<>();
statusIconColumn.setContextMenuTitle(constants.statusIconHost());
// $NON-NLS-1$
getTable().addColumn(statusIconColumn, constants.empty(), "35px");
HostAdditionalStatusColumn additionalStatusColumn = new HostAdditionalStatusColumn();
additionalStatusColumn.setContextMenuTitle(constants.additionalStatusHost());
// $NON-NLS-1$
getTable().addColumn(additionalStatusColumn, constants.empty(), "60px");
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());
// The link was clicked, now fire an event to switch to details.
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.hostGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VDS object) {
return object.getName();
}
};
nameColumn.makeSortable(VdsConditionFieldAutoCompleter.NAME);
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameHost(), "150px");
CommentColumn<VDS> commentColumn = new CommentColumn<>();
getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
"75px");
AbstractTextColumn<VDS> hostColumn = new AbstractTextColumn<VDS>() {
@Override
public String getValue(VDS object) {
return object.getHostName();
}
};
hostColumn.makeSortable(VdsConditionFieldAutoCompleter.ADDRESS);
// $NON-NLS-1$
getTable().addColumn(hostColumn, constants.ipHost(), "150px");
AbstractTextColumn<VDS> clusterColumn = 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.getClusterName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.clusterGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VDS object) {
return object.getClusterName();
}
};
clusterColumn.makeSortable(VdsConditionFieldAutoCompleter.CLUSTER);
// $NON-NLS-1$
getTable().addColumn(clusterColumn, constants.clusterHost(), "150px");
if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
AbstractTextColumn<VDS> dcColumn = 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.getStoragePoolName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
}
}) {
@Override
public String getValue(VDS object) {
return object.getStoragePoolName();
}
};
dcColumn.makeSortable(VdsConditionFieldAutoCompleter.DATACENTER);
// $NON-NLS-1$
getTable().addColumn(dcColumn, constants.dcHost(), "150px");
}
AbstractTextColumn<VDS> statusColumn = new AbstractEnumColumn<VDS, VDSStatus>() {
@Override
public VDSStatus getRawValue(VDS object) {
return object.getStatus();
}
};
ReasonColumn<VDS> reasonColumn = new ReasonColumn<VDS>() {
@Override
protected String getReason(VDS value) {
return value.getMaintenanceReason();
}
};
List<HasCell<VDS, ?>> list = new ArrayList<>();
list.add(statusColumn);
list.add(reasonColumn);
Cell<VDS> compositeCell = new StatusCompositeCell<>(list);
AbstractColumn<VDS, VDS> statusTextColumn = new AbstractColumn<VDS, VDS>(compositeCell) {
@Override
public VDS getValue(VDS object) {
return object;
}
@Override
public SafeHtml getTooltip(VDS value) {
String maintenanceReason = value.getMaintenanceReason();
if (maintenanceReason != null && !maintenanceReason.trim().isEmpty()) {
return SafeHtmlUtils.fromString(maintenanceReason);
}
return null;
}
};
statusTextColumn.makeSortable(VdsConditionFieldAutoCompleter.STATUS);
// $NON-NLS-1$
getTable().addColumn(statusTextColumn, constants.statusHost(), "100px");
if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
VmCountColumn vmCountColumn = new VmCountColumn();
vmCountColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
vmCountColumn.makeSortable(VdsConditionFieldAutoCompleter.ACTIVE_VMS);
// $NON-NLS-1$
getTable().addColumn(vmCountColumn, constants.vmsCount(), "110px");
}
AbstractPercentColumn<VDS> memColumn = new AbstractPercentColumn<VDS>() {
@Override
public Integer getProgressValue(VDS object) {
return object.getUsageMemPercent();
}
};
memColumn.makeSortable(VdsConditionFieldAutoCompleter.MEM_USAGE);
// $NON-NLS-1$
getTable().addColumn(memColumn, constants.memoryHost(), "80px");
AbstractPercentColumn<VDS> cpuColumn = new AbstractPercentColumn<VDS>() {
@Override
public Integer getProgressValue(VDS object) {
return object.getUsageCpuPercent();
}
};
cpuColumn.makeSortable(VdsConditionFieldAutoCompleter.CPU_USAGE);
// $NON-NLS-1$
getTable().addColumn(cpuColumn, constants.cpuHost(), "80px");
AbstractPercentColumn<VDS> netColumn = new AbstractPercentColumn<VDS>() {
@Override
public Integer getProgressValue(VDS object) {
return object.getUsageNetworkPercent();
}
};
netColumn.makeSortable(VdsConditionFieldAutoCompleter.NETWORK_USAGE);
// $NON-NLS-1$
getTable().addColumn(netColumn, constants.networkHost(), "80px");
if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
AbstractTextColumn<VDS> spmColumn = new AbstractTextColumn<VDS>() {
@Override
public String getValue(VDS object) {
int value = object.getVdsSpmPriority();
int lowValue = defaultSpmPriority / 2;
int highValue = defaultSpmPriority + (maxSpmPriority - defaultSpmPriority) / 2;
if (object.getSpmStatus() != VdsSpmStatus.None) {
return object.getSpmStatus().name();
}
if (value == -1) {
return constants.spmNeverText();
} else if (value == lowValue) {
return constants.spmLowText();
} else if (value == defaultSpmPriority) {
return constants.spmNormalText();
} else if (value == highValue) {
return constants.spmHighText();
}
return constants.spmCustomText();
}
};
// $NON-NLS-1$
getTable().addColumn(spmColumn, constants.spmPriorityHost(), "100px");
}
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn 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.AbstractLinkColumn 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