<commit_before>define([
	"dojo/_base/declare", "dojo/_base/lang", "dojo/on", "dojo/topic", "dojo/dom-construct",
	"dijit/layout/BorderContainer",  "dijit/layout/TabContainer", "dijit/layout/StackContainer", "dijit/layout/TabController", "dijit/layout/ContentPane",
	"dijit/form/RadioButton", "dijit/form/Textarea", "dijit/form/TextBox", "dijit/form/Button", "dijit/form/Select",
	"./ActionBar", "./ContainerActionBar",
	"./GeneExpressionGridContainer", "./GeneExpressionChartContainer", "./GeneExpressionMetadataChartContainer",  "dijit/TooltipDialog", "dijit/Dialog", "dijit/popup"
], function(declare, lang, on, Topic, domConstruct,
			BorderContainer, TabContainer, StackContainer, TabController, ContentPane,
			RadioButton, TextArea, TextBox, Button, Select,
			ActionBar, ContainerActionBar,
			GeneExpressionGridContainer, GeneExpressionChartContainer, GeneExpressionMetadataChartContainer, TooltipDialog, Dialog, popup){

	return declare([BorderContainer], {
		id: "GEContainer",
		gutters: false,
		state: null,
		tgState: null,
		apiServer: window.App.dataServiceURL,
		constructor: function(){
			var self = this;

			Topic.subscribe("GeneExpression", lang.hitch(self, function(){
				console.log("GeneExpression:", arguments);
				var key = arguments[0], value = arguments[1];

				switch(key){
					case "updateTgState":
						self.tgState = value;
						break;
					default:
						break;
				}
			}));
		},
		onSetState: function(attr, oldVal, state){
			console.log("GeneExpressionGridContainer onSetState set state: ", state);
			if (!state){ return; }
			if(this.GeneExpressionGridContainer){
				this.GeneExpressionGridContainer.set('state', state);
			}
			if(this.GeneExpressionChartContainer){
				this.GeneExpressionChartContainer.set('state', state);
			}
			if(this.GeneExpressionMetadataChartContainer){
				this.GeneExpressionMetadataChartContainer.set('state', state);
			}
			this._set('state', state);
		},

		visible: false,
		_setVisibleAttr: function(visible){
			this.visible = visible;

			if(this.visible && !this._firstView){
				this.onFirstView();
			}
			if(this.GeneExpressionGridContainer){
				this.GeneExpressionGridContainer.set('visible', true);
			}
		},

		onFirstView: function(){
			if(this._firstView){
				return;
			}

			var filterPanel = this._buildFilterPanel();

			console.log("GeneExpressionGridContainer onFirstView: this", this);
			console.log("GeneExpressionGridContainer onFirstView after _buildFilterPanel(): this.tgState", this.tgState);
			this.tabContainer = new StackContainer({region: "center", id: this.id + "_TabContainer"});
			var tabController = new TabController({
				containerId: this.id + "_TabContainer",
				region: "top",
				"class": "TextTabButtons"
			});

			// for charts
			// outer BorderContainer
			var bc1 = new BorderContainer({
				region: "top",
				title: "Chart",
				style: "height: 350px;",
				gutters: false
			});

			var bc = new BorderContainer({
				region: "top",
				title: "Chart",
				style: "height: 350px;"
			});

			console.log("Before creating GeneExpressionChartContainer", this);

			var chartContainer1 = new GeneExpressionChartContainer({
				region: "leading", style: "height: 350px; width: 500px;", doLayout: false, id: this.id + "_chartContainer1",
				//region: "leading", style: "width: 500px;", doLayout: false, id: this.id + "_chartContainer1",
				title: "Chart",
				content: "Gene Expression Chart",
				state: this.state,
				tgtate: this.tgState,
				apiServer: this.apiServer
			});
			chartContainer1.startup();

			var chartContainer2 = new GeneExpressionMetadataChartContainer({
				region: "leading", style: "height: 350px; width: 500px;", doLayout: false, id: this.id + "_chartContainer2",
				//region: "leading", style: "width: 500px;", doLayout: false, id: this.id + "_chartContainer2",
				title: "Chart",
				content: "Gene Expression Metadata Chart",
				state: this.state,
				tgtate: this.tgState,
				apiServer: this.apiServer
			});
			chartContainer2.startup();

			//console.log("onFirstView new GeneExpressionGridContainer state: ", this.state);
			//console.log(" onFirstView new GeneExpressionGridContainer this.apiServer: ", this.apiServer);

			// for data grid
			
			this.GeneExpressionGridContainer = new GeneExpressionGridContainer({
				title: "Table",
				content: "Gene Expression Table",
				state: this.state,
				apiServer: this.apiServer
			});

			console.log("onFirstView create GeneExpressionGrid: ", this.GeneExpressionGridContainer);

			this.watch("state", lang.hitch(this, "onSetState"));

			this.addChild(tabController);
			this.addChild(filterPanel);
			this.tabContainer.addChild(bc1);
			bc1.addChild(bc);
			bc.addChild(chartContainer1);
			bc.addChild(chartContainer2);
			this.tabContainer.addChild(this.GeneExpressionGridContainer);
			this.addChild(this.tabContainer);
			
			this.inherited(arguments);
			this._firstView = true;
			//console.log("new GeneExpressionGridContainer arguments: ", arguments);
		},

		_buildFilterPanel: function(){
<commit_msg>fix table view of gene expression viewer<commit_after>define([
	"dojo/_base/declare", "dojo/_base/lang", "dojo/on", "dojo/topic", "dojo/dom-construct",
	"dijit/layout/BorderContainer",  "dijit/layout/TabContainer", "dijit/layout/StackContainer", "dijit/layout/TabController", "dijit/layout/ContentPane",
	"dijit/form/RadioButton", "dijit/form/Textarea", "dijit/form/TextBox", "dijit/form/Button", "dijit/form/Select",
	"./ActionBar", "./ContainerActionBar",
	"./GeneExpressionGridContainer", "./GeneExpressionChartContainer", "./GeneExpressionMetadataChartContainer",  "dijit/TooltipDialog", "dijit/Dialog", "dijit/popup"
], function(declare, lang, on, Topic, domConstruct,
			BorderContainer, TabContainer, StackContainer, TabController, ContentPane,
			RadioButton, TextArea, TextBox, Button, Select,
			ActionBar, ContainerActionBar,
			GeneExpressionGridContainer, GeneExpressionChartContainer, GeneExpressionMetadataChartContainer, TooltipDialog, Dialog, popup){

	return declare([BorderContainer], {
		id: "GEContainer",
		gutters: false,
		state: null,
		tgState: null,
		apiServer: window.App.dataServiceURL,
		constructor: function(){
			var self = this;

			Topic.subscribe("GeneExpression", lang.hitch(self, function(){
				console.log("GeneExpression:", arguments);
				var key = arguments[0], value = arguments[1];

				switch(key){
					case "updateTgState":
						self.tgState = value;
						break;
					default:
						break;
				}
			}));
		},
		onSetState: function(attr, oldVal, state){
			console.log("GeneExpressionGridContainer onSetState set state: ", state);
			if (!state){ return; }
			if(this.GeneExpressionGridContainer){
				this.GeneExpressionGridContainer.set('state', state);
			}
			if(this.GeneExpressionChartContainer){
				this.GeneExpressionChartContainer.set('state', state);
			}
			if(this.GeneExpressionMetadataChartContainer){
				this.GeneExpressionMetadataChartContainer.set('state', state);
			}
			this._set('state', state);
		},

		visible: false,
		_setVisibleAttr: function(visible){
			this.visible = visible;

			if(this.visible && !this._firstView){
				this.onFirstView();
			}
		},

		onFirstView: function(){
			if(this._firstView){
				return;
			}

			var filterPanel = this._buildFilterPanel();

			console.log("GeneExpressionGridContainer onFirstView: this", this);
			console.log("GeneExpressionGridContainer onFirstView after _buildFilterPanel(): this.tgState", this.tgState);
			this.tabContainer = new StackContainer({region: "center", id: this.id + "_TabContainer"});
			var tabController = new TabController({
				containerId: this.id + "_TabContainer",
				region: "top",
				"class": "TextTabButtons"
			});



			// for charts
			// outer BorderContainer
			var bc1 = new BorderContainer({
				region: "top",
				title: "Chart",
				style: "height: 350px;",
				gutters: false
			});

			var bc = new BorderContainer({
				region: "top",
				title: "Chart",
				style: "height: 350px;"
			});

			console.log("Before creating GeneExpressionChartContainer", this);

			var chartContainer1 = new GeneExpressionChartContainer({
				region: "leading", style: "height: 350px; width: 500px;", doLayout: false, id: this.id + "_chartContainer1",
				//region: "leading", style: "width: 500px;", doLayout: false, id: this.id + "_chartContainer1",
				title: "Chart",
				content: "Gene Expression Chart",
				state: this.state,
				tgtate: this.tgState,
				apiServer: this.apiServer
			});
			chartContainer1.startup();

			var chartContainer2 = new GeneExpressionMetadataChartContainer({
				region: "leading", style: "height: 350px; width: 500px;", doLayout: false, id: this.id + "_chartContainer2",
				//region: "leading", style: "width: 500px;", doLayout: false, id: this.id + "_chartContainer2",
				title: "Chart",
				content: "Gene Expression Metadata Chart",
				state: this.state,
				tgtate: this.tgState,
				apiServer: this.apiServer
			});
			chartContainer2.startup();

			//console.log("onFirstView new GeneExpressionGridContainer state: ", this.state);
			//console.log(" onFirstView new GeneExpressionGridContainer this.apiServer: ", this.apiServer);

			// for data grid
			
			this.GeneExpressionGridContainer = new GeneExpressionGridContainer({
				title: "Table",
				content: "Gene Expression Table"
			});

			console.log("onFirstView create GeneExpressionGrid: ", this.GeneExpressionGridContainer);

			this.watch("state", lang.hitch(this, "onSetState"));

			this.addChild(tabController);
			this.addChild(filterPanel);
			this.tabContainer.addChild(bc1);
			bc1.addChild(bc);
			bc.addChild(chartContainer1);
			bc.addChild(chartContainer2);
			this.tabContainer.addChild(this.GeneExpressionGridContainer);
			this.addChild(this.tabContainer);
			
			Topic.subscribe(this.id+"_TabContainer-selectChild", lang.hitch(this,function(page){
				page.set('state', this.state)
				page.set('visible', true);
			}));
			this.inherited(arguments);
			this._firstView = true;
			//console.log("new GeneExpressionGridContainer arguments: ", arguments);
		},

		_buildFilterPanel: function(){

{'fraction_non_alphanumeric': 0.13943592281048986, 'fraction_numerical': 0.007718951014349332, 'mean_word_length': 4.480477223427332, 'pattern_counts': {'":': 4, '<': 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': '6880148', 'n_tokens_mistral': 3719, 'n_tokens_neox': 3017, 'n_words': 633}