java类java.beans.Visibility的实例源码

BeanContextSupport.java 文件源码 项目:openjdk-jdk7u-jdk 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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();
            }
        }
    }
}
BeanContextSupport.java 文件源码 项目:freeVM 阅读 33 收藏 0 点赞 0 评论 0
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;
}
BeanContextSupport.java 文件源码 项目:openjdk-icedtea7 阅读 31 收藏 0 点赞 0 评论 0
/**
 * 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();
           }
        }
    }
}
BeanContextSupport.java 文件源码 项目:openjdk-icedtea7 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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();
            }
        }
    }
}
BeanContextSupport.java 文件源码 项目:OpenJSharp 阅读 22 收藏 0 点赞 0 评论 0
/**
 * <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;
}
BeanContextSupport.java 文件源码 项目:OpenJSharp 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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;
    }
}
BeanContextSupport.java 文件源码 项目:jdk8u-jdk 阅读 28 收藏 0 点赞 0 评论 0
/**
 * <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;
}
BeanContextSupport.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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;
    }
}
BeanContextSupport.java 文件源码 项目:openjdk-jdk10 阅读 39 收藏 0 点赞 0 评论 0
/**
 * <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 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
/**
 * 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;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号