Search in sources :

Example 21 with Div

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

the class ShadowRootView method onShow.

@Override
protected void onShow() {
    Div div = new Div();
    div.getElement().setAttribute("id", "test-element");
    add(div);
    ShadowRoot shadowRoot = div.getElement().attachShadow();
    Element shadowDiv = ElementFactory.createDiv();
    shadowDiv.setText("Div inside shadow DOM");
    shadowDiv.setAttribute("id", "shadow-div");
    shadowRoot.appendChild(shadowDiv);
    Element shadowLabel = ElementFactory.createLabel("Label inside shadow DOM");
    shadowLabel.setAttribute("id", "shadow-label");
    shadowRoot.appendChild(shadowLabel);
    NativeButton removeChild = new NativeButton("Remove the last child from the shadow root", event -> shadowRoot.removeChild(shadowLabel));
    removeChild.setId("remove");
    add(removeChild);
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) Element(com.vaadin.flow.dom.Element) ShadowRoot(com.vaadin.flow.dom.ShadowRoot)

Example 22 with Div

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

the class SynchronizedPropertyView method addSimpleSync.

private void addSimpleSync() {
    add(new Text("Synchronized on 'change' event"));
    Div label = new Div();
    label.setId("syncOnChangeLabel");
    InputSync syncOnChange = new InputSync(label, "change");
    syncOnChange.setId("syncOnChange");
    add(syncOnChange);
    add(label);
}
Also used : Div(com.vaadin.flow.component.html.Div) Text(com.vaadin.flow.component.Text)

Example 23 with Div

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

the class SynchronizedPropertyView method addSyncOnKeyup.

private void addSyncOnKeyup() {
    Div label;
    add(new Text("Synchronized on 'keyup' event"));
    label = new Div();
    label.setId("syncOnKeyUpLabel");
    InputSync syncOnKeyUp = new InputSync(label, "keyup");
    syncOnKeyUp.setId("syncOnKeyUp");
    add(syncOnKeyUp);
    add(label);
}
Also used : Div(com.vaadin.flow.component.html.Div) Text(com.vaadin.flow.component.Text)

Example 24 with Div

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

the class ClearNodeChildrenView method addDivTo.

private void addDivTo(HasComponents container) {
    Div div = new Div();
    div.setText("Server div " + (container.getElement().getChildCount() + 1));
    div.addAttachListener(evt -> message.setText(message.getText() + "\nDiv '" + div.getText() + "' attached."));
    div.addDetachListener(evt -> message.setText(message.getText() + "\nDiv '" + div.getText() + "' detached."));
    container.add(div);
}
Also used : Div(com.vaadin.flow.component.html.Div)

Example 25 with Div

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

the class PolymerDefaultPropertyValueView method createEmailValue.

private void createEmailValue(PolymerDefaultPropertyValue template) {
    Div div = new Div();
    div.setText(template.getEmail());
    div.setId("email-value");
    add(div);
}
Also used : Div(com.vaadin.flow.component.html.Div)

Aggregations

Div (com.vaadin.flow.component.html.Div)30 NativeButton (com.vaadin.flow.component.html.NativeButton)7 Text (com.vaadin.flow.component.Text)6 Element (com.vaadin.flow.dom.Element)4 HasComponents (com.vaadin.flow.component.HasComponents)3 EventHandler (com.vaadin.flow.component.polymertemplate.EventHandler)3 Input (com.vaadin.flow.component.html.Input)2 ShadowRoot (com.vaadin.flow.dom.ShadowRoot)2 HasText (com.vaadin.flow.component.HasText)1 H3 (com.vaadin.flow.component.html.H3)1 Hr (com.vaadin.flow.component.html.Hr)1 Label (com.vaadin.flow.component.html.Label)1 Span (com.vaadin.flow.component.html.Span)1 Style (com.vaadin.flow.dom.Style)1 NameField (com.vaadin.flow.uitest.ui.CompositeView.NameField)1