/** * Inserts the node newChild after the existing child node refChild. If * refChild is <code>null</code>, insert newChild at the end of the list of children. * * @param newChild The node to insert * @param refChild The reference node (that is, the node after which the new * node must be inserted), or <code>null</code> * @return The node being inserted */ public final Node insertAfter(Node newChild, Node refChild) { assert (newChild != null) : "Cannot add a null child node"; Node next = (refChild == null) ? null : refChild.getNextSibling(); if (next == null) { return appendChild(newChild); } else { return insertBefore(newChild, next); } }
/** * The node immediately following this node. If there is no such node, * this returns <code>null</code>. * @return The node immediately following this node. */ public final OMNode getNextSibling() { Node nextSibling = ot.getNextSibling(); return (nextSibling != null) ? convert(nextSibling) : null; }
/** * The node immediately following this node. If there is no such node, * this returns <code>null</code>. * @return The node immediately following this node. */ public final OMNode getNextSibling() { Node nextSibling = ot.getNextSibling(); return (nextSibling != null) ? convert(nextSibling) : null; }
@Override public Node getNextSibling() { return new NodeWrapper(node.getNextSibling()); }
@Override public Node getNextSibling() { return new NodeWrapper(node.getNextSibling()); }
@PatchMethod static JavaScriptObject getNextSibling(JavaScriptObject o) { Node n = o.cast(); return n.getNextSibling(); }
@PatchMethod static JavaScriptObject getNextSibling(JavaScriptObject o) { Node n = o.cast(); return n.getNextSibling(); }
/** * Inserts the node newChild after the existing child node refChild. If * refChild is <code>null</code>, insert newChild at the end of the list of children. * * @param newChild The node to insert * @param refChild The reference node (that is, the node after which the new * node must be inserted), or <code>null</code> * @return The node being inserted */ public final Node insertAfter(Node newChild, Node refChild) { assert (newChild != null) : "Cannot add a null child node"; Node next = (refChild == null) ? null : refChild.getNextSibling(); if (next == null) { return appendChild(newChild); } else { return insertBefore(newChild, next); } }
/** * Inserts the node newChild after the existing child node refChild. If * refChild is <code>null</code>, insert newChild at the end of the list of children. * * @param newChild The node to insert * @param refChild The reference node (that is, the node after which the new * node must be inserted), or <code>null</code> * @return The node being inserted */ public final Node insertAfter(Node newChild, Node refChild) { assert (newChild != null) : "Cannot add a null child node"; Node next = (refChild == null) ? null : refChild.getNextSibling(); if (next == null) { return appendChild(newChild); } else { return insertBefore(newChild, next); } }
private void doUpdateAllElementsSize(int width, int height) { Node element = elementsParent.getFirstChildElement(); while (element != null) { doSetElementSize(width, height, Element.as(element)); element = element.getNextSibling(); } }
protected void assertStructure(ContentNode n, ContentElement parent, ContentNode prev, ContentNode next) { assertSame(parent, c.getParentElement(n)); assertSame(prev, c.getPreviousSibling(n)); assertSame(next, c.getNextSibling(n)); // TODO(danilatos): Factor this out, and use filtered view... assertSame(parent == null ? null : parent.getImplNodelet(), n.getImplNodelet().getParentElement()); assertSame(prev == null ? null : prev.getImplNodelet(), n.getImplNodelet().getPreviousSibling()); assertSame(next == null ? null : next.getImplNodelet(), n.getImplNodelet().getNextSibling()); } }
protected void assertStructure(ContentNode n, ContentElement parent, ContentNode prev, ContentNode next) { assertSame(parent, c.getParentElement(n)); assertSame(prev, c.getPreviousSibling(n)); assertSame(next, c.getNextSibling(n)); // TODO(danilatos): Factor this out, and use filtered view... assertSame(parent == null ? null : parent.getImplNodelet(), n.getImplNodelet().getParentElement()); assertSame(prev == null ? null : prev.getImplNodelet(), n.getImplNodelet().getPreviousSibling()); assertSame(next == null ? null : next.getImplNodelet(), n.getImplNodelet().getNextSibling()); } }
public void testImplDataSumsTextNodes() throws HtmlMissing { ContentDocument dom = TestEditors.createTestDocument(); c = dom.debugGetRawDocument(); ContentElement root = c.getDocumentElement(); ContentTextNode t1 = c.createTextNode("hello", root, null); Text txt = t1.getImplNodelet(); assertEquals("hello", t1.getImplData()); Text txt3 = Document.get().createTextNode(" there"); txt.getParentNode().insertAfter(txt3, txt); assertEquals("hello there", t1.getImplData()); Text txt2 = txt.splitText(2); assertEquals("hello there", t1.getImplData()); assertSame(txt3, txt.getNextSibling().getNextSibling()); assertTrue(t1.owns(txt) && t1.owns(txt2) && t1.owns(txt3)); ContentTextNode t2 = c.createTextNode("before", root, t1); assertEquals("before", t2.getImplData()); Text t2_2 = t2.getImplNodelet().splitText(3); assertEquals("before", t2.getImplData()); assertTrue(t2.owns(t2_2)); }
public void testImplDataSumsTextNodes() throws HtmlMissing { ContentDocument dom = TestEditors.createTestDocument(); c = dom.debugGetRawDocument(); ContentElement root = c.getDocumentElement(); ContentTextNode t1 = c.createTextNode("hello", root, null); Text txt = t1.getImplNodelet(); assertEquals("hello", t1.getImplData()); Text txt3 = Document.get().createTextNode(" there"); txt.getParentNode().insertAfter(txt3, txt); assertEquals("hello there", t1.getImplData()); Text txt2 = txt.splitText(2); assertEquals("hello there", t1.getImplData()); assertSame(txt3, txt.getNextSibling().getNextSibling()); assertTrue(t1.owns(txt) && t1.owns(txt2) && t1.owns(txt3)); ContentTextNode t2 = c.createTextNode("before", root, t1); assertEquals("before", t2.getImplData()); Text t2_2 = t2.getImplNodelet().splitText(3); assertEquals("before", t2.getImplData()); assertTrue(t2.owns(t2_2)); }