/** * {@inheritDoc} */ @Override public DomNode appendChild(final org.w3c.dom.Node node) { final DomNode domNode = (DomNode) node; if (append_) { return target_.appendChild(domNode); } target_.insertBefore(domNode); return domNode; }
/** * Replaces this node with another node. If the specified node is this node, this * method is a no-op. * @param newNode the node to replace this one */ public void replace(final DomNode newNode) { if (newNode != this) { final DomNode exParent = parent_; final DomNode exNextSibling = nextSibling_; remove(); exParent.insertBefore(newNode, exNextSibling); } }
/** * {@inheritDoc} */ @Override public DomNode appendChild(final org.w3c.dom.Node node) { final DomNode domNode = (DomNode) node; if (append_) { return target_.appendChild(domNode); } target_.insertBefore(domNode); return domNode; }
/** * {@inheritDoc} */ @Override public DomNode appendChild(final org.w3c.dom.Node node) { final DomNode domNode = (DomNode) node; if (append_) { return target_.appendChild(domNode); } target_.insertBefore(domNode); return domNode; }
/** * {@inheritDoc} */ @Override public DomNode appendChild(final org.w3c.dom.Node node) { final DomNode domNode = (DomNode) node; if (append_) { return target_.appendChild(domNode); } target_.insertBefore(domNode); return domNode; }
/** * {@inheritDoc} */ @Override public DomNode appendChild(final org.w3c.dom.Node node) { final DomNode domNode = (DomNode) node; if (append_) { return target_.appendChild(domNode); } target_.insertBefore(domNode); return domNode; }
/** * Replaces this node with another node. If the specified node is this node, this * method is a no-op. * @param newNode the node to replace this one */ public void replace(final DomNode newNode) { if (newNode != this) { final DomNode exParent = parent_; final DomNode exNextSibling = nextSibling_; remove(); exParent.insertBefore(newNode, exNextSibling); } }
/** * {@inheritDoc} */ public Node insertBefore(final Node newChild, final Node refChild) { if (refChild == null) { appendChild(newChild); } else { if (refChild.getParentNode() != this) { throw new DOMException(DOMException.NOT_FOUND_ERR, "Reference node is not a child of this node."); } ((DomNode) refChild).insertBefore((DomNode) newChild); } return null; }
/** * {@inheritDoc} */ public Node insertBefore(final Node newChild, final Node refChild) { if (refChild == null) { appendChild(newChild); } else { if (refChild.getParentNode() != this) { throw new DOMException(DOMException.NOT_FOUND_ERR, "Reference node is not a child of this node."); } ((DomNode) refChild).insertBefore((DomNode) newChild); } return null; }
/** * {@inheritDoc} */ public Node insertBefore(final Node newChild, final Node refChild) { if (refChild == null) { appendChild(newChild); } else { if (refChild.getParentNode() != this) { throw new DOMException(DOMException.NOT_FOUND_ERR, "Reference node is not a child of this node."); } ((DomNode) refChild).insertBefore((DomNode) newChild); } return null; }
/** * Replaces this node with another node. If the specified node is this node, this * method is a no-op. * @param newNode the node to replace this one * @throws IllegalStateException if this node is not a child of any other node */ public void replace(final DomNode newNode) throws IllegalStateException { if (newNode != this) { newNode.remove(); insertBefore(newNode); remove(); } }
/** * Replaces this node with another node. If the specified node is this node, this * method is a no-op. * @param newNode the node to replace this one * @throws IllegalStateException if this node is not a child of any other node */ public void replace(final DomNode newNode) throws IllegalStateException { if (newNode != this) { newNode.remove(); insertBefore(newNode); remove(); } }
/** * Replaces this node with another node. If the specified node is this node, this * method is a no-op. * @param newNode the node to replace this one * @throws IllegalStateException if this node is not a child of any other node */ public void replace(final DomNode newNode) throws IllegalStateException { if (newNode != this) { newNode.remove(); insertBefore(newNode); remove(); } }
/** * Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, * just before this ChildNode. * @param context the context * @param thisObj this object * @param args the arguments * @param function the function */ protected static void before(final Context context, final Scriptable thisObj, final Object[] args, final Function function) { for (Object arg : args) { final Node node = toNodeOrTextNode((Node) thisObj, arg); ((Node) thisObj).getDomNodeOrDie().insertBefore(node.getDomNodeOrDie()); } }
/** * Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, * just before this ChildNode. * @param context the context * @param thisObj this object * @param args the arguments * @param function the function */ protected static void before(final Context context, final Scriptable thisObj, final Object[] args, final Function function) { for (Object arg : args) { final Node node = toNodeOrTextNode((Node) thisObj, arg); ((Node) thisObj).getDomNodeOrDie().insertBefore(node.getDomNodeOrDie()); } }
/** * Moves the row at the specified source index to the specified target index, returning * the row that was moved. * @param sourceIndex the index of the row to move * @param targetIndex the index to move the row to * @return the row that was moved */ public Object jsxFunction_moveRow(final int sourceIndex, final int targetIndex) { final HTMLCollection rows = (HTMLCollection) jsxGet_rows(); final int rowCount = rows.jsxGet_length(); final boolean sourceIndexValid = (sourceIndex >= 0 && sourceIndex < rowCount); final boolean targetIndexValid = (targetIndex >= 0 && targetIndex < rowCount); if (sourceIndexValid && targetIndexValid) { final SimpleScriptable sourceRow = (SimpleScriptable) rows.jsxFunction_item(new Integer(sourceIndex)); final SimpleScriptable targetRow = (SimpleScriptable) rows.jsxFunction_item(new Integer(targetIndex)); targetRow.getDomNodeOrDie().insertBefore(sourceRow.getDomNodeOrDie()); return sourceRow; } return null; }
/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ @Override public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }
/** * {@inheritDoc} */ public DomText splitText(final int offset) { if (offset < 0 || offset > getLength()) { throw new IllegalArgumentException("offset: " + offset + " data.length: " + getLength()); } // split text into two separate nodes final DomText newText = createSplitTextNode(offset); setData(getData().substring(0, offset)); // insert new text node if (getParentNode() != null) { getParentNode().insertBefore(newText, getNextSibling()); } return newText; }