Search in sources :

Example 16 with NativeButton

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

the class HelloWorldUI method init.

@Override
protected void init(VaadinRequest request) {
    NativeButton b = new NativeButton("Hello", e -> {
        add(new Text("Hello!"));
    });
    add(b);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) Text(com.vaadin.flow.component.Text)

Example 17 with NativeButton

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

the class PushView method onAttach.

@Override
protected void onAttach(AttachEvent attachEvent) {
    super.onAttach(attachEvent);
    UI ui = attachEvent.getUI();
    // Fallback transport is forced to websocket so that we either get a
    // websocket connection or no push connection at all
    ui.getPushConfiguration().setFallbackTransport(Transport.WEBSOCKET);
    add(new NativeButton("Say hello", e -> {
        add(new Paragraph("Hello"));
        new Thread(new SayWorld(ui)).start();
    }));
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) UI(com.vaadin.flow.component.UI) Transport(com.vaadin.flow.shared.ui.Transport) AttachEvent(com.vaadin.flow.component.AttachEvent) Paragraph(com.vaadin.flow.component.html.Paragraph) Push(com.vaadin.flow.component.page.Push) Route(com.vaadin.flow.router.Route) NativeButton(com.vaadin.flow.component.html.NativeButton) UI(com.vaadin.flow.component.UI) Paragraph(com.vaadin.flow.component.html.Paragraph)

Example 18 with NativeButton

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

the class MemoryLeakUI method init.

@Override
protected void init(VaadinRequest request) {
    NativeButton button = new NativeButton("Hello", e -> add(new Text("Hello")));
    button.setId("hello");
    add(button);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) Text(com.vaadin.flow.component.Text)

Example 19 with NativeButton

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

the class EventListenersView method onShow.

@Override
protected void onShow() {
    AtomicInteger count = new AtomicInteger();
    NativeButton button = new NativeButton("Click me");
    button.setId("click");
    button.addClickListener(evt -> {
        int value = count.incrementAndGet();
        Label label = new Label(String.valueOf(value));
        label.addClassName("count");
        add(label);
        add(button);
    });
    add(button);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Label(com.vaadin.flow.component.html.Label)

Example 20 with NativeButton

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

the class InMemoryChildrenView method onShow.

@Override
protected void onShow() {
    Label label = new Label();
    label.setId("in-memory");
    label.setText("In memory element");
    getElement().appendVirtualChild(label.getElement());
    getElement().getNode().runWhenAttached(ui -> ui.getPage().executeJavaScript("window.inMemoryConnector.init($0, $1)", getElement(), label));
    Div target = new Div();
    target.setId("target");
    add(target);
    NativeButton button = new NativeButton("Add copy of in-memory element to the target", event -> getElement().callFunction("useInMemoryElement", target));
    button.setId("copy");
    add(button);
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) Label(com.vaadin.flow.component.html.Label)

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