<commit_before>Ext.namespace("Gemma");

/**
 * 
 * @class Gemma.MGEDCombo
 * @extends Ext.form.ComboBox
 */
Gemma.MGEDCombo = Ext.extend(Ext.form.ComboBox, {

			editable : true,
			mode : 'local',
			selectOnFocus : true,
			triggerAction : 'all',
			typeAhead : true,
			forceSelection : true,
			displayField : 'term',

			record : Ext.data.Record.create([{
						name : "uri"
					}, {
						name : "term"
					}, {
						name : "comment"
					}]),

			getTerm : function() {
				return this.selectedTerm;
			},

			initComponent : function() {
				if (this.termKey) {
					this.dwrMethod = MgedOntologyService.getMgedTermsByKey;
					this.dwrParams = [this.termKey];
				} else {
					this.dwrMethod = MgedOntologyService.getUsefulMgedTerms;
					this.dwrParams = [];
				}

				this.store = new Ext.data.Store({
							proxy : new Ext.data.DWRProxy(this.dwrMethod),
							reader : new Ext.data.ListRangeReader({
										id : "uri"
									}, this.record),
							remoteSort : false,
							sortInfo : {
								field : "term"
							}
						});

				Gemma.MGEDCombo.superclass.initComponent.call(this);

				// this.tpl = new Ext.XTemplate('<tpl for="."><div ext:qtip="{comment}<br/>{uri}"
				// class="x-combo-list-item">{term}</div></tpl>');
				// this.tpl.compile();

				this.on("select", function(combo, record, index) {
							this.selectedTerm = record.data;
						});<commit_msg>fix for 1927 - select on blur<commit_after>Ext.namespace("Gemma");

/**
 * Dropdown menu of MGED categories to use in annotations
 * 
 * @class Gemma.MGEDCombo
 * @extends Ext.form.ComboBox
 * @version $Id$
 */
Gemma.MGEDCombo = Ext.extend(Ext.form.ComboBox, {

			editable : true,
			mode : 'local',
			selectOnFocus : true,
			triggerAction : 'all',
			typeAhead : true,
			forceSelection : true,
			displayField : 'term',

			record : Ext.data.Record.create([{
						name : "uri"
					}, {
						name : "term"
					}, {
						name : "comment"
					}]),

			getTerm : function() {
				return this.selectedTerm;
			},

			initComponent : function() {
				if (this.termKey) {
					this.dwrMethod = MgedOntologyService.getMgedTermsByKey;
					this.dwrParams = [this.termKey];
				} else {
					this.dwrMethod = MgedOntologyService.getUsefulMgedTerms;
					this.dwrParams = [];
				}

				this.store = new Ext.data.Store({
							proxy : new Ext.data.DWRProxy(this.dwrMethod),
							reader : new Ext.data.ListRangeReader({
										id : "uri"
									}, this.record),
							remoteSort : false,
							sortInfo : {
								field : "term"
							}
						});

				Gemma.MGEDCombo.superclass.initComponent.call(this);

				// so that tabbing away still results in a 'select'. I wish there was a better way to do this.
				this.on("change", function(combo) {
							if (this.getValue()) {
								var ix = this.getStore().find("term", this.getValue());
								var rec = this.getStore().getAt(ix);
								this.select(ix, true);
								this.fireEvent('select', this, rec, ix);
							}
						});

				this.on("select", function(combo, record, index) {
							this.selectedTerm = record.data;
						});
{'fraction_non_alphanumeric': 0.15106520335700452, 'fraction_numerical': 0.0012911555842479018, 'mean_word_length': 2.4017563117453347, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '1371298', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1041, 'n_words': 197}