本文整理了Java中elemental2.dom.Node
类的一些代码示例,展示了Node
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node
类的具体详情如下:
包路径:elemental2.dom.Node
类名称:Node
暂无
代码示例来源:origin: org.jboss.errai/errai-common
/**
* Detaches all element children from a node.
* @param node Must not be null.
* @return True iff any element children were detached by this call.
*/
public boolean removeAllElementChildren(final Node node) {
final boolean hadChildren = node.lastChild != null;
while (node.lastChild != null) {
node.removeChild(node.lastChild);
}
return hadChildren;
}
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-patternfly
public static void insertBefore(final Node newNode,
final Node referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode);
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-dmn-client
void updateSubItems(final Element children) {
subItems.parentNode.replaceChild(children, subItems);
}
代码示例来源:origin: hal/elemento
/**
* Inserts the specified element into the parent of the after element if not already present. If parent already
* contains child, this method does nothing.
*/
public static void lazyInsertAfter(Element newElement, Element after) {
if (!after.parentNode.contains(newElement)) {
after.parentNode.insertBefore(newElement, after.nextSibling);
}
}
代码示例来源:origin: hal/elemento
/**
* Removes the child from parent if both parent and child are not null and parent contains child.
*
* @return {@code true} if the the element has been removed from its parent, {@code false} otherwise.
*/
public static boolean failSafeRemove(Node parent, Element child) {
//noinspection SimplifiableIfStatement
if (parent != null && child != null && parent.contains(child)) {
return parent.removeChild(child) != null;
}
return false;
}
代码示例来源:origin: DominoKit/domino-ui
private static boolean isChildOfObservedNode(String attachId, List<Node> nodes, String attachUidKey) {
for (int i = 0; i < nodes.size(); i++) {
Node elementNode = Js.uncheckedCast(nodes.get(i));
if (Node.ELEMENT_NODE == elementNode.nodeType) {
if (nonNull(elementNode.querySelector("[" + attachUidKey + "='" + attachId + "']"))) {
return true;
}
}
}
return false;
}
代码示例来源:origin: com.google.elemental2/elemental2-dom
@JsOverlay
public final JsObject setUserData(Object key, Object data, UserDataHandler handler) {
return setUserData(Js.<JsObject>uncheckedCast(key), Js.<JsObject>uncheckedCast(data), handler);
}
}
代码示例来源:origin: org.jresearch.dominokit/domino-ui
public InputValueBox(String type, String label) {
super(type, label);
suggestionsDataList.id = getDominoId();
getInputElement().setAttribute("list", getDominoId());
getInputElement().asElement().parentNode.appendChild(suggestionsDataList);
addTypeMismatchValidator();
addInvalidPatternValidator();
setAutoValidation(true);
}
代码示例来源:origin: DominoKit/domino-ui
public KeyboardEvents(T element) {
element.addEventListener(KEYDOWN, evt -> {
KeyboardEvent keyboardEvent = Js.uncheckedCast(evt);
String key = keyboardEvent.key.toLowerCase();
HandlerContext handlerContext = null;
if (keyboardEvent.ctrlKey && ctrlHandlers.containsKey(key)) {
handlerContext = ctrlHandlers.get(key);
} else if (handlers.containsKey(key)) {
handlerContext = handlers.get(key);
}
if (nonNull(handlerContext)) {
handlerContext.handler.handleEvent(evt);
if (handlerContext.options.preventDefault) {
evt.preventDefault();
}
if (handlerContext.options.stopPropagation) {
evt.stopPropagation();
}
}
});
}
代码示例来源:origin: hal/elemento
/**
* Inserts the specified element into the parent of the before element if not already present. If parent already
* contains child, this method does nothing.
*/
public static void lazyInsertBefore(Element newElement, Element before) {
if (!before.parentNode.contains(newElement)) {
before.parentNode.insertBefore(newElement, before);
}
}
代码示例来源:origin: org.jresearch.dominokit/domino-ui
private static boolean isChildOfObservedNode(String attachId, List<Node> nodes, String attachUidKey) {
for (int i = 0; i < nodes.size(); i++) {
Node elementNode = Js.uncheckedCast(nodes.get(i));
if (Node.ELEMENT_NODE == elementNode.nodeType) {
if (nonNull(elementNode.querySelector("[" + attachUidKey + "='" + attachId + "']"))) {
return true;
}
}
}
return false;
}
代码示例来源:origin: org.realityforge.com.google.elemental2/elemental2-dom
@JsOverlay
public final JsObject setUserData(Object key, Object data, UserDataHandler handler) {
return setUserData(Js.<JsObject>uncheckedCast(key), Js.<JsObject>uncheckedCast(data), handler);
}
}
代码示例来源:origin: DominoKit/domino-ui
public InputValueBox(String type, String label) {
super(type, label);
suggestionsDataList.id = getDominoId();
getInputElement().setAttribute("list", getDominoId());
getInputElement().asElement().parentNode.appendChild(suggestionsDataList);
addTypeMismatchValidator();
addInvalidPatternValidator();
setAutoValidation(true);
}
代码示例来源:origin: org.jresearch.dominokit/domino-ui
public KeyboardEvents(T element) {
element.addEventListener(KEYDOWN, evt -> {
KeyboardEvent keyboardEvent = Js.uncheckedCast(evt);
String key = keyboardEvent.key.toLowerCase();
HandlerContext handlerContext = null;
if (keyboardEvent.ctrlKey && ctrlHandlers.containsKey(key)) {
handlerContext = ctrlHandlers.get(key);
} else if (handlers.containsKey(key)) {
handlerContext = handlers.get(key);
}
if (nonNull(handlerContext)) {
handlerContext.handler.handleEvent(evt);
if (handlerContext.options.preventDefault) {
evt.preventDefault();
}
if (handlerContext.options.stopPropagation) {
evt.stopPropagation();
}
}
});
}
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-patternfly
public static void remove(final Node element) {
element.parentNode.removeChild(element);
}
}
代码示例来源:origin: org.uberfire/uberfire-workbench-client-views-patternfly
public static void insertAfter(final Node newNode,
final Node referenceNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
代码示例来源:origin: org.jboss.gwt.elemento/elemento-template
public static void replaceElement(HTMLElement context, String identifier, HTMLElement newElement) {
if (newElement == null) {
throw new NullPointerException("New element must not be null in TemplateUtils.replaceElement()");
}
HTMLElement oldElement = resolveElement(context, identifier);
if (oldElement != null && oldElement.parentNode != null) {
oldElement.parentNode.replaceChild(newElement, oldElement);
}
}
代码示例来源:origin: org.kie.workbench/kie-wb-common-dmn-client
private Optional<Element> querySelector(final String selector) {
return Optional.ofNullable(getElement().parentNode.querySelector(selector));
}
代码示例来源:origin: errai/errai
/**
* Detaches all element children from a node.
* @param node Must not be null.
* @return True iff any element children were detached by this call.
*/
public boolean removeAllElementChildren(final Node node) {
final boolean hadChildren = node.lastChild != null;
while (node.lastChild != null) {
node.removeChild(node.lastChild);
}
return hadChildren;
}
代码示例来源:origin: hal/elemento
/** Inserts the specified element into the parent of the before element. */
public static void insertBefore(Element newElement, Element before) {
before.parentNode.insertBefore(newElement, before);
}
内容来源于网络,如有侵权,请联系作者删除!