Example usage for com.google.gwt.user.client Element setPropertyString

List of usage examples for com.google.gwt.user.client Element setPropertyString

Introduction

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

Prototype

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

Source Link

Usage

From source file:com.emitrom.gwt4.touch2.demo.client.core.CSS.java

License:Open Source License

/** 
 * Adds a stylesheet to the document. /*from w  w w .j  a v a2  s.  co m*/
 *  
 * @param id the id 
 * @param url the stylesheet url 
 */
public static void addStyleSheet(String id, String url) {
    Element link = DOM.createElement("link");
    link.setPropertyString("rel", "stylesheet");
    link.setPropertyString("type", "text/css");
    link.setPropertyString("id", id);
    link.setPropertyString("href", url);
    link.setPropertyString("disabled", "");

    Element elem = getHeadElement();

    Element all = null;

    for (int i = 0; i < elem.getChildNodes().getLength(); i++) {
        Node node = elem.getChildNodes().getItem(i).cast();
        if (node instanceof Element) {
            Element child = (Element) node;
            String tag = child.getTagName();
            if (tag != null && child.getTagName().equalsIgnoreCase("link")) {
                String href = child.getAttribute("href");
                if (href.length() != 0 && href.indexOf("gxt-all.css") != -1) {
                    all = child;
                    break;
                }
            }
        }
    }

    if (all != null) {
        int idx = DOM.getChildIndex(elem, all);
        DOM.insertChild(elem, link, idx + 1);
    } else {
        DOM.appendChild(elem, link);
    }

}

From source file:com.extjs.gxt.ui.client.util.CSS.java

License:sencha.com license

/**
 * Adds a stylesheet to the document./*w  w w . j  a v  a 2  s  .c om*/
 * 
 * @param id the id
 * @param url the stylesheet url
 */
public static void addStyleSheet(String id, String url) {
    Element link = DOM.createElement("link");
    link.setPropertyString("rel", "stylesheet");
    link.setPropertyString("type", "text/css");
    link.setPropertyString("id", id);
    link.setPropertyString("href", url);
    link.setPropertyString("disabled", "");

    Element elem = XDOM.getHead();

    Element all = null;

    for (int i = 0; i < elem.getChildNodes().getLength(); i++) {
        Node node = elem.getChildNodes().getItem(i).cast();
        if (node instanceof Element) {
            Element child = (Element) node;
            String tag = child.getTagName();
            if (tag != null && child.getTagName().equalsIgnoreCase("link")) {
                String href = child.getAttribute("href");
                if (href.length() != 0 && href.indexOf("gxt-all.css") != -1) {
                    all = child;
                    break;
                }
            }
        }
    }

    if (all != null) {
        int idx = DOM.getChildIndex(elem, all);
        DOM.insertChild(elem, link, idx + 1);
    } else {
        DOM.appendChild(elem, link);
    }

}

From source file:com.qualogy.qafe.mgwt.client.ui.renderer.AbstractEditableComponentRenderer.java

License:Apache License

private void resetInlineStyle(Element element) {
    if (element == null) {
        return;//from   w w  w  .  j ava2 s . c  om
    }
    String inlineStyleInit = element.getPropertyString(QAMLConstants.INTERNAL_STYLE_INIT);
    if ((inlineStyleInit == null) || (inlineStyleInit.length() == 0)) {
        inlineStyleInit = QAMLConstants.INTERNAL_EMPTY;
        if (element.hasAttribute(QAMLConstants.INTERNAL_STYLE)) {
            inlineStyleInit = element.getAttribute(QAMLConstants.INTERNAL_STYLE);
        }
        element.setPropertyString(QAMLConstants.INTERNAL_STYLE_INIT, inlineStyleInit);
    } else {
        if (QAMLConstants.INTERNAL_EMPTY.equals(inlineStyleInit)) {
            inlineStyleInit = "";
        }
        element.setAttribute(QAMLConstants.INTERNAL_STYLE, inlineStyleInit);
    }
}

From source file:org.cruxframework.crux.widgets.client.rollingtabs.SimpleDecoratedPanel.java

License:Apache License

/**
 * Creates a TD with the given style name 
 * @param styleName//from   w w w.  j a  va 2  s. c  o m
 * @return
 */
private Element createTd(Element templateTD, String styleName) {
    Element td = templateTD.cloneNode(false).cast();
    td.setClassName(styleName);

    td.setPropertyString("align", "center");
    td.setPropertyString("valign", "middle");
    return td;
}

From source file:org.cruxframework.crux.widgets.client.rollingtabs.SimpleDecoratedPanel.java

License:Apache License

/**
 * Creates a TD with the given style name 
 * @param styleName/*from  ww w .j  a  va2  s . c  o m*/
 * @return
 */
private Element createTemplateTd() {
    Element td = DOM.createTD();
    td.setPropertyString("align", "center");
    td.setPropertyString("valign", "middle");
    return td;
}

From source file:org.geomajas.gwt.client.gfx.context.VmlGraphicsContext.java

License:Open Source License

/**
 * Draw a string of text onto the <code>GraphicsContext</code>.
 * /*from w w  w .j  av  a 2  s.  c o  m*/
 * @param parent
 *            parent group object
 * @param name
 *            The text's name.
 * @param text
 *            The actual string content.
 * @param position
 *            The upper left corner for the text to originate.
 * @param style
 *            The styling object for the text.
 */
public void drawText(Object parent, String name, String text, Coordinate position, FontStyle style) {
    if (isAttached()) {
        Element element = helper.createOrUpdateElement(parent, name, "shape", null);
        if (element != null) {
            // Set position, style and content:
            applyAbsolutePosition(element, position);
            Element textbox = helper.createOrUpdateSingleChild(element, "textbox");
            VmlStyleUtil.applyStyle(textbox, style);
            // hook to upper-left corner
            textbox.setPropertyString("inset", "0px, 0px, 0px, 0px");
            textbox.setInnerHTML(text);
            // Set width, because this may change otherwise...
            applyElementSize(element, getWidth(), getHeight(), false);
        }
    }
}

From source file:rocket.widget.client.Hidden.java

License:Apache License

protected Element createElement() {
    final Element element = DOM.createElement("input");
    element.setPropertyString("type", WidgetConstants.HIDDEN_INPUT_TYPE);
    return element;
}