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

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

Introduction

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

Prototype

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

Source Link

Usage

From source file:org.rstudio.core.client.widget.FontSizer.java

License:Open Source License

public static void setNormalFontSize(Document document, double size) {
    size = size + BrowseCap.getFontSkew();

    final String STYLE_EL_ID = "__rstudio_normal_size";

    Element oldStyle = document.getElementById(STYLE_EL_ID);

    StyleElement style = document.createStyleElement();
    style.setAttribute("type", "text/css");
    style.setInnerText("." + styles.normalSize() + ", " + "." + styles.normalSize() + " td, " + "."
            + styles.normalSize() + " pre" + " {font-size:" + size + "pt !important;}");
    document.getBody().appendChild(style);

    if (oldStyle != null)
        oldStyle.removeFromParent();/* w w w .  jav a2  s .c  o  m*/

    style.setId(STYLE_EL_ID);
}

From source file:org.rstudio.studio.client.workbench.prefs.views.AceEditorPreview.java

License:Open Source License

public void setFont(String font) {
    final String STYLE_EL_ID = "__rstudio_font_family";
    Document document = getDocument();

    Element oldStyle = document.getElementById(STYLE_EL_ID);

    StyleElement style = document.createStyleElement();
    style.setAttribute("type", "text/css");
    style.setInnerText(".ace_editor, .ace_text-layer {\n" + "font-family: " + font + " !important;\n" + "}");

    document.getBody().appendChild(style);

    if (oldStyle != null)
        oldStyle.removeFromParent();/*from  w  ww .ja va2  s.  c om*/

    style.setId(STYLE_EL_ID);
}

From source file:org.rstudio.studio.client.workbench.prefs.views.AceEditorPreview.java

License:Open Source License

public void setZoomLevel(double zoomLevel) {
    zoomLevel_ = zoomLevel;//from   w  w  w .ja  v a 2 s  .  c  om
    if (!isFrameLoaded_)
        return;

    final String STYLE_EL_ID = "__rstudio_zoom_level";
    Document document = getDocument();

    Element oldStyle = document.getElementById(STYLE_EL_ID);

    StyleElement style = document.createStyleElement();
    style.setAttribute("type", "text/css");
    String zoom = Double.toString(zoomLevel);
    style.setInnerText(".ace_line {\n" + "  -webkit-transform: scale(" + zoom + ");\n" + "}");

    document.getBody().appendChild(style);

    if (oldStyle != null)
        oldStyle.removeFromParent();

    style.setId(STYLE_EL_ID);
}