com.google.gwt.dom.client.Element.getNodeName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中com.google.gwt.dom.client.Element.getNodeName()方法的一些代码示例,展示了Element.getNodeName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNodeName()方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:getNodeName

Element.getNodeName介绍

暂无

代码示例

代码示例来源:origin: com.allen-sauer.gwt.dnd/gwt-dnd

/**
 * Determine an element's node name via the <code>nodeName</code> property.
 * 
 * @param elem the element whose node name is to be determined
 * @return the element's node name
 */
public static String getNodeName(Element elem) {
 return elem.getNodeName();
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

public boolean f(Element e, int index) {
  return e.getNodeName().toLowerCase().matches("h\\d");
 }
});

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

public boolean f(Element e, int index) {
  return e.getNodeName().toLowerCase().matches("input|select|textarea|button");
 }
});

代码示例来源:origin: pl.touk.gwtaculous/gwtaculous-lib

public static boolean isFormElement(Element element) {
  String elementNodeName = element.getNodeName().toUpperCase();
  if (	"SELECT".equals(elementNodeName) ||
      "INPUT".equals(elementNodeName) || 
      "TEXTAREA".equals(elementNodeName)) {
    return true;
  }
  return false;
}

代码示例来源:origin: dennisjzh/GwtMobile-UI

public static boolean isHtmlFormControl(com.google.gwt.dom.client.Element ele) {
  if (ele == null) {
    return false;
  }
  String FromControls = "BUTTON INPUT SELECT TEXTAREA";
  String nodeName = ele.getNodeName().toUpperCase();
  String roleName = ele.getAttribute("role").toUpperCase();
  return FromControls.contains(nodeName) 
    || roleName.length() > 0 && FromControls.contains(roleName)
    || isHtmlFormControl(ele.getParentElement());
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * Check if an element is a DOM or a XML node.
 */
public static boolean isXML(Node o) {
 return o == null ? false
   : !"HTML".equals(getOwnerDocument(o).getDocumentElement().getNodeName());
}

代码示例来源:origin: com.arcbees/gwtchosen

private void addNode(Node child) {
  if (!Element.is(child)) {
    return;
  }
  Element e = Element.as(child);
  if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) {
    addGroup(OptGroupElement.as(e));
  } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) {
    addOption(OptionElement.as(e), -1, false);
  }
}

代码示例来源:origin: com.github.jdramaix/gwtchosen

private void addNode(Node child) {
  if (!Element.is(child)) {
    return;
  }
  Element e = Element.as(child);
  if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) {
    addGroup(OptGroupElement.as(e));
  } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) {
    addOption(OptionElement.as(e), -1, false);
  }
}

代码示例来源:origin: ArcBees/gwtchosen

private void addNode(Node child) {
  if (!Element.is(child)) {
    return;
  }
  Element e = Element.as(child);
  if ("OPTGROUP".equalsIgnoreCase(e.getNodeName())) {
    addGroup(OptGroupElement.as(e));
  } else if ("OPTION".equalsIgnoreCase(e.getNodeName())) {
    addOption(OptionElement.as(e), -1, false);
  }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * The scroll top offset is set to the passed value on all matched elements. This method works for
 * both visible and hidden elements.
 */
public GQuery scrollTop(int top) {
 for (Element e : elements) {
  if (e == window || e.getNodeName() == null || e == (Node) document) {
   Window.scrollTo($(e).scrollLeft(), top);
  } else {
   e.setPropertyInt("scrollTop", top);
  }
 }
 return this;
}

代码示例来源:origin: com.github.jdramaix/gwtchosen

private boolean containerMouseUp(Event e) {
  Element target = e.getEventTarget().cast();
  GQuery $e = $(target);
  if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) {
    resultsReset(e);
    return false;
  }
  return true;
}

代码示例来源:origin: com.arcbees/gwtchosen

private boolean containerMouseUp(Event e) {
  Element target = e.getEventTarget().cast();
  GQuery $e = $(target);
  if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) {
    resultsReset();
    return false;
  }
  return true;
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * The scroll left offset is set to the passed value on all matched elements. This method works
 * for both visible and hidden elements.
 */
public GQuery scrollLeft(int left) {
 for (Element e : elements) {
  if (e == window || e.getNodeName() == null || e == (Node) document) {
   Window.scrollTo(left, $(e).scrollTop());
  } else {
   e.setPropertyInt("scrollLeft", left);
  }
 }
 return this;
}

