Search in sources :

Example 1 with Hr

use of com.vaadin.flow.component.html.Hr in project flow by vaadin.

the class DependencyView method onShow.

@Override
protected void onShow() {
    add(new Text("This test initially loads a stylesheet which makes all text red, a JavaScript for logging window messages, a JavaScript for handling body click events and an HTML which sends a window message"), new Hr(), new HtmlComponent(), new Hr());
    Div clickBody = new Div();
    clickBody.setText("Hello, click the body please");
    clickBody.setId("hello");
    add(clickBody);
    NativeButton jsOrder = new NativeButton("Test JS order", e -> {
        getPage().addJavaScript("/test-files/js/set-global-var.js");
        getPage().addJavaScript("/test-files/js/read-global-var.js", LoadMode.LAZY);
    });
    jsOrder.setId("loadJs");
    /* HTML imports */
    NativeButton htmlOrder = new NativeButton("Test HTML order", e -> {
        getPage().addHtmlImport("base://" + htmlImport2.getResourceUri().toString());
        // This failure can only be seen in the browser console
        getPage().addHtmlImport("/doesnotexist.html");
        // Can't test JS/HTML order because of #765
        getPage().addHtmlImport("base://" + htmlImport3.getResourceUri().toString());
    });
    htmlOrder.setId("loadHtml");
    /* HTML & JS order */
    NativeButton mixedOrder = new NativeButton("Test HTML & JS order", e -> {
        getPage().addHtmlImport("/test-files/html/combinedMixed.html");
    });
    mixedOrder.setId("loadMixed");
    NativeButton allBlue = new NativeButton("Load 'everything blue' stylesheet", e -> {
        getPage().addStyleSheet("/test-files/css/allblueimportant.css");
    });
    allBlue.setId("loadBlue");
    NativeButton loadUnavailableResources = new NativeButton("Load unavailable resources", e -> {
        getPage().addStyleSheet("/not-found.css");
        getPage().addHtmlImport("/not-found.html");
        getPage().addJavaScript("/not-found.js");
    });
    loadUnavailableResources.setId("loadUnavailableResources");
    Div log = new Div();
    log.setId("log");
    add(jsOrder, htmlOrder, mixedOrder, allBlue, loadUnavailableResources, new Hr(), log);
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) Text(com.vaadin.flow.component.Text) HasText(com.vaadin.flow.component.HasText) Hr(com.vaadin.flow.component.html.Hr)

Example 2 with Hr

use of com.vaadin.flow.component.html.Hr in project flow by vaadin.

the class OrderedDependencyView method onShow.

@Override
protected void onShow() {
    Html2Component html2Component = new Html2Component();
    html2Component.setId("component");
    add(html2Component, new Hr());
    NativeButton scripts = new NativeButton("Add scripts", event -> add(new Script2Component()));
    scripts.setId("addJs");
    add(scripts);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) Hr(com.vaadin.flow.component.html.Hr)

Aggregations

Hr (com.vaadin.flow.component.html.Hr)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2 HasText (com.vaadin.flow.component.HasText)1 Text (com.vaadin.flow.component.Text)1 Div (com.vaadin.flow.component.html.Div)1