@Override public N getLastChild(N node) { return inner.getLastChild(node); }
/** * Gets the last child element of an element, if there is one. * * @param doc document accessor * @param element parent element * @return the last child element of {@code element} if there is one, * otherwise {@code null}. */ public static <N, E extends N> E getLastChildElement(ReadableDocument<N, E, ?> doc, E element) { return getNextElementInclusive(doc, doc.getLastChild(element), false); }
@Override public N getLastChild(N node) { N find = inner.getLastChild(node); return getPreviousVisibleNodeDepthFirst(find, node, true); }
/** * @param doc * @param point * @return Node before the given point */ public static <N, E extends N, T extends N> N nodeBefore( ReadableDocument<N,E,T> doc, Point.El<N> point) { N node = point.getNodeAfter(); return node == null ? doc.getLastChild(point.getContainer()) : doc.getPreviousSibling(node); }
E element = doc.asElement(start); if (element != null) { next = rightwards ? doc.getFirstChild(element) : doc.getLastChild(element); if (next != null) { return next;
public void testNodeAtEnd() { TestDocumentContext<Node, Element, Text> cxt = createAnnotationContext(); MutableDocument<Node, Element, Text> doc = cxt.document(); Element e = doc.createChildElement(doc.getDocumentElement(), "p", Attributes.EMPTY_MAP); doc.insertText(Point.<Node>inElement(e, null), "Hi"); doc.setAnnotation(3, 4, "x", "1"); timerService.tick(100); ReadableDocument<Node, Element, Text> fullDoc = cxt.getFullRawDoc(); Element boundary = fullDoc.asElement(fullDoc.getLastChild(e)); assertNotNull(boundary); assertEquals("l:b", boundary.getTagName()); doc.setAnnotation(3, 4, "x", null); timerService.tick(100); boundary = fullDoc.asElement(fullDoc.getLastChild(e)); assertNull(boundary); }
public void testNodeAtEnd() { TestDocumentContext<Node, Element, Text> cxt = createAnnotationContext(); MutableDocument<Node, Element, Text> doc = cxt.document(); Element e = doc.createChildElement(doc.getDocumentElement(), "p", Attributes.EMPTY_MAP); doc.insertText(Point.<Node>inElement(e, null), "Hi"); doc.setAnnotation(3, 4, "x", "1"); timerService.tick(100); ReadableDocument<Node, Element, Text> fullDoc = cxt.getFullRawDoc(); Element boundary = fullDoc.asElement(fullDoc.getLastChild(e)); assertNotNull(boundary); assertEquals("l:b", boundary.getTagName()); doc.setAnnotation(3, 4, "x", null); timerService.tick(100); boundary = fullDoc.asElement(fullDoc.getLastChild(e)); assertNull(boundary); }
lastBefore = fullDoc.getLastChild(parent); } else { lastBefore = fullDoc.getPreviousSibling(at);
Element x = doc.getLastChild(doc.getDocumentElement()).asElement(); assertNull(DocHelper.getLastElementWithTagName(doc, "z", x)); Element expectedX = doc.getFirstChild(doc.getLastChild( doc.getDocumentElement())).asElement(); assertSame(expectedX, DocHelper.getLastElementWithTagName(doc, "x"));
Element x = doc.getLastChild(doc.getDocumentElement()).asElement(); assertNull(DocHelper.getLastElementWithTagName(doc, "z", x)); Element expectedX = doc.getFirstChild(doc.getLastChild( doc.getDocumentElement())).asElement(); assertSame(expectedX, DocHelper.getLastElementWithTagName(doc, "x"));
Element expectedZ = doc.getLastChild(container).asElement(); assertSame(expectedZ, DocHelper.getElementWithTagName(doc, "z"));
Element expectedZ = doc.getLastChild(container).asElement(); assertSame(expectedZ, DocHelper.getElementWithTagName(doc, "z"));