<commit_before>class GuiObjectListComponent extends GuiAbstractListComponent {
    constructor(object, propertyInfo) {
        super(object, propertyInfo);
        this.$details = null;
        this.cssClassName = "object-list-panel";
        this.otherCssClasses.push("ui-widget-content");
        this.setUniqueId();
        this.setIds();
        this._constructorName = "GuiObjectListComponent";
        this.currentDetailComponent = null;
        const uiInfo = propertyInfo.uniqueIdInfo;
        //    uiInfo.manager.addUniqueIdListener(uiInfo.namespace, this);
    }
    componentRemoved() {
        GuiAbstractListComponent.prototype.componentRemoved.call(this);
        const uiInfo = this.propertyInfo.uniqueIdInfo;
        //    uiInfo.manager.removeUniqueIdListener(uiInfo.namespace, this);
        if (this.currentDetailComponent) {
            this.currentDetailComponent.componentRemoved();
        }
    }
    getHtmlContentBeforeChildren(resultArr) {
        GuiAbstractListComponent.prototype.getHtmlContentBeforeChildren.call(this, resultArr);
        // Details panel
        resultArr.push("<div ");
        resultArr.push("id=\"" + this.detailsId + "\" ");
        resultArr.push(">\n");
        resultArr.push("</div>\n");
    }
    jQueryCreated($localRoot) {
        GuiAbstractListComponent.prototype.jQueryCreated.call(this, $localRoot);
        this.$details = this.$component.find("#" + this.detailsId);
    }
    itemAppended($newItem, newValue) {
        GuiAbstractListComponent.prototype.itemAppended.call(this, $newItem, newValue);
        this.callChangeListeners();
    }
    deleteSelectedItems() {
        GuiAbstractListComponent.prototype.deleteSelectedItems.call(this);
        this.updateDetailsPanel();
        this.callChangeListeners();
    }
    removeDetailComponent() {
        if (this.currentDetailComponent) {
            //        this.propertyInfo.
            this.currentDetailComponent.componentRemoved();
            this.currentDetailComponent = null;
        }
    }
    updateDetailsPanel() {
        const selectedArr = this.getSelectedItems();
        const comp = this;
        const propInfo = this.propertyInfo;
        if (selectedArr.length == 1) {
            const item = selectedArr[0];
            const valueItem = $(item).data("value");
            if (valueItem) {
                this.$details.empty();
                // Create or get the details component
                //            logit("Creating details component with parentPropInfo " + propInfo + "<br />");
                let instanceText = null;
                const constructorInfos = propInfo.listInfo.constructorInfos;
                if (constructorInfos.length > 1) {
                    for (let i = 0; i < constructorInfos.length; i++) {
                        const ci = constructorInfos[i];
                        if (ci.nameIsConstructor && ci.name == valueItem._constructorName) {
                            instanceText = ci.text;
                            break;
                        }
                    }
                }
                const newComponent = new GuiPropertiesComponent({
                    propertyInfoProvider: propInfo.propertyInfoProvider,
                    object: valueItem,
                    parentPropertyInfo: propInfo,
                    componentRegisters: propInfo.componentRegisters
                });
                const that = this;
                newComponent.changeListeners.push(function (c, oldValue, newValue) {
                    that.callChangeListeners();
                    const items = that.getSelectedItems();
                    for (let i = 0; i < items.length; i++) {
                        const item = items[i];
                        const valueItem = $(item).data("value");
                        const rArr = [];
                        that.getListItemContentHtml(valueItem, rArr);
                        //                            logit("new item html " + rArr.join(""));
                        $(item).find(".object-list-item-content")[0].innerHTML = rArr.join("");
                    }
                });
                this.$details.show();
                newComponent.spawn(this.$details);
                if (instanceText) {
                    newComponent.$component.prepend($("<div><p>" + instanceText + "</p></div>"));
                }
                newComponent.alignComponents();
                // Make sure that the previous detail component knows about its removal
                this.removeDetailComponent();
                this.currentDetailComponent = newComponent;
                // Show the details
            }
        }
        else {
            // Hide all details
            this.$details.empty();
            this.removeDetailComponent();
        }
    }
    listItemSelected(event, ui) {
        GuiAbstractListComponent.prototype.listItemSelected.call(this, event, ui);
        this.updateDetailsPanel();
    }
    listItemUnselected(event, ui) {
        GuiAbstractListComponent.prototype.listItemUnselected.call(this, event, ui);
        this.updateDetailsPanel();
    }
}
<commit_msg>use es6 classes<commit_after>class GuiObjectListComponent extends GuiAbstractListComponent {
    constructor(object, propertyInfo) {
        super(object, propertyInfo);
        this.$details = null;
        this.cssClassName = "object-list-panel";
        this.otherCssClasses.push("ui-widget-content");
        this.setUniqueId();
        this.setIds();
        this._constructorName = "GuiObjectListComponent";
        this.currentDetailComponent = null;
    }
    componentRemoved() {
        suepr.componentRemoved();
        if (this.currentDetailComponent) {
            this.currentDetailComponent.componentRemoved();
        }
    }
    getHtmlContentBeforeChildren(resultArr) {
        super.getHtmlContentBeforeChildren(resultArr);
        // Details panel
        resultArr.push("<div ");
        resultArr.push("id=\"" + this.detailsId + "\" ");
        resultArr.push(">\n");
        resultArr.push("</div>\n");
    }
    jQueryCreated($localRoot) {
        super.jQueryCreated($localRoot);
        this.$details = this.$component.find("#" + this.detailsId);
    }
    itemAppended($newItem, newValue) {
        super.itemAppended($newItem, newValue);
        this.callChangeListeners();
    }
    deleteSelectedItems() {
        super.deleteSelectedItems(this);
        this.updateDetailsPanel();
        this.callChangeListeners();
    }
    removeDetailComponent() {
        if (this.currentDetailComponent) {
            this.currentDetailComponent.componentRemoved();
            this.currentDetailComponent = null;
        }
    }
    updateDetailsPanel() {
        const selectedArr = this.getSelectedItems();
        const propInfo = this.propertyInfo;
        if (selectedArr.length == 1) {
            const item = selectedArr[0];
            const valueItem = $(item).data("value");
            if (valueItem) {
                this.$details.empty();
                // Create or get the details component
                //            logit("Creating details component with parentPropInfo " + propInfo + "<br />");
                let instanceText = null;
                const constructorInfos = propInfo.listInfo.constructorInfos;
                if (constructorInfos.length > 1) {
                    for (let i = 0; i < constructorInfos.length; i++) {
                        const ci = constructorInfos[i];
                        if (ci.nameIsConstructor && ci.name == valueItem._constructorName) {
                            instanceText = ci.text;
                            break;
                        }
                    }
                }
                const newComponent = new GuiPropertiesComponent({
                    propertyInfoProvider: propInfo.propertyInfoProvider,
                    object: valueItem,
                    parentPropertyInfo: propInfo,
                    componentRegisters: propInfo.componentRegisters
                });
                const that = this;
                newComponent.changeListeners.push(function (c, oldValue, newValue) {
                    that.callChangeListeners();
                    const items = that.getSelectedItems();
                    for (let i = 0; i < items.length; i++) {
                        const item = items[i];
                        const valueItem = $(item).data("value");
                        const rArr = [];
                        that.getListItemContentHtml(valueItem, rArr);
                        //                            logit("new item html " + rArr.join(""));
                        $(item).find(".object-list-item-content")[0].innerHTML = rArr.join("");
                    }
                });
                this.$details.show();
                newComponent.spawn(this.$details);
                if (instanceText) {
                    newComponent.$component.prepend($("<div><p>" + instanceText + "</p></div>"));
                }
                newComponent.alignComponents();
                // Make sure that the previous detail component knows about its removal
                this.removeDetailComponent();
                this.currentDetailComponent = newComponent;
                // Show the details
            }
        }
        else {
            // Hide all details
            this.$details.empty();
            this.removeDetailComponent();
        }
    }
    listItemSelected(event, ui) {
        super.listItemSelected(event, ui);
        this.updateDetailsPanel();
    }
    listItemUnselected(event, ui) {
        super.listItemUnselected(event, ui);
        this.updateDetailsPanel();
    }
}

{'fraction_non_alphanumeric': 0.10727496917385944, 'fraction_numerical': 0.0013357994245787094, 'mean_word_length': 1.6797907488986785, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4795630', 'n_tokens_mistral': 2385, 'n_tokens_neox': 2296, 'n_words': 417}