代码示例来源:origin: ArcBees/gwtchosen

private boolean containerMouseUp(Event e) {
  Element target = e.getEventTarget().cast();
  GQuery $e = $(target);
  if (!$e.isEmpty() && "ABBR".equalsIgnoreCase($e.get(0).getNodeName()) && !isDisabled) {
    resultsReset();
    return false;
  }
  return true;
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

public void setAttribute(Element e, String name, Object value) {
  String tag = e.getNodeName();
  if (NOT_AUTHORIZED_NODE.test(tag)
    && GQuery.$(e).parents("body").length() > 0) {
   //  TODO maybe it's better to simply do nothing...
   throw new RuntimeException(
     "You cannot change type of button or input element if the element is already attached to the dom");
  }
  if ("input".equals(tag.toLowerCase()) && "radio".equals(value)) {
   // some browser (IE6-9) resets value property of the input when you change the type to radio button
   InputElement ie = InputElement.as(e);
   String keepValue = ie.getValue();
   super.setAttribute(ie, "type", value);
   ie.setValue(keepValue);
  } else {
   super.setAttribute(e, name, value);
  }
 }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * Gets the scroll top offset of the first matched element. This method works for both visible and
 * hidden elements.
 */
public int scrollTop() {
 Element e = get(0);
 if (e == null) {
  return 0;
 }
 if (e == window || e.getNodeName() == null) {
  return Window.getScrollTop();
 } else if (e == (Node) document) {
  return document.getScrollTop();
 } else {
  return e.getScrollTop();
 }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

/**
 * Gets the scroll left offset of the first matched element. This method works for both visible
 * and hidden elements.
 */
public int scrollLeft() {
 Element e = get(0);
 if (e == null) {
  return 0;
 }
 if (e == window || e.getNodeName() == null) {
  return Window.getScrollLeft();
 } else if (e == (Node) document) {
  return document.getScrollLeft();
 } else {
  return e.getScrollLeft();
 }
}

代码示例来源:origin: com.allen-sauer.gwt.dnd/gwt-dnd

private void checkGWTIssue1813(Widget child, AbsolutePanel parent) {
 if (!GWT.isScript()) {
  if (child.getElement().getOffsetParent() != parent.getElement()
    && !"HTML".equals(child.getElement().getOffsetParent().getNodeName())) {
   DOMUtil.reportFatalAndThrowRuntimeException("The boundary panel for this drag controller does not appear to have"
     + " 'position: relative' CSS applied to it."
     + " This may be due to custom CSS in your application, although this"
     + " is often caused by using the result of RootPanel.get(\"some-unique-id\") as your boundary"
     + " panel, as described in GWT issue 1813"
     + " (http://code.google.com/p/google-web-toolkit/issues/detail?id=1813)."
     + " You can often remedy this problem by adding one line of code to your application:"
     + " boundaryPanel.getElement().getStyle().setProperty(\"position\", \"relative\");");
  }
 }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

protected void removeData(Element item, String name) {
 if (dataCache == null) {
  windowData = JavaScriptObject.createObject().cast();
  dataCache = JavaScriptObject.createObject().cast();
 }
 item = item == window || item.getNodeName() == null ? windowData : item;
 int id = item.hashCode();
 if (name != null) {
  if (dataCache.exists(id)) {
   dataCache.getCache(id).delete(name);
   if (dataCache.getCache(id).isEmpty()) {
    // Save memory
    removeData(item, null);
   }
  }
 } else {
  // when the element cache is empty we remove its entry to save memory (issue 132)
  dataCache.delete(id);
 }
}

代码示例来源:origin: com.googlecode.gwtquery/gwtquery

private static <T> T data(Element element, String key, T value, Class<? extends T> clz) {
 if (dataCache == null) {
  windowData = JavaScriptObject.createObject().cast();
  dataCache = JavaScriptObject.createObject().cast();
 }
 element = element == window || element.getNodeName() == null ? windowData : element;
 if (element != null && key != null) {
  int id = element.hashCode();
  if (value == null) {
   return dataCache.exists(id) ? dataCache.getCache(id).get(key, clz) : null;
  }
  if (!dataCache.exists(id)) {
   dataCache.put(id, JsCache.createObject().cast());
  }
  dataCache.getCache(id).put(key, value);
 }
 return value;
}

相关文章

微信公众号

最新文章

更多

Element类方法