use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class GlusterVolumeGeoReplicationSessionConfigPopupView method initConfigTable.
private void initConfigTable() {
geoReplicationConfigTable = new EntityModelCellTable<>(false, true);
geoReplicationConfigTable.setSelectionModel(new NoSelectionModel());
geoReplicationConfigTable.addColumn(new AbstractEntityModelTextColumn<Pair<Boolean, GlusterGeoRepSessionConfiguration>>() {
@Override
protected String getText(Pair<Boolean, GlusterGeoRepSessionConfiguration> entity) {
return entity.getSecond().getKey();
}
}, constants.optionKeyVolumeParameter(), // $NON-NLS-1$
"150px");
geoReplicationConfigTable.addColumn(new AbstractScrollableTextColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>() {
@Override
public String getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getSecond().getDescription() == null ? constants.notAvailableLabel() : object.getEntity().getSecond().getDescription();
}
}, constants.descriptionVolumeParameter(), // $NON-NLS-1$
"300px");
geoReplicationConfigTable.addColumn(new GlusterConfigAwareColumn(), constants.optionValueVolumeParameter(), // $NON-NLS-1$
"200px");
geoReplicationConfigTable.addColumn(new AbstractCheckboxColumn<EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>>>(true, (index, object, value) -> object.getEntity().setFirst(value)) {
@Override
protected boolean canEdit(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return true;
}
@Override
public Boolean getValue(EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> object) {
return object.getEntity().getFirst();
}
}, constants.resetGeoRepSessionConfig());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class GlusterVolumeSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {
@Override
public String getText(VolumeSnapshotOptionModel object) {
return object.getOptionName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"150px");
configsTable.addColumn(new AbstractEntityModelTextColumn<VolumeSnapshotOptionModel>() {
@Override
public String getText(VolumeSnapshotOptionModel object) {
return object.getCorrespodingClusterValue();
}
}, constants.clusterSnapshotConfigValue(), // $NON-NLS-1$
"200px");
Column<EntityModel<VolumeSnapshotOptionModel>, String> valueColumn = new Column<EntityModel<VolumeSnapshotOptionModel>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<VolumeSnapshotOptionModel> object) {
return ((VolumeSnapshotOptionModel) object.getEntity()).getOptionValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setOptionValue(value));
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ErrataListWithDetailsPopupView method updateErrataDetailFormPanel.
public void updateErrataDetailFormPanel(Erratum erratum) {
errataTitle.clear();
errataTitle.add(new HTML(erratum.getTitle()));
EntityModel<Erratum> entityModel = new EntityModel<>();
entityModel.setEntity(erratum);
errataDetailModelForm.setModel(entityModel);
errataDetailModelForm.update();
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ManualFenceConfirmationPopupView method edit.
@Override
public void edit(final ConfirmationModel object) {
driver.edit(object);
// Bind "Latch.IsAvailable"
object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
if ("IsAvailable".equals(args.propertyName)) {
// $NON-NLS-1$
EntityModel entity = (EntityModel) sender;
if (entity.getIsAvailable()) {
latch.setVisible(true);
}
}
});
object.getItemsChangedEvent().addListener((ev, sender, args) -> {
VDS vds = (VDS) object.getItems().iterator().next();
// Message
messageLabel.setText(messages.manaulFencePopupMessageLabel(vds.getName()));
// Spm warning
VdsSpmStatus spmStatus = vds.getSpmStatus();
if (spmStatus == VdsSpmStatus.None) {
spmWarningLabel.setText(constants.manaulFencePopupNoneSpmWarningLabel());
} else if (spmStatus == VdsSpmStatus.SPM) {
spmWarningLabel.setText(constants.manaulFencePopupSpmWarningLabel());
} else if (spmStatus == VdsSpmStatus.Contending) {
spmWarningLabel.setText(constants.manaulFencePopupContendingSpmWarningLabel());
}
// Warning
warningLabel.setText(constants.manaulFencePopupWarningLabel());
});
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmDiskAttachPopupWidget method initDiskImagesTable.
private void initDiskImagesTable() {
imageDiskTable.enableColumnResizing();
AbstractTextColumn<EntityModel> aliasColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getDiskAlias();
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(aliasColumn, constants.aliasVmDiskTable(), "85px");
AbstractTextColumn<EntityModel> descriptionColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getDiskDescription();
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(descriptionColumn, constants.descriptionVmDiskTable(), "85px");
AbstractTextColumn<EntityModel> idColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getId().toString();
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(idColumn, constants.idVmDiskTable(), "85px");
AbstractDiskSizeColumn<EntityModel> sizeColumn = new AbstractDiskSizeColumn<EntityModel>() {
@Override
protected Long getRawValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getSize();
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(sizeColumn, constants.provisionedSizeVmDiskTable(), "100px");
AbstractDiskSizeColumn<EntityModel> actualSizeColumn = new AbstractDiskSizeColumn<EntityModel>() {
@Override
protected Long getRawValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getActualSizeInBytes();
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(actualSizeColumn, constants.sizeVmDiskTable(), "100px");
AbstractTextColumn<EntityModel> storageDomainColumn = new AbstractTextColumn<EntityModel>() {
@Override
public String getValue(EntityModel object) {
DiskImage diskImage = (DiskImage) ((DiskModel) object.getEntity()).getDisk();
return diskImage.getStoragesNames().get(0);
}
};
// $NON-NLS-1$
imageDiskTable.addColumn(storageDomainColumn, constants.storageDomainVmDiskTable(), "100px");
// $NON-NLS-1$
imageDiskTable.addColumn(getDiskInterfaceSelectionColumn(), constants.interfaceVmDiskPopup(), "115px");
imageDiskTable.addColumn(getReadOnlyCheckBoxColumn(), new ImageResourceHeader(resources.readOnlyDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.readOnly())), // $NON-NLS-1$
"30px");
imageDiskTable.addColumn(getBootCheckBoxColumn(), new ImageResourceHeader(resources.bootableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.bootableDisk())), // $NON-NLS-1$
"30px");
imageDiskTable.addColumn(new AbstractImageResourceColumn<EntityModel>() {
@Override
public ImageResource getValue(EntityModel object) {
Disk disk = ((DiskModel) object.getEntity()).getDisk();
return disk.isShareable() ? resources.shareableDiskIcon() : null;
}
@Override
public SafeHtml getTooltip(EntityModel object) {
Disk disk = ((DiskModel) object.getEntity()).getDisk();
if (disk.isShareable()) {
return SafeHtmlUtils.fromSafeConstant(constants.shareable());
}
return null;
}
}, new ImageResourceHeader(resources.shareableDiskIcon(), SafeHtmlUtils.fromTrustedString(constants.shareable())), // $NON-NLS-1$
"30px");
// $NON-NLS-1$
imageDiskTable.setWidth("100%");
imageDiskTable.setEmptyTableWidget(new NoItemsLabel());
}
Aggregations