List of usage examples for com.google.gwt.dom.client Style clearBorderWidth
public void clearBorderWidth()
From source file:com.goodow.wave.client.wavepanel.blip.SetColor.java
License:Apache License
public SetColor() { Widget widget = binder.createAndBindUi(this); this.getElement().getStyle().setWidth(129, Unit.PX); this.add(widget); this.setAutoHideEnabled(true); NodeList<Node> childNodes = colors.getChildNodes(); putColor(childNodes);/*from w w w .j a v a 2s . co m*/ DOM.sinkEvents((com.google.gwt.user.client.Element) noColor, Event.ONCLICK); DOM.setEventListener((com.google.gwt.user.client.Element) noColor, new EventListener() { @Override public void onBrowserEvent(final Event event) { if (DOM.eventGetType(event) == Event.ONCLICK) { NodeList<Element> aTags = changeElm.getElementsByTagName("span"); Element aTag = aTags.getItem(1); Style aTagStyle = aTag.getStyle(); aTagStyle.clearColor(); aTagStyle.clearBackgroundColor(); aTagStyle.clearBorderColor(); aTagStyle.clearBorderStyle(); aTagStyle.clearBorderWidth(); aTagStyle.clearTextDecoration(); } } }); }
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 ww w .j a va2 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:jetbrains.jetpad.projectional.view.toGwt.BaseViewMapper.java
License:Apache License
@Override protected void registerSynchronizers(SynchronizersConfiguration conf) { super.registerSynchronizers(conf); Style targetStyle = getTarget().getStyle(); if (!isDomPosition()) { targetStyle.setPosition(Style.Position.ABSOLUTE); } else {/*from w ww .j a v a 2 s. c o m*/ targetStyle.setPosition(Style.Position.RELATIVE); } if (!isDomPosition() || !isDomLayout()) { final ReadableProperty<Rectangle> positionInParent; if (getParent() instanceof BaseViewMapper) { final BaseViewMapper<?, ?> parent = (BaseViewMapper<?, ?>) getParent(); positionInParent = new DerivedProperty<Rectangle>(getSource().bounds(), parent.getSource().bounds()) { @Override public Rectangle doGet() { Rectangle sourceBounds = getSource().bounds().get(); Rectangle parentSourceBounds = parent.getSource().bounds().get(); return sourceBounds.sub(parentSourceBounds.origin); } }; } else { positionInParent = getSource().bounds(); } final Value<Boolean> valid = new Value<>(false); conf.add(Synchronizers.forEventSource(EventSources.composite(positionInParent, getSource().border()), new Runnable() { @Override public void run() { valid.set(false); whenValid(new Runnable() { @Override public void run() { if (valid.get()) return; final Rectangle value = positionInParent.get(); Style style = getTarget().getStyle(); if (!isDomPosition()) { style.setLeft(value.origin.x, Style.Unit.PX); style.setTop(value.origin.y, Style.Unit.PX); } if (!isDomLayout()) { int width = value.dimension.x; int height = value.dimension.y; style.setWidth(width, Style.Unit.PX); style.setHeight(height, Style.Unit.PX); } valid.set(true); } }); } })); } if (!isCustomBackgroundSync()) { conf.add(Synchronizers.forPropsOneWay(getSource().background(), new WritableProperty<Color>() { @Override public void set(Color value) { Style style = getTarget().getStyle(); if (value == null) { style.setBackgroundColor(null); } else { style.setBackgroundColor(value.toCssColor()); } } })); } conf.add(Synchronizers.forPropsOneWay(getSource().border(), new WritableProperty<Color>() { @Override public void set(Color value) { Style style = getTarget().getStyle(); if (value != null) { style.setOutlineColor(value.toCssColor()); style.setOutlineWidth(1, Style.Unit.PX); style.setOutlineStyle(Style.OutlineStyle.SOLID); } else { style.clearOutlineStyle(); style.clearOutlineColor(); style.clearBorderWidth(); } } })); conf.add(Synchronizers.forPropsOneWay(getSource().visible(), new WritableProperty<Boolean>() { @Override public void set(final Boolean value) { whenValid(new Runnable() { @Override public void run() { getTarget().getStyle().setDisplay(value ? Style.Display.BLOCK : Style.Display.NONE); } }); } })); conf.add(Synchronizers.forPropsOneWay(getSource().hasShadow(), new WritableProperty<Boolean>() { @Override public void set(Boolean value) { if (value) { getTarget().getStyle().setProperty("boxShadow", "2px 2px 4px black"); } else { getTarget().getStyle().setProperty("boxShadow", null); } } })); }