Commit d64c7436 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Better InheritanceLogic in respect to private classes.

Instead of hiding all private classes, now only those that have
no non-private subclasses get hidden.
parent 292b084e
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@ Ext.define('Docs.view.cls.InheritanceLogic', {

        this.subclasses = this.buildLookupTable(this.classes);
        Ext.Array.forEach(this.classes, this.addClass, this);
        if (!this.showPrivateClasses) {
            this.stripPrivateClasses(this.root);
        }
        this.sortTree(this.root);
        return this.root;
    },
@@ -36,9 +39,6 @@ Ext.define('Docs.view.cls.InheritanceLogic', {
    buildLookupTable: function(classes) {
        var map = {};
        Ext.Array.forEach(classes, function(cls) {
            if (cls["private"] && !this.showPrivateClasses) {
                return;
            }
            var parent = cls["extends"];
            if (parent && parent !== "Object") {
                if (!map[parent]) {
@@ -61,9 +61,6 @@ Ext.define('Docs.view.cls.InheritanceLogic', {
    },

    addClass: function(cls) {
        if (cls["private"] && !this.showPrivateClasses) {
            return;
        }
        var parent = cls["extends"];
        if (!parent || parent === "Object") {
            var node = this.classNode(cls);
@@ -83,6 +80,14 @@ Ext.define('Docs.view.cls.InheritanceLogic', {
            node.leaf = node.children.length === 0;
            return node;
        }, this);
    },

    stripPrivateClasses: function(node) {
        node.children = Ext.Array.filter(node.children, function(child) {
            this.stripPrivateClasses(child);
            // Remove private class unless it has non-private subclasses
            return !(child.cls === "private" && child.children.length === 0);
        }, this);
    }

});