本文整理匯總了Java中com.google.gwt.dom.client.Node.getNodeType方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getNodeType方法的具體用法?Java Node.getNodeType怎麽用?Java Node.getNodeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.dom.client.Node
的用法示例。
在下文中一共展示了Node.getNodeType方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleDOMMutation
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/**
* Handles DOM mutation events.
* @param event
* @param contentRange last known selection
*/
public void handleDOMMutation(SignalEvent event, ContentRange contentRange) {
// Early exit if non-safari or non-mac
if (!(UserAgent.isSafari() && UserAgent.isMac())) {
return;
}
// We don't care about DOMMutations that we generate while we are reverting.
if (isReverting) {
return;
}
previousContentRange = contentRange;
Node n = event.getTarget();
if (n.getNodeType() == Node.ELEMENT_NODE) {
Element e = Element.as(event.getTarget());
if (DOM_EVENTS_IGNORE.contains(event.getType())) {
// ignore
} else if (event.getType().equals(JsEvents.DOM_NODE_INSERTED) && handleDOMNodeInserted(e)) {
} else if (event.getType().equals(JsEvents.DOM_NODE_REMOVED) && handleDOMNodeRemoved(e)) {
}
}
}
示例2: collectAllChildrenStyles
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
private List<Style> collectAllChildrenStyles(NodeList<Node> childNodes) {
List<Style> allStyles = Lists.newArrayList();
for (int x = 0; x < childNodes.getLength(); ++x) {
Node item = childNodes.getItem(x);
if (item.getNodeType() == Node.ELEMENT_NODE) {
Style styles = cssHelper.getComputedStyle(item);
allStyles.add(styles);
allStyles.addAll(collectAllChildrenStyles(((com.google.gwt.dom.client.Element) item).getChildNodes()));
}
}
return allStyles;
}
示例3: isElement
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/**
* @return true if it is an element
*/
public static boolean isElement(Node n) {
return n.getNodeType() == Node.ELEMENT_NODE;
}
示例4: isTextNode
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/**
* @return true if it is a text node
*/
public static boolean isTextNode(Node n) {
return n.getNodeType() == Node.TEXT_NODE;
}
示例5: asElement
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public Element asElement(Node node) {
return node.getNodeType() == Node.ELEMENT_NODE ? node.<Element>cast() : null;
}
示例6: getNodeType
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
public short getNodeType(Node node) {
return node.getNodeType();
}
示例7: isUnreadable
import com.google.gwt.dom.client.Node; //導入方法依賴的package包/類
/**
* Checks whether the properties of given node cannot be accessed (by testing the nodeType).
*
* It is sometimes the case where we need to access properties of a Node, but the properties
* on that node are not readable (for example, a shadow node like a div created to hold the
* selection within an input field).
*
* In these cases, when the javascript cannot access the node's properties, any attempt to do
* so may cause an internal permissions exception. This method swallows the exception and uses
* its existence to indicate whether or not the node is actually readable.
*
* @param n Node to check
* @return Whether or not the node can have properties read.
*/
public static boolean isUnreadable(Node n) {
try {
n.getNodeType();
return false;
} catch (RuntimeException e) {
return true;
}
}