List of usage examples for com.google.gwt.dom.client Style clearWidth
public void clearWidth()
From source file:burrito.client.widgets.form.EditForm.java
License:Apache License
public void makeButtonsStick(boolean stick) { getElement().getStyle().setPropertyPx("minHeight", getOffsetHeight()); Style style = buttonWrapper.getElement().getStyle(); buttonWrapper.addStyleName("k5-EditForm-fixedButtons"); if (stick) {/*from www. j a v a 2 s. co m*/ style.setPosition(Position.FIXED); style.setBottom(0, Unit.PX); style.setLeft(getAbsoluteLeft(), Unit.PX); style.setWidth(getOffsetWidth(), Unit.PX); } else { style.clearPosition(); style.clearBottom(); style.clearLeft(); style.clearWidth(); } }
From source file:com.alkacon.acacia.client.ui.AttributeValueView.java
License:Open Source License
/** * Removes the drag helper styles from the given element.<p> * //from www . j ava2s. c o m * @param helper the helper element */ private void removeDragHelperStyles(Element helper) { Style style = helper.getStyle(); style.clearTop(); style.clearLeft(); style.clearPosition(); style.clearWidth(); helper.removeClassName(formCss().dragHelper()); }
From source file:com.google.appinventor.client.editor.simple.components.MockImageBase.java
License:Open Source License
private void unclipImage() { Style style = image.getElement().getStyle(); style.clearLeft();/*w w w . j a v a 2 s. com*/ style.clearTop(); style.clearWidth(); style.clearHeight(); }
From source file:com.haulmont.cuba.web.toolkit.ui.client.sourcecodeeditor.CubaSuggestPopup.java
License:Apache License
public CubaSuggestPopup() { Style style = loadingImage.getElement().getStyle(); style.clearWidth(); style.clearHeight(); style.setDisplay(Style.Display.BLOCK); }
From source file:com.smartgwt.mobile.client.widgets.BaseButton.java
License:Open Source License
private void doSetIcon(boolean fireContentChangedEvent) { assert icon != null && iconImage != null; final Element img = iconImage.getElement(); final Style imgStyle = img.getStyle(); if (masked) { iconImage.setResource(IconResources.INSTANCE.blank()); if ("IMG".equals(img.getTagName())) { final ImageElement iconImageImgElem = ImageElement.as(img); iconImageImgElem.removeAttribute("width"); iconImageImgElem.removeAttribute("height"); }// ww w . j av a 2 s . c o m imgStyle.clearWidth(); imgStyle.clearHeight(); img.setClassName(_CSS.maskedButtonIconClass()); imgStyle.clearBackgroundColor(); imgStyle.clearBackgroundImage(); // Note: Mobile WebKit automatically scales down the mask image to fit the element // to which the mask image is applied. imgStyle.setProperty("WebkitMaskBoxImage", "url(" + icon.getSafeUri().asString() + ")"); } else { if ("IMG".equals(img.getTagName())) { final ImageElement iconImageImgElem = ImageElement.as(img); iconImageImgElem.removeAttribute("width"); iconImageImgElem.removeAttribute("height"); } imgStyle.clearWidth(); imgStyle.clearHeight(); imgStyle.clearProperty("MozBackgroundSize"); imgStyle.clearProperty("OBackgroundSize"); imgStyle.clearProperty("WebkitBackgroundSize"); imgStyle.clearProperty("backgroundSize"); img.removeClassName(_CSS.maskedButtonIconClass()); } setIconAlign(iconAlign); if (iconColor != null) { setIconColor(iconColor); } imgStyle.clearVisibility(); if (fireContentChangedEvent) _fireContentChangedEvent(); }
From source file:com.vaadin.client.ui.audio.AudioConnector.java
License:Apache License
@Override public void onStateChanged(StateChangeEvent stateChangeEvent) { super.onStateChanged(stateChangeEvent); // Opera (12.14) has a bug where an audio element w/o controls is shown // as 150x300px, which is not usually desired. However, in order to show // the error/alt message, we only do this in the exact situation. if (BrowserInfo.get().isOpera() && stateChangeEvent.hasPropertyChanged("showControls")) { Style style = getWidget().getElement().getStyle(); if (!getState().showControls) { if (isUndefinedHeight() && isUndefinedWidth() && getWidget().getOffsetHeight() == 150 && getWidget().getOffsetWidth() == 300) { // only if no size set and 150x300 style.setWidth(0, Unit.PX); style.setHeight(0, Unit.PX); }/*from w w w .j a v a 2 s . c om*/ } else { // clear sizes if it's supposed to be undefined if (isUndefinedHeight()) { style.clearHeight(); } if (isUndefinedWidth()) { style.clearWidth(); } } } }
From source file:com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout.java
License:Apache License
/** * Assigns relative sizes to the children that should expand based on their * expand ratios.// www. j a v a2 s . c o m */ public void updateExpandedSizes() { // Ensure the expand wrapper is in place if (expandWrapper == null) { expandWrapper = DOM.createDiv(); expandWrapper.setClassName("v-expand"); // Detach all widgets before modifying DOM for (Widget widget : getChildren()) { orphan(widget); } while (getElement().getChildCount() > 0) { Node el = getElement().getChild(0); expandWrapper.appendChild(el); } getElement().appendChild(expandWrapper); // Attach all widgets again for (Widget widget : getChildren()) { adopt(widget); } } // Sum up expand ratios to get the denominator double total = 0; for (Slot slot : widgetToSlot.values()) { // FIXME expandRatio might be <0 total += slot.getExpandRatio(); } // Give each expanded child its own share for (Slot slot : widgetToSlot.values()) { Element slotElement = slot.getElement(); slotElement.removeAttribute("aria-hidden"); Style slotStyle = slotElement.getStyle(); slotStyle.clearVisibility(); slotStyle.clearMarginLeft(); slotStyle.clearMarginTop(); if (slot.getExpandRatio() != 0) { // FIXME expandRatio might be <0 double size = 100 * (slot.getExpandRatio() / total); if (vertical) { slot.setHeight(size + "%"); if (slot.hasRelativeHeight()) { Util.notifyParentOfSizeChange(this, true); } } else { slot.setWidth(size + "%"); if (slot.hasRelativeWidth()) { Util.notifyParentOfSizeChange(this, true); } } } else if (slot.isRelativeInDirection(vertical)) { // Relative child without expansion gets no space at all if (vertical) { slot.setHeight("0"); } else { slot.setWidth("0"); } slotStyle.setVisibility(Visibility.HIDDEN); slotElement.setAttribute("aria-hidden", "true"); } else { // Non-relative child without expansion should be unconstrained if (BrowserInfo.get().isIE8()) { // unconstrained in IE8 is auto if (vertical) { slot.setHeight("auto"); } else { slot.setWidth("auto"); } } else { if (vertical) { slotStyle.clearHeight(); } else { slotStyle.clearWidth(); } } } } }
From source file:com.vaadin.client.ui.window.WindowConnector.java
License:Apache License
@Override public void layout() { LayoutManager lm = getLayoutManager(); VWindow window = getWidget();// ww w . j a va2 s . co m ComponentConnector content = getContent(); boolean hasContent = (content != null); Element contentElement = window.contentPanel.getElement(); Style contentStyle = window.contents.getStyle(); int headerHeight = lm.getOuterHeight(window.header); contentStyle.setPaddingTop(headerHeight, Unit.PX); contentStyle.setMarginTop(-headerHeight, Unit.PX); int footerHeight = lm.getOuterHeight(window.footer); contentStyle.setPaddingBottom(footerHeight, Unit.PX); contentStyle.setMarginBottom(-footerHeight, Unit.PX); int minWidth = lm.getOuterWidth(window.header) - lm.getInnerWidth(window.header); int minHeight = footerHeight + headerHeight; getWidget().getElement().getStyle().setPropertyPx("minWidth", minWidth); getWidget().getElement().getStyle().setPropertyPx("minHeight", minHeight); /* * Must set absolute position if the child has relative height and * there's a chance of horizontal scrolling as some browsers will * otherwise not take the scrollbar into account when calculating the * height. */ if (hasContent) { Element layoutElement = content.getWidget().getElement(); Style childStyle = layoutElement.getStyle(); // IE8 needs some hackery to measure its content correctly WidgetUtil.forceIE8Redraw(layoutElement); if (content.isRelativeHeight() && !BrowserInfo.get().isIE9()) { childStyle.setPosition(Position.ABSOLUTE); Style wrapperStyle = contentElement.getStyle(); if (window.getElement().getStyle().getWidth().length() == 0 && !content.isRelativeWidth()) { /* * Need to lock width to make undefined width work even with * absolute positioning */ int contentWidth = lm.getOuterWidth(layoutElement); wrapperStyle.setWidth(contentWidth, Unit.PX); } else { wrapperStyle.clearWidth(); } } else { childStyle.clearPosition(); } } }
From source file:fr.putnami.pwt.core.widget.client.Affix.java
License:Open Source License
private void clearElementStyle() { Element e = this.getElement(); Style style = e.getStyle(); style.clearPosition();/*from w w w .j a v a2 s .com*/ style.clearTop(); style.clearBottom(); style.clearWidth(); style.clearHeight(); style.clearZIndex(); e.getParentElement().getStyle().clearPaddingTop(); }
From source file:geogebra.web.gui.app.docklayout.LayoutImpl.java
License:Apache License
public void removeChild(Element container, Element child) { container.removeFromParent();/*from w w w.j a va2 s . c om*/ // We want this code to be resilient to the child having already been // removed from its container (perhaps by widget code). if (child.getParentElement() == container) { child.removeFromParent(); } // Cleanup child styles set by fillParent(). Style style = child.getStyle(); style.clearPosition(); style.clearLeft(); style.clearTop(); style.clearWidth(); style.clearHeight(); }