use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabUserPermissionView method initTable.
void initTable() {
getTable().enableColumnResizing();
PermissionTypeColumn typeColumn = new PermissionTypeColumn();
typeColumn.setContextMenuTitle(constants.typePermission());
// $NON-NLS-1$
getTable().addColumn(typeColumn, constants.empty(), "30px");
AbstractTextColumn<Permission> roleColumn = new AbstractTextColumn<Permission>() {
@Override
public String getValue(Permission object) {
return object.getRoleName();
}
};
roleColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(roleColumn, constants.rolePermission(), "560px");
AbstractTextColumn<Permission> permissionColumn = new AbstractObjectNameColumn<Permission>() {
@Override
protected Object[] getRawValue(Permission object) {
return new Object[] { object.getObjectType(), object.getObjectName() };
}
};
permissionColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(permissionColumn, constants.objectPermission(), "560px");
AbstractTextColumn<Permission> inheritedColumn = new AbstractGroupNameColumn<Permission>() {
@Override
protected Object[] getRawValue(Permission object) {
return new Object[] { getDetailModel().getEntity(), object.getAdElementId(), object.getOwnerName() };
}
};
inheritedColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(inheritedColumn, constants.inheritedPermission(), "560px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class EventListModelTable method initTable.
@Override
public void initTable() {
getTable().enableColumnResizing();
AuditLogSeverityColumn severityColumn = new AuditLogSeverityColumn();
severityColumn.setContextMenuTitle(constants.severityEvent());
// $NON-NLS-1$
getTable().addColumn(severityColumn, constants.empty(), "20px");
AbstractTextColumn<AuditLog> logTimeColumn = new AbstractFullDateTimeColumn<AuditLog>() {
@Override
protected Date getRawValue(AuditLog object) {
return object.getLogTime();
}
};
logTimeColumn.makeSortable(AuditLogConditionFieldAutoCompleter.TIME);
// $NON-NLS-1$
getTable().addColumn(logTimeColumn, constants.timeEvent(), "170px");
AbstractTextColumn<AuditLog> messageColumn = new AbstractTextColumn<AuditLog>() {
@Override
public String getValue(AuditLog object) {
return object.getMessage();
}
};
messageColumn.makeSortable(AuditLogConditionFieldAutoCompleter.MESSAGE);
// $NON-NLS-1$
getTable().addColumn(messageColumn, constants.messageEvent(), "600px");
AbstractTextColumn<AuditLog> correlationIdColumn = new AbstractTextColumn<AuditLog>() {
@Override
public String getValue(AuditLog object) {
return object.getCorrelationId();
}
};
correlationIdColumn.makeSortable(AuditLogConditionFieldAutoCompleter.CORRELATION_ID);
// $NON-NLS-1$
getTable().addColumn(correlationIdColumn, constants.correltaionIdEvent(), "100px");
AbstractTextColumn<AuditLog> originColumn = new AbstractTextColumn<AuditLog>() {
@Override
public String getValue(AuditLog object) {
return object.getOrigin();
}
};
originColumn.makeSortable(AuditLogConditionFieldAutoCompleter.ORIGIN);
// $NON-NLS-1$
getTable().addColumn(originColumn, constants.originEvent(), "100px");
AbstractTextColumn<AuditLog> customEventIdColumn = new AbstractTextColumn<AuditLog>() {
@Override
public String getValue(AuditLog object) {
int id = object.getCustomEventId();
// $NON-NLS-1$
return id >= 0 ? String.valueOf(id) : "";
}
};
customEventIdColumn.makeSortable(AuditLogConditionFieldAutoCompleter.CUSTOM_EVENT_ID);
// $NON-NLS-1$
getTable().addColumn(customEventIdColumn, constants.customEventIdEvent(), "120px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class AbstractNetworkPopupView method initEntityModelCellTable.
void initEntityModelCellTable() {
AbstractCheckboxHeader assignAllHeader = new AbstractCheckboxHeader() {
@Override
protected void selectionChanged(Boolean value) {
for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
if (networkClusterModel.getIsChangable()) {
networkClusterModel.setAttached(value);
networkClusterModel.setRequired(value && networkClusterModel.isRequired());
}
}
refreshClustersTable();
}
@Override
public Boolean getValue() {
for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
if (networkClusterModel.getIsChangable() && !networkClusterModel.isAttached()) {
return false;
}
}
return true;
}
@Override
public boolean isEnabled() {
for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
if (networkClusterModel.getIsChangable()) {
return true;
}
}
return false;
}
@Override
public String getLabel() {
return constants.attachAll();
}
};
AbstractCheckboxHeader requiredAllHeader = new AbstractCheckboxHeader() {
@Override
protected void selectionChanged(Boolean value) {
for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
networkClusterModel.setRequired(value && networkClusterModel.isAttached());
}
refreshClustersTable();
}
@Override
public Boolean getValue() {
for (NetworkClusterModel networkClusterModel : getClustersTableItems()) {
if (!networkClusterModel.isRequired()) {
return false;
}
}
return true;
}
@Override
public boolean isEnabled() {
return isRequiredChangeable();
}
@Override
public String getLabel() {
return constants.requiredAll();
}
};
clustersTable.addColumn(new AbstractTextColumn<NetworkClusterModel>() {
@Override
public String getValue(NetworkClusterModel model) {
return model.getName();
}
}, constants.nameClusterHeader());
clustersTable.addColumn(new AbstractCheckboxColumn<NetworkClusterModel>((index, model, value) -> {
model.setAttached(value);
model.setRequired(value && model.isRequired());
refreshClustersTable();
}) {
@Override
public Boolean getValue(NetworkClusterModel model) {
return model.isAttached();
}
@Override
protected boolean canEdit(NetworkClusterModel model) {
return model.getIsChangable();
}
@Override
public void render(Context context, NetworkClusterModel object, SafeHtmlBuilder sb) {
super.render(context, object, sb);
sb.append(templates.textForCheckBox(constants.attach()));
}
}, assignAllHeader, // $NON-NLS-1$
"150px");
clustersTable.addColumn(new AbstractCheckboxColumn<NetworkClusterModel>((index, model, value) -> {
model.setRequired(value && model.isAttached());
refreshClustersTable();
}) {
@Override
public Boolean getValue(NetworkClusterModel model) {
return model.isRequired();
}
@Override
protected boolean canEdit(NetworkClusterModel model) {
return isRequiredChangeable() && model.isAttached();
}
@Override
public void render(Context context, NetworkClusterModel object, SafeHtmlBuilder sb) {
super.render(context, object, sb);
sb.append(templates.textForCheckBox(constants.required()));
}
}, requiredAllHeader, // $NON-NLS-1$
"150px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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