本文整理了Java中com.google.gwt.dom.client.Element.getAttribute()
方法的一些代码示例,展示了Element.getAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getAttribute()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称: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
/**
* Requests the string value of the state with the specified namespace.
*
* @param elem the element which has the specified state
* @param stateName the name of the state
* @return the value of the state, or an empty string if none exists
*/
public static String getState(Element elem, String stateName) {
return elem.getAttribute(stateName);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the HTML attribute value for the attribute with name {@code name} for element
* {@code element}
*
* @param element HTML element
* @return The attribute value for {@code element}
*/
public String get(Element element) {
assert element != null : "Element cannot be null.";
return element.getAttribute(name);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Requests the string value of the role with the specified namespace.
*
* @param elem the element which has the specified role
* @return the value of the role, or an empty string if none exists
*/
public static String getRole(Element elem) {
return elem.getAttribute(ATTR_NAME_ROLE);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Check if the specified element handles the a non-bubbling event.
*
* @param elem the element to check
* @param typeName the non-bubbling event
* @return true if the event is handled, false if not
*/
private static boolean isNonBubblingEventHandled(Element elem, String typeName) {
return "true".equals(elem.getAttribute("__gwtCellBasedWidgetImplDispatching" + typeName));
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Gets the named attribute from the element.
*
* @param elem the element whose property is to be retrieved
* @param attr the name of the attribute
* @return the value of the attribute
* @deprecated Use {@link Element#getAttribute(String)} instead.
*/
@Deprecated
public static String getElementAttribute(Element elem, String attr) {
return elem.getAttribute(attr);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private String getElementAttribute(Element elem, String attribute) {
if (elem == null) {
return null;
}
String value = elem.getAttribute(attribute);
return (value == null) || (value.length() == 0) ? null : value;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Check if an element is the parent of a rendered cell.
*
* @param elem the element to check
* @return the cellId if a cell parent, null if not
*/
private String getCellId(Element elem) {
if (elem == null) {
return null;
}
String cellId = elem.getAttribute(CELL_ATTRIBUTE);
return (cellId == null) || (cellId.length() == 0) ? null : cellId;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Returns the WAI-ARIA role for the {@code element}. If no 'role' attribute is set to the
* {@code element} or if the set role tokens do not include a WAI-ARIA role,
* null is returned. Otherwise, if a WAI_ARIA role is among the role tokens in the 'role'
* attribute token list, a {@link Role} corresponding the WAI-ARIA role is returned.
*/
public static Role roleOf(Element element) {
assert element != null : "Element cannot be null.";
String roleAttributeValue = element.getAttribute("role");
for (String testRoleName : roleAttributeValue.split("\\s+")) {
Role role = ROLES_MAP.get(testRoleName);
if (role != null) {
return role;
}
}
return null;
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience methods to get an attribute on a cell.
*
* @param row cell's row
* @param column cell's column
* @param attr attribute to get
* @return the attribute's value
* @throws IndexOutOfBoundsException
*/
protected String getAttr(int row, int column, String attr) {
Element elem = getElement(row, column);
return elem.getAttribute(attr);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
Element elem = widget.getElement();
String attr = "__gwtCellBasedWidgetImplDispatchingFocus";
if (!"true".equals(elem.getAttribute(attr))) {
elem.setAttribute(attr, "true");
sinkFocusEvents(elem);
代码示例来源:origin: com.google.gwt/gwt-servlet
String uiId = root.getAttribute(attribute);
String renderedId = buildInnerId(fieldName, uiId);
代码示例来源:origin: com.google.gwt/gwt-servlet
String uiId = root.getAttribute(RENDERED_ATTRIBUTE);
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Requests the string value of the role with the specified namespace.
*
* @param elem the element which has the specified role
* @return the value of the role, or an empty string if none exists
*/
public static String getRole(Element elem) {
return elem.getAttribute(ATTR_NAME_ROLE);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
while ((cellTarget != null) && ((idxString = cellTarget.getAttribute("__idx")).length() == 0)) {
cellTarget = cellTarget.getParentElement();
代码示例来源:origin: net.wetheinter/gwt-user
/**
* Gets the named attribute from the element.
*
* @param elem the element whose property is to be retrieved
* @param attr the name of the attribute
* @return the value of the attribute
* @deprecated Use {@link Element#getAttribute(String)} instead.
*/
@Deprecated
public static String getElementAttribute(Element elem, String attr) {
return elem.getAttribute(attr);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
/**
* Gets the named attribute from the element.
*
* @param elem the element whose property is to be retrieved
* @param attr the name of the attribute
* @return the value of the attribute
* @deprecated Use {@link Element#getAttribute(String)} instead.
*/
@Deprecated
public static String getElementAttribute(Element elem, String attr) {
return elem.getAttribute(attr);
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private void handleCellStyle(Grid wrapped, Element element, int columnIndex) {
String styleName = element.getAttribute(STYLE_ATTR);
if (styleName.length() > 0) {
wrapped.getCellFormatter().setStyleName(currentRowIndex, columnIndex, styleName);
}
}
代码示例来源:origin: com.sksamuel.jqm4gwt/jqm4gwt-library
private Element getToolBar(String role) {
Element element = getElement().getFirstChildElement();
while (element != null) {
if (role.equals(element.getAttribute("data-role"))) {
return element;
}
element = element.getNextSiblingElement();
}
return null;
}
代码示例来源:origin: com.googlecode.gwt-test-utils/gwt-test-utils
private void handleRow(Grid wrapped, Element element) {
// 1. insert
wrapped.insertRow(currentRowIndex);
// 2. handle row style
String styleName = element.getAttribute(STYLE_ATTR);
if (styleName.length() > 0) {
wrapped.getRowFormatter().setStyleName(currentRowIndex, styleName);
}
// 3. handle child cells
handleRowCells(wrapped, element);
}
代码示例来源:origin: net.sf.gwt-widget/gwt-sl
private Message decodeMessage(Element e) {
Message message = new Message();
String content = e.getInnerText();
String[] parts = content.split(",");
message.setContent(URL.decodeQueryString(parts[0]));
for (int i = 1; i < parts.length; i++) {
String[] keyValuePair = parts[i].split("=");
message.getAttributes().put(URL.decodeQueryString(keyValuePair[0]), URL.decodeQueryString(keyValuePair[1]));
}
message.setSerialNumber(Integer.parseInt(e.getAttribute("id")));
return message;
}
内容来源于网络,如有侵权,请联系作者删除!