/** * 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); }
/** * 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); }
/** * 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); }
/** * 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)); }
/** * 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); }
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; }
/** * 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; }
/** * 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; } }
/** * 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); }
Element elem = widget.getElement(); String attr = "__gwtCellBasedWidgetImplDispatchingFocus"; if (!"true".equals(elem.getAttribute(attr))) { elem.setAttribute(attr, "true"); sinkFocusEvents(elem);
String uiId = root.getAttribute(attribute); String renderedId = buildInnerId(fieldName, uiId);
String uiId = root.getAttribute(RENDERED_ATTRIBUTE);
/** * 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); }
while ((cellTarget != null) && ((idxString = cellTarget.getAttribute("__idx")).length() == 0)) { cellTarget = cellTarget.getParentElement();
/** * 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); }
/** * 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); }
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); } }
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; }
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); }
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; }