@@ -34,7 +34,7 @@ define([
3434this . config . sizeLevel = 1 ;
3535
3636this . state = {
37- subsetEditor : undefined ,
37+ vp_instanceVariable : '' ,
3838variable :{
3939stack :[ ]
4040} ,
@@ -43,6 +43,8 @@ define([
4343 ...this . state
4444}
4545this . pointer = this . state . variable ;
46+ this . subsetEditor = null ;
47+ this . insEditor = null ;
4648
4749this . _addCodemirror ( 'vp_instanceVariable' , this . wrapSelector ( '#vp_instanceVariable' ) , 'readonly' ) ;
4850}
@@ -173,7 +175,9 @@ define([
173175}
174176
175177templateForBody ( ) {
176- return insHtml ;
178+ let page = $ ( insHtml ) ;
179+ $ ( page ) . find ( '#vp_instanceVariable' ) . val ( this . state . vp_instanceVariable ) ;
180+ return page ;
177181}
178182
179183render ( ) {
@@ -182,25 +186,25 @@ define([
182186let that = this ;
183187
184188// vpSubsetEditor
185- this . state . subsetEditor = new Subset ( { pandasObject :'' , config :{ name :'Subset' } } ,
189+ this . subsetEditor = new Subset ( { pandasObject :'' , config :{ name :'Subset' } } ,
186190{
187191useInputVariable :true ,
188192targetSelector :this . wrapSelector ( '#vp_instanceVariable' ) ,
189193pageThis :this ,
190194finish :function ( code ) {
191195that . addStack ( ) ;
192- that . state . subsetEditor . state . pandasObject = code ;
196+ that . subsetEditor . state . pandasObject = code ;
193197that . updateValue ( code ) ;
194198}
195199} ) ;
196- this . state . subsetEditor . disableButton ( ) ;
200+ this . subsetEditor . disableButton ( ) ;
197201
198- this . ALLOW_SUBSET_TYPES = this . state . subsetEditor . getAllowSubsetTypes ( ) ;
202+ this . ALLOW_SUBSET_TYPES = this . subsetEditor . getAllowSubsetTypes ( ) ;
199203
200204// vpInstanceEditor
201- this . state . variable . insEditor = new InstanceEditor ( this , "vp_instanceVariable" , 'vp_variableInsEditContainer' ) ;
205+ this . insEditor = new InstanceEditor ( this , "vp_instanceVariable" , 'vp_variableInsEditContainer' ) ;
202206
203- this . state . variable . insEditor . show ( ) ;
207+ this . insEditor . show ( ) ;
204208
205209// variable load
206210this . reloadInsEditor ( ) ;
@@ -232,17 +236,17 @@ define([
232236
233237hide ( ) {
234238super . hide ( ) ;
235- this . state . subsetEditor && this . state . subsetEditor . hide ( ) ;
239+ this . subsetEditor && this . subsetEditor . hide ( ) ;
236240}
237241
238242close ( ) {
239243super . close ( ) ;
240- this . state . subsetEditor && this . state . subsetEditor . close ( ) ;
244+ this . subsetEditor && this . subsetEditor . close ( ) ;
241245}
242246
243247remove ( ) {
244248super . remove ( ) ;
245- this . state . subsetEditor && this . state . subsetEditor . remove ( ) ;
249+ this . subsetEditor && this . subsetEditor . remove ( ) ;
246250}
247251
248252updateValue ( value ) {
@@ -254,6 +258,7 @@ define([
254258cm . focus ( ) ;
255259cm . setCursor ( { line :0 , ch :value . length } ) ;
256260}
261+ this . state . vp_instanceVariable = value ;
257262}
258263
259264addStack ( ) {
@@ -287,22 +292,17 @@ define([
287292var varType = varObj . type ;
288293
289294if ( that . ALLOW_SUBSET_TYPES . includes ( varType ) ) {
290- that . state . subsetEditor . state . dataType = varType ;
295+ that . subsetEditor . state . dataType = varType ;
291296let cmObj = that . getCodemirror ( 'vp_instanceVariable' ) ;
292297let nowCode = ( cmObj && cmObj . cm ) ?cmObj . cm . getValue ( ) :'' ;
293- that . state . subsetEditor . state . pandasObject = nowCode ;
294- that . state . subsetEditor . enableButton ( ) ;
298+ that . subsetEditor . state . pandasObject = nowCode ;
299+ that . subsetEditor . enableButton ( ) ;
295300} else {
296- that . state . subsetEditor . disableButton ( ) ;
301+ that . subsetEditor . disableButton ( ) ;
297302}
298303} ;
299304
300- if ( type == '' ) {
301- this . pointer . insEditor . reload ( callbackFunction ) ;
302- } else {
303- tempPointer = this . state [ type ] ;
304- this . state [ type ] . insEditor . reload ( callbackFunction ) ;
305- }
305+ this . insEditor . reload ( callbackFunction ) ;
306306}
307307}
308308