use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project ovirt-engine by oVirt.
the class ClusterWarningsPopupView method buildWarnings.
private SafeHtml buildWarnings(List<ClusterEditWarnings.Warning> warnings) {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
for (ClusterEditWarnings.Warning warning : warnings) {
builder.append(warningTemplates.warningTitle(localize(warning.getMainMessage())));
builder.append(warningTemplates.warningList(buildWarningDetails(warning.getDetailsByName())));
}
return builder.toSafeHtml();
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder 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 com.google.gwt.safehtml.shared.SafeHtmlBuilder in project ovirt-engine by oVirt.
the class AlertPanel method updateBadge.
private void updateBadge() {
badge.setVisible(count != 1);
badgeText.setText(String.valueOf(count));
if (badge.isVisible()) {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
for (SafeHtml message : messagesList) {
builder.append(message);
}
alertTooltip.setHtml(builder.toSafeHtml());
}
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project ovirt-engine by oVirt.
the class RegisterVmPopupView method createEntityTable.
@Override
protected void createEntityTable(RegisterVmModel model) {
entityTable.addColumn(new AbstractImageResourceColumn<RegisterVmData>() {
@Override
public ImageResource getValue(RegisterVmData registerVmData) {
if (registerVmData.getError() != null) {
return resources.errorImage();
}
if (registerVmData.getWarning() != null) {
return resources.alertImage();
}
return null;
}
@Override
public SafeHtml getTooltip(RegisterVmData registerVmData) {
String problem;
if (registerVmData.getError() != null) {
problem = registerVmData.getError();
} else {
problem = registerVmData.getWarning();
}
return problem == null ? null : new SafeHtmlBuilder().appendEscapedLines(problem).toSafeHtml();
}
}, constants.empty(), // $NON-NLS-1$
"20px");
AbstractTextColumn<RegisterVmData> nameColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
return registerVmData.getVm().getName();
}
};
// $NON-NLS-1$
entityTable.addColumn(nameColumn, constants.nameVm(), "150px");
AbstractTextColumn<RegisterVmData> originColumn = new AbstractEnumColumn<RegisterVmData, OriginType>() {
@Override
protected OriginType getRawValue(RegisterVmData registerVmData) {
return registerVmData.getVm().getOrigin();
}
};
// $NON-NLS-1$
entityTable.addColumn(originColumn, constants.originVm(), "100px");
AbstractTextColumn<RegisterVmData> memoryColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int size = registerVmData.getVm().getVmMemSizeMb();
return messages.megabytes(String.valueOf(size));
}
};
// $NON-NLS-1$
entityTable.addColumn(memoryColumn, constants.memoryVm(), "100px");
AbstractTextColumn<RegisterVmData> cpuColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int numOfCpus = registerVmData.getVm().getNumOfCpus();
return String.valueOf(numOfCpus);
}
};
// $NON-NLS-1$
entityTable.addColumn(cpuColumn, constants.cpusVm(), "50px");
AbstractTextColumn<RegisterVmData> archColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
ArchitectureType clusterArch = registerVmData.getVm().getClusterArch();
return String.valueOf(clusterArch);
}
};
// $NON-NLS-1$
entityTable.addColumn(archColumn, constants.architectureVm(), "100px");
AbstractTextColumn<RegisterVmData> diskColumn = new AbstractTextColumn<RegisterVmData>() {
@Override
public String getValue(RegisterVmData registerVmData) {
int numOfDisks = registerVmData.getVm().getDiskMap().size();
return String.valueOf(numOfDisks);
}
};
// $NON-NLS-1$
entityTable.addColumn(diskColumn, constants.disksVm(), "50px");
// $NON-NLS-1$
entityTable.addColumn(creatReassignMacsColumn(), new ReassignBadMacsHeader(), "150px");
// $NON-NLS-1$
entityTable.addColumn(createAllowPartialColumn(), constants.allowPartial(), "95px");
// $NON-NLS-1$
entityTable.addColumn(getClusterColumn(), constants.clusterVm(), "150px");
if (model.isQuotaEnabled()) {
// $NON-NLS-1$
entityTable.addColumn(getClusterQuotaColumn(), constants.quotaVm(), "150px");
}
}
use of com.google.gwt.safehtml.shared.SafeHtmlBuilder in project ovirt-engine by oVirt.
the class DisksBreadCrumbsView method getName.
@Override
public SafeHtml getName(Disk item) {
SafeHtmlBuilder builder = new SafeHtmlBuilder();
builder.append(super.getName(item));
// $NON-NLS-1$
builder.appendEscaped(" (");
builder.appendEscaped(item.getId().toString());
// $NON-NLS-1$
builder.appendEscaped(")");
return builder.toSafeHtml();
}
Aggregations