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