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

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

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

Element.getAttribute介绍

[英]Retrieves an attribute value by name. Attribute support can be inconsistent across various browsers. Consider using the accessors in Element and its specific subclasses to retrieve attributes and properties.
[中]按名称检索属性值。不同浏览器的属性支持可能不一致。考虑使用元素及其特定子类中的访问器来检索属性和属性。

代码示例

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

  1. /**
  2. * Requests the string value of the state with the specified namespace.
  3. *
  4. * @param elem the element which has the specified state
  5. * @param stateName the name of the state
  6. * @return the value of the state, or an empty string if none exists
  7. */
  8. public static String getState(Element elem, String stateName) {
  9. return elem.getAttribute(stateName);
  10. }

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

  1. /**
  2. * Gets the HTML attribute value for the attribute with name {@code name} for element
  3. * {@code element}
  4. *
  5. * @param element HTML element
  6. * @return The attribute value for {@code element}
  7. */
  8. public String get(Element element) {
  9. assert element != null : "Element cannot be null.";
  10. return element.getAttribute(name);
  11. }

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

  1. /**
  2. * Requests the string value of the role with the specified namespace.
  3. *
  4. * @param elem the element which has the specified role
  5. * @return the value of the role, or an empty string if none exists
  6. */
  7. public static String getRole(Element elem) {
  8. return elem.getAttribute(ATTR_NAME_ROLE);
  9. }

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

  1. /**
  2. * Check if the specified element handles the a non-bubbling event.
  3. *
  4. * @param elem the element to check
  5. * @param typeName the non-bubbling event
  6. * @return true if the event is handled, false if not
  7. */
  8. private static boolean isNonBubblingEventHandled(Element elem, String typeName) {
  9. return "true".equals(elem.getAttribute("__gwtCellBasedWidgetImplDispatching" + typeName));
  10. }

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

  1. /**
  2. * Gets the named attribute from the element.
  3. *
  4. * @param elem the element whose property is to be retrieved
  5. * @param attr the name of the attribute
  6. * @return the value of the attribute
  7. * @deprecated Use {@link Element#getAttribute(String)} instead.
  8. */
  9. @Deprecated
  10. public static String getElementAttribute(Element elem, String attr) {
  11. return elem.getAttribute(attr);
  12. }

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

  1. private String getElementAttribute(Element elem, String attribute) {
  2. if (elem == null) {
  3. return null;
  4. }
  5. String value = elem.getAttribute(attribute);
  6. return (value == null) || (value.length() == 0) ? null : value;
  7. }

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

  1. /**
  2. * Check if an element is the parent of a rendered cell.
  3. *
  4. * @param elem the element to check
  5. * @return the cellId if a cell parent, null if not
  6. */
  7. private String getCellId(Element elem) {
  8. if (elem == null) {
  9. return null;
  10. }
  11. String cellId = elem.getAttribute(CELL_ATTRIBUTE);
  12. return (cellId == null) || (cellId.length() == 0) ? null : cellId;
  13. }

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

  1. /**
  2. * Returns the WAI-ARIA role for the {@code element}. If no 'role' attribute is set to the
  3. * {@code element} or if the set role tokens do not include a WAI-ARIA role,
  4. * null is returned. Otherwise, if a WAI_ARIA role is among the role tokens in the 'role'
  5. * attribute token list, a {@link Role} corresponding the WAI-ARIA role is returned.
  6. */
  7. public static Role roleOf(Element element) {
  8. assert element != null : "Element cannot be null.";
  9. String roleAttributeValue = element.getAttribute("role");
  10. for (String testRoleName : roleAttributeValue.split("\\s+")) {
  11. Role role = ROLES_MAP.get(testRoleName);
  12. if (role != null) {
  13. return role;
  14. }
  15. }
  16. return null;
  17. }
  18. }

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

  1. /**
  2. * Convenience methods to get an attribute on a cell.
  3. *
  4. * @param row cell's row
  5. * @param column cell's column
  6. * @param attr attribute to get
  7. * @return the attribute's value
  8. * @throws IndexOutOfBoundsException
  9. */
  10. protected String getAttr(int row, int column, String attr) {
  11. Element elem = getElement(row, column);
  12. return elem.getAttribute(attr);
  13. }

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

  1. Element elem = widget.getElement();
  2. String attr = "__gwtCellBasedWidgetImplDispatchingFocus";
  3. if (!"true".equals(elem.getAttribute(attr))) {
  4. elem.setAttribute(attr, "true");
  5. sinkFocusEvents(elem);

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

  1. String uiId = root.getAttribute(attribute);
  2. String renderedId = buildInnerId(fieldName, uiId);

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

  1. String uiId = root.getAttribute(RENDERED_ATTRIBUTE);

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Requests the string value of the role with the specified namespace.
  3. *
  4. * @param elem the element which has the specified role
  5. * @return the value of the role, or an empty string if none exists
  6. */
  7. public static String getRole(Element elem) {
  8. return elem.getAttribute(ATTR_NAME_ROLE);
  9. }

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

  1. while ((cellTarget != null) && ((idxString = cellTarget.getAttribute("__idx")).length() == 0)) {
  2. cellTarget = cellTarget.getParentElement();

代码示例来源:origin: net.wetheinter/gwt-user

  1. /**
  2. * Gets the named attribute from the element.
  3. *
  4. * @param elem the element whose property is to be retrieved
  5. * @param attr the name of the attribute
  6. * @return the value of the attribute
  7. * @deprecated Use {@link Element#getAttribute(String)} instead.
  8. */
  9. @Deprecated
  10. public static String getElementAttribute(Element elem, String attr) {
  11. return elem.getAttribute(attr);
  12. }

代码示例来源:origin: com.vaadin.external.gwt/gwt-user

  1. /**
  2. * Gets the named attribute from the element.
  3. *
  4. * @param elem the element whose property is to be retrieved
  5. * @param attr the name of the attribute
  6. * @return the value of the attribute
  7. * @deprecated Use {@link Element#getAttribute(String)} instead.
  8. */
  9. @Deprecated
  10. public static String getElementAttribute(Element elem, String attr) {
  11. return elem.getAttribute(attr);
  12. }

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

  1. private void handleCellStyle(Grid wrapped, Element element, int columnIndex) {
  2. String styleName = element.getAttribute(STYLE_ATTR);
  3. if (styleName.length() > 0) {
  4. wrapped.getCellFormatter().setStyleName(currentRowIndex, columnIndex, styleName);
  5. }
  6. }

代码示例来源:origin: com.sksamuel.jqm4gwt/jqm4gwt-library

  1. private Element getToolBar(String role) {
  2. Element element = getElement().getFirstChildElement();
  3. while (element != null) {
  4. if (role.equals(element.getAttribute("data-role"))) {
  5. return element;
  6. }
  7. element = element.getNextSiblingElement();
  8. }
  9. return null;
  10. }

代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils

  1. private void handleRow(Grid wrapped, Element element) {
  2. // 1. insert
  3. wrapped.insertRow(currentRowIndex);
  4. // 2. handle row style
  5. String styleName = element.getAttribute(STYLE_ATTR);
  6. if (styleName.length() > 0) {
  7. wrapped.getRowFormatter().setStyleName(currentRowIndex, styleName);
  8. }
  9. // 3. handle child cells
  10. handleRowCells(wrapped, element);
  11. }

代码示例来源:origin: net.sf.gwt-widget/gwt-sl

  1. private Message decodeMessage(Element e) {
  2. Message message = new Message();
  3. String content = e.getInnerText();
  4. String[] parts = content.split(",");
  5. message.setContent(URL.decodeQueryString(parts[0]));
  6. for (int i = 1; i < parts.length; i++) {
  7. String[] keyValuePair = parts[i].split("=");
  8. message.getAttributes().put(URL.decodeQueryString(keyValuePair[0]), URL.decodeQueryString(keyValuePair[1]));
  9. }
  10. message.setSerialNumber(Integer.parseInt(e.getAttribute("id")));
  11. return message;
  12. }

相关文章

Element类方法