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

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

Introduction

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

Prototype

public String getZIndex() 

Source Link

Usage

From source file:com.isotrol.impe3.pms.gui.client.widget.design.PortalComponent.java

License:Open Source License

/**
 * Adds a click listener to show the component html in a popup
 *///from   w ww  .java  2  s  .com
protected void showHtmlOnClick() {
    final HTML html = new HTML(dto.getMarkup(0));
    final PopupPanel htmlPopup = new PopupPanel(true);
    htmlPopup.setAnimationEnabled(true);
    htmlPopup.setPixelSize(200, 200);
    htmlPopup.setWidget(html);
    htmlPopup.addStyleName("popup-component-html");

    clickHandler = addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {

            // z-index of design window is different each time, so we find out it to set the popup z-index
            final Style designStyle = Design.getInstance().getElement().getStyle();
            String zIndex = designStyle.getZIndex();
            if (!Util.emptyString(zIndex)) {
                int popUpZIndex = Integer.parseInt(zIndex) + 1;
                htmlPopup.getElement().getStyle().setZIndex(popUpZIndex);
            }

            htmlPopup.setPopupPosition(event.getClientX(), event.getClientY());
            htmlPopup.show();
        }
    });
}

From source file:org.rstudio.core.client.widget.RStudioDataGrid.java

License:Open Source License

@Override
public void onAttach() {
    super.onAttach();

    // None of the below is necessary unless on MacOS since that's the only
    // platform that uses overlay scrollbars.
    if (!BrowseCap.isMacintosh())
        return;/*from  w  w w.  j a  v  a2s .c  o m*/

    // GWT's DataGrid implementation adds a handful of nodes with aggressive
    // inline styles in the header and footer of the grid. They're designed to
    // help with scrolling, but in newer versions of Chromium, they cause
    // horizontal overlay scrollbars to appear when the grid is created and
    // whenever it's resized. The below tweaks these elements so that they
    // don't have a scrollbar.
    //
    // Typically we'd use CSS here but these elements are buried, have no
    // assigned class, and have all their style attributes applied inline, so
    // instead we scan the attached DOM subtree and change the inline styles.
    Element parent = getElement().getParentElement().getParentElement();
    List<Node> matches = DomUtils.findNodes(parent, 10, // Max results 
            3, // Recurse depth 
            false, // Check siblings
            node -> {
                // Ignore text nodes, etc.
                if (node.getNodeType() != Node.ELEMENT_NODE)
                    return false;

                com.google.gwt.dom.client.Style style = Element.as(node).getStyle();

                // The scroll helpers are hidden, and set to appear behind the grid.
                return style.getZIndex() == "-1" && style.getOverflow() == "scroll"
                        && style.getVisibility() == "hidden";
            });

    for (Node match : matches) {
        // Don't show scrollbars on these elements
        Element.as(match).getStyle().setOverflow(Overflow.HIDDEN);
    }
}