Search in sources :

Example 11 with NativeButton

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

the class InfoView method update.

private void update(UI ui) {
    VaadinSession session = ui.getSession();
    WebBrowser webBrowser = session.getBrowser();
    DeploymentConfiguration deploymentConfiguration = session.getConfiguration();
    List<String> device = new ArrayList<>();
    List<String> os = new ArrayList<>();
    List<String> browser = new ArrayList<>();
    removeAll();
    add(new NativeButton("Refresh", e -> {
        update(ui);
    }));
    header("Browser");
    info("Address", webBrowser.getAddress());
    add(device, "Android", webBrowser.isAndroid());
    add(device, "iOS", webBrowser.isIOS());
    add(device, "iPad", webBrowser.isIPad());
    add(device, "iPhone", webBrowser.isIPhone());
    add(device, "Windows Phone", webBrowser.isWindowsPhone());
    info("Device", device.stream().collect(Collectors.joining(", ")));
    add(os, "Linux", webBrowser.isLinux());
    add(os, "Mac", webBrowser.isMacOSX());
    add(os, "Windows", webBrowser.isWindows());
    info("Os", os.stream().collect(Collectors.joining(", ")));
    add(browser, "Touch device", webBrowser.isTouchDevice());
    add(browser, "Chrome", webBrowser.isChrome());
    add(browser, "Edge", webBrowser.isEdge());
    add(browser, "Firefox", webBrowser.isFirefox());
    add(browser, "IE", webBrowser.isIE());
    add(browser, "Safari", webBrowser.isSafari());
    info("Browser", browser.stream().collect(Collectors.joining(", ")));
    if (webBrowser.isTooOldToFunctionProperly()) {
        header("Browser is too old to function properly");
    }
    info("User-agent", webBrowser.getBrowserApplication());
    info("Browser major", webBrowser.getBrowserMajorVersion());
    info("Browser minor", webBrowser.getBrowserMinorVersion());
    info("Screen height", webBrowser.getScreenHeight());
    info("Screen width", webBrowser.getScreenWidth());
    info("Locale", webBrowser.getLocale());
    info("Secure connection (https)", webBrowser.isSecureConnection());
    separator();
    header("Push configuration");
    info("Push mode", ui.getPushConfiguration().getPushMode());
    info("Push transport", ui.getPushConfiguration().getTransport());
    separator();
    header("Deployment configuration");
    info("Heartbeat interval", deploymentConfiguration.getHeartbeatInterval());
    info("Router configurator class", deploymentConfiguration.getRouterConfiguratorClassName());
    info("UI class", deploymentConfiguration.getUIClassName());
    info("Close idle sessions", deploymentConfiguration.isCloseIdleSessions());
    info("Send URLs as parameters", deploymentConfiguration.isSendUrlsAsParameters());
    info("Sync id enabled", deploymentConfiguration.isSyncIdCheckEnabled());
    info("XSRF protection enabled", deploymentConfiguration.isXsrfProtectionEnabled());
    info("Production mode", deploymentConfiguration.isProductionMode());
}
Also used : VaadinSession(com.vaadin.flow.server.VaadinSession) Html(com.vaadin.flow.component.Html) Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) ViewTestLayout(com.vaadin.flow.uitest.servlet.ViewTestLayout) Hr(com.vaadin.flow.component.html.Hr) Collectors(java.util.stream.Collectors) DeploymentConfiguration(com.vaadin.flow.function.DeploymentConfiguration) ArrayList(java.util.ArrayList) Route(com.vaadin.flow.router.Route) List(java.util.List) WebBrowser(com.vaadin.flow.server.WebBrowser) UI(com.vaadin.flow.component.UI) AttachEvent(com.vaadin.flow.component.AttachEvent) NativeButton(com.vaadin.flow.component.html.NativeButton) VaadinSession(com.vaadin.flow.server.VaadinSession) WebBrowser(com.vaadin.flow.server.WebBrowser) ArrayList(java.util.ArrayList) DeploymentConfiguration(com.vaadin.flow.function.DeploymentConfiguration)

