List of usage examples for com.google.gwt.dom.client Style setBackgroundColor
public void setBackgroundColor(String value)
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; }//from w w w. j a v a 2 s . co 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:com.google.gwt.sample.showcase.client.content.cell.AsyncContactProvider.java
private void installLoadingIndicator() { Style style = loadingStatus.getElement().getStyle(); style.setFontSize(2, Unit.EM);/* w w w .j a va 2s .co m*/ style.setFontWeight(FontWeight.BOLD); style.setBackgroundColor("yellow"); style.setTextAlign(TextAlign.CENTER); RootLayoutPanel.get().add(loadingStatus); RootLayoutPanel.get().setWidgetTopHeight(loadingStatus, 0, Unit.PX, 3, Unit.EM); }
From source file:com.googlecode.gwtquake.client.GwtQuake.java
License:Open Source License
public void onModuleLoad() { // Initialize drivers. Document doc = Document.get(); doc.setTitle("GWT Quake II"); BodyElement body = doc.getBody();//from w ww. ja v a 2 s.co m Style style = body.getStyle(); style.setPadding(0, Unit.PX); style.setMargin(0, Unit.PX); style.setBorderWidth(0, Unit.PX); style.setProperty("height", "100%"); style.setBackgroundColor("#000"); style.setColor("#888"); // Window.alert("UA: " + userAgent+ " type: " + browserType); boolean wireframe = ("" + Window.Location.getHash()).indexOf("wireframe") != -1; canvas = (CanvasElement) doc.createElement("canvas"); video = doc.createElement("video"); w = Window.getClientWidth(); h = Window.getClientHeight(); canvas.setWidth(w); canvas.setHeight(h); style = canvas.getStyle(); style.setProperty("height", "100%"); style.setProperty("width", "100%"); style = video.getStyle(); style.setProperty("height", "100%"); style.setProperty("width", "100%"); style.setProperty("display", "none"); body.appendChild(canvas); body.appendChild(video); try { Globals.autojoin.value = Window.Location.getHash().indexOf("autojoin") != -1 ? 1.0f : 0.0f; final Renderer renderer = wireframe ? new GwtWireframeGLRenderer(canvas) : new GwtWebGLRenderer(canvas, video); Globals.re = renderer; ResourceLoader.impl = new GwtResourceLoaderImpl(); Compatibility.impl = new CompatibilityImpl(); Sound.impl = new GwtSound(); NET.socketFactory = new WebSocketFactoryImpl(); // Sys.impl = new Sys.SysImpl() { // public void exit(int status) { // Window.alert("Something's rotten in Denmark"); // Window.Location.assign("gameover.html"); // } // }; // Flags. QuakeCommon.Init(new String[] { "GQuake" }); // Enable stdout. Globals.nostdout = ConsoleVariables.Get("nostdout", "0", 0); Window.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { if (Window.getClientWidth() == w && Window.getClientHeight() == h) { return; } w = Window.getClientWidth(); h = Window.getClientHeight(); renderer.GLimp_SetMode(new Dimension(w, h), 0, false); } }); // QuakeServer.main(new String[0], new DummySNetImpl(), false); timer = new Timer() { double startTime = Duration.currentTimeMillis(); @Override public void run() { try { double curTime = Duration.currentTimeMillis(); boolean pumping = ResourceLoader.Pump(); if (pumping) { Screen.UpdateScreen2(); } else { int dt = (int) (curTime - startTime); GwtKBD.Frame(dt); QuakeCommon.Frame(dt); } startTime = curTime; timer.schedule(ResourceLoader.Pump() ? LOADING_DELAY : INTER_FRAME_DELAY); } catch (Exception e) { Compatibility.printStackTrace(e); } } }; timer.schedule(INTER_FRAME_DELAY); } catch (Exception e) { Compatibility.printStackTrace(e); DivElement div = doc.createDivElement(); div.setInnerHTML(NO_WEBGL_MESSAGE); body.appendChild(div); } }
From source file:com.googlesource.gerrit.plugins.cookbook.client.PopDownButton.java
License:Apache License
private void show() { if (popup != null) { getElement().getStyle().clearFontWeight(); popup.hide();// w w w. j a va2s . c om return; } final Widget relativeTo = getParent(); final PopupPanel p = new PopupPanel(true) { @Override public void setPopupPosition(int left, int top) { top -= Document.get().getBodyOffsetTop(); int w = Window.getScrollLeft() + Window.getClientWidth(); int r = relativeTo.getAbsoluteLeft() + relativeTo.getOffsetWidth(); int right = w - r; Style style = getElement().getStyle(); style.clearProperty("left"); style.setPropertyPx("right", right); style.setPropertyPx("top", top); } }; Style popupStyle = p.getElement().getStyle(); popupStyle.setBorderWidth(0, Unit.PX); popupStyle.setBackgroundColor("#EEEEEE"); p.addAutoHidePartner(getElement()); p.addCloseHandler(new CloseHandler<PopupPanel>() { @Override public void onClose(CloseEvent<PopupPanel> event) { if (popup == p) { getElement().getStyle().clearFontWeight(); popup = null; } } }); p.add(widget); p.showRelativeTo(relativeTo); GlobalKey.dialog(p); getElement().getStyle().setFontWeight(FontWeight.BOLD); popup = p; }
From source file:com.ksyzt.gwt.client.ui.richeditor.RichTextToolbar.java
License:Open Source License
/** * Inits the popup panel.//from w ww. j a v a 2 s .c o m */ private void initPopupPanel() { m_ap_shadow = new HTMLPanel("div", ""); m_ap_content = new HTMLPanel("div", ""); m_ap_line = new HTMLPanel("div", ""); Style style = m_ap_content.getElement().getStyle(); style.setProperty("border", "solid 1px skyblue"); style.setBackgroundColor("white"); style.setPadding(5, Unit.PX); style.setPosition(Position.ABSOLUTE); style.setZIndex(1000000); style = m_ap_shadow.getElement().getStyle(); style.setBackgroundColor("#f0f0f0"); style.setPosition(Position.ABSOLUTE); style.setZIndex(999999); m_ap_line.setHeight("1px"); style = m_ap_line.getElement().getStyle(); style.setBackgroundColor("white"); style.setPosition(Position.ABSOLUTE); style.setZIndex(1000001); RootPanel.get().add(m_ap_shadow); RootPanel.get().add(m_ap_content); RootPanel.get().add(m_ap_line); m_ap_content.setVisible(false); m_ap_shadow.setVisible(false); m_ap_line.setVisible(false); }
From source file:com.sciencegadgets.client.algebra.transformations.VariableTransformations.java
License:Open Source License
@Override protected void onUpdate(double progress) { double inverseProgress = 1 - progress; for (Style style : subStyles) { style.setBackgroundColor("rgba(0,255,0," + inverseProgress + ")"); }// w ww .j av a2s.c o m }
From source file:com.threerings.admin.web.client.ConfigFieldEditor.java
License:Open Source License
protected void updateModificationState() { Style style = _value.getElement().getStyle(); if (getModifiedField() != null) { style.setBackgroundColor("red"); _reset.setVisible(true);//from www . j av a2s .c o m } else { style.clearBackgroundColor(); _reset.setVisible(false); } _onChange.execute(); }
From source file:com.vaadin.client.debug.internal.Highlight.java
License:Apache License
/** * Highlight the given {@link Element} using the given color. * <p>/*from ww w . ja v a 2 s . c o m*/ * Pass the returned highlight {@link Element} to {@link #hide(Element)} to * remove this particular highlight. * </p> * * @param element * Element to highlight * @param color * Color of highlight * @return Highlight element */ static Element show(Element element, String color) { if (element != null) { if (highlights == null) { highlights = new HashSet<Element>(); } Element highlight = DOM.createDiv(); Style style = highlight.getStyle(); style.setTop(element.getAbsoluteTop(), Unit.PX); style.setLeft(element.getAbsoluteLeft(), Unit.PX); int width = element.getOffsetWidth(); if (width < MIN_WIDTH) { width = MIN_WIDTH; } style.setWidth(width, Unit.PX); int height = element.getOffsetHeight(); if (height < MIN_HEIGHT) { height = MIN_HEIGHT; } style.setHeight(height, Unit.PX); RootPanel.getBodyElement().appendChild(highlight); style.setPosition(Position.ABSOLUTE); style.setZIndex(VWindow.Z_INDEX + 1000); style.setBackgroundColor(color); style.setOpacity(DEFAULT_OPACITY); if (BrowserInfo.get().isIE()) { style.setProperty("filter", "alpha(opacity=" + (DEFAULT_OPACITY * 100) + ")"); } highlights.add(highlight); return highlight; } return null; }
From source file:com.vaadin.client.metadata.ConnectorBundleLoader.java
License:Apache License
private void notice(String productName) { if (notice == null) { notice = new HTML(); notice.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { notice.removeFromParent(); }/*w w w . j a v a 2 s. c om*/ }); notice.addTouchStartHandler(new TouchStartHandler() { public void onTouchStart(TouchStartEvent event) { notice.removeFromParent(); } }); } String msg = notice.getText().trim(); msg += msg.isEmpty() ? "Using Evaluation License of: " : ", "; notice.setText(msg + productName); RootPanel.get().add(notice); notice.getElement().setClassName(""); Style s = notice.getElement().getStyle(); s.setPosition(Position.FIXED); s.setTextAlign(TextAlign.CENTER); s.setRight(0, Unit.PX); s.setLeft(0, Unit.PX); s.setBottom(0, Unit.PX); s.setProperty("padding", "0.5em 1em"); s.setProperty("font-family", "sans-serif"); s.setFontSize(12, Unit.PX); s.setLineHeight(1.1, Unit.EM); s.setColor("white"); s.setBackgroundColor("black"); s.setOpacity(0.7); s.setZIndex(2147483646); s.setProperty("top", "auto"); s.setProperty("width", "auto"); s.setDisplay(Display.BLOCK); s.setWhiteSpace(WhiteSpace.NORMAL); s.setVisibility(Visibility.VISIBLE); s.setMargin(0, Unit.PX); }
From source file:com.vaadin.client.SimpleTree.java
License:Apache License
public SimpleTree() { setElement(Document.get().createDivElement()); Style style = getElement().getStyle(); style.setProperty("whiteSpace", "nowrap"); style.setPadding(3, Unit.PX);/*from w ww.j av a 2 s. c om*/ style.setPaddingLeft(12, Unit.PX); // handle styling style = handle.getStyle(); style.setDisplay(Display.NONE); style.setTextAlign(TextAlign.CENTER); style.setWidth(0.5, Unit.EM); style.setHeight(0.5, Unit.EM); style.setCursor(Cursor.POINTER); style.setBackgroundColor("gray"); style.setColor("white"); style.setPadding(4, Unit.PX); style.setMarginRight(3, Unit.PX); style.setLineHeight(0.5, Unit.EM); handle.setInnerHTML("+"); getElement().appendChild(handle); getElement().appendChild(text); // children styling style = children.getStyle(); style.setPaddingLeft(1.5, Unit.EM); style.setDisplay(Display.NONE); getElement().appendChild(children); addDomHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (event.getNativeEvent().getEventTarget().cast() == handle) { if (children.getStyle().getDisplay().intern() == Display.NONE.getCssName()) { open(event.getNativeEvent().getAltKey()); } else { close(); } } else if (event.getNativeEvent().getEventTarget().cast() == text) { select(event); } } }, ClickEvent.getType()); }