use of com.vaadin.flow.component.details.Details in project microstream by microstream-one.
the class InternalErrorView method beforeEnter.
@Override
public void beforeEnter(final BeforeEnterEvent event) {
final H3 header = new H3(getTranslation("INTERNAL_ERROR_TITLE"));
header.addClassName(ClassNames.ERROR);
this.add(header);
final VaadinSession session = event.getUI().getSession();
final SessionData sessionData = session.getAttribute(SessionData.class);
if (sessionData != null) {
this.add(new Label(getTranslation("INTERNAL_ERROR_HINT", sessionData.baseUrl())));
}
final Throwable t = (Throwable) session.getAttribute(ApplicationErrorHandler.THROWABLE_ATTRIBUTE);
if (t != null) {
this.add(new Hr());
final StringWriter stringWriter = new StringWriter();
try (final PrintWriter writer = new PrintWriter(stringWriter)) {
t.printStackTrace(writer);
}
final TextArea stackTrace = new TextArea();
stackTrace.setValue(stringWriter.toString());
stackTrace.setReadOnly(true);
stackTrace.setWidth("100%");
final Details details = new Details(getTranslation("DETAILS"), stackTrace);
details.setOpened(false);
this.add(details);
this.setHorizontalComponentAlignment(Alignment.STRETCH, details);
this.setFlexGrow(1, details);
}
}
use of com.vaadin.flow.component.details.Details in project docs by vaadin.
the class DetailsContent method createDetails.
private Details createDetails(String summary, Anchor... anchors) {
Details details = new Details(summary, createContent(anchors));
details.setOpened(true);
return details;
}
Aggregations