Example 12 with NativeButton

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

the class LoadingIndicatorView method beforeEnter.

@Override
public void beforeEnter(BeforeEnterEvent event) {
    add(divWithText("First delay: " + getLoadingIndicatorConfiguration().getFirstDelay()));
    add(divWithText("Second delay: " + getLoadingIndicatorConfiguration().getSecondDelay()));
    add(divWithText("Third delay: " + getLoadingIndicatorConfiguration().getThirdDelay()));
    int[] delays = new int[] { 100, 200, 500, 1000, 2000, 5000, 10000 };
    for (int delay : delays) {
        NativeButton button = new NativeButton("Trigger event which takes " + delay + "ms", e -> delay(delay));
        button.setId("wait" + delay);
        add(button);
    }
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton)

Example 13 with NativeButton

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

the class TimingInfoReportedView method onAttach.

// @formatter:on
@Override
protected void onAttach(AttachEvent attachEvent) {
    getUI().get().getPage().executeJavaScript(REPORT_TIMINGS, getElement());
    NativeButton button = new NativeButton("test request");
    button.addClickListener(event -> getUI().get().getPage().executeJavaScript(REPORT_TIMINGS, getElement()));
    add(button);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton)

Example 14 with NativeButton

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

the class LockingUI method init.

@Override
protected void init(VaadinRequest request) {
    message = new Div();
    message.setId("message");
    message.setText("default");
    NativeButton lockButton = new NativeButton("Lock UI for too long");
    lockButton.addClickListener(e -> {
        setHeartBeats();
        message.setText(LOCKING_ENDED);
    });
    NativeButton checkButton = new NativeButton("Test communication", e -> message.setText(ALL_OK));
    lockButton.setId("lock");
    checkButton.setId("check");
    add(lockButton, checkButton, message);
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton)

Example 15 with NativeButton

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

the class BasicPollUI method init.

@Override
protected void init(VaadinRequest request) {
    super.init(request);
    getElement().insertChild(0, pollInterval);
    getElement().insertChild(0, pollCounter);
    setPollInterval(500);
    addPollListener(e -> {
        pollCounter.setText("Polls received: " + (++pollCount));
    });
    NativeButton stopPolling = new NativeButton("Stop polling", e -> {
        setPollInterval(-1);
        updatePollIntervalText();
    });
    stopPolling.setId(STOP_POLLING_BUTTON);
    NativeButton startPolling = new NativeButton("Start polling", e -> {
        setPollInterval(500);
        updatePollIntervalText();
    });
    startPolling.setId(START_POLLING_BUTTON);
    spacer();
    getElement().appendChild(new Div(startPolling, stopPolling).getElement());
    updatePollIntervalText();
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton)

Aggregations

NativeButton (com.vaadin.flow.component.html.NativeButton)24 Div (com.vaadin.flow.component.html.Div)9 Text (com.vaadin.flow.component.Text)4 Hr (com.vaadin.flow.component.html.Hr)3 Input (com.vaadin.flow.component.html.Input)3 Label (com.vaadin.flow.component.html.Label)3 AttachEvent (com.vaadin.flow.component.AttachEvent)2 Component (com.vaadin.flow.component.Component)2 UI (com.vaadin.flow.component.UI)2 Element (com.vaadin.flow.dom.Element)2 ShadowRoot (com.vaadin.flow.dom.ShadowRoot)2 Route (com.vaadin.flow.router.Route)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 HasText (com.vaadin.flow.component.HasText)1 HasValidation (com.vaadin.flow.component.HasValidation)1 Html (com.vaadin.flow.component.Html)1 Paragraph (com.vaadin.flow.component.html.Paragraph)1 Push (com.vaadin.flow.component.page.Push)1 Style (com.vaadin.flow.dom.Style)1