本文整理汇总了Java中elemental.dom.Node类的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Node类属于elemental.dom包,在下文中一共展示了Node类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: printStructure
import elemental.dom.Node; //导入依赖的package包/类
private void printStructure(Element element) {
console.log("<" + element.getNodeName());
NamedNodeMap attributes = element.getAttributes();
if (attributes != null) {
for (int x = 0; x < attributes.length(); x++) {
Node attr = attributes.item(x);
console.log(" " + attr.getNodeName() + "=" + attr.getNodeValue());
}
}
console.log(">");
if (element.getTextContent() != null) {
console.log(element.getTextContent());
}
NodeList children = element.getChildNodes();
for (int x = 0; x < children.getLength(); x++) {
printStructure((Element) children.at(x));
}
console.log("</" + element.getNodeName() + ">");
}
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:20,代码来源:AnotherTest.java
示例2: renderSignature
import elemental.dom.Node; //导入依赖的package包/类
private Element renderSignature(
Element signatures, SignatureInfo signatureInfo, Optional<Integer> activeParameter) {
Element signatureElement = Elements.createDivElement();
signatures.appendChild(signatureElement);
Element code = Elements.createDivElement();
signatureElement.appendChild(code);
boolean hasParameters =
signatureInfo.getParameters().isPresent() && !signatureInfo.getParameters().get().isEmpty();
if (hasParameters) {
renderParameters(code, signatureInfo, activeParameter);
} else {
Node label = code.appendChild(Elements.createSpanElement());
label.setTextContent(signatureInfo.getLabel());
}
return signatureElement;
}
开发者ID:eclipse,项目名称:che,代码行数:20,代码来源:SignatureHelpView.java
示例3: removeAnnotation
import elemental.dom.Node; //导入依赖的package包/类
@Override
public final void removeAnnotation(final Annotation annotation, int offset) {
final HTMLCollection children = asElemental().getChildren();
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
if (compareStrings(getMessage(dataset), annotation.getText())
&& getOffset(dataset) == offset
&& getLayer(dataset) == annotation.getLayer()
&& compareStrings(getType(dataset), annotation.getType())) {
// we may not strictly be on the same annotation instance, but it is not discernible
asElemental().removeChild(element);
updateIconVisibility();
break;
}
}
}
}
开发者ID:eclipse,项目名称:che,代码行数:21,代码来源:AnnotationGroupImpl.java
示例4: getMessages
import elemental.dom.Node; //导入依赖的package包/类
@Override
public List<String> getMessages() {
final List<String> result = new ArrayList<>();
final HTMLCollection children = asElemental().getChildren();
for (int i = 0; i < children.length(); i++) {
final Node child = (Node) children.at(i);
if (child instanceof elemental.dom.Element) {
final elemental.dom.Element element = (elemental.dom.Element) child;
final Mappable dataset = element.getDataset();
final String message = getMessage(dataset);
if (message != null) {
result.add(message);
}
}
}
return result;
}
开发者ID:eclipse,项目名称:che,代码行数:19,代码来源:AnnotationGroupImpl.java
示例5: getFirstChildElement
import elemental.dom.Node; //导入依赖的package包/类
public static JsElement getFirstChildElement(Element element) {
elemental.dom.Node child = element.getFirstChild();
while ((child != null) && child.getNodeType() != Node.ELEMENT_NODE) {
child = child.getNextSibling();
}
return ((JsElement) child);
}
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:DomUtils.java
示例6: renderAction
import elemental.dom.Node; //导入依赖的package包/类
private Node renderAction(String title, final Action action) {
final Presentation presentation = presentationFactory.getPresentation(action);
Element divElement = Elements.createDivElement(style.listElement());
divElement.addEventListener(
"click",
new EventListener() {
@Override
public void handleEvent(Event evt) {
ActionEvent event = new ActionEvent(presentation, actionManager);
action.actionPerformed(event);
}
},
true);
divElement.getStyle().setCursor("pointer");
divElement.getStyle().setColor(Style.getOutputLinkColor());
Element label = Elements.createDivElement(style.actionLabel());
label.setInnerText(title);
divElement.appendChild(label);
String hotKey =
KeyMapUtil.getShortcutText(keyBindingAgent.getKeyBinding(actionManager.getId(action)));
if (hotKey == null) {
hotKey = " ";
} else {
hotKey = "<nobr> " + hotKey + " </nobr>";
}
SpanElement hotKeyElement = Elements.createSpanElement(style.hotKey());
hotKeyElement.setInnerHTML(hotKey);
divElement.appendChild(hotKeyElement);
return divElement;
}
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:EmptyEditorsPanel.java
示例7: createItem
import elemental.dom.Node; //导入依赖的package包/类
public Element createItem(final CompletionProposal proposal) {
final Element element = Elements.createLiElement(popupResources.popupStyle().item());
final Element icon = Elements.createDivElement(popupResources.popupStyle().icon());
if (proposal.getIcon() != null && proposal.getIcon().getSVGImage() != null) {
icon.appendChild((Node) proposal.getIcon().getSVGImage().getElement());
} else if (proposal.getIcon() != null && proposal.getIcon().getImage() != null) {
icon.appendChild((Node) proposal.getIcon().getImage().getElement());
}
element.appendChild(icon);
final SpanElement label = Elements.createSpanElement(popupResources.popupStyle().label());
label.setInnerHTML(proposal.getDisplayString());
element.appendChild(label);
final EventListener validateListener =
new EventListener() {
@Override
public void handleEvent(final Event evt) {
proposal.getCompletion(
new CompletionProposal.CompletionCallback() {
@Override
public void onCompletion(final Completion completion) {
HandlesUndoRedo undoRedo = null;
if (textEditor instanceof UndoableEditor) {
UndoableEditor undoableEditor =
(UndoableEditor) QuickAssistWidget.this.textEditor;
undoRedo = undoableEditor.getUndoRedo();
}
try {
if (undoRedo != null) {
undoRedo.beginCompoundChange();
}
completion.apply(textEditor.getDocument());
final LinearRange selection =
completion.getSelection(textEditor.getDocument());
if (selection != null) {
textEditor.getDocument().setSelectedRange(selection, true);
}
} catch (final Exception e) {
Log.error(getClass(), e);
} finally {
if (undoRedo != null) {
undoRedo.endCompoundChange();
}
}
}
});
hide();
}
};
element.addEventListener(Event.DBLCLICK, validateListener, false);
element.addEventListener(CUSTOM_EVT_TYPE_VALIDATE, validateListener, false);
return element;
}
开发者ID:eclipse,项目名称:che,代码行数:58,代码来源:QuickAssistWidget.java
示例8: createCloseElement
import elemental.dom.Node; //导入依赖的package包/类
private SpanElement createCloseElement(final ProcessTreeNode node) {
SpanElement closeButton =
Elements.createSpanElement(resources.getCss().processesPanelCloseButtonForProcess());
ensureDebugId(closeButton, "close-terminal-node-button");
SVGImage icon = new SVGImage(partResources.closeIcon());
closeButton.appendChild((Node) icon.getElement());
Tooltip.create(closeButton, BOTTOM, MIDDLE, locale.viewCloseProcessOutputTooltip());
closeButton.addEventListener(
Event.CLICK,
event -> {
if (stopProcessHandler != null) {
stopProcessHandler.onCloseProcessOutputClick(node);
}
},
true);
return closeButton;
}
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:TerminalNodeRenderStrategy.java
示例9: createCloseElement
import elemental.dom.Node; //导入依赖的package包/类
private SpanElement createCloseElement(final ProcessTreeNode node) {
SpanElement closeButton =
Elements.createSpanElement(resources.getCss().processesPanelCloseButtonForProcess());
ensureDebugId(closeButton, "close-command-node-button");
SVGImage icon = new SVGImage(partResources.closeIcon());
closeButton.appendChild((Node) icon.getElement());
Tooltip.create(closeButton, BOTTOM, MIDDLE, locale.viewCloseProcessOutputTooltip());
closeButton.addEventListener(
Event.CLICK,
event -> {
if (stopProcessHandler != null) {
stopProcessHandler.onCloseProcessOutputClick(node);
}
},
true);
return closeButton;
}
开发者ID:eclipse,项目名称:che,代码行数:22,代码来源:CommandNodeRenderStrategy.java
示例10: createRenderHintFunc
import elemental.dom.Node; //导入依赖的package包/类
private CMRenderFunctionOverlay createRenderHintFunc(final CompletionProposal proposal,
final AdditionalInfoCallback additionalInfoCallback) {
return CMRenderFunctionOverlay.create(new RenderFunction() {
@Override
public void renderHint(final Element element, final CMHintResultsOverlay data,
final JavaScriptObject completion) {
final SpanElement icon = Elements.createSpanElement(completionCss.proposalIcon());
final SpanElement label = Elements.createSpanElement(completionCss.proposalLabel());
final SpanElement group = Elements.createSpanElement(completionCss.proposalGroup());
if (proposal.getIcon() != null && proposal.getIcon().getSVGImage() != null){
icon.appendChild((Node)proposal.getIcon().getSVGImage().getElement());
} else if (proposal.getIcon() != null && proposal.getIcon().getImage() != null) {
icon.appendChild((Node)proposal.getIcon().getImage().getElement());
}
label.setInnerHTML(proposal.getDisplayString());
element.appendChild(icon);
element.appendChild(label);
element.appendChild(group);
}
});
}
开发者ID:codenvy-legacy,项目名称:plugin-editor-codemirror,代码行数:24,代码来源:ShowCompletion.java
示例11: setVirtualShadowRootTemplate
import elemental.dom.Node; //导入依赖的package包/类
private Element setVirtualShadowRootTemplate(Element element, Element template, ShadowDomControllerBuilder controller) {
if (template != null) {
Node clone = JsSupport.doc().importNode((Node)JsSupport.getNode(template, "content"), true);
// append the document fragment from the template, filling our dom with "fake shadow root"
element.setAttribute(DISABLE_SHADOW_SPLICING, "true");
element.setInnerHTML("");
element.removeAttribute(DISABLE_SHADOW_SPLICING);
element.appendChild(clone);
}
return element;
}
开发者ID:WeTheInternet,项目名称:xapi,代码行数:12,代码来源:WebComponentBuilder.java
示例12: compareApplyRemove
import elemental.dom.Node; //导入依赖的package包/类
private static <T, V> void compareApplyRemove(Node element, T name, V value, What what) {
// Fluent.console.log("removing " + name + " with " + value);
switch (what) {
case Attributes:
switch ((Att) name) {
case checked:
((InputElement) element).setChecked(false);
break;
case value:
((InputElement) element).setValue(null);
break;
case selectedIndex:
// nothing to do
// ((SelectElement) element).);
break;
default:
((Element) element).removeAttribute(((Att) name).nameValid());
break;
}
break;
case Styles:
((Element) element).getStyle().removeProperty(((Css) name).nameValid());
break;
case Listeners:
element.removeEventListener((String) name, (EventListener) value);
break;
default:
throw new IllegalArgumentException("Not possible");
}
}
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:31,代码来源:Renderer.java
示例13: compareApplySet
import elemental.dom.Node; //导入依赖的package包/类
private static <T, V> void compareApplySet(Node element, T name, V value, What what) {
// Fluent.console.log("setting " + name + " with " + value);
switch (what) {
case Attributes:
switch ((Att) name) {
case checked:
((InputElement) element).setChecked(true);
break;
case value:
((InputElement) element).setValue((String) value);
break;
case selectedIndex:
((SelectElement) element).setSelectedIndex(Integer.parseInt((String) value));
default:
((Element) element).setAttribute(((Att) name).nameValid(), (String) value);
break;
}
break;
case Styles:
((Element) element).getStyle().setProperty(((Css) name).nameValid(), (String) value);
break;
case Listeners:
element.addEventListener((String) name, (EventListener) value);
break;
default:
throw new IllegalArgumentException("Not possible");
}
}
开发者ID:nielsbaloe,项目名称:vertxui,代码行数:29,代码来源:Renderer.java
示例14: handleEvent
import elemental.dom.Node; //导入依赖的package包/类
@Override
public void handleEvent(Event evt) {
for (Element clickTarget : clickTargets) {
if (clickTarget.contains((Node) evt.getTarget())) {
return;
}
}
forceHide();
if (stopOutsideClick) {
evt.stopPropagation();
}
}
开发者ID:eclipse,项目名称:che,代码行数:13,代码来源:AutoHideComponent.java
示例15: getNextSiblingElement
import elemental.dom.Node; //导入依赖的package包/类
public static JsElement getNextSiblingElement(Element element) {
Node sib = element.getNextSibling();
while ((sib != null) && sib.getNodeType() != Node.ELEMENT_NODE) {
sib = sib.getNextSibling();
}
return ((JsElement) sib);
}
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:DomUtils.java
示例16: getParentElement
import elemental.dom.Node; //导入依赖的package包/类
public static elemental.js.dom.JsElement getParentElement(Element element) {
Node parent = element.getParentNode();
if ((parent == null) || parent.getNodeType() != Node.ELEMENT_NODE) {
parent = null;
}
return (JsElement) parent;
}
开发者ID:eclipse,项目名称:che,代码行数:8,代码来源:DomUtils.java
示例17: render
import elemental.dom.Node; //导入依赖的package包/类
private void render(String title, Map<String, Action> actions) {
this.title.setInnerText(title);
container.removeAllChildren();
Element listElement = Elements.createElement("ul", new String[] {style.list()});
for (Map.Entry<String, Action> pair : actions.entrySet()) {
LIElement liElement = Elements.createLiElement();
liElement.appendChild(renderAction(pair.getKey(), pair.getValue()));
listElement.appendChild(liElement);
}
container.appendChild((com.google.gwt.dom.client.Node) listElement);
}
开发者ID:eclipse,项目名称:che,代码行数:14,代码来源:EmptyEditorsPanel.java
示例18: render
import elemental.dom.Node; //导入依赖的package包/类
@Override
public void render(Element itemElement, Action itemData) {
TableCellElement icon = Elements.createTDElement(css.proposalIcon());
TableCellElement label = Elements.createTDElement(css.proposalLabel());
TableCellElement group = Elements.createTDElement(css.proposalGroup());
Presentation presentation = presentationFactory.getPresentation(itemData);
itemData.update(new ActionEvent(presentation, actionManager));
if (presentation.getImageElement() != null) {
ElementWidget image = new ElementWidget(presentation.getImageElement());
image.getElement().setAttribute("class", toolbarResources.toolbar().iconButtonIcon());
image.getElement().getStyle().setMargin(0, Style.Unit.PX);
icon.appendChild((Node) image.getElement());
} else if (presentation.getHTMLResource() != null) {
icon.setInnerHTML(presentation.getHTMLResource());
}
String hotKey =
KeyMapUtil.getShortcutText(
keyBindingAgent.getKeyBinding(actionManager.getId(itemData)));
if (hotKey == null) {
hotKey = " ";
} else {
hotKey = "<nobr> [" + hotKey + "] </nobr>";
}
label.setInnerHTML(presentation.getText() + hotKey);
if (!presentation.isEnabled() || !presentation.isVisible()) {
itemElement.getStyle().setProperty("opacity", "0.6");
}
String groupName = actions.get(itemData);
if (groupName != null) {
group.setInnerHTML(groupName);
}
itemElement.appendChild(icon);
itemElement.appendChild(label);
itemElement.appendChild(group);
}
开发者ID:eclipse,项目名称:che,代码行数:40,代码来源:FindActionViewImpl.java
示例19: handleEvent
import elemental.dom.Node; //导入依赖的package包/类
@Override
public void handleEvent(Event evt) {
if (((Element) popup.getElement()).contains((Node) evt.getTarget())) {
if (((Element) selectorLeft.getElement()).contains((Node) evt.getTarget())) {
delegate.onSelectorLeftClicked();
} else if (((Element) selectorLeftBottom.getElement())
.contains((Node) evt.getTarget())) {
delegate.onSelectorLeftBottomClicked();
} else if (((Element) selectorFullEditor.getElement())
.contains((Node) evt.getTarget())) {
delegate.onSelectorFullEditorClicked();
} else if (((Element) selectorBottom.getElement()).contains((Node) evt.getTarget())) {
delegate.onSelectorBottomClicked();
} else if (((Element) selectorRight.getElement()).contains((Node) evt.getTarget())) {
delegate.onSelectorRightClicked();
} else if (((Element) selectorLeftRightBottom.getElement())
.contains((Node) evt.getTarget())) {
delegate.onSelectorLeftRightBottomClicked();
} else {
return;
}
hidePopup();
return;
}
if (((Element) button.getElement()).contains((Node) evt.getTarget())) {
return;
}
hidePopup();
}
开发者ID:eclipse,项目名称:che,代码行数:34,代码来源:PanelSelectorViewImpl.java
示例20: createTerminalElement
import elemental.dom.Node; //导入依赖的package包/类
private SpanElement createTerminalElement(ProcessTreeNode node) {
SpanElement root = Elements.createSpanElement();
ensureDebugId(root, "terminal-root-element");
root.appendChild(createCloseElement(node));
SVGResource icon = node.getTitleIcon();
if (icon != null) {
SpanElement iconElement = Elements.createSpanElement(resources.getCss().processIcon());
ensureDebugId(iconElement, "terminal-icon-element");
root.appendChild(iconElement);
DivElement divElement = Elements.createDivElement(resources.getCss().processIconPanel());
iconElement.appendChild(divElement);
divElement.appendChild((Node) new SVGImage(icon).getElement());
}
Element nameElement = Elements.createSpanElement();
nameElement.setTextContent(node.getName());
ensureDebugId(nameElement, "terminal-name-element");
Tooltip.create(nameElement, BOTTOM, MIDDLE, node.getName());
root.appendChild(nameElement);
Element spanElement = Elements.createSpanElement();
spanElement.setInnerHTML(" ");
root.appendChild(spanElement);
return root;
}
开发者ID:eclipse,项目名称:che,代码行数:33,代码来源:TerminalNodeRenderStrategy.java
注:本文中的elemental.dom.Node类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论