List of usage examples for com.google.gwt.dom.client Style getBackgroundColor
public String getBackgroundColor()
From source file:com.goodow.wave.client.wavepanel.blip.SetColor.java
License:Apache License
@Override public void onBrowserEvent(final Event event) { if (DOM.eventGetType(event) == Event.ONCLICK) { if (changeElm == null) { Window.alert("changeElm is null!"); return; }// w w w . j ava 2 s . c o m NodeList<Element> aTags = changeElm.getElementsByTagName("span"); Element aTag = aTags.getItem(1); Element elm = Element.as(event.getEventTarget()); Style elmStyle = elm.getStyle(); Style aTagStyle = aTag.getStyle(); if (elm.getTitle().equals("White") || elm.getTitle().equals("20% Black")) { aTagStyle.setBackgroundColor(elmStyle.getBackgroundColor()); aTagStyle.setColor("black"); aTagStyle.setBorderStyle(BorderStyle.SOLID); aTagStyle.setBorderWidth(1, Unit.PX); aTagStyle.setBorderColor("black"); aTagStyle.setTextDecoration(TextDecoration.NONE); } else { if (!aTagStyle.getBorderWidth().equals("")) { aTagStyle.clearBorderColor(); aTagStyle.clearBorderStyle(); aTagStyle.clearBorderWidth(); } aTagStyle.setTextDecoration(TextDecoration.NONE); aTagStyle.setBackgroundColor(elmStyle.getBackgroundColor()); aTagStyle.setColor("white"); } // Window.alert("title:" + elm.getTitle() + ";color:" + elm.getStyle().getBackgroundColor()); } }
From source file:org.rstudio.studio.client.application.ApplicationThemes.java
License:Open Source License
@Override public void onComputeThemeColors(ComputeThemeColorsEvent event) { // Establish defaults String foreground = "#000000"; String background = "#FFFFFF"; // We're very exception sensitive here since this code runs in a // WaitForMethod (and therefore can hold the server while we wait for it // to return). try {/*from ww w . ja v a2s . co m*/ // Create a sampler element to read runtime styles; hide it and position // it offscreen to ensure it doesn't flicker. Element sampler = Document.get().createElement("div"); sampler.addClassName("ace_editor ace_content"); sampler.getStyle().setVisibility(Visibility.HIDDEN); sampler.getStyle().setPosition(Position.ABSOLUTE); sampler.getStyle().setTop(-10000, Unit.PX); sampler.getStyle().setLeft(-10000, Unit.PX); // Append the sampler element to the root panel, read its content, and // remove it. root_.appendChild(sampler); Style style = DomUtils.getComputedStyles(sampler); foreground = style.getColor(); background = style.getBackgroundColor(); root_.removeChild(sampler); } catch (Exception e) { Debug.logException(e); } // Send the server the computed colors server_.setComputedThemeColors(foreground, background, new VoidServerRequestCallback()); }
From source file:org.rstudio.studio.client.workbench.views.source.DocumentOutlineWidget.java
License:Open Source License
private void updateStyles(Widget widget, Style computed) { Style outlineStyles = widget.getElement().getStyle(); outlineStyles.setBackgroundColor(computed.getBackgroundColor()); outlineStyles.setColor(computed.getColor()); }