Example usage for com.google.gwt.dom.client Style clearHeight

List of usage examples for com.google.gwt.dom.client Style clearHeight

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Style clearHeight.

Prototype

public void clearHeight() 

Source Link

Usage

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();// ww w.  jav  a 2  s. co  m
    style.clearTop();
    style.clearWidth();
    style.clearHeight();
}

From source file:com.haulmont.cuba.web.toolkit.ui.client.fieldgrouplayout.CubaFieldGroupLayoutComponentSlot.java

License:Apache License

@Override
public void positionVertically(double currentLocation, double allocatedSpace, double marginBottom) {
    if (!isCaptionInline()) {
        super.positionVertically(currentLocation, allocatedSpace, marginBottom);
        return;//from w  ww. j  ava2s.  c om
    }

    // CAUTION copied from VLayoutSlot.positionVertically(~)
    Style style = wrapper.getStyle();

    double contentHeight = allocatedSpace;

    int captionHeight;
    VCaption caption = getCaption();
    if (caption == null || caption.shouldBePlacedAfterComponent() || isCaptionInline()) {
        style.clearPaddingTop();
        captionHeight = 0;
    } else {
        captionHeight = getCaptionHeight();
        contentHeight -= captionHeight;
        if (contentHeight < 0) {
            contentHeight = 0;
        }
        style.setPaddingTop(captionHeight, Style.Unit.PX);
    }

    if (marginBottom > 0) {
        style.setMarginBottom(marginBottom, Style.Unit.PX);
    } else {
        style.clearMarginBottom();
    }

    if (isRelativeHeight()) {
        style.setHeight(contentHeight, Style.Unit.PX);
    } else {
        style.clearHeight();
    }

    double allocatedContentHeight = 0;
    if (isRelativeHeight()) {
        String height = getWidget().getElement().getStyle().getHeight();
        double percentage = parsePercent(height);
        allocatedContentHeight = contentHeight * (percentage / 100);
        reportActualRelativeHeight(Math.round((float) allocatedContentHeight));
    }

    AlignmentInfo alignment = getAlignment();
    if (!alignment.isTop()) {
        double usedHeight;
        if (isRelativeHeight()) {
            if (isCaptionInline()) {
                usedHeight = allocatedContentHeight;
            } else {
                usedHeight = captionHeight + allocatedContentHeight;
            }
        } else {
            usedHeight = getUsedHeight();
        }
        if (alignment.isVerticalCenter()) {
            currentLocation += (allocatedSpace - usedHeight) / 2d;
        } else {
            currentLocation += (allocatedSpace - usedHeight);
        }
    }

    style.setTop(currentLocation, Style.Unit.PX);
}

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");
        }//from www  .  j av  a2s  .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.smartgwt.mobile.client.widgets.Canvas.java

License:Open Source License

@SGWTInternal
protected static void _hideAddressBarNow() {
    // In iOS 7, the scrollTo() hack to hide the address bar does not work anymore.
    // http://www.mobilexweb.com/blog/safari-ios7-html5-problems-apis-review
    // We still run some code in _maybeHideAddressBar() on iPad, however, to work around
    // the issue that 20px is cut off from the top or bottom in landscape mode.
    // Also, on iPhone running in a UIWebView, we need to move up the RootLayoutPanel's
    // bottom coord.
    final Style rootLayoutPanelElementStyle = RootLayoutPanel.get().getElement().getStyle();
    if (IMPL.isIOSMin7_0()) {
        if (!Canvas.isUIWebView()) {
            // Work around an issue with iOS 7 Mobile Safari on an iPad in landscape mode.
            // http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue
            // http://stackoverflow.com/questions/18855642/ios-7-css-html-height-100-692px
            if (Canvas.isIPad()) {
                if (Page.getOrientation() == PageOrientation.LANDSCAPE) {
                    rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() - 20, Style.Unit.PX);
                } else {
                    rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT);
                }// w  w  w . j av  a  2  s .  c o m

                // On iPhone running iOS 7.1 using the 'minimal-ui' viewport parameter, the top 20 CSS pixels
                // in landscape mode should not be used because tapping within this area causes the browser
                // chrome to be revealed: http://www.mobilexweb.com/blog/ios-7-1-safari-minimal-ui-bugs
            } else if (Canvas.isIPhone() && IMPL.isIOSMin7_1()) {
                if (Page.getOrientation() == PageOrientation.LANDSCAPE) {
                    rootLayoutPanelElementStyle.clearHeight();
                    rootLayoutPanelElementStyle.setTop(20, Style.Unit.PX);
                } else {
                    rootLayoutPanelElementStyle.setHeight(100, Style.Unit.PCT);
                    rootLayoutPanelElementStyle.setTop(0, Style.Unit.PX);
                }
            }

            // Since, when running in a UIWebView, the device-width/device-height
            // includes the height of the status bar, set the bottom of the RootLayoutPanel's
            // element to 20px (the standard height of the status bar).
        } else if (Canvas.isUIWebView()) {
            rootLayoutPanelElementStyle.clearHeight();
            rootLayoutPanelElementStyle.setBottom(20.0, Style.Unit.PX);
        }

        Window.scrollTo(0, 0);
    } else if (isIPhone() && !isStandAlone() && !isUIWebView()) {
        rootLayoutPanelElementStyle.setHeight(Window.getClientHeight() + 100 - 40, Style.Unit.PX);
        Window.scrollTo(0, 0);
    } else {
        rootLayoutPanelElementStyle.setHeight(Window.getClientHeight(), Style.Unit.PX);
    }
}

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  . ja va  2s.com
        } 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.//ww  w . j a  va2s  . c  om
 */
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: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 ww .  ja  va  2  s  .  c om*/
    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 ww.jav  a  2 s  .  co  m

    // 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();
}

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();
    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/*  w  w w.  j  ava2s  . c om*/
        public void execute(JQueryWrapper query) {
            tabPanelStyle.clearOverflow();
            tabPanelStyle.clearProperty(heightPropertyCC);
        }
    });
    animation.run(HEIGHT_CHANGE_ANIMATION_DURATION, tabPanel.getElement());
}