/**
* <p>
* This method is typically called from the environment in order to determine
* if the implementor "needs" a GUI.
* </p>
* <p>
* The algorithm used herein tests the BeanContextPeer, and its current children
* to determine if they are either Containers, Components, or if they implement
* Visibility and return needsGui() == true.
* </p>
* @return {@code true} if the implementor needs a GUI
*/
public synchronized boolean needsGui() {
BeanContext bc = getBeanContextPeer();
if (bc != this) {
if (bc instanceof Visibility) return ((Visibility)bc).needsGui();
if (bc instanceof Container || bc instanceof Component)
return true;
}
synchronized(children) {
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
Object c = i.next();
try {
return ((Visibility)c).needsGui();
} catch (ClassCastException cce) {
// do nothing ...
}
if (c instanceof Container || c instanceof Component)
return true;
}
}
return false;
}
BeanContextSupport.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录