<commit_before>define( [
    "dojo/_base/declare",
    "dijit/form/CheckBox",
    "../../../../locale/Dictionary",
    "../../../_include/_HelpMixin",
    "./_AttributeWidgetMixin"
],
function(
    declare,
    CheckBox,
    Dict,
    _HelpMixin,
    _AttributeWidgetMixin
) {
    return declare([CheckBox, _HelpMixin, _AttributeWidgetMixin], {

        inputType: null, // control description as string as used in Factory.getControlClass()
        entity: {},

        constructor: function(args) {
            declare.safeMixin(this, args);

            this.label = Dict.translate(this.name);
            this.checked = this.value == 1; // value may be string or number
        },

        _getValueAttr: function() {
            return this.get("checked") ? "1" : "0";
        }
    });
});<commit_msg>Fix: BinaryCheckBox did not listen to entity changes<commit_after>define( [
    "dojo/_base/declare",
    "dojo/_base/lang",
    "dojo/topic",
    "dijit/form/CheckBox",
    "../../../../locale/Dictionary",
    "../../../_include/_HelpMixin",
    "./_AttributeWidgetMixin"
],
function(
    declare,
    lang,
    topic,
    CheckBox,
    Dict,
    _HelpMixin,
    _AttributeWidgetMixin
) {
    return declare([CheckBox, _HelpMixin, _AttributeWidgetMixin], {

        inputType: null, // control description as string as used in Factory.getControlClass()
        entity: {},

        constructor: function(args) {
            declare.safeMixin(this, args);

            this.label = Dict.translate(this.name);
            this.checked = this.value == 1; // value may be string or number
        },

        postCreate: function() {
            this.inherited(arguments);

            this.own(
                topic.subscribe("entity-datachange", lang.hitch(this, function(data) {
                    if ((this.entity && this.entity.get('oid') === data.entity.get('oid')) &&
                            data.name === this.name) {
                        this.set("value", data.newValue);
                    }
                }))
            );
        },

        _getValueAttr: function() {
            return this.get("checked") ? "1" : "0";
        }
    });
});
{'fraction_non_alphanumeric': 0.1510824504836481, 'fraction_numerical': 0.0027637033625057578, 'mean_word_length': 1.8616600790513833, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5521570', 'n_tokens_mistral': 638, 'n_tokens_neox': 618, 'n_words': 122}