Search in sources :

Example 1 with Details

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);
    }
}
Also used : Details(com.vaadin.flow.component.details.Details) VaadinSession(com.vaadin.flow.server.VaadinSession) StringWriter(java.io.StringWriter) TextArea(com.vaadin.flow.component.textfield.TextArea) Label(com.vaadin.flow.component.html.Label) Hr(com.vaadin.flow.component.html.Hr) H3(com.vaadin.flow.component.html.H3) SessionData(one.microstream.storage.restclient.app.types.SessionData) PrintWriter(java.io.PrintWriter)

Example 2 with 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;
}
Also used : Details(com.vaadin.flow.component.details.Details)

Aggregations

Details (com.vaadin.flow.component.details.Details)2 H3 (com.vaadin.flow.component.html.H3)1 Hr (com.vaadin.flow.component.html.Hr)1 Label (com.vaadin.flow.component.html.Label)1 TextArea (com.vaadin.flow.component.textfield.TextArea)1 VaadinSession (com.vaadin.flow.server.VaadinSession)1 PrintWriter (java.io.PrintWriter)1 StringWriter (java.io.StringWriter)1 SessionData (one.microstream.storage.restclient.app.types.SessionData)1