Example usage for com.google.gwt.dom.client Style setBackgroundColor

List of usage examples for com.google.gwt.dom.client Style setBackgroundColor

Introduction

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

Prototype

public void setBackgroundColor(String value) 

Source Link

Usage

From source file:com.vaadin.client.VDebugConsole.java

License:Apache License

@Override
public void init() {
    panel = new FlowPanel();
    if (!quietMode) {
        DOM.appendChild(getContainerElement(), caption);
        setWidget(panel);// w  w w  . j a  v  a  2s  .c  o m
        caption.setClassName("v-debug-console-caption");
        setStyleName("v-debug-console");
        getElement().getStyle().setZIndex(20000);
        getElement().getStyle().setOverflow(Overflow.HIDDEN);

        sinkEvents(Event.ONDBLCLICK);

        sinkEvents(Event.MOUSEEVENTS);

        panel.setStyleName("v-debug-console-content");

        caption.setInnerHTML("Debug window");
        caption.getStyle().setHeight(25, Unit.PX);
        caption.setTitle(help);

        show();
        setToDefaultSizeAndPos();

        actions = new HorizontalPanel();
        Style style = actions.getElement().getStyle();
        style.setPosition(Position.ABSOLUTE);
        style.setBackgroundColor("#666");
        style.setLeft(135, Unit.PX);
        style.setHeight(25, Unit.PX);
        style.setTop(0, Unit.PX);

        actions.add(clear);
        actions.add(restart);
        actions.add(forceLayout);
        actions.add(analyzeLayout);
        actions.add(highlight);
        actions.add(connectorStats);
        connectorStats.setTitle("Show connector statistics for client");
        highlight.setTitle(
                "Select a component and print details about it to the server log and client side console.");
        actions.add(savePosition);
        savePosition.setTitle("Saves the position and size of debug console to a cookie");
        actions.add(autoScroll);
        addDevMode();
        addSuperDevMode();

        autoScroll.setTitle("Automatically scroll so that new messages are visible");

        panel.add(actions);

        panel.add(new HTML("<i>" + help + "</i>"));

        clear.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                int width = panel.getOffsetWidth();
                int height = panel.getOffsetHeight();
                panel = new FlowPanel();
                panel.setPixelSize(width, height);
                panel.setStyleName("v-debug-console-content");
                panel.add(actions);
                setWidget(panel);
            }
        });

        restart.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {

                String queryString = Window.Location.getQueryString();
                if (queryString != null && queryString.contains("restartApplications")) {
                    Window.Location.reload();
                } else {
                    String url = Location.getHref();
                    String separator = "?";
                    if (url.contains("?")) {
                        separator = "&";
                    }
                    if (!url.contains("restartApplication")) {
                        url += separator;
                        url += "restartApplication";
                    }
                    if (!"".equals(Location.getHash())) {
                        String hash = Location.getHash();
                        url = url.replace(hash, "") + hash;
                    }
                    Window.Location.replace(url);
                }

            }
        });

        forceLayout.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                for (ApplicationConnection applicationConnection : ApplicationConfiguration
                        .getRunningApplications()) {
                    applicationConnection.forceLayout();
                }
            }
        });

        analyzeLayout.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                List<ApplicationConnection> runningApplications = ApplicationConfiguration
                        .getRunningApplications();
                for (ApplicationConnection applicationConnection : runningApplications) {
                    applicationConnection.analyzeLayouts();
                }
            }
        });
        analyzeLayout.setTitle("Analyzes currently rendered view and "
                + "reports possible common problems in usage of relative sizes."
                + "Will cause server visit/rendering of whole screen and loss of"
                + " all non committed variables form client side.");

        savePosition.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                String pos = getAbsoluteLeft() + "," + getAbsoluteTop() + "," + getOffsetWidth() + ","
                        + getOffsetHeight() + "," + autoScroll.getValue();
                Cookies.setCookie(POS_COOKIE_NAME, pos);
            }
        });

        highlight.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                final Label label = new Label("--");
                log("<i>Use mouse to select a component or click ESC to exit highlight mode.</i>");
                panel.add(label);
                highlightModeRegistration = Event.addNativePreviewHandler(new HighlightModeHandler(label));

            }
        });

    }
    connectorStats.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            for (ApplicationConnection a : ApplicationConfiguration.getRunningApplications()) {
                dumpConnectorInfo(a);
            }
        }
    });
    log("Starting Vaadin client side engine. Widgetset: " + GWT.getModuleName());

    log("Widget set is built on version: " + Version.getFullVersion());

    logToDebugWindow("<div class=\"v-theme-version v-theme-version-"
            + Version.getFullVersion().replaceAll("\\.", "_") + "\">Warning: widgetset version "
            + Version.getFullVersion() + " does not seem to match theme version </div>", true);

}

