<commit_before>dojo.provide("org.ppwcode.dojo.dijit.form._FormDataViewBox");

dojo.require("org.ppwcode.dojo.dijit.form._DataViewBox");
dojo.require("dijit.form._FormWidget");

dojo.declare(
	"org.ppwcode.dojo.dijit.form._FormDataViewBox",
	[dijit.form._FormValueWidget, org.ppwcode.dojo.dijit.form._DataViewBox],
	{
		_selectable: true,
		_resizeeventhandle: null,
		
		postCreate: function() {
			this.inherited(arguments);
			this._overrideGridCanEdit();
			this._connectToParentContainer();
		},

		_overrideGridCanEdit: function() {
			//DataGrid's editable status depends on the Write capability
			//of its data store,  in our case, the write capability
			//also depends on the _selectabe variable.  so we do some nasty
			//stuff to 
			var oldCanEdit = this._masterGrid.canEdit;
			var f = dojo.hitch(this._masterGrid, oldCanEdit);
			var g = dojo.hitch(this, this.getSelectable);
			this._masterGrid.canEdit = function() {
				return (f() && g());
			};
		},
		
		_connectToParentContainer: function() {
			// summary:
			//   connect to a container up in the DOM tree so we can redraw
			//   ourselves upon resizing of the parent container
			// description:
			//   this is a hack :/... It's the only way I found to redraw
			//   the grid if resize events other than the window resize
			//   events occur.
			var potentialNode = this.domNode.parentNode;
			var found = false, nodesdijit = null;
			while (!found && potentialNode != dojo.body()) {
				nodesdijit = dijit.byNode(potentialNode);
				if ( nodesdijit && ( (nodesdijit instanceof dijit.layout._LayoutWidget) 
			        	             || (nodesdijit instanceof dijit.layout.ContentPane) )    
			       ) {
				  found = true;
				} else {
                  potentialNode = potentialNode.parentNode;
				}
			}
			if (found) {
				//console.log("PpwDataViewBox._connectToParentContainer(): potentialNode is " + potentialNode);
				//console.log("PpwDataViewBox._connectToParentContainer(): dijit is " + nodesdijit);
				this._resizeeventhandle = dojo.connect(nodesdijit, "resize", this, "layout");
			} // else {
			//	console.log("PpwDataViewBox._connectToParentContainer(): nothing found");
			//}<commit_msg>removing references to Ppw prefix<commit_after>dojo.provide("org.ppwcode.dojo.dijit.form._FormDataViewBox");

dojo.require("org.ppwcode.dojo.dijit.form._DataViewBox");
dojo.require("dijit.form._FormWidget");

dojo.declare(
	"org.ppwcode.dojo.dijit.form._FormDataViewBox",
	[dijit.form._FormValueWidget, org.ppwcode.dojo.dijit.form._DataViewBox],
	{
		_selectable: true,
		_resizeeventhandle: null,
		
		postCreate: function() {
			this.inherited(arguments);
			this._overrideGridCanEdit();
			this._connectToParentContainer();
		},

		_overrideGridCanEdit: function() {
			//DataGrid's editable status depends on the Write capability
			//of its data store,  in our case, the write capability
			//also depends on the _selectabe variable.  so we do some nasty
			//stuff to 
			var oldCanEdit = this._masterGrid.canEdit;
			var f = dojo.hitch(this._masterGrid, oldCanEdit);
			var g = dojo.hitch(this, this.getSelectable);
			this._masterGrid.canEdit = function() {
				return (f() && g());
			};
		},
		
		_connectToParentContainer: function() {
			// summary:
			//   connect to a container up in the DOM tree so we can redraw
			//   ourselves upon resizing of the parent container
			// description:
			//   this is a hack :/... It's the only way I found to redraw
			//   the grid if resize events other than the window resize
			//   events occur.
			var potentialNode = this.domNode.parentNode;
			var found = false, nodesdijit = null;
			while (!found && potentialNode != dojo.body()) {
				nodesdijit = dijit.byNode(potentialNode);
				if ( nodesdijit && ( (nodesdijit instanceof dijit.layout._LayoutWidget) 
			        	             || (nodesdijit instanceof dijit.layout.ContentPane) )    
			       ) {
				  found = true;
				} else {
                  potentialNode = potentialNode.parentNode;
				}
			}
			if (found) {
				//console.log("_FormDataViewBox._connectToParentContainer(): potentialNode is " + potentialNode);
				//console.log("_FormDataViewBox._connectToParentContainer(): dijit is " + nodesdijit);
				this._resizeeventhandle = dojo.connect(nodesdijit, "resize", this, "layout");
			} // else {
			//	console.log("_FormDataViewBox._connectToParentContainer(): nothing found");
			//}
{'fraction_non_alphanumeric': 0.12181818181818181, 'fraction_numerical': 0.0, 'mean_word_length': 3.2114832535885167, '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': '264174', 'n_tokens_mistral': 1613, 'n_tokens_neox': 1395, 'n_words': 322}