Search in sources :

Example 1 with EventHandler

use of com.vaadin.flow.component.polymertemplate.EventHandler in project flow by vaadin.

the class ConvertToBeanView method submit.

@EventHandler
private void submit() {
    Date date = getModel().getDate();
    getModel().setMessage(new SimpleDateFormat("dd.MM.yyyy").format(date));
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) EventHandler(com.vaadin.flow.component.polymertemplate.EventHandler)

Example 2 with EventHandler

use of com.vaadin.flow.component.polymertemplate.EventHandler in project flow by vaadin.

the class EventHandlerView method overriddenClick.

@EventHandler
private void overriddenClick(@EventData("event.result") String result) {
    Element label = ElementFactory.createLabel("Overridden server event was invoked with result: " + result);
    label.setAttribute("id", "overridden-event-handler-result");
    getParent().get().getElement().appendChild(label);
}
Also used : Element(com.vaadin.flow.dom.Element) EventHandler(com.vaadin.flow.component.polymertemplate.EventHandler)

Example 3 with EventHandler

use of com.vaadin.flow.component.polymertemplate.EventHandler in project flow by vaadin.

the class EventHandlerView method handleClick.

@EventHandler
private void handleClick() {
    Element label = ElementFactory.createLabel("Event handler is invoked");
    label.setAttribute("id", "event-handler-result");
    getParent().get().getElement().appendChild(label);
}
Also used : Element(com.vaadin.flow.dom.Element) EventHandler(com.vaadin.flow.component.polymertemplate.EventHandler)

Example 4 with EventHandler

use of com.vaadin.flow.component.polymertemplate.EventHandler in project flow by vaadin.

the class SubPropertyModelTemplate method valueUpdated.

@EventHandler
private void valueUpdated() {
    Div div = new Div();
    div.setId("value-update");
    div.setText(getStatus().getMessage());
    ((HasComponents) getParent().get()).add(div);
}
Also used : Div(com.vaadin.flow.component.html.Div) HasComponents(com.vaadin.flow.component.HasComponents) EventHandler(com.vaadin.flow.component.polymertemplate.EventHandler)

Example 5 with EventHandler

use of com.vaadin.flow.component.polymertemplate.EventHandler in project flow by vaadin.

the class EventHandlerView method sendData.

@EventHandler
private void sendData(@EventData("event.button") int button, @EventData("event.type") String type, @EventData("event.srcElement.tagName") String tag) {
    Element container = ElementFactory.createDiv();
    container.appendChild(ElementFactory.createDiv("Received event from the client with the data:"));
    container.appendChild(ElementFactory.createDiv("button: " + button));
    container.appendChild(ElementFactory.createDiv("type: " + type));
    container.appendChild(ElementFactory.createDiv("tag: " + tag.toLowerCase(Locale.ENGLISH)));
    container.setAttribute("id", "event-data");
    getParent().get().getElement().appendChild(container);
}
Also used : Element(com.vaadin.flow.dom.Element) EventHandler(com.vaadin.flow.component.polymertemplate.EventHandler)

Aggregations

EventHandler (com.vaadin.flow.component.polymertemplate.EventHandler)7 HasComponents (com.vaadin.flow.component.HasComponents)3 Div (com.vaadin.flow.component.html.Div)3 Element (com.vaadin.flow.dom.Element)3 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1