English 中文(简体)
如何发现地球静止轨道的成分?
原标题:How to detect is a GWT element is visible?

我有几批露面和隐藏的碎片。 我如何在某个特定要素上发现,这在网页上是显而易见的?

该元素的风格赢得了笔帮助,因为它是正在隐藏的德国OM系统中的母体编码

最佳回答

Its offset height and width will both be 0.

UIObject component = ...
boolean isHidden = (component.getOffsetHeight() == 0 && component.getOffsetWidth() == 0);
问题回答

我也曾讨论过这个问题,我发现以下是最佳解决办法:

Given an Element called "element":

boolean visible = UIObject.isVisible(element) && (element.getAbsoluteLeft() > 0) && (element.getAbsoluteTop() > 0);

UIObject的静态“可行”方法将检查显示无异于这种,而对AbsoluteLeft和AsoluteTop的检查则可以处理。 我认为必须进行后一种检查的原因是,如果某个因素脱离了管理局(因此没有出现在网页上),那么,德国世界银行将继续告诉你,除非其可见性被明确定为虚假,否则其可见性是真实的。

NB: You could replace the AbsoluteTop and AbsoluteLeft checks with the offset width and height checks as suggested by Simon, but you should include the isVisible check as well in my opinion.

You can have something like that:

  public boolean isVisible(Widget w) {
        while (w.getElement().hasParentElement()) {
           if (w.isVisible()) {
                return true;
            }
            w = w.getParent();
        }
        return w.isVisible();
    }

如果它带有一个要素,而不是一个UIObject,那么我的工作如下:

!"hidden".equals(element.getStyle().getVisibility())
  && !"none".equals(element.getStyle().getDisplay())

I was walking down the tree, so knew the parent elements were visible; if your case is different, you ll probably need to do the same check on all parent elements.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签