use of com.vaadin.flow.component.html.Input in project flow by vaadin.
the class BasicComponentView method onShow.
@Override
protected void onShow() {
getElement().getStyle().set("margin", "1em");
getElement().setAttribute("id", "root");
Text text = new Text(TEXT);
Input input = new Input();
input.setPlaceholder("Synchronized on change event");
NativeButton button = new NativeButton(BUTTON_TEXT, e -> {
Div greeting = new Div();
greeting.addClassName("thankYou");
String buttonText = e.getSource().getElement().getText();
greeting.setText("Thank you for clicking \"" + buttonText + "\" at (" + e.getClientX() + "," + e.getClientY() + ")! The field value is " + input.getValue());
greeting.addClickListener(e2 -> remove(greeting));
add(greeting);
});
Div helloWorld = new Div();
helloWorld.setText(DIV_TEXT);
helloWorld.addClassName("hello");
helloWorld.setId("hello-world");
helloWorld.addClickListener(e -> {
helloWorld.setText("Stop touching me!");
helloWorld.getElement().getClassList().clear();
});
Style s = helloWorld.getElement().getStyle();
s.set("color", "red");
s.set("fontWeight", "bold");
add(text, helloWorld, button, input);
}
use of com.vaadin.flow.component.html.Input in project flow by vaadin.
the class ExecJavaScriptView method onShow.
@Override
protected void onShow() {
NativeButton alertButton = createJsButton("Alert", "alertButton", "window.alert($0)", "Hello world");
NativeButton focusButton = createJsButton("Focus Alert button", "focusButton", "$0.focus()", alertButton);
NativeButton swapText = createJsButton("Swap button texts", "swapButton", "(function() {var t = $0.textContent; $0.textContent = $1.textContent; $1.textContent = t;})()", alertButton, focusButton);
NativeButton logButton = createJsButton("Log", "logButton", "console.log($0)", JsonUtils.createArray(Json.create("Hello world"), Json.create(true)));
NativeButton createElementButton = new NativeButton("Create and update element", e -> {
Input input = new Input();
input.addClassName("newInput");
UI.getCurrent().getPage().executeJavaScript("$0.value = $1", input, "Value from js");
add(input);
});
createElementButton.setId("createButton");
add(alertButton, focusButton, swapText, logButton, createElementButton);
}
use of com.vaadin.flow.component.html.Input in project flow by vaadin.
the class PageView method beforeEnter.
@Override
public void beforeEnter(BeforeEnterEvent event) {
Input input = new Input();
input.setId("input");
input.clear();
Div updateButton = new Div();
updateButton.setId("button");
updateButton.setText("Update page title");
updateButton.addClickListener(e -> {
getPage().setTitle(input.getValue());
});
Div overrideButton = new Div();
overrideButton.setId("override");
overrideButton.setText("Triggers two updates");
overrideButton.addClickListener(e -> {
getPage().setTitle(input.getValue());
getPage().setTitle("OVERRIDDEN");
});
Div reloadButton = new Div();
reloadButton.setId("reload");
reloadButton.setText("Reloads the page");
reloadButton.addClickListener(e -> {
getPage().reload();
});
add(input, updateButton, overrideButton, reloadButton);
}
use of com.vaadin.flow.component.html.Input in project flow by vaadin.
the class RPCLoggerUI method init.
@Override
protected void init(VaadinRequest request) {
NativeButton button = new NativeButton("Click Me");
button.addClickListener(event -> {
});
Input input = new Input();
add(button, input);
}
Aggregations