Example usage for com.google.gwt.dom.client Element setAttribute

List of usage examples for com.google.gwt.dom.client Element setAttribute

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Element setAttribute.

Prototype

@Override
    public void setAttribute(String name, String value) 

Source Link

Usage

From source file:cc.alcina.framework.gwt.client.util.ClientUtils.java

License:Apache License

public static void setElementStyle(Element eltMulti, String css) {
    if (eltMulti.implAccess().linkedToRemote()) {
        setElementStyle0(eltMulti, css);
    } else {/*from ww w .  j a va  2s .  com*/
        eltMulti.setAttribute("style", css);
    }
}

From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java

License:Apache License

public static void disableTextBoxHelpers(Widget textBox) {
    Element elt = textBox.getElement();
    elt.setAttribute("autocapitalize", "off");
    elt.setAttribute("autocorrect", "off");
    elt.setAttribute("autocomplete", "off");
    elt.setAttribute("spellcheck", "false");
}

From source file:cc.alcina.framework.gwt.client.widget.dialog.RelativePopupPanel.java

License:Apache License

@Override
public void setTitle(String title) {
    Element containerElement = getContainerElement();
    if (title == null || title.length() == 0) {
        containerElement.removeAttribute("title");
    } else {/*w w w.j a va2  s.  c o m*/
        containerElement.setAttribute("title", title);
    }
}

From source file:ch.unifr.pai.twice.layout.client.mobile.MobileUtils.java

License:Apache License

/**
 * Add necessary html tags to ensure unified initial zoom levels of the web page, fullscreen establishment and add proprietary tags (e.g.
 * "apple-mobile-web-app-capable" for extended functionalities).
 * /*from  ww w  . j ava  2  s. c  o m*/
 * The main purpose is to establish a "native" look of the application even within the boundaries of the web browser.
 */
public static void preparePage() {
    RootPanel.getBodyElement().getStyle().setHeight(100, Unit.PCT);
    RootPanel.getBodyElement().getStyle().setOverflow(Overflow.HIDDEN);
    RootPanel.getBodyElement().getStyle().setMargin(0, Unit.PX);
    RootPanel.getBodyElement().getStyle().setPadding(0, Unit.PX);
    Document.get().getDocumentElement().getStyle().setProperty("minHeight", "300px");
    Document.get().getDocumentElement().getStyle().setHeight(100, Unit.PCT);
    NodeList<Element> tags = Document.get().getElementsByTagName("head");
    Element head;
    if (tags.getLength() > 0) {
        head = tags.getItem(0);
    } else {
        head = DOM.createElement("head");
        Document.get().insertFirst(head);
    }
    Element meta = DOM.createElement("meta");
    meta.setAttribute("name", "viewport");
    meta.setAttribute("content", "width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0");
    head.appendChild(meta);
    LinkElement e = Document.get().createLinkElement();
    e.setRel("stylesheet");
    e.setHref(GWT.getModuleBaseURL() + "master.css");
    head.appendChild(e);

    Element iphoneFullscreen = DOM.createElement("meta");
    iphoneFullscreen.setAttribute("name", "apple-touch-fullscreen");
    iphoneFullscreen.setAttribute("content", "yes");
    head.appendChild(iphoneFullscreen);

    Element iphoneWebAppCapable = DOM.createElement("meta");
    iphoneWebAppCapable.setAttribute("name", "apple-mobile-web-app-capable");
    iphoneWebAppCapable.setAttribute("content", "yes");
    head.appendChild(iphoneWebAppCapable);

    Scheduler.get().scheduleDeferred(new ScheduledCommand() {

        @Override
        public void execute() {
            Window.scrollTo(0, 1);
        }
    });
}

From source file:client.net.sf.saxon.ce.dom.HTMLWriter.java

License:Mozilla Public License

public static void setAttribute(Document doc, Element element, String name, String URI, String value,
        WriteMode wMode) {/*w  w w  .  j av  a2s .c  o  m*/
    // fix for IE issue with colspan etc #1570

    name = tableAttributeFix(name, wMode);

    if (attNSSupported(doc)) {
        setAttributeJs(doc, element, name, URI, value);
    } else {
        String prefix = name.substring(0, name.indexOf(":"));
        String x = "xmlns";
        String nsDeclaraction = (prefix.length() == 0) ? x : x + ":" + prefix;
        if (!element.hasAttribute(nsDeclaraction)) {
            addNamespace(element, prefix, URI);
        }
        element.setAttribute(name, value);
        setAttributeProps(element, name, value);
    }
}

From source file:client.net.sf.saxon.ce.dom.HTMLWriter.java

License:Mozilla Public License

private static void addNamespace(Element element, String prefix, String uri) {
    String attName = (prefix.isEmpty() ? "xmlns" : "xmlns:" + prefix);
    element.setAttribute(attName, uri);
}

From source file:client.net.sf.saxon.ce.dom.HTMLWriter.java

License:Mozilla Public License

public void attribute(int nameCode, CharSequence value) throws XPathException {
    String localName = namePool.getLocalName(nameCode);
    String uri = namePool.getURI(nameCode);
    String val = value.toString();
    Element element = (Element) currentNode;

    // must be HTML write mode
    if (mode != WriteMode.XML && NamespaceConstant.HTML_PROP.equals(uri)) {
        element.setPropertyString(localName, val);
    } else if (mode != WriteMode.XML && NamespaceConstant.HTML_STYLE_PROP.equals(uri)) {
        // if localName starts with '_-' then remove the underscore e.g _-webkit-transition
        if (localName.length() > 1 && localName.charAt(0) == '_' && localName.charAt(1) == '-') {
            localName = localName.substring(1);
        }/*from w  ww  . j a  v  a  2s. com*/
        localName = HTMLWriter.getCamelCaseName(localName);
        element.getStyle().setProperty(localName, val);
    } else if (uri != null && !uri.isEmpty()) {
        String fullname = namePool.getDisplayName(nameCode);
        setAttribute(document, element, fullname, uri, val, mode);
    } else {
        localName = tableAttributeFix(localName, mode);
        element.setAttribute(localName, val);
        setAttributeProps(element, localName, val);
    }
}

From source file:com.ait.toolkit.intro.client.Intro.java

License:Open Source License

/**
 * The tooltip text of step/*from  ww  w .j av a  2  s .co  m*/
 */
public Intro setIntro(Element element, String value) {
    element.setAttribute("data-intro", value);
    return this;
}

From source file:com.ait.toolkit.intro.client.Intro.java

License:Open Source License

/**
 * Optionally define a CSS class for tooltip
 *///from   ww  w .  ja  v  a2  s .c o  m
public Intro setTooltipClass(Element element, String value) {
    element.setAttribute("data-tooltipClass", value);
    return this;
}

From source file:com.ait.toolkit.intro.client.Intro.java

License:Open Source License

/**
 * Optionally define a CSS class for tooltip
 *//*from  w  w  w . jav a 2s  .c  om*/
public Intro setHighlightClass(Element element, String value) {
    element.setAttribute("data-highlightClass", value);
    return this;
}