Search in sources :

Example 6 with ElementChildrenList

use of com.vaadin.flow.internal.nodefeature.ElementChildrenList in project flow by vaadin.

the class StateNodeTest method setParent.

public static void setParent(StateNode child, StateNode parent) {
    if (parent == null) {
        // Remove child
        parent = child.getParent();
        ElementChildrenList children = parent.getFeature(ElementChildrenList.class);
        children.remove(children.indexOf(child));
    } else {
        // Add child
        assert child.getParent() == null;
        ElementChildrenList children = parent.getFeature(ElementChildrenList.class);
        children.add(children.size(), child);
    }
}
Also used : ElementChildrenList(com.vaadin.flow.internal.nodefeature.ElementChildrenList)

Example 7 with ElementChildrenList

use of com.vaadin.flow.internal.nodefeature.ElementChildrenList in project flow by vaadin.

the class StateNodeTest method addChild.

private void addChild(StateNode parent, StateNode node) {
    removeFromParent(node);
    ElementChildrenList list = parent.getFeature(ElementChildrenList.class);
    list.add(list.size(), node);
}
Also used : ElementChildrenList(com.vaadin.flow.internal.nodefeature.ElementChildrenList)

Aggregations

ElementChildrenList (com.vaadin.flow.internal.nodefeature.ElementChildrenList)7 Test (org.junit.Test)4 UI (com.vaadin.flow.component.UI)1 InertData (com.vaadin.flow.internal.nodefeature.InertData)1 WeakReference (java.lang.ref.WeakReference)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1