From source file:com.vaadin.graph.client.VGraphExplorer.java

License:Apache License

/**
 * The constructor should first call super() to initialize the component and
 * then handle any initialization relevant to Vaadin.
 *//*  w ww. j ava 2 s.co m*/
public VGraphExplorer() {
    initWidget(root);
    RootPanel.getBodyElement().getStyle().setBackgroundColor("green");
    Style canvasStyle = canvas.getElement().getStyle();
    canvasStyle.setPosition(Position.ABSOLUTE);
    canvasStyle.setBackgroundColor("white");
    root.add(canvas);
    root.getElement().getStyle().setPosition(Position.ABSOLUTE);

    /*
     * This method call of the Paintable interface sets the component style
     * name in DOM tree
     */
    setStyleName(CLASSNAME);
}

From source file:com.vaadin.terminal.gwt.client.VDebugConsole.java

License:Open Source License

public void init() {
    panel = new FlowPanel();
    if (!quietMode) {
        DOM.appendChild(getContainerElement(), caption);
        setWidget(panel);//w w w  .  jav a2 s  . co m
        caption.setClassName("v-debug-console-caption");
        setStyleName("v-debug-console");
        getElement().getStyle().setZIndex(20000);
        getElement().getStyle().setOverflow(Overflow.HIDDEN);

        sinkEvents(Event.ONDBLCLICK);

        sinkEvents(Event.MOUSEEVENTS);

        panel.setStyleName("v-debug-console-content");

        caption.setInnerHTML("Debug window");
        caption.getStyle().setHeight(25, Unit.PX);
        caption.setTitle(help);

        show();
        setToDefaultSizeAndPos();

        actions = new HorizontalPanel();
        Style style = actions.getElement().getStyle();
        style.setPosition(Position.ABSOLUTE);
        style.setBackgroundColor("#666");
        style.setLeft(135, Unit.PX);
        style.setHeight(25, Unit.PX);
        style.setTop(0, Unit.PX);

        actions.add(clear);
        actions.add(restart);
        actions.add(forceLayout);
        actions.add(analyzeLayout);
        actions.add(highlight);
        highlight.setTitle(
                "Select a component and print details about it to the server log and client side console.");
        actions.add(savePosition);
        savePosition.setTitle("Saves the position and size of debug console to a cookie");
        actions.add(autoScroll);
        actions.add(hostedMode);
        if (Location.getParameter("gwt.codesvr") != null) {
            hostedMode.setValue(true);
        }
        hostedMode.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                if (hostedMode.getValue()) {
                    addHMParameter();
                } else {
                    removeHMParameter();
                }
            }

            private void addHMParameter() {
                UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                createUrlBuilder.setParameter("gwt.codesvr", "localhost:9997");
                Location.assign(createUrlBuilder.buildString());
            }

            private void removeHMParameter() {
                UrlBuilder createUrlBuilder = Location.createUrlBuilder();
                createUrlBuilder.removeParameter("gwt.codesvr");
                Location.assign(createUrlBuilder.buildString());

            }
        });

        autoScroll.setTitle("Automatically scroll so that new messages are visible");

        panel.add(actions);

        panel.add(new HTML("<i>" + help + "</i>"));

        clear.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                int width = panel.getOffsetWidth();
                int height = panel.getOffsetHeight();
                panel = new FlowPanel();
                panel.setPixelSize(width, height);
                panel.setStyleName("v-debug-console-content");
                panel.add(actions);
                setWidget(panel);
            }
        });

        restart.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {

                String queryString = Window.Location.getQueryString();
                if (queryString != null && queryString.contains("restartApplications")) {
                    Window.Location.reload();
                } else {
                    String url = Location.getHref();
                    String separator = "?";
                    if (url.contains("?")) {
                        separator = "&";
                    }
                    if (!url.contains("restartApplication")) {
                        url += separator;
                        url += "restartApplication";
                    }
                    if (!"".equals(Location.getHash())) {
                        String hash = Location.getHash();
                        url = url.replace(hash, "") + hash;
                    }
                    Window.Location.replace(url);
                }

            }
        });

        forceLayout.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                // TODO for each client in appconf force layout
                // VDebugConsole.this.client.forceLayout();
            }
        });

        analyzeLayout.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                List<ApplicationConnection> runningApplications = ApplicationConfiguration
                        .getRunningApplications();
                for (ApplicationConnection applicationConnection : runningApplications) {
                    applicationConnection.analyzeLayouts();
                }
            }
        });
        analyzeLayout.setTitle("Analyzes currently rendered view and "
                + "reports possible common problems in usage of relative sizes."
                + "Will cause server visit/rendering of whole screen and loss of"
                + " all non committed variables form client side.");

        savePosition.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String pos = getAbsoluteLeft() + "," + getAbsoluteTop() + "," + getOffsetWidth() + ","
                        + getOffsetHeight() + "," + autoScroll.getValue();
                Cookies.setCookie(POS_COOKIE_NAME, pos);
            }
        });

        highlight.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                final Label label = new Label("--");
                log("<i>Use mouse to select a component or click ESC to exit highlight mode.</i>");
                panel.add(label);
                highlightModeRegistration = Event.addNativePreviewHandler(new HighlightModeHandler(label));

            }
        });

    }
    log("Starting Vaadin client side engine. Widgetset: " + GWT.getModuleName());

    log("Widget set is built on version: " + ApplicationConfiguration.VERSION);

    logToDebugWindow("<div class=\"v-theme-version v-theme-version-"
            + ApplicationConfiguration.VERSION.replaceAll("\\.", "_") + "\">Warning: widgetset version "
            + ApplicationConfiguration.VERSION + " does not seem to match theme version </div>", true);

}

