use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderPopupView method initDiskTable.
private void initDiskTable() {
diskTable = new ListModelObjectCellTable<>();
diskTable.enableColumnResizing();
AbstractTextColumn<DiskImage> aliasColumn = new AbstractTextColumn<DiskImage>() {
@Override
public String getValue(DiskImage object) {
return object.getDiskAlias();
}
};
// $NON-NLS-1$
diskTable.addColumn(aliasColumn, constants.aliasDisk(), "300px");
AbstractImageResourceColumn<DiskImage> bootableDiskColumn = new AbstractImageResourceColumn<DiskImage>() {
@Override
public ImageResource getValue(DiskImage object) {
boolean isBoot = !object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot();
return isBoot ? getDefaultImage() : null;
}
@Override
public ImageResource getDefaultImage() {
return resources.bootableDiskIcon();
}
@Override
public SafeHtml getTooltip(DiskImage object) {
if (!object.getDiskVmElements().isEmpty() && object.getDiskVmElements().iterator().next().isBoot()) {
return SafeHtmlUtils.fromSafeConstant(constants.bootableDisk());
}
return null;
}
};
diskTable.addColumn(bootableDiskColumn, new ImageResourceHeader(DisksViewColumns.bootableDiskColumn.getDefaultImage(), SafeHtmlUtils.fromSafeConstant(constants.bootableDisk())), // $NON-NLS-1$
"30px");
AbstractDiskSizeColumn<DiskImage> sizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getSize();
}
};
// $NON-NLS-1$
diskTable.addColumn(sizeColumn, constants.provisionedSizeDisk(), "130px");
AbstractDiskSizeColumn<DiskImage> actualSizeColumn = new AbstractDiskSizeColumn<DiskImage>() {
@Override
protected Long getRawValue(DiskImage object) {
return object.getActualSizeInBytes();
}
};
// $NON-NLS-1$
diskTable.addColumn(actualSizeColumn, constants.sizeDisk(), "130px");
diskTable.setSelectionModel(new NoSelectionModel<DiskImage>());
diskTable.getElement().getStyle().setPosition(Position.RELATIVE);
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class ImportVmFromExternalProviderPopupView method initMainTable.
protected void initMainTable() {
this.table = new ListModelObjectCellTable<>();
AbstractCheckboxColumn<ImportVmData> cloneVMColumn = new AbstractCheckboxColumn<ImportVmData>((index, model, value) -> {
model.getClone().setEntity(value);
table.asEditor().edit(importModel);
}) {
@Override
public Boolean getValue(ImportVmData model) {
return model.getClone().getEntity();
}
@Override
protected boolean canEdit(ImportVmData model) {
return model.getClone().getIsChangable();
}
@Override
protected String getDisabledMessage(ImportVmData model) {
return model.getClone().getChangeProhibitionReason();
}
};
// $NON-NLS-1$
table.addColumn(cloneVMColumn, constants.cloneVM(), "50px");
AbstractTextColumn<ImportVmData> nameColumn = new AbstractTextColumn<ImportVmData>() {
@Override
public String getValue(ImportVmData object) {
return object.getName();
}
};
// $NON-NLS-1$
table.addColumn(nameColumn, constants.nameVm(), "150px");
AbstractTextColumn<ImportVmData> originColumn = new AbstractEnumColumn<ImportVmData, OriginType>() {
@Override
protected OriginType getRawValue(ImportVmData object) {
return object.getVm().getOrigin();
}
};
// $NON-NLS-1$
table.addColumn(originColumn, constants.originVm(), "100px");
table.addColumn(new AbstractSafeHtmlColumn<ImportVmData>() {
@Override
public SafeHtml getValue(ImportVmData object) {
return VmTypeColumn.getRenderedValue(object.getVm());
}
}, constants.empty(), // $NON-NLS-1$
"30px");
AbstractTextColumn<ImportVmData> memoryColumn = new AbstractTextColumn<ImportVmData>() {
@Override
public String getValue(ImportVmData object) {
return messages.megabytes(String.valueOf(object.getVm().getVmMemSizeMb()));
}
};
// $NON-NLS-1$
table.addColumn(memoryColumn, constants.memoryVm(), "100px");
AbstractTextColumn<ImportVmData> cpuColumn = new AbstractTextColumn<ImportVmData>() {
@Override
public String getValue(ImportVmData object) {
return String.valueOf(object.getVm().getNumOfCpus());
}
};
// $NON-NLS-1$
table.addColumn(cpuColumn, constants.cpusVm(), "50px");
AbstractTextColumn<ImportVmData> archColumn = new AbstractTextColumn<ImportVmData>() {
@Override
public String getValue(ImportVmData object) {
return String.valueOf(object.getVm().getClusterArch());
}
};
// $NON-NLS-1$
table.addColumn(archColumn, constants.architectureVm(), "50px");
AbstractTextColumn<ImportVmData> diskColumn = new AbstractTextColumn<ImportVmData>() {
@Override
public String getValue(ImportVmData object) {
return String.valueOf(object.getVm().getDiskMap().size());
}
};
// $NON-NLS-1$
table.addColumn(diskColumn, constants.disksVm(), "50px");
ScrollPanel sp = new ScrollPanel();
sp.add(table);
splitLayoutPanel.add(sp);
table.getElement().getStyle().setPosition(Position.RELATIVE);
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabClusterGlusterHookView method initTable.
void initTable() {
getTable().enableColumnResizing();
getTable().addColumn(new GlusterHookSyncStatusColumn(), constants.empty(), // $NON-NLS-1$
"10px");
AbstractTextColumn<GlusterHookEntity> nameColumn = new AbstractTextColumn<GlusterHookEntity>() {
@Override
public String getValue(GlusterHookEntity object) {
return object.getName();
}
};
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameHook(), "200px");
AbstractTextColumn<GlusterHookEntity> statusColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStatus>() {
@Override
protected GlusterHookStatus getRawValue(GlusterHookEntity object) {
return object.getStatus();
}
};
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusHook(), "150px");
AbstractTextColumn<GlusterHookEntity> glusterCommandColumn = new AbstractTextColumn<GlusterHookEntity>() {
@Override
public String getValue(GlusterHookEntity object) {
return object.getGlusterCommand();
}
};
getTable().addColumn(glusterCommandColumn, constants.glusterVolumeEventHook(), // $NON-NLS-1$;
"100px");
AbstractTextColumn<GlusterHookEntity> stageColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookStage>() {
@Override
protected GlusterHookStage getRawValue(GlusterHookEntity object) {
return object.getStage();
}
};
// $NON-NLS-1$
getTable().addColumn(stageColumn, constants.stageHook(), "100px");
AbstractTextColumn<GlusterHookEntity> contentTypeColumn = new AbstractEnumColumn<GlusterHookEntity, GlusterHookContentType>() {
@Override
protected GlusterHookContentType getRawValue(GlusterHookEntity object) {
return object.getContentType();
}
};
// $NON-NLS-1$
getTable().addColumn(contentTypeColumn, constants.contentTypeHook(), "150px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabClusterNetworkView method initTable.
private void initTable() {
getTable().enableColumnResizing();
NetworkStatusColumn statusIconColumn = new NetworkStatusColumn();
statusIconColumn.setContextMenuTitle(constants.statusIconNetwork());
// $NON-NLS-1$ //$NON-NLS-2$
getTable().addColumn(statusIconColumn, "", "20px");
AbstractTextColumn<Network> nameColumn = new AbstractLinkColumn<Network>(new FieldUpdater<Network, String>() {
@Override
public void update(int index, Network network, String value) {
Map<String, String> parameters = new HashMap<>();
parameters.put(FragmentParams.NAME.getName(), network.getName());
parameters.put(FragmentParams.DATACENTER.getName(), getModelProvider().getMainModel().getSelectedItem().getStoragePoolName());
getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.networkGeneralSubTabPlace, parameters);
}
}) {
@Override
public String getValue(Network object) {
return object.getName();
}
};
nameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(nameColumn, constants.nameNetwork(), "400px");
AbstractTextColumn<Network> statusColumn = new AbstractEnumColumn<Network, NetworkStatus>() {
@Override
public NetworkStatus getRawValue(Network object) {
return object.getCluster().getStatus();
}
};
statusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(statusColumn, constants.statusNetwork(), "100px");
// $NON-NLS-1$
getTable().addColumn(createNetRoleColumn(), constants.roleNetwork(), "90px");
AbstractTextColumn<Network> descColumn = new AbstractTextColumn<Network>() {
@Override
public String getValue(Network object) {
return object.getDescription();
}
};
descColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(descColumn, constants.descriptionNetwork(), "400px");
}
use of org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn in project ovirt-engine by oVirt.
the class SubTabGlusterVolumeSnapshotView method initTable.
void initTable() {
getTable().enableColumnResizing();
GlusterVolumeSnapshotStatusColumn snapshotStatusColumn = new GlusterVolumeSnapshotStatusColumn();
snapshotStatusColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(snapshotStatusColumn, constants.empty(), "30px");
AbstractTextColumn<GlusterVolumeSnapshotEntity> snapshotNameColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {
@Override
public String getValue(GlusterVolumeSnapshotEntity snapshot) {
return snapshot.getSnapshotName();
}
};
snapshotNameColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(snapshotNameColumn, constants.volumeSnapshotName(), "300px");
AbstractTextColumn<GlusterVolumeSnapshotEntity> descriptionColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {
@Override
public String getValue(GlusterVolumeSnapshotEntity snapshot) {
return snapshot.getDescription();
}
};
descriptionColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(descriptionColumn, constants.volumeSnapshotDescription(), "400px");
AbstractTextColumn<GlusterVolumeSnapshotEntity> creationTimeColumn = new AbstractTextColumn<GlusterVolumeSnapshotEntity>() {
@Override
public String getValue(GlusterVolumeSnapshotEntity snapshot) {
// $NON-NLS-1$
DateTimeFormat df = DateTimeFormat.getFormat("yyyy-MM-dd, HH:mm:ss");
return df.format(snapshot.getCreatedAt());
}
};
creationTimeColumn.makeSortable();
// $NON-NLS-1$
getTable().addColumn(creationTimeColumn, constants.volumeSnapshotCreationTime(), "400px");
}
Aggregations