Search in sources :

Example 51 with Component

use of com.vaadin.flow.component.Component in project flow by vaadin.

the class GeneratedVaadinTextField method addToPrefix.

/**
 * Adds the given components as children of this component at the slot
 * 'prefix'.
 *
 * @param components
 *            The components to add.
 * @see <a
 *      href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot">MDN
 *      page about slots</a>
 * @see <a
 *      href="https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element">Spec
 *      website about slots</a>
 */
protected void addToPrefix(Component... components) {
    for (Component component : components) {
        component.getElement().setAttribute("slot", "prefix");
        getElement().appendChild(component.getElement());
    }
}
Also used : Component(com.vaadin.flow.component.Component)

Example 52 with Component

use of com.vaadin.flow.component.Component in project flow by vaadin.

the class GeneratedVaadinTextField method addToSuffix.

/**
 * Adds the given components as children of this component at the slot
 * 'suffix'.
 *
 * @param components
 *            The components to add.
 * @see <a
 *      href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot">MDN
 *      page about slots</a>
 * @see <a
 *      href="https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element">Spec
 *      website about slots</a>
 */
protected void addToSuffix(Component... components) {
    for (Component component : components) {
        component.getElement().setAttribute("slot", "suffix");
        getElement().appendChild(component.getElement());
    }
}
Also used : Component(com.vaadin.flow.component.Component)

Example 53 with Component

use of com.vaadin.flow.component.Component in project flow by vaadin.

the class GeneratedVaadinTextField method remove.

/**
 * Removes the given child components from this component.
 *
 * @param components
 *            The components to remove.
 * @throws IllegalArgumentException
 *             if any of the components is not a child of this component.
 */
protected void remove(Component... components) {
    for (Component component : components) {
        if (getElement().equals(component.getElement().getParent())) {
            component.getElement().removeAttribute("slot");
            getElement().removeChild(component.getElement());
        } else {
            throw new IllegalArgumentException("The given component (" + component + ") is not a child of this component");
        }
    }
}
Also used : Component(com.vaadin.flow.component.Component)

Example 54 with Component

use of com.vaadin.flow.component.Component in project flow by vaadin.

the class GeneratedVaadinUpload method addToFileList.

/**
 * Adds the given components as children of this component at the slot
 * 'file-list'.
 *
 * @param components
 *            The components to add.
 * @see <a
 *      href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot">MDN
 *      page about slots</a>
 * @see <a
 *      href="https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element">Spec
 *      website about slots</a>
 */
protected void addToFileList(Component... components) {
    for (Component component : components) {
        component.getElement().setAttribute("slot", "file-list");
        getElement().appendChild(component.getElement());
    }
}
Also used : Component(com.vaadin.flow.component.Component)

Example 55 with Component

use of com.vaadin.flow.component.Component in project flow by vaadin.

the class GeneratedVaadinUpload method addToAddButton.

/**
 * Adds the given components as children of this component at the slot
 * 'add-button'.
 *
 * @param components
 *            The components to add.
 * @see <a
 *      href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/slot">MDN
 *      page about slots</a>
 * @see <a
 *      href="https://html.spec.whatwg.org/multipage/scripting.html#the-slot-element">Spec
 *      website about slots</a>
 */
protected void addToAddButton(Component... components) {
    for (Component component : components) {
        component.getElement().setAttribute("slot", "add-button");
        getElement().appendChild(component.getElement());
    }
}
Also used : Component(com.vaadin.flow.component.Component)

Aggregations

Component (com.vaadin.flow.component.Component)66 Test (org.junit.Test)9 Element (com.vaadin.flow.dom.Element)7 UI (com.vaadin.flow.component.UI)4 ArrayList (java.util.ArrayList)4 List (java.util.List)4 HasElement (com.vaadin.flow.component.HasElement)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2 VirtualChildrenList (com.vaadin.flow.internal.nodefeature.VirtualChildrenList)2 AfterNavigationEvent (com.vaadin.flow.router.AfterNavigationEvent)2 BeforeEnterEvent (com.vaadin.flow.router.BeforeEnterEvent)2 BeforeLeaveEvent (com.vaadin.flow.router.BeforeLeaveEvent)2 ContinueNavigationAction (com.vaadin.flow.router.BeforeLeaveEvent.ContinueNavigationAction)2 Location (com.vaadin.flow.router.Location)2 LocationChangeEvent (com.vaadin.flow.router.LocationChangeEvent)2 NavigationEvent (com.vaadin.flow.router.NavigationEvent)2 RouterLayout (com.vaadin.flow.router.RouterLayout)2 ErrorStateRenderer (com.vaadin.flow.router.internal.ErrorStateRenderer)2 ViewClassLocator (com.vaadin.flow.uitest.servlet.ViewClassLocator)2 Optional (java.util.Optional)2