use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabQuotaUserView method initTable.
private void initTable() {
getTable().enableColumnResizing();
// $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();
// $NON-NLS-1$
getTable().addColumn(userColumn, constants.userUser(), "400px");
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();
// $NON-NLS-1$
getTable().addColumn(permissionColumn, constants.inheritedFromUser(), "400px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabStorageDRView method initTable.
void initTable() {
getTable().enableColumnResizing();
AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId());
if (session == null) {
return storageDomainDR.getGeoRepSessionId().toString();
} else {
return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName());
}
}
};
// $NON-NLS-1$
getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px");
AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() {
@Override
public String getValue(StorageDomainDR storageDomainDR) {
StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression());
return schedule.toString();
}
};
// $NON-NLS-1$
getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn 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.AbstractTextColumn 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.AbstractTextColumn 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");
}
Aggregations