From source file:fr.mncc.gwttoolbox.ui.client.Indicator.java

License:Open Source License

public void setMessage(String msg, String bkgColor, String txtColor) {

    label_.setText(msg);// w w  w  .ja va 2  s  .  c o m

    Style labelStyle = label_.getElement().getStyle();
    labelStyle.setFontSize(1.6, Style.Unit.EM);
    labelStyle.setBackgroundColor(bkgColor);
    labelStyle.setColor(txtColor);
    labelStyle.setPadding(5, Style.Unit.PX);
}

From source file:ilarkesto.gwt.client.desktop.AObjectTableWithGroups.java

License:Open Source License

protected Widget createGroupWidget(G group) {
    if (group instanceof String) {
        Label title = Widgets.text(group);
        Style style = title.getElement().getStyle();
        style.setColor("white");
        style.setBackgroundColor(Colors.googleBlue);
        style.setPadding(Widgets.defaultSpacing, Unit.PX);
        return title;
    }//from   w w  w. j a  v a  2  s  .  c  o  m
    return Widgets.widget(group);
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Label textTitleInverted(Object object) {
    if (object == null)
        return null;
    Label label = new Label(Str.format(object));
    Style style = label.getElement().getStyle();
    style.setFontWeight(FontWeight.BOLD);
    style.setFontSize(105, Unit.PCT);/*from  www . ja v  a 2s.com*/
    style.setBackgroundColor(Colors.googleBlue);
    style.setColor("white");
    return label;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget verticalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setWidth(100, Unit.PCT);/*from w  w w  .ja  v a 2  s.  com*/
    style.setHeight(1, Unit.PX);
    style.setBackgroundColor("#eeeeee");
    style.setMarginTop(margin, Unit.PX);
    style.setMarginBottom(margin, Unit.PX);
    return spacer;
}

From source file:ilarkesto.gwt.client.desktop.Widgets.java

License:Open Source License

public static Widget horizontalLine(int margin) {
    SimplePanel spacer = new SimplePanel();
    Style style = spacer.getElement().getStyle();
    style.setFloat(Float.LEFT);/*from   w  ww  . j ava2 s .c o m*/
    style.setWidth(1, Unit.PX);
    style.setHeight(100, Unit.PCT);
    style.setBackgroundColor("#999999");
    style.setMarginLeft(margin, Unit.PX);
    style.setMarginRight(margin, Unit.PX);
    return spacer;
}

From source file:ilarkesto.gwt.client.integration.ace.AceEditor.java

License:Open Source License

@Override
public Widget asWidget() {
    if (div == null) {
        div = new SimplePanel();
        div.getElement().setId(id);//from   w w  w. ja  va 2  s .com
        Style style = div.getElement().getStyle();
        // style.setPosition(Position.ABSOLUTE);
        // style.setTop(0, Unit.PX);
        // style.setRight(0, Unit.PX);
        // style.setBottom(0, Unit.PX);
        // style.setLeft(0, Unit.PX);
        style.setWidth(800, Unit.PX);
        // style.setHeight(400, Unit.PX);
        style.setBackgroundColor("yellow");
        div.addAttachHandler(new AttachEvent.Handler() {

            @Override
            public void onAttachOrDetach(AttachEvent event) {
                if (event.isAttached()) {
                    activate();
                }
            }
        });
    }
    return div;
}

From source file:info.magnolia.ui.vaadin.gwt.client.applauncher.widget.AppTileWidget.java

License:Open Source License

/**
 * Set colors with the group coloring./*from   www.  j av a  2 s  .  com*/
 */
private void setColors(boolean isTileWhite) {
    final Style style = getElement().getStyle();
    if (isTileWhite) {
        style.setColor(getParent().getColor());
        style.setBackgroundColor("white");
    } else {
        style.setBackgroundColor(getParent().getColor());
        style.setColor("white");
    }
}