List of usage examples for com.google.gwt.dom.client Style clearProperty
public void clearProperty(String name)
From source file:forplay.html.HtmlImageLayerDom.java
License:Apache License
private void applyBackgroundSize() { Style style = element().getStyle(); // Set background-repeat to get the right repeating behavior. String repeat = repeatX ? "repeat-x " : ""; repeat += repeatY ? "repeat-y" : ""; style.setProperty("backgroundRepeat", repeat); // Set background-size to get the right pinning behavior. if (sourceRectSet) { float wratio = widthSet ? (width / sw) : (image().width() / sw); float hratio = heightSet ? (height / sh) : (image().height() / sh); if (wratio == 0) { wratio = 1;//from w ww . ja v a 2 s .c om } if (hratio == 0) { hratio = 1; } float backWidth = image().width() * wratio; float backHeight = image().height() * hratio; style.setProperty("backgroundSize", backWidth + "px " + backHeight + "px"); style.setProperty("backgroundPosition", (-sx * wratio) + "px " + (-sy * hratio) + "px"); } else { String size = repeatX ? image().width() + "px " : "100% "; size += repeatY ? image().height() + "px" : "100%"; style.setProperty("backgroundSize", size); style.clearProperty("backgroundPosition"); } }
From source file:fr.putnami.pwt.core.widget.client.Image.java
License:Open Source License
private void resetSize() { Style imgStyle = this.imgElement.getStyle(); imgStyle.clearProperty(Image.PROP_WIDTH); imgStyle.clearProperty(Image.PROP_HEIGHT); imgStyle.clearProperty(Image.PROP_MAX_WIDTH); imgStyle.clearProperty(Image.PROP_MAX_HEIGHT); if (this.widthPx > 0) { imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_WIDTH : Image.PROP_WIDTH, this.widthPx); }// w w w . ja v a 2s . c o m if (this.heightPx > 0) { imgStyle.setPropertyPx(this.keepPropertions ? Image.PROP_MAX_HEIGHT : Image.PROP_HEIGHT, this.heightPx); } }
From source file:info.magnolia.ui.vaadin.gwt.client.tabsheet.widget.MagnoliaTabSheetViewImpl.java
License:Open Source License
private void animateHeightChange(MagnoliaTabWidget newActiveTab) { final Style tabPanelStyle = tabPanel.getElement().getStyle(); int offsetTabHeight = tabPanel.getOffsetHeight(); tabPanelStyle.clearHeight();/*w ww . java 2 s .c o m*/ int newHeight = newActiveTab.getOffsetHeight(); final String heightPropertyCC = offsetTabHeight < newHeight ? "maxHeight" : "minHeight"; final String heightProperty = offsetTabHeight < newHeight ? "max-height" : "min-height"; final JQueryAnimation animation = new JQueryAnimation(); tabPanelStyle.setProperty(heightPropertyCC, offsetTabHeight + "px"); animation.setProperty(heightProperty, newHeight); tabPanelStyle.setOverflow(Style.Overflow.HIDDEN); animation.addCallback(new JQueryCallback() { @Override public void execute(JQueryWrapper query) { tabPanelStyle.clearOverflow(); tabPanelStyle.clearProperty(heightPropertyCC); } }); animation.run(HEIGHT_CHANGE_ANIMATION_DURATION, tabPanel.getElement()); }
From source file:jetbrains.jetpad.cell.toDom.BaseCellMapper.java
License:Apache License
private void applyBackground(String color, String underline) { Style style = getTarget().getStyle(); if (color == null) { if (underline == null) { style.clearProperty(BACKGROUND); } else {//from w w w .j a v a 2 s .co m style.setProperty(BACKGROUND, underline + UNDERLINE_SUFFIX); } } else { if (underline == null) { style.setProperty(BACKGROUND, color); } else { style.setProperty(BACKGROUND, underline + UNDERLINE_SUFFIX + " " + color); } } }
From source file:next.i.view.widgets.XPopup.java
License:Apache License
public void doPosition() { Style s = getWidget().getElement().getStyle(); if (isCentered) { setBottom(null);// w w w. j ava 2s. co m setRight(null); setTop("50%"); setLeft("50%"); int height = getWidget().getOffsetHeight(); int width = getWidget().getOffsetWidth(); // XLog.info("height: " + height + ", getOffsetHeight(): " + // getOffsetHeight()); int top_ = height >= getOffsetHeight() ? 0 : (height / 2); int left_ = width >= getOffsetWidth() ? 0 : (width / 2); s.setProperty("marginTop", "-" + top_ + "px"); s.setProperty("marginLeft", "-" + left_ + "px"); } else { if (top == null) { s.clearProperty("top"); } else { s.setProperty("top", top); } if (right == null) { s.clearProperty("right"); } else { s.setProperty("right", right); } if (bottom == null) { s.clearProperty("bottom"); } else { s.setProperty("bottom", bottom); } if (left == null) { s.clearProperty("left"); } else { s.setProperty("left", left); } } }
From source file:org.anstis.client.grid.widget.dom.BaseDOMElement.java
License:Apache License
/** * Transform the DOMElement based on the render context, such as scale and position. * @param context//from www. j a v a2 s . c o m */ protected void transform(final GridCellRenderContext context) { final Transform transform = context.getTransform(); final double width = context.getWidth(); final double height = context.getHeight(); final Style style = container.getElement().getStyle(); //Reposition and transform the DOM Element style.setLeft((context.getX() * transform.getScaleX()) + transform.getTranslateX(), Style.Unit.PX); style.setTop((context.getY() * transform.getScaleY()) + transform.getTranslateY(), Style.Unit.PX); style.setWidth(width, Style.Unit.PX); style.setHeight(height, Style.Unit.PX); if (isOne(transform.getScaleX()) && isOne(transform.getScaleY())) { style.clearProperty("WebkitTransform"); style.clearProperty("MozTransform"); style.clearProperty("Transform"); return; } final String scale = "scale(" + FORMAT.format(transform.getScaleX()) + ", " + FORMAT.format(transform.getScaleY()) + ")"; final String translate = "translate(" + FORMAT.format(((width - width * transform.getScaleX()) / -2.0)) + "px, " + FORMAT.format(((height - height * transform.getScaleY()) / -2.0)) + "px)"; style.setProperty("WebkitTransform", translate + " " + scale); style.setProperty("MozTransform", translate + " " + scale); style.setProperty("Transform", translate + " " + scale); }
From source file:org.cruxframework.crux.smartfaces.client.dialog.PopupPanel.java
License:Apache License
private void uncentralizeMe() { Style style = getElement().getStyle(); style.clearProperty("webkitTransform"); style.clearProperty("transform"); centered = false;/*from w w w.j av a 2s .c o m*/ }
From source file:org.opencms.ui.client.CmsBreadCrumbConnector.java
License:Open Source License
/** * Updates the entry max-width according to the available space.<p> *///from w w w . j a v a 2 s . co m void updateMaxWidth() { Element base = getWidget().getElement(); int availableWidth = base.getOffsetWidth(); int requiredWidth = 0; NodeList<Element> children = CmsDomUtil.querySelectorAll("div > a, div > span", base); for (int i = 0; i < children.getLength(); i++) { Element child = children.getItem(i); Style style = child.getFirstChildElement().getStyle(); style.setProperty("maxWidth", "none"); requiredWidth += child.getOffsetWidth(); style.clearProperty("maxWidth"); } if (requiredWidth > availableWidth) { int padding = 30 + ((children.getLength() - 1) * 35); int maxWidth = (availableWidth - padding) / children.getLength(); setMaxWidth(maxWidth + "px"); } else { setMaxWidth("none"); } }
From source file:org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement.java
License:Apache License
/** * Transform the DOMElement based on the render context, such as scale and position. * @param context/*from ww w. j av a 2s .co m*/ */ protected void transform(final GridBodyCellRenderContext context) { final Transform transform = context.getTransform(); final double width = context.getCellWidth(); final double height = context.getCellHeight(); final Style style = widgetContainer.getElement().getStyle(); //Copy across GridWidget's opacity to DOMElements style.setOpacity(gridWidget.getAlpha()); //Reposition and transform the DOM Element style.setLeft((context.getAbsoluteCellX() * transform.getScaleX()) + transform.getTranslateX(), Style.Unit.PX); style.setTop((context.getAbsoluteCellY() * transform.getScaleY()) + transform.getTranslateY(), Style.Unit.PX); style.setWidth(width, Style.Unit.PX); style.setHeight(height, Style.Unit.PX); //If the DOMElement overlaps a fixed header clip content style.clearProperty("clip"); final double top = context.getAbsoluteCellY() + transform.getTranslateY(); final double left = context.getAbsoluteCellX() + transform.getTranslateX(); final boolean isFloating = context.isFloating(); boolean clip = false; double ct = 0.0; double cr = width; double cb = height; double cl = 0.0; final Group header = gridWidget.getHeader(); final double clipMinY = context.getClipMinY() + transform.getTranslateY(); final double clipMinX = context.getClipMinX() + transform.getTranslateX(); if (header != null) { if (top < clipMinY) { ct = clipMinY - top; clip = true; } } if (!isFloating && left < clipMinX) { cl = clipMinX - left; clip = true; } if (clip) { style.setProperty("clip", "rect(" + (int) ct + "px," + (int) cr + "px," + (int) cb + "px," + (int) cl + "px)"); } // --- Workaround for BS2 --- style.setProperty("WebkitBoxSizing", "border-box"); style.setProperty("MozBoxSizing", "border-box"); style.setProperty("boxSizing", "border-box"); style.setProperty("lineHeight", "normal"); // --- End workaround --- if (MathUtilities.isOne(transform.getScaleX()) && MathUtilities.isOne(transform.getScaleY())) { style.clearProperty("WebkitTransform"); style.clearProperty("MozTransform"); style.clearProperty("Transform"); style.clearProperty("MsTransform"); return; } final String scale = "scale(" + FORMAT.format(transform.getScaleX()) + ", " + FORMAT.format(transform.getScaleY()) + ")"; final String translate = "translate(" + FORMAT.format(((width - width * transform.getScaleX()) / -2.0)) + "px, " + FORMAT.format(((height - height * transform.getScaleY()) / -2.0)) + "px)"; style.setProperty("WebkitTransform", translate + " " + scale); style.setProperty("MozTransform", translate + " " + scale); style.setProperty("Transform", translate + " " + scale); style.setProperty("MsTransform", translate + " " + scale); }
From source file:org.vaadin.alump.scaleimage.gwt.client.conn.ScaleImageConnector.java
License:Apache License
@Override public void onStateChanged(StateChangeEvent event) { super.onStateChanged(event); clickEventHandler.handleEventHandlerRegistration(); String url = getResourceUrl(AbstractEmbeddedState.SOURCE_RESOURCE); getWidget().setUrl(url);/*from w ww .j av a2 s .c o m*/ for (String property : getState().styleValues.keySet()) { String value = getState().styleValues.get(property); Style elementStyle = getWidget().getElement().getStyle(); if (value == null || value.isEmpty()) { elementStyle.clearProperty(property); } else { elementStyle.setProperty(property, value); } } }