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

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

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

Element.getTagName介绍

[英]Gets the element's full tag name, including the namespace-prefix if present.
[中]获取元素的完整标记名,包括命名空间前缀(如果存在)。

代码示例

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determines whether this element has the given tag name.
 * 
 * @param tagName the tag name, including namespace-prefix (if present)
 * @return <code>true</code> if the element has the given tag name
 */
public final boolean hasTagName(String tagName) {
 assert tagName != null : "tagName must not be null";
 return tagName.equalsIgnoreCase(getTagName());
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 return elem != null && 
   (elem.getTagName().equalsIgnoreCase(TAG_Q) || elem.getTagName().equalsIgnoreCase(TAG_BLOCKQUOTE));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 return elem != null && 
   (  elem.getTagName().equalsIgnoreCase(TAG_THEAD)
   || elem.getTagName().equalsIgnoreCase(TAG_TFOOT)
   || elem.getTagName().equalsIgnoreCase(TAG_TBODY) );
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 return elem != null &&
   (elem.getTagName().equalsIgnoreCase(TAG_TD) || elem.getTagName().equalsIgnoreCase(TAG_TH)); 
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 return elem != null &&
   ( elem.getTagName().equalsIgnoreCase(TAG_INS) ||
    elem.getTagName().equalsIgnoreCase(TAG_DEL) );
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 return elem != null && 
   (elem.getTagName().equalsIgnoreCase(TAG_COL) || elem.getTagName().equalsIgnoreCase(TAG_COLGROUP));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

protected LabelBase(Element element) {
 this(element, "span".equalsIgnoreCase(element.getTagName()));
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Check if an element is focusable. If an element is focusable, the cell
 * widget should not steal focus from it.
 * 
 * @param elem the element
 * @return true if the element is focusable, false if not
 */
public boolean isFocusable(Element elem) {
 return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT))
   || elem.getTabIndex() >= 0;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

@Override
public boolean isFocusable(Element elem) {
 return focusableTypes.contains(elem.getTagName().toLowerCase(Locale.ROOT))
   || getTabIndexIfSpecified(elem) >= 0;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Determine whether the given {@link Element} can be cast to this class.
 * A <code>null</code> node will cause this method to return
 * <code>false</code>.
 */
public static boolean is(Element elem) {
 
 if (elem == null) {
  return false;
 }
 
 String tag = elem.getTagName().toLowerCase(Locale.ROOT);
 
 if (tag.length() != 2) {
  return false;
 }
 
 if (tag.charAt(0) != 'h') {
  return false;
 }
 int n = Integer.parseInt(tag.substring(1, 2));
 if (n < 1 || n > 6) {
  return false;
 }
 
 return true;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Check whether or not an element is a checkbox or radio button.
 *
 * @param elem the element to check
 * @return true if a checkbox, false if not
 */
private static boolean isCheckbox(Element elem) {
 if (elem == null || !"input".equalsIgnoreCase(elem.getTagName())) {
  return false;
 }
 String inputType = InputElement.as(elem).getType().toLowerCase(Locale.ROOT);
 return "checkbox".equals(inputType) || "radio".equals(inputType);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

private LabelBase(Element element, boolean isElementInline) {
 assert (isElementInline ? "span" : "div").equalsIgnoreCase(element.getTagName());
 setElement(element);
 directionalTextHelper = new DirectionalTextHelper(getElement(),
   isElementInline);
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Get the keyboard selected element from the selected table cell.
 * 
 * @return the keyboard selected element, or null if there is none
 */
private Element getKeyboardSelectedElement(TableCellElement td) {
 if (td == null) {
  return null;
 }
 /*
  * The TD itself is a cell parent, which means its internal structure
  * (including the tabIndex that we set) could be modified by its Cell. We
  * return the TD to be safe.
  */
 if (tableBuilder.isColumn(td)) {
  return td;
 }
 /*
  * The default table builder adds a focusable div to the table cell because
  * TDs aren't focusable in all browsers. If the user defines a custom table
  * builder with a different structure, we must assume the keyboard selected
  * element is the TD itself.
  */
 Element firstChild = td.getFirstChildElement();
 if (firstChild != null && td.getChildCount() == 1
   && "div".equalsIgnoreCase(firstChild.getTagName())) {
  return firstChild;
 }
 return td;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

/**
 * Start a child element.
 * 
 * @param element the element to start
 * @param builder the builder used to builder the new element
 */
private void start(Element element, ElementBuilderBase<?> builder) {
 onStart(element.getTagName(), builder);
 // Set the root element.
 if (rootElement == null) {
  // This is the new root element.
  rootElement = element;
 } else {
  // Appending to the current element.
  getCurrentElement().appendChild(element);
 }
 // Add the element to the stack.
 currentElement = element;
}

代码示例来源:origin: com.google.gwt/gwt-servlet

public SelectAction translateSelectionEvent(CellPreviewEvent<T> event) {
  // Handle the event.
  NativeEvent nativeEvent = event.getNativeEvent();
  if (BrowserEvents.CLICK.equals(nativeEvent.getType())) {
   // Ignore if the event didn't occur in the correct column.
   if (column > -1 && column != event.getColumn()) {
    return SelectAction.IGNORE;
   }
   // Determine if we clicked on a checkbox.
   Element target = nativeEvent.getEventTarget().cast();
   if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) {
    final InputElement input = target.cast();
    if ("checkbox".equals(input.getType().toLowerCase(Locale.ROOT))) {
     // Synchronize the checkbox with the current selection state.
     input.setChecked(event.getDisplay().getSelectionModel().isSelected(
       event.getValue()));
     return SelectAction.TOGGLE;
    }
   }
   return SelectAction.IGNORE;
  }
  // For keyboard events, do the default action.
  return SelectAction.DEFAULT;
 }
}

代码示例来源:origin: com.google.gwt/gwt-servlet

if (Element.is(eventTarget)) {
 Element target = Element.as(eventTarget);
 if ("input".equals(target.getTagName().toLowerCase(Locale.ROOT))) {
  commit(context, parent, viewData, valueUpdater);

代码示例来源:origin: com.google.gwt/gwt-servlet

if (BrowserEvents.FOCUSIN.equals(type)) {
 String tagName = target.getTagName().toLowerCase(Locale.ROOT);
 if (inputTypes.contains(tagName)) {
  focusedInput = target;

代码示例来源:origin: com.google.gwt/gwt-servlet

if (TableCellElement.TAG_TD.equalsIgnoreCase(cur.getTagName()) && 
  tableBuilder.isColumn(cur.getFirstChildElement())) {
 cur = cur.getFirstChildElement();
 String tagName = cur.getTagName();
 if (TableCellElement.TAG_TD.equalsIgnoreCase(tagName)
   || TableCellElement.TAG_TH.equalsIgnoreCase(tagName)) {

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

public void setAttribute(Element e, String key, Object value) {
  if ("button".equals(e.getTagName())) {
   AttrNodeSetter.getInstance().setAttribute(e, key, value);
   return;
  }
  super.setAttribute(e, key, value);
 }
}

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

public Button create(Element e) {
 Button button = new Button();
 button.getElement().setInnerText(e.getInnerText());
 if ("button".equalsIgnoreCase(e.getTagName())) {
  copyAttributes((ButtonElement) e.cast(), (ButtonElement) button.getElement().cast());
 }
 WidgetsUtils.replaceOrAppend(e, button);
 return button;
}

相关文章

微信公众号

最新文章

更多

Element类方法