use of elemental2.dom.HTMLPreElement in project console by hal.
the class ConfigurationChangeDisplay method getDescriptionHtml.
@Override
@SuppressWarnings("HardCodedStringLiteral")
public SafeHtml getDescriptionHtml() {
SafeHtmlBuilder html = new SafeHtmlBuilder();
if (hideDescriptionWhenLarge()) {
html.append(SafeHtmlUtils.fromTrustedString("<pre class=\"" + formControlStatic + " " + wrap + "\">"));
}
item.changes().forEach(m -> {
String op = m.get(OPERATION).asString();
ResourceAddress address = new ResourceAddress(m.get(ADDRESS));
html.append(SafeHtmlUtils.fromTrustedString(resources.constants().operation() + ": <strong>" + op + "</strong><br/>"));
html.append(SafeHtmlUtils.fromTrustedString(resources.constants().address() + ": <strong>" + address + "</strong><br/>"));
HTMLPreElement elem = pre().css(formControlStatic, wrap).element();
m.asPropertyList().forEach(prop -> {
boolean allowedProperties = !(prop.getName().equals(OPERATION) || prop.getName().equals(ADDRESS) || prop.getName().equals(OPERATION_HEADERS));
if (allowedProperties) {
html.append(SafeHtmlUtils.fromTrustedString(" " + prop.getName() + COLON + prop.getValue() + "<br/>"));
}
});
});
if (hideDescriptionWhenLarge()) {
html.append(SafeHtmlUtils.fromTrustedString("</pre>"));
}
return html.toSafeHtml();
}
use of elemental2.dom.HTMLPreElement in project console by hal.
the class ConfigurationChangesPresenter method showInDialog.
void showInDialog(String textContent) {
HTMLPreElement elem = pre().css(formControlStatic, wrap).element();
elem.textContent = textContent;
HTMLElement content = div().add(elem).style("overflow: scroll").element();
int maxheight = applicationHeight() - 6 * MARGIN_BIG;
content.style.maxHeight = CSSProperties.MaxHeightUnionType.of(px(maxheight));
Dialog dialog = new Dialog.Builder(resources.constants().configurationChanges()).primary(resources.constants().close(), () -> true).closeOnEsc(true).closeIcon(true).size(LARGE).add(content).build();
dialog.show();
}
Aggregations