本文整理汇总了Java中java.beans.Visibility类的典型用法代码示例。如果您正苦于以下问题:Java Visibility类的具体用法?Java Visibility怎么用?Java Visibility使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Visibility类属于java.beans包,在下文中一共展示了Visibility类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dontUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* notify this instance that it may no longer render a GUI.
*/
public synchronized void dontUseGui() {
if (okToUseGui) {
okToUseGui = false;
// lets also tell the Children that can that they may not use their GUI's
synchronized(children) {
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.dontUseGui();
}
}
}
}
示例2: okToUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* Notify this instance that it may now render a GUI
*/
public synchronized void okToUseGui() {
if (!okToUseGui) {
okToUseGui = true;
// lets also tell the Children that can that they may use their GUI's
synchronized(children) {
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.okToUseGui();
}
}
}
}
示例3: dontUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* notify this instance that it may no longer render a GUI.
*/
public synchronized void dontUseGui() {
if (okToUseGui) {
okToUseGui = false;
// lets also tell the Children that can that they may not use their GUI's
synchronized(children) {
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.dontUseGui();
}
}
}
}
示例4: okToUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* Notify this instance that it may now render a GUI
*/
public synchronized void okToUseGui() {
if (!okToUseGui) {
okToUseGui = true;
// lets also tell the Children that can that they may use their GUI's
synchronized(children) {
for (Iterator<Object> i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.okToUseGui();
}
}
}
}
示例5: dontUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* notify this instance that it may no longer render a GUI.
*/
public synchronized void dontUseGui() {
if (okToUseGui) {
okToUseGui = false;
// lets also tell the Children that can that they may not use their GUI's
synchronized(children) {
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.dontUseGui();
}
}
}
}
示例6: okToUseGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* Notify this instance that it may now render a GUI
*/
public synchronized void okToUseGui() {
if (!okToUseGui) {
okToUseGui = true;
// lets also tell the Children that can that they may use their GUI's
synchronized(children) {
for (Iterator i = children.keySet().iterator(); i.hasNext();) {
Visibility v = getChildVisibility(i.next());
if (v != null) v.okToUseGui();
}
}
}
}
示例7: needsGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* Returns true if this context or its children needs GUI to work properly.
* <p>
* The implementation checks the peer and all the children that implement
* <code>Visibility</code> to see if any of their <code>needsGui()</code>
* returns true, and if any of the children extends
* <code>java.awt.Component</code>.</p>
*
* @see java.beans.Visibility#needsGui()
*/
public boolean needsGui() {
if (inNeedsGui) {
return false;
}
inNeedsGui = true;
try {
if (getBeanContextPeer() != this) {
if (getBeanContextPeer().needsGui()) {
return true;
}
}
Object childs[] = copyChildren();
for (int i = 0; i < childs.length; i++) {
Visibility v = getChildVisibility(childs[i]);
if (v != null && v.needsGui()) {
return true;
}
}
return false;
} finally {
inNeedsGui = false;
}
}
示例8: needsGui
import java.beans.Visibility; //导入依赖的package包/类
public synchronized boolean needsGui() {
// BeanContext needs GUI if at least one its children needs it.
// We may check it by trying to cast each child to Visibility
// and see it needs GUI.
// A child definitely needs GUI if it implements Component
for (Iterator it = iterator(); it.hasNext();) {
Object next = it.next();
Visibility vis = getChildVisibility(next);
if (vis != null) {
if (vis.needsGui()) {
return true;
}
}
if (next instanceof java.awt.Component) {
return true;
}
}
return false;
}
示例9: needsGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* <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 <tt>true</tt> 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 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;
}
示例10: getChildVisibility
import java.beans.Visibility; //导入依赖的package包/类
/**
* Gets the Component (if any) associated with the specified child.
* @param child the specified child
* @return the Component (if any) associated with the specified child.
*/
protected static final Visibility getChildVisibility(Object child) {
try {
return (Visibility)child;
} catch (ClassCastException cce) {
return null;
}
}
示例11: needsGui
import java.beans.Visibility; //导入依赖的package包/类
/**
* <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;
}