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

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

Introduction

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

Prototype

@Override
    public void setInnerHTML(String html) 

Source Link

Usage

From source file:com.google.gerrit.client.Themer.java

License:Apache License

protected void setCssText(StyleElement el, String css) {
    el.setInnerHTML(css);
}

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

License:Open Source License

private void addThemesStyle(String customStyle, String urlStyle, boolean removeBodyStyle) {
    if (getWindow() != null && getWindow().getDocument() != null) {
        Document document = getWindow().getDocument();

        if (customStyle == null)
            customStyle = "";

        customStyle += "\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars::-webkit-scrollbar,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars ::-webkit-scrollbar {\n"
                + "   background: #FFF;\n" + "}\n" + "\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars::-webkit-scrollbar-thumb,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars ::-webkit-scrollbar-thumb {\n"
                + "   -webkit-border-radius: 10px;\n" + "   background: " + ThemeColors.darkGreyBackground
                + ";\n" + "}\n" + "\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars::-webkit-scrollbar-track,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars ::-webkit-scrollbar-track,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars::-webkit-scrollbar-corner,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars ::-webkit-scrollbar-corner {\n"
                + "   background: " + ThemeColors.darkGreyMostInactiveBackground + ";\n" + "}\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars::-webkit-scrollbar-thumb,\n"
                + ".rstudio-themes-flat.rstudio-themes-dark.rstudio-themes-scrollbars ::-webkit-scrollbar-thumb{\n"
                + "   border: solid 3px " + ThemeColors.darkGreyMostInactiveBackground + ";" + "}\n";

        StyleElement style = document.createStyleElement();
        style.setInnerHTML(customStyle);
        document.getHead().appendChild(style);

        if (urlStyle != null) {
            LinkElement styleLink = document.createLinkElement();
            styleLink.setHref(urlStyle);
            styleLink.setRel("stylesheet");
            document.getHead().appendChild(styleLink);
        }//from   w w w .j  a  v a 2  s. c  o  m

        RStudioGinjector.INSTANCE.getAceThemes().applyTheme(document);

        BodyElement body = document.getBody();
        if (body != null) {
            if (removeBodyStyle)
                body.removeAttribute("style");

            RStudioThemes.initializeThemes(RStudioGinjector.INSTANCE.getUIPrefs(), document,
                    document.getBody());

            body.addClassName("ace_editor_theme");
        }
    }
}