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++) {
                if (childs[i] instanceof Component) {
                    return true;
                }
                Visibility v = getChildVisibility(childs[i]);
                if (v != null && v.needsGui()) {
                    return true;
                }
            }
            return false;
        } finally {
            inNeedsGui = false;
        }
    }