use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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");
}
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabQuotaPermissionView method initTable.
private void initTable() {
// $NON-NLS-1$
getTable().addColumn(new PermissionTypeColumn(), constants.empty(), "30px");
AbstractTextColumn<Permission> userColumn = new AbstractTextColumn<Permission>() {
@Override
public String getValue(Permission object) {
return object.getOwnerName();
}
};
userColumn.makeSortable();
getTable().addColumn(userColumn, constants.userPermission());
AbstractTextColumn<Permission> roleColumn = new AbstractTextColumn<Permission>() {
@Override
public String getValue(Permission object) {
return object.getRoleName();
}
};
roleColumn.makeSortable();
getTable().addColumn(roleColumn, constants.rolePermission());
AbstractTextColumn<Permission> permissionColumn = new AbstractObjectNameColumn<Permission>() {
@Override
protected Object[] getRawValue(Permission object) {
return new Object[] { object.getObjectType(), object.getObjectName(), getDetailModel().getEntity(), object.getObjectId() };
}
};
permissionColumn.makeSortable();
getTable().addColumn(permissionColumn, constants.inheretedFromPermission());
}
Aggregations