本文整理匯總了Java中com.google.gwt.dom.client.Node.removeFromParent方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.removeFromParent方法的具體用法?Java Node.removeFromParent怎麽用?Java Node.removeFromParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.dom.client.Node
的用法示例。
在下文中一共展示了Node.removeFromParent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: reattachImplChildren
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
private void reattachImplChildren(Node parentNodelet, Node nodeletBefore, Node nodeletAfter,
ContentNode first, ContentNode last) {
// TODO(danilatos): Replace this hairy code with pre-order traversal
// getters, once they exist
while (true) {
Node nodelet = nodeletBefore == null
? strippingView.getFirstChild(parentNodelet)
: strippingView.getNextSibling(nodeletBefore);
if (nodelet == null || nodelet == nodeletAfter) {
break;
}
if (nodelet.getParentElement() != null) {
nodelet.removeFromParent();
}
}
for (ContentNode node = first; node != last; node = renderedView.getNextSibling(node)) {
parentNodelet.insertBefore(node.getImplNodelet(), nodeletAfter);
}
}
示例2: removeNodes
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/**
* Remove nodes in the given range from the DOM
* @param from
* @param toExcl
*/
public static void removeNodes(Node from, Node toExcl) {
if (from == null || !from.hasParentElement()) {
return;
}
for (Node n = from; n != toExcl && n != null;) {
Node r = n;
n = n.getNextSibling();
r.removeFromParent();
}
}
示例3: getPosition
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
private OffsetPosition getPosition(Node focusNode, int focusOffset) {
if (focusNode == null || focusNode.getParentElement() == null) {
// Return null if cannot get selection, or selection is inside an
// "unattached" node.
return null;
}
if (DomHelper.isTextNode(focusNode)) {
// We don't want to split the existing child text node, so we just add
// duplicate the string up to the offset.
Node txt =
Document.get().createTextNode(
focusNode.getNodeValue().substring(0, focusOffset));
try {
mutationListener.startTransientMutations();
focusNode.getParentNode().insertBefore(txt, focusNode);
txt.getParentNode().insertAfter(SPAN, txt);
OffsetPosition ret =
new OffsetPosition(SPAN.getOffsetLeft(), SPAN.getOffsetTop(), SPAN.getOffsetParent());
return ret;
} finally {
SPAN.removeFromParent();
txt.removeFromParent();
mutationListener.endTransientMutations();
}
} else {
Element e = focusNode.cast();
return new OffsetPosition(e.getOffsetLeft(), e.getOffsetTop(), e.getOffsetParent());
}
}