private Resource[] getSubResources(Resource p) {
        Resource[] cp = new Resource[0];
        Resource[] all;
        {
            Collection<Resource> ta = new HashSet<Resource>();
            Collection<Resource> open;
            synchronized (ui.sess.glob.paginae) {
                open = new HashSet<Resource>(ui.sess.glob.paginae);
            }
            while (!open.isEmpty()) {
                for (Resource r : open.toArray(cp)) {
                    if (!r.loading) {
                        AButton ad = r.layer(Resource.action);
                        if (ad == null)
                            throw (new PaginaException(r));
                        if ((ad.parent != null) && !ta.contains(ad.parent))
                            open.add(ad.parent);
                        ta.add(r);
                        open.remove(r);
                    }
                }
            }
            all = ta.toArray(cp);
        }
        Collection<Resource> tobe = new HashSet<Resource>();
        for (Resource r : all) {
            if (r.layer(Resource.action).parent == p)
                tobe.add(r);
        }
        return (tobe.toArray(cp));
    }