@Override public void clear() { // Delete non-canonical elements first so no events are generated. cleanup(); // Then delete the canonical, which will remove currentValue. Doc.E element = findCanonicalElement(); if (element != null) { getDocument().deleteNode(element); } assert currentElement == null; assert currentValue == null; }
@Override public V set(I initialState) { final Map<String, String> attributes = Initializer.Helper.buildAttributes(initialState, valueFactory); // Insert a new first-child element of the container. Point<Doc.N> insertionPoint = Point.inElement(container, getDocument().getFirstChild(container)); Doc.E element = getDocument().createElement(insertionPoint, valueTagName, attributes); // onElementAdded will create the value object. assert currentElement != null; assert currentValue != null; cleanup(); return currentValue; }