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

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

Introduction

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

Prototype

public String getVisibility() 

Source Link

Usage

From source file:com.dom_distiller.client.DomUtil.java

License:Open Source License

public static boolean isVisible(Element e) {
    Style style = getComputedStyle(e);
    float opacity = 1.0F;
    try {//from ww w.  j a  v a 2  s.co  m
        opacity = Float.parseFloat(style.getOpacity());
    } catch (NumberFormatException exception) {
    }
    return !(style.getDisplay().equals("none") || style.getVisibility().equals("hidden") || opacity == 0.0F);
}

From source file:com.dom_distiller.client.FilteringDomVisitor.java

License:Open Source License

private static void logVisibilityInfo(Element e, boolean visible) {
    if (!LogUtil.isLoggable(LogUtil.DEBUG_LEVEL_VISIBILITY_INFO))
        return;//from w w  w.  ja va 2  s.co  m
    Style style = DomUtil.getComputedStyle(e);
    LogUtil.logToConsole((visible ? "KEEP " : "SKIP ") + e.getTagName() + ": id=" + e.getId() + ", dsp="
            + style.getDisplay() + ", vis=" + style.getVisibility() + ", opaq=" + style.getOpacity());
}

From source file:org.chromium.distiller.DomUtil.java

License:Open Source License

public static boolean isVisible(Element e) {
    Style style = getComputedStyle(e);
    double opacity = JavaScript.parseFloat(style.getOpacity());
    return !(style.getDisplay().equals("none") || style.getVisibility().equals("hidden") || opacity == 0.0F);
}

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  ww w .  j  a  v  a  2 s.  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);
    }
}