src/Builder4/PopoverFileDetails.bjs
[app.Builder.js] / src / Builder4 / PopoverFileDetails.vala
1 static Xcls_PopoverFileDetails  _PopoverFileDetails;
2
3 public class Xcls_PopoverFileDetails : Object
4 {
5     public Gtk.Popover el;
6     private Xcls_PopoverFileDetails  _this;
7
8     public static Xcls_PopoverFileDetails singleton()
9     {
10         if (_PopoverFileDetails == null) {
11             _PopoverFileDetails= new Xcls_PopoverFileDetails();
12         }
13         return _PopoverFileDetails;
14     }
15     public Xcls_filetype filetype;
16     public Xcls_ftdbcellrenderer ftdbcellrenderer;
17     public Xcls_ftdbmodel ftdbmodel;
18     public Xcls_name name;
19     public Xcls_title title;
20     public Xcls_region region;
21     public Xcls_parent parent;
22     public Xcls_permname permname;
23     public Xcls_modOrder modOrder;
24     public Xcls_build_module build_module;
25     public Xcls_dbcellrenderer dbcellrenderer;
26     public Xcls_dbmodel dbmodel;
27     public Xcls_save_btn save_btn;
28
29         // my vars (def)
30     public signal void success (Project.Project pr, JsRender.JsRender file);
31     public bool done;
32     public Project.Project project;
33     public JsRender.JsRender file;
34     public Xcls_MainWindow mainwindow;
35
36     // ctor
37     public Xcls_PopoverFileDetails()
38     {
39         _this = this;
40         this.el = new Gtk.Popover( null );
41
42         // my vars (dec)
43         this.done = false;
44         this.file = null;
45         this.mainwindow = null;
46
47         // set gobject values
48         this.el.border_width = 0;
49         this.el.modal = true;
50         this.el.position = Gtk.PositionType.RIGHT;
51         var child_0 = new Xcls_Box2( _this );
52         child_0.ref();
53         this.el.add (  child_0.el  );
54
55         //listeners
56         this.el.closed.connect( () => {
57           if (!this.done) {
58             _this.el.show();
59           
60           }
61         });
62     }
63
64     // user defined functions
65     public   void updateFileFromEntry () {
66     
67             _this.file.title = _this.title.el.get_text();
68             _this.file.region = _this.region.el.get_text();            
69             _this.file.parent = _this.parent.el.get_text();                        
70             _this.file.permname = _this.permname.el.get_text();                                    
71             _this.file.modOrder = _this.modOrder.el.get_text();
72             
73             if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
74                 _this.file.renameTo(_this.name.el.get_text());
75             }
76             // store the module...
77             _this.file.build_module = "";        
78              Gtk.TreeIter iter; 
79             if (_this.build_module.el.get_active_iter (out iter)) {
80                  Value vfname;
81                  this.dbmodel.el.get_value (iter, 0, out vfname);
82                  if (((string)vfname).length > 0) {
83                      _this.file.build_module = (string)vfname;
84                  }
85         
86             }
87             
88             
89     
90                                                         
91     }
92     public void show (JsRender.JsRender c, Gtk.Widget btn) 
93     {
94         this.project = c.project;
95         this.done = false;
96         
97         
98         //if (!this.el) {
99             //this.init();
100          //}
101         
102         _this.name.el.set_text(c.name);
103         _this.title.el.set_text(c.title);
104         _this.parent.el.set_text(c.parent);    
105         _this.region.el.set_text(c.region);
106         _this.modOrder.el.set_text(c.modOrder);
107          _this.permname.el.set_text(c.permname);
108         
109         _this.filetype.loadData();
110         
111         
112         if (c.path.length > 0) {
113         
114             this.save_btn.el.set_label("Save");
115         } else {
116             this.save_btn.el.set_label("Create");
117         }
118         
119          var ar = new Gee.ArrayList<string>();
120          _this.dbmodel.loadData(ar,"");
121         // load the modules... if relivant..
122         if (this.project.xtype == "Gtk") {
123             var p = (Project.Gtk)c.project;
124               var cg = p.compilegroups;
125     
126             var iter = cg.map_iterator();
127            while(iter.next()) {
128                 var key = iter.get_key();
129                 if (key == "_default_") {
130                     continue;
131                 }
132                 ar.add(key);
133             };
134             _this.dbmodel.loadData(ar, c.build_module);
135     
136         }
137         
138          
139         _this.file = c;
140         //console.log('show all');
141        this.el.set_modal(true);
142         this.el.set_relative_to(btn);
143     
144         this.el.set_position(Gtk.PositionType.RIGHT);
145         
146         // window + header?
147          print("SHOWALL - POPIP\n");
148         this.el.show_all();
149         this.name.el.grab_focus();
150         
151         //this.success = c.success;
152         
153         
154     }
155     public class Xcls_Box2 : Object
156     {
157         public Gtk.Box el;
158         private Xcls_PopoverFileDetails  _this;
159
160
161             // my vars (def)
162
163         // ctor
164         public Xcls_Box2(Xcls_PopoverFileDetails _owner )
165         {
166             _this = _owner;
167             this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
168
169             // my vars (dec)
170
171             // set gobject values
172             this.el.homogeneous = false;
173             var child_0 = new Xcls_HeaderBar3( _this );
174             child_0.ref();
175             this.el.pack_start (  child_0.el , false,true,0 );
176             var child_1 = new Xcls_Table4( _this );
177             child_1.ref();
178             this.el.pack_start (  child_1.el , false,false,4 );
179             var child_2 = new Xcls_HButtonBox25( _this );
180             child_2.ref();
181             this.el.pack_end (  child_2.el , false,true,0 );
182         }
183
184         // user defined functions
185     }
186     public class Xcls_HeaderBar3 : Object
187     {
188         public Gtk.HeaderBar el;
189         private Xcls_PopoverFileDetails  _this;
190
191
192             // my vars (def)
193
194         // ctor
195         public Xcls_HeaderBar3(Xcls_PopoverFileDetails _owner )
196         {
197             _this = _owner;
198             this.el = new Gtk.HeaderBar();
199
200             // my vars (dec)
201
202             // set gobject values
203             this.el.title = "Add / Edit File";
204         }
205
206         // user defined functions
207     }
208
209     public class Xcls_Table4 : Object
210     {
211         public Gtk.Table el;
212         private Xcls_PopoverFileDetails  _this;
213
214
215             // my vars (def)
216
217         // ctor
218         public Xcls_Table4(Xcls_PopoverFileDetails _owner )
219         {
220             _this = _owner;
221             this.el = new Gtk.Table( 7, 2, true );
222
223             // my vars (dec)
224
225             // set gobject values
226             this.el.margin_right = 4;
227             this.el.margin_left = 4;
228             this.el.row_spacing = 2;
229             var child_0 = new Xcls_Label5( _this );
230             child_0.ref();
231             this.el.attach_defaults (  child_0.el , 0,1,0,1 );
232             var child_1 = new Xcls_filetype( _this );
233             child_1.ref();
234             this.el.attach_defaults (  child_1.el , 1,2,0,1 );
235             var child_2 = new Xcls_Label9( _this );
236             child_2.ref();
237             this.el.attach_defaults (  child_2.el , 0,1,1,2 );
238             var child_3 = new Xcls_name( _this );
239             child_3.ref();
240             this.el.attach_defaults (  child_3.el , 1,2,1,2 );
241             var child_4 = new Xcls_Label11( _this );
242             child_4.ref();
243             this.el.attach_defaults (  child_4.el , 0,1,2,3 );
244             var child_5 = new Xcls_title( _this );
245             child_5.ref();
246             this.el.attach_defaults (  child_5.el , 1,2,2,3 );
247             var child_6 = new Xcls_Label13( _this );
248             child_6.ref();
249             this.el.attach_defaults (  child_6.el , 0,1,3,4 );
250             var child_7 = new Xcls_region( _this );
251             child_7.ref();
252             this.el.attach_defaults (  child_7.el , 1,2,3,4 );
253             var child_8 = new Xcls_Label15( _this );
254             child_8.ref();
255             this.el.attach_defaults (  child_8.el , 0,1,4,5 );
256             var child_9 = new Xcls_parent( _this );
257             child_9.ref();
258             this.el.attach_defaults (  child_9.el , 1,2,4,5 );
259             var child_10 = new Xcls_Label17( _this );
260             child_10.ref();
261             this.el.attach_defaults (  child_10.el , 0,1,5,6 );
262             var child_11 = new Xcls_permname( _this );
263             child_11.ref();
264             this.el.attach_defaults (  child_11.el , 1,2,5,6 );
265             var child_12 = new Xcls_Label19( _this );
266             child_12.ref();
267             this.el.attach_defaults (  child_12.el , 0,1,6,7 );
268             var child_13 = new Xcls_modOrder( _this );
269             child_13.ref();
270             this.el.attach_defaults (  child_13.el , 1,2,6,7 );
271             var child_14 = new Xcls_Label21( _this );
272             child_14.ref();
273             this.el.attach_defaults (  child_14.el , 0,1,7,8 );
274             var child_15 = new Xcls_build_module( _this );
275             child_15.ref();
276             this.el.attach_defaults (  child_15.el , 1,2,7,8 );
277         }
278
279         // user defined functions
280     }
281     public class Xcls_Label5 : Object
282     {
283         public Gtk.Label el;
284         private Xcls_PopoverFileDetails  _this;
285
286
287             // my vars (def)
288
289         // ctor
290         public Xcls_Label5(Xcls_PopoverFileDetails _owner )
291         {
292             _this = _owner;
293             this.el = new Gtk.Label( "File type" );
294
295             // my vars (dec)
296
297             // set gobject values
298             this.el.justify = Gtk.Justification.RIGHT;
299             this.el.xalign = 0.900000f;
300         }
301
302         // user defined functions
303     }
304
305     public class Xcls_filetype : Object
306     {
307         public Gtk.ComboBox el;
308         private Xcls_PopoverFileDetails  _this;
309
310
311             // my vars (def)
312
313         // ctor
314         public Xcls_filetype(Xcls_PopoverFileDetails _owner )
315         {
316             _this = _owner;
317             _this.filetype = this;
318             this.el = new Gtk.ComboBox();
319
320             // my vars (dec)
321
322             // set gobject values
323             var child_0 = new Xcls_ftdbcellrenderer( _this );
324             child_0.ref();
325             this.el.pack_start (  child_0.el , true );
326             var child_1 = new Xcls_ftdbmodel( _this );
327             child_1.ref();
328             this.el.set_model (  child_1.el  );
329
330             // init method
331
332             this.el.add_attribute(_this.ftdbcellrenderer.el , "markup", 1 );
333         }
334
335         // user defined functions
336     }
337     public class Xcls_ftdbcellrenderer : Object
338     {
339         public Gtk.CellRendererText el;
340         private Xcls_PopoverFileDetails  _this;
341
342
343             // my vars (def)
344
345         // ctor
346         public Xcls_ftdbcellrenderer(Xcls_PopoverFileDetails _owner )
347         {
348             _this = _owner;
349             _this.ftdbcellrenderer = this;
350             this.el = new Gtk.CellRendererText();
351
352             // my vars (dec)
353
354             // set gobject values
355         }
356
357         // user defined functions
358     }
359
360     public class Xcls_ftdbmodel : Object
361     {
362         public Gtk.ListStore el;
363         private Xcls_PopoverFileDetails  _this;
364
365
366             // my vars (def)
367
368         // ctor
369         public Xcls_ftdbmodel(Xcls_PopoverFileDetails _owner )
370         {
371             _this = _owner;
372             _this.ftdbmodel = this;
373             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
374
375             // my vars (dec)
376
377             // set gobject values
378         }
379
380         // user defined functions
381         public void loadData (Gee.ArrayList<string> data, string cur) {
382             this.el.clear();                                    
383             Gtk.TreeIter iter;
384             var el = this.el;
385             
386            /// el.append(out iter);
387             
388              
389            // el.set_value(iter, 0, "");
390            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
391         
392             el.append(out iter);
393         
394             
395             el.set_value(iter, 0, "bjs");
396             el.set_value(iter, 1, "User Interface File (bjs)");
397             _this.filetype.el.set_active_iter(iter);
398         
399             el.append(out iter);
400             
401             el.set_value(iter, 0, "vala");
402             el.set_value(iter, 1, "Vala");
403         
404         
405         
406         
407             el.append(out iter);
408             
409             el.set_value(iter, 0, "js");
410             el.set_value(iter, 1, "Javascript");
411         
412         
413         
414             el.append(out iter);
415             
416             el.set_value(iter, 0, "css");
417             el.set_value(iter, 1, "CSS");
418         
419                                              
420         }
421     }
422
423
424     public class Xcls_Label9 : Object
425     {
426         public Gtk.Label el;
427         private Xcls_PopoverFileDetails  _this;
428
429
430             // my vars (def)
431
432         // ctor
433         public Xcls_Label9(Xcls_PopoverFileDetails _owner )
434         {
435             _this = _owner;
436             this.el = new Gtk.Label( "Component Name" );
437
438             // my vars (dec)
439
440             // set gobject values
441             this.el.justify = Gtk.Justification.RIGHT;
442             this.el.xalign = 0.900000f;
443         }
444
445         // user defined functions
446     }
447
448     public class Xcls_name : Object
449     {
450         public Gtk.Entry el;
451         private Xcls_PopoverFileDetails  _this;
452
453
454             // my vars (def)
455
456         // ctor
457         public Xcls_name(Xcls_PopoverFileDetails _owner )
458         {
459             _this = _owner;
460             _this.name = this;
461             this.el = new Gtk.Entry();
462
463             // my vars (dec)
464
465             // set gobject values
466             this.el.visible = true;
467         }
468
469         // user defined functions
470     }
471
472     public class Xcls_Label11 : Object
473     {
474         public Gtk.Label el;
475         private Xcls_PopoverFileDetails  _this;
476
477
478             // my vars (def)
479
480         // ctor
481         public Xcls_Label11(Xcls_PopoverFileDetails _owner )
482         {
483             _this = _owner;
484             this.el = new Gtk.Label( "Title" );
485
486             // my vars (dec)
487
488             // set gobject values
489             this.el.justify = Gtk.Justification.RIGHT;
490             this.el.xalign = 0.900000f;
491             this.el.visible = true;
492         }
493
494         // user defined functions
495     }
496
497     public class Xcls_title : Object
498     {
499         public Gtk.Entry el;
500         private Xcls_PopoverFileDetails  _this;
501
502
503             // my vars (def)
504
505         // ctor
506         public Xcls_title(Xcls_PopoverFileDetails _owner )
507         {
508             _this = _owner;
509             _this.title = this;
510             this.el = new Gtk.Entry();
511
512             // my vars (dec)
513
514             // set gobject values
515             this.el.visible = true;
516         }
517
518         // user defined functions
519     }
520
521     public class Xcls_Label13 : Object
522     {
523         public Gtk.Label el;
524         private Xcls_PopoverFileDetails  _this;
525
526
527             // my vars (def)
528
529         // ctor
530         public Xcls_Label13(Xcls_PopoverFileDetails _owner )
531         {
532             _this = _owner;
533             this.el = new Gtk.Label( "Region" );
534
535             // my vars (dec)
536
537             // set gobject values
538             this.el.justify = Gtk.Justification.RIGHT;
539             this.el.xalign = 0.900000f;
540             this.el.tooltip_text = "center, north, south, east, west";
541             this.el.visible = true;
542         }
543
544         // user defined functions
545     }
546
547     public class Xcls_region : Object
548     {
549         public Gtk.Entry el;
550         private Xcls_PopoverFileDetails  _this;
551
552
553             // my vars (def)
554
555         // ctor
556         public Xcls_region(Xcls_PopoverFileDetails _owner )
557         {
558             _this = _owner;
559             _this.region = this;
560             this.el = new Gtk.Entry();
561
562             // my vars (dec)
563
564             // set gobject values
565             this.el.visible = true;
566         }
567
568         // user defined functions
569     }
570
571     public class Xcls_Label15 : Object
572     {
573         public Gtk.Label el;
574         private Xcls_PopoverFileDetails  _this;
575
576
577             // my vars (def)
578
579         // ctor
580         public Xcls_Label15(Xcls_PopoverFileDetails _owner )
581         {
582             _this = _owner;
583             this.el = new Gtk.Label( "Parent Name" );
584
585             // my vars (dec)
586
587             // set gobject values
588             this.el.justify = Gtk.Justification.RIGHT;
589             this.el.xalign = 0.900000f;
590             this.el.visible = true;
591         }
592
593         // user defined functions
594     }
595
596     public class Xcls_parent : Object
597     {
598         public Gtk.Entry el;
599         private Xcls_PopoverFileDetails  _this;
600
601
602             // my vars (def)
603
604         // ctor
605         public Xcls_parent(Xcls_PopoverFileDetails _owner )
606         {
607             _this = _owner;
608             _this.parent = this;
609             this.el = new Gtk.Entry();
610
611             // my vars (dec)
612
613             // set gobject values
614             this.el.visible = true;
615         }
616
617         // user defined functions
618     }
619
620     public class Xcls_Label17 : Object
621     {
622         public Gtk.Label el;
623         private Xcls_PopoverFileDetails  _this;
624
625
626             // my vars (def)
627
628         // ctor
629         public Xcls_Label17(Xcls_PopoverFileDetails _owner )
630         {
631             _this = _owner;
632             this.el = new Gtk.Label( "Permission Name" );
633
634             // my vars (dec)
635
636             // set gobject values
637             this.el.justify = Gtk.Justification.RIGHT;
638             this.el.xalign = 0.900000f;
639             this.el.visible = true;
640         }
641
642         // user defined functions
643     }
644
645     public class Xcls_permname : Object
646     {
647         public Gtk.Entry el;
648         private Xcls_PopoverFileDetails  _this;
649
650
651             // my vars (def)
652
653         // ctor
654         public Xcls_permname(Xcls_PopoverFileDetails _owner )
655         {
656             _this = _owner;
657             _this.permname = this;
658             this.el = new Gtk.Entry();
659
660             // my vars (dec)
661
662             // set gobject values
663             this.el.visible = true;
664         }
665
666         // user defined functions
667     }
668
669     public class Xcls_Label19 : Object
670     {
671         public Gtk.Label el;
672         private Xcls_PopoverFileDetails  _this;
673
674
675             // my vars (def)
676
677         // ctor
678         public Xcls_Label19(Xcls_PopoverFileDetails _owner )
679         {
680             _this = _owner;
681             this.el = new Gtk.Label( "Order (for tabs)" );
682
683             // my vars (dec)
684
685             // set gobject values
686             this.el.justify = Gtk.Justification.RIGHT;
687             this.el.xalign = 0.900000f;
688             this.el.visible = true;
689         }
690
691         // user defined functions
692     }
693
694     public class Xcls_modOrder : Object
695     {
696         public Gtk.Entry el;
697         private Xcls_PopoverFileDetails  _this;
698
699
700             // my vars (def)
701
702         // ctor
703         public Xcls_modOrder(Xcls_PopoverFileDetails _owner )
704         {
705             _this = _owner;
706             _this.modOrder = this;
707             this.el = new Gtk.Entry();
708
709             // my vars (dec)
710
711             // set gobject values
712             this.el.visible = true;
713         }
714
715         // user defined functions
716     }
717
718     public class Xcls_Label21 : Object
719     {
720         public Gtk.Label el;
721         private Xcls_PopoverFileDetails  _this;
722
723
724             // my vars (def)
725
726         // ctor
727         public Xcls_Label21(Xcls_PopoverFileDetails _owner )
728         {
729             _this = _owner;
730             this.el = new Gtk.Label( "Module to build (Vala only)" );
731
732             // my vars (dec)
733
734             // set gobject values
735             this.el.justify = Gtk.Justification.RIGHT;
736             this.el.xalign = 0.900000f;
737             this.el.visible = true;
738         }
739
740         // user defined functions
741     }
742
743     public class Xcls_build_module : Object
744     {
745         public Gtk.ComboBox el;
746         private Xcls_PopoverFileDetails  _this;
747
748
749             // my vars (def)
750
751         // ctor
752         public Xcls_build_module(Xcls_PopoverFileDetails _owner )
753         {
754             _this = _owner;
755             _this.build_module = this;
756             this.el = new Gtk.ComboBox();
757
758             // my vars (dec)
759
760             // set gobject values
761             var child_0 = new Xcls_dbcellrenderer( _this );
762             child_0.ref();
763             this.el.pack_start (  child_0.el , true );
764             var child_1 = new Xcls_dbmodel( _this );
765             child_1.ref();
766             this.el.set_model (  child_1.el  );
767
768             // init method
769
770             this.el.add_attribute(_this.dbcellrenderer.el , "markup", 1 );
771         }
772
773         // user defined functions
774     }
775     public class Xcls_dbcellrenderer : Object
776     {
777         public Gtk.CellRendererText el;
778         private Xcls_PopoverFileDetails  _this;
779
780
781             // my vars (def)
782
783         // ctor
784         public Xcls_dbcellrenderer(Xcls_PopoverFileDetails _owner )
785         {
786             _this = _owner;
787             _this.dbcellrenderer = this;
788             this.el = new Gtk.CellRendererText();
789
790             // my vars (dec)
791
792             // set gobject values
793         }
794
795         // user defined functions
796     }
797
798     public class Xcls_dbmodel : Object
799     {
800         public Gtk.ListStore el;
801         private Xcls_PopoverFileDetails  _this;
802
803
804             // my vars (def)
805
806         // ctor
807         public Xcls_dbmodel(Xcls_PopoverFileDetails _owner )
808         {
809             _this = _owner;
810             _this.dbmodel = this;
811             this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
812
813             // my vars (dec)
814
815             // set gobject values
816         }
817
818         // user defined functions
819         public void loadData (Gee.ArrayList<string> data, string cur) {
820             this.el.clear();                                    
821             Gtk.TreeIter iter;
822             var el = this.el;
823             
824            /// el.append(out iter);
825             
826              
827            // el.set_value(iter, 0, "");
828            // el.set_value(iter, 1, "aaa  - Just add Element - aaa");
829         
830             el.append(out iter);
831         
832             
833             el.set_value(iter, 0, "");
834             el.set_value(iter, 1, "-- select a module --");
835             _this.build_module.el.set_active_iter(iter);
836             
837             for (var i = 0; i < data.size;i++) {
838             
839         
840                 el.append(out iter);
841                 
842                 el.set_value(iter, 0, data.get(i));
843                 el.set_value(iter, 1, data.get(i));
844                 
845                 if (data.get(i) == cur) {
846                     _this.build_module.el.set_active_iter(iter);
847                 }
848                 
849             }
850              this.el.set_sort_column_id(0, Gtk.SortType.ASCENDING);          
851                                              
852         }
853     }
854
855
856
857     public class Xcls_HButtonBox25 : Object
858     {
859         public Gtk.HButtonBox el;
860         private Xcls_PopoverFileDetails  _this;
861
862
863             // my vars (def)
864
865         // ctor
866         public Xcls_HButtonBox25(Xcls_PopoverFileDetails _owner )
867         {
868             _this = _owner;
869             this.el = new Gtk.HButtonBox();
870
871             // my vars (dec)
872
873             // set gobject values
874             this.el.margin_right = 4;
875             this.el.margin_left = 4;
876             this.el.margin_bottom = 4;
877             var child_0 = new Xcls_Button26( _this );
878             child_0.ref();
879             this.el.add (  child_0.el  );
880             var child_1 = new Xcls_save_btn( _this );
881             child_1.ref();
882             this.el.add (  child_1.el  );
883         }
884
885         // user defined functions
886     }
887     public class Xcls_Button26 : Object
888     {
889         public Gtk.Button el;
890         private Xcls_PopoverFileDetails  _this;
891
892
893             // my vars (def)
894
895         // ctor
896         public Xcls_Button26(Xcls_PopoverFileDetails _owner )
897         {
898             _this = _owner;
899             this.el = new Gtk.Button();
900
901             // my vars (dec)
902
903             // set gobject values
904             this.el.label = "Cancel";
905
906             //listeners
907             this.el.clicked.connect( () => { 
908             
909               _this.done = true;
910                 _this.el.hide(); 
911             });
912         }
913
914         // user defined functions
915     }
916
917     public class Xcls_save_btn : Object
918     {
919         public Gtk.Button el;
920         private Xcls_PopoverFileDetails  _this;
921
922
923             // my vars (def)
924
925         // ctor
926         public Xcls_save_btn(Xcls_PopoverFileDetails _owner )
927         {
928             _this = _owner;
929             _this.save_btn = this;
930             this.el = new Gtk.Button();
931
932             // my vars (dec)
933
934             // set gobject values
935             this.el.label = "Save";
936
937             //listeners
938             this.el.clicked.connect( ( ) =>  { 
939             
940              
941             
942             
943                 if (_this.name.el.get_text().length  < 1) {
944                     StandardErrorDialog.show(
945                         _this.mainwindow.el,
946                         "You have to set Component name "
947                     );
948                      
949                     return;
950                 }
951                 // what does this do?
952                 
953                 var isNew = _this.file.name.length  > 0 ? false : true;
954                 /*
955                 if (!isNew && this.file.name != _this.name.el.get_text()) {
956                     Xcls_StandardErrorDialog.singleton().show(
957                         this.el,
958                         "Sorry changing names does not work yet. "
959                     );
960                      
961                     return;
962                 }
963                 */
964                  
965                 
966               
967                 // FIXME - this may be more complicated...
968                 //for (var i in this.def) {
969                 //    this.file[i] =  this.get(i).el.get_text();
970                 //}
971             
972                 if (!isNew) {
973                     try {
974                          _this.updateFileFromEntry();
975                      } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
976                           Xcls_StandardErrorDialog.singleton().show(
977                             _this.mainwindow.el,
978                             "The name you used already exists "
979                         );
980                         return;
981                          
982                      }
983             
984                       _this.done = true;
985                     _this.file.save();
986                     _this.el.hide();
987                     return;
988                 }
989                 var fn = _this.name.el.get_text();
990                 var dir = _this.project.firstPath();
991                
992                 if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
993                     Xcls_StandardErrorDialog.singleton().show(
994                         _this.mainwindow.el,
995                         "That file already exists"
996                     ); 
997                     return;
998                 }
999                
1000                var f =  JsRender.JsRender.factory(
1001                         _this.file.project.xtype,  
1002                         _this.file.project, 
1003                         dir + "/" + fn + ".bjs");
1004             
1005                 _this.file = f;
1006                 
1007             
1008                 
1009                 _this.updateFileFromEntry();
1010                 _this.file.loaded = true;
1011                 _this.file.save();
1012                 _this.file.project.addFile(_this.file);
1013                 
1014              
1015                 // what about .js ?
1016                _this.done = true;
1017                 _this.el.hide();
1018             
1019                 
1020                 
1021                 _this.success(_this.project, _this.file);
1022                
1023             });
1024         }
1025
1026         // user defined functions
1027     }
1028
1029
1030
1031 }