use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class InstanceTypeAttachDetachManager method manageInstanceType.
public void manageInstanceType(InstanceType instanceType) {
this.managedInstanceType = instanceType;
setAttachedTo(instanceType);
modelToProperValue = new HashMap<>();
for (Model model : detachableModels) {
if (model instanceof ListModel) {
modelToProperValue.put(model, ((ListModel) model).getSelectedItem());
} else if (model instanceof EntityModel) {
modelToProperValue.put(model, ((EntityModel) model).getEntity());
}
}
if (!alreadyRegistered) {
model.getInstanceTypes().getSelectedItemChangedEvent().addListener(this);
listenToDetachableFields(detachableModels);
alreadyRegistered = true;
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeGeoRepSessionDetailsPopUpView method intiEditors.
private void intiEditors(final ApplicationConstants constants) {
checkPointStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
String checkPointStatusValue = object.getCheckPointStatus();
return checkPointStatusValue == null || checkPointStatusValue.isEmpty() ? constants.notAvailableLabel() : checkPointStatusValue;
}
});
crawlStatus = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getCrawlStatus().toString();
}
});
dataOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getDataOpsPending().toString();
}
});
metaOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getMetaOpsPending().toString();
}
});
entryOpsPending = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getEntryOpsPending().toString();
}
});
failures = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return object.getFailures().toString();
}
});
checkPointTime = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return new FullDateTimeRenderer().render(object.getCheckPointTime());
}
});
checkPointCompletedAt = new EntityModelLabelEditor<>(new AbstractRenderer<GlusterGeoRepSessionDetails>() {
@Override
public String render(GlusterGeoRepSessionDetails object) {
return new FullDateTimeRenderer().render(object.getCheckPointCompletedAt());
}
});
geoRepSessionSummaryTable = new EntityModelCellTable<>(false, true);
geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {
@Override
public String getText(GlusterGeoRepSessionDetails object) {
return object.getMasterBrickHostName() == null ? constants.notAvailableLabel() : object.getMasterBrickHostName();
}
}, constants.geoRepSessionHostName());
geoRepSessionSummaryTable.addColumn(new AbstractEntityModelTextColumn<GlusterGeoRepSessionDetails>() {
@Override
protected String getText(GlusterGeoRepSessionDetails entity) {
return (entity == null || entity.getStatus() == null) ? constants.notAvailableLabel() : entity.getStatus().toString();
}
}, constants.geoRepSessionStatus());
geoRepSessionSummaryTable.addColumn(new AbstractFullDateTimeColumn<EntityModel<GlusterGeoRepSessionDetails>>() {
@Override
protected Date getRawValue(EntityModel<GlusterGeoRepSessionDetails> object) {
GlusterGeoRepSessionDetails sessionDetail = object.getEntity();
return (sessionDetail == null || sessionDetail.getLastSyncedAt() == null) ? new Date() : sessionDetail.getLastSyncedAt();
}
}, constants.geoRepLastSyncedAt());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class ManageGlusterSwiftPopupView method initEditors.
private void initEditors() {
swiftStatusEditor = new EntityModelLabelEditor<>(new EnumRenderer<GlusterServiceStatus>());
// $NON-NLS-1$
startSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
stopSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
// $NON-NLS-1$
restartSwift = new EntityModelRadioButtonEditor("swift_action", Align.RIGHT);
manageSwiftServerLevel = new EntityModelCheckBoxEditor(Align.RIGHT);
hostServicesTable = new EntityModelCellTable<>(false, true);
hostServicesTable.addColumn(new AbstractEntityModelTextColumn<GlusterServerService>() {
@Override
public String getText(GlusterServerService entity) {
return entity.getHostName();
}
}, constants.hostGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, ServiceType>() {
@Override
protected ServiceType getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getServiceType();
}
}, constants.serviceNameGlusterSwift());
hostServicesTable.addColumn(new AbstractEnumColumn<EntityModel, GlusterServiceStatus>() {
@Override
protected GlusterServiceStatus getRawValue(EntityModel object) {
return ((GlusterSwiftServiceModel) object).getEntity().getStatus();
}
}, constants.serviceStatusGlusterSwift());
Column<EntityModel, Boolean> startSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
startSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getStartSwift().setEntity(value);
if (value) {
swiftModel.getStopSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(startSwiftColumn, constants.startGlusterSwift());
Column<EntityModel, Boolean> stopSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getStopSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getStopSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
stopSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
if (swiftModel.getStopSwift().getIsChangable()) {
swiftModel.getStopSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getRestartSwift().setEntity(false);
hostServicesTable.redraw();
}
}
});
hostServicesTable.addColumn(stopSwiftColumn, constants.stopGlusterSwift());
Column<EntityModel, Boolean> restartSwiftColumn = new Column<EntityModel, Boolean>(new RadioboxCell(false, true)) {
@Override
public Boolean getValue(EntityModel object) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
return swiftServiceModel.getRestartSwift().getEntity();
}
@Override
public void render(Context context, EntityModel object, SafeHtmlBuilder sb) {
GlusterSwiftServiceModel swiftServiceModel = (GlusterSwiftServiceModel) object;
if (swiftServiceModel.getRestartSwift().getIsChangable()) {
super.render(context, object, sb);
}
}
};
restartSwiftColumn.setFieldUpdater((index, object, value) -> {
GlusterSwiftServiceModel swiftModel = (GlusterSwiftServiceModel) object;
swiftModel.getRestartSwift().setEntity(value);
if (value) {
swiftModel.getStartSwift().setEntity(false);
swiftModel.getStopSwift().setEntity(false);
hostServicesTable.redraw();
}
});
hostServicesTable.addColumn(restartSwiftColumn, constants.restartGlusterSwift());
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class RecoveryStorageConfirmationPopupView method edit.
@Override
public void edit(final ConfirmationModel object) {
storageDomainItems.setRowData(new ArrayList<EntityModel>());
storageDomainItems.asEditor().edit(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) -> {
// Message
messageLabel.setHTML(constants.dataCenterRecoveryStoragePopupMessageLabel());
selectNewDSDLabel.setText(constants.dataCenterRecoveryStoragePopupSelectNewDSDLabel());
});
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class AbstractVmRemoveConfimationPopup method addItemText.
@SuppressWarnings("unchecked")
@Override
protected void addItemText(Object item) {
Entry<Guid, EntityModel<Boolean>> entry = (Entry<Guid, EntityModel<Boolean>>) item;
EntityModelCheckBoxWidget cb = new EntityModelCheckBoxWidget(Align.RIGHT, "- " + entry.getValue().getMessage(), // $NON-NLS-1$
entry.getValue().getTitle());
cb.edit(entry.getValue());
itemColumn.add(cb);
}
Aggregations