/** * Assigns the specified element the specified role and value for that role. * * @param elem the element to be given the specified role * @param roleName the name of the role */ public static void setRole(Element elem, String roleName) { elem.setAttribute(ATTR_NAME_ROLE, roleName); }
@Override public void set(Element element) { assert element != null : "Element cannot be null."; element.setAttribute(ATTR_NAME_ROLE, roleName); }
/** * Assigns the specified element the specified state and value for that state. * * @param elem the element to be given the specified state * @param stateName the name of the state * @param stateValue the value of the state */ public static void setState(Element elem, String stateName, String stateValue) { elem.setAttribute(stateName, stateValue); }
@Override public void onDetach() { panel.container.setAttribute("onresize", null); }
/** * Sets an attribute on a given element. * * @param elem element whose attribute is to be set * @param attr the name of the attribute * @param value the value to which the attribute should be set * @deprecated Use {@link Element#setAttribute(String, String)} instead. */ @Deprecated public static void setElementAttribute(Element elem, String attr, String value) { elem.setAttribute(attr, value); }
/** * Sets the state/property value to the defaultValue if not null. If a list of default values is * set, every default value is converted to string and the string values are concatenated in a * string token list. There is an assertion checking whether the default is null. Note that the * asserts are enabled during development and testing but they will be stripped in production * mode. * * @param element HTML element */ public void setDefault(Element element) { assert element != null : "Element cannot be null."; assert defaultValue != null && !defaultValue.isEmpty() : "Default value cannot be null."; element.setAttribute(name, defaultValue); }
/** * Sets the state/property {@code value} for the HTML element {@code element}. * * @param element HTML element * @param values Attribute value */ public void set(Element element, T... values) { assert element != null : "Element cannot be null."; assert values.length > 0; element.setAttribute(name, getAriaValue(values)); }
/** * Convenience methods to set an attribute on a cell. * * @param row cell's row * @param column cell's column * @param attrName attribute to set * @param value value to set * @throws IndexOutOfBoundsException */ protected void setAttr(int row, int column, String attrName, String value) { Element elem = ensureElement(row, column); elem.setAttribute(attrName, value); }
/** * Convenience methods to set an attribute on a row. * * @param row cell's row * @param attrName attribute to set * @param value value to set * @throws IndexOutOfBoundsException */ protected void setAttr(int row, String attrName, String value) { Element elem = ensureElement(row); elem.setAttribute(attrName, value); } }
@Override public void setTitle(String title) { Element containerElement = getContainerElement(); if (title == null || title.length() == 0) { containerElement.removeAttribute("title"); } else { containerElement.setAttribute("title", title); } }
@Override public R attribute(String name, int value) { assertCanAddAttribute().setAttribute(name, String.valueOf(value)); return getReturnBuilder(); }
@Override public R attribute(String name, String value) { assertCanAddAttribute().setAttribute(name, value); return getReturnBuilder(); }
@Override public void ensureDebugId(Element elem, String baseID, String id) { assert baseID != null; baseID = (baseID.length() > 0) ? baseID + "-" : ""; String prefix = DebugInfo.getDebugIdPrefix(); String debugId = ((prefix == null) ? "" : prefix) + baseID + id; String attribute = DebugInfo.getDebugIdAttribute(); if (DebugInfo.isDebugIdAsProperty()) { elem.setPropertyString(attribute, debugId); } else { elem.setAttribute(attribute, debugId); } } }
String attr = "__gwtCellBasedWidgetImplDispatchingFocus"; if (!"true".equals(elem.getAttribute(attr))) { elem.setAttribute(attr, "true"); sinkFocusEvents(elem);
@Override protected int sinkEvent(Widget widget, String typeName) { if (nonBubblingEvents.contains(typeName)) { // Initialize the event system. if (dispatchNonBubblingEvent == null) { initEventSystem(); } // Sink the non-bubbling event. Element elem = widget.getElement(); if (!isNonBubblingEventHandled(elem, typeName)) { elem.setAttribute("__gwtCellBasedWidgetImplDispatching" + typeName, "true"); sinkEventImpl(elem, typeName); } return -1; } else { return super.sinkEvent(widget, typeName); } }
/** * Creates an empty tree item. * * @param isRoot true if this item is the root of a tree */ TreeItem(boolean isRoot) { this.isRoot = isRoot; Element elem = DOM.clone(BASE_BARE_ELEM, true); setElement(elem); contentElem = DOM.getFirstChild(elem); contentElem.setAttribute("id", DOM.createUniqueId()); // The root item always has children. if (isRoot) { initChildren(); } }
private void init(ImageAdapter images, boolean useLeafImages) { setImages(images, useLeafImages); setElement(DOM.createDiv()); getElement().getStyle().setProperty("position", "relative"); // Fix rendering problem with relatively-positioned elements and their // children by // forcing the element that is positioned relatively to 'have layout' getElement().getStyle().setProperty("zoom", "1"); focusable = FocusPanel.impl.createFocusable(); focusable.getStyle().setProperty("fontSize", "0"); focusable.getStyle().setProperty("position", "absolute"); // Hide focus outline in Mozilla/Webkit focusable.getStyle().setProperty("outline", "0px"); // Hide focus outline in IE 6/7 focusable.setAttribute("hideFocus", "true"); DOM.setIntStyleAttribute(focusable, "zIndex", -1); DOM.appendChild(getElement(), focusable); sinkEvents(Event.ONMOUSEDOWN | Event.ONCLICK | Event.KEYEVENTS); DOM.sinkEvents(focusable, Event.FOCUSEVENTS); // The 'root' item is invisible and serves only as a container // for all top-level items. root = new TreeItem(true); root.setTree(this); setStyleName("gwt-Tree"); // Add a11y role "tree" Roles.getTreeRole().set(focusable); }
public MaterialDropDown(Element activatorElement) { this(); activatorElement.setAttribute("data-activates", getId()); this.activatorElement = activatorElement; }
@Override public void setLength(int length) { this.length = length; Element e = uiObject.getElement(); if (uiObject instanceof MaterialValueBox) { e = ((MaterialValueBox) uiObject).asValueBoxBase().getElement(); } if (e != null) { e.setAttribute("length", String.valueOf(length)); initialize(e); } }
@Override public void load() { if (getResource() != null && !getResource().isEmpty()) { // Check whether manifestElement was already attached to the head element. if (manifestElement == null) { manifestElement = Document.get().createLinkElement(); getManager().getHeadElement().appendChild(manifestElement); } manifestElement.setAttribute("rel", "manifest"); manifestElement.setAttribute("href", getResource()); } }