JsRender/Roo.js
[app.Builder.js] / Builder4 / DialogNewComponent.vala
1 /* -- to compile
2 valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
3     /tmp/DialogNewComponent.vala  -o /tmp/DialogNewComponent
4 */
5
6
7 /* -- to test class
8 static int main (string[] args) {
9     Gtk.init (ref args);
10     new Xcls_DialogNewComponent();
11     DialogNewComponent.show_all();
12      Gtk.main ();
13     return 0;
14 }
15 */
16
17
18 public static Xcls_DialogNewComponent  DialogNewComponent;
19
20 public class Xcls_DialogNewComponent
21 {
22     public Gtk.Dialog el;
23     private static Xcls_DialogNewComponent  _this;
24
25     public Xcls_name name;
26     public Xcls_title title;
27     public Xcls_region region;
28     public Xcls_parent parent;
29     public Xcls_permname permname;
30     public Xcls_modOrder modOrder;
31
32         // my vars
33
34         // ctor 
35     public Xcls_DialogNewComponent()
36     {
37         this.el = new Gtk.Dialog();
38         _this = this;
39         DialogNewComponent = this;
40
41         // my vars
42
43         // set gobject values
44         this.el.default_height = 200;
45         this.el.default_width = 500;
46         this.el.deletable = false;
47         this.el.modal = true;
48         this.el.title = "New Component";
49         var child_0 = new Xcls_VBox2();
50         this.el.add (  child_0.el  );
51         var child_1 = new Xcls_Button16();
52         this.el.add_action_widget (  child_1.el , 0 );
53         var child_2 = new Xcls_Button17();
54         this.el.add_action_widget (  child_2.el , 1 );
55
56         // listeners 
57         this.el.delete_event.connect(  (self, event) => {
58             this.el.hide();
59             return true;
60         } );
61         this.el.response.connect(  (self, response_id) => {
62                 if (response_id < 1) { // cancel!
63                     this.el.hide();
64                     return;
65                 }
66         
67                 if (DialogNewComponent.name.el.get_text().length  < 1) {
68                     StandardErrorDialog.show(
69                         "You haDe to set Project name "
70                     );
71                      
72                     return;
73                 }
74                 var isNew = this.file.name.length  > 0 ? false : true;
75                 
76                 if (this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {
77                     StandardErrorDialog.show(
78                         "Sorry changing names does not work yet. "
79                     );
80                      
81                     return;
82                 }
83                 // FIXME - this may be more complicated...
84                 //for (var i in this.def) {
85                 //    this.file[i] =  this.get(i).el.get_text();
86                 //}
87                
88                 if (!isNew) {
89                     this.file.save();
90                     this.el.hide();
91                     return;
92                 }
93                
94             
95                 var dir ='';
96                 //FIXME...
97                 //for (var i in this.project.paths) {
98                 //      dir = i;
99                 //      break;
100                 //}
101         
102          
103                 
104                 // what about .js ?
105                 if (GLib.file_test (GLib.dir + "/" + this.file.name + ".bjs", GLib.FileTest.EXISTS)) {
106                     StandardErrorDialog.show(
107                         "That file already exists"
108                     ); 
109                     return;
110                 }
111                 this.el.hide();
112                 
113                 
114                 //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
115                  
116                 var nf = _this.project.create(dir + "/" + this.file.name + ".bjs");
117                 //for (var i in this.file) {
118                 //    nf[i] = this.file[i];
119                 //}
120                 
121                 if (DialogNewComponent.success != null) {
122                     DialogNewComponent.success(_this.project, nf);
123                 }
124         } );
125         this.el.show.connect(  (self) => {
126           this.el.show_all();
127         } );
128     }
129
130     // userdefined functions 
131
132     // skip listeners - not pipe 
133
134     // skip default_height - already used 
135
136     // skip default_width - already used 
137
138     // skip id - not pipe 
139
140     // skip title - already used 
141
142     // skip xtype - not pipe 
143
144     // skip |deletable - already used 
145
146     // skip |modal - already used 
147
148     // skip |show - could not find seperator
149
150     // skip |xns - could not find seperator
151
152     // skip items - not pipe 
153
154     // skip xvala_cls - not pipe 
155
156     // skip xvala_xcls - not pipe 
157
158     // skip xvala_id - not pipe 
159     public class Xcls_VBox2
160     {
161         public Gtk.VBox el;
162
163             // my vars
164
165             // ctor 
166         public Xcls_VBox2()
167         {
168             this.el = new Gtk.VBox( true, 0 );
169
170             // my vars
171
172             // set gobject values
173             var child_0 = new Xcls_Table3();
174             this.el.pack_start (  child_0.el , false,false,0 );
175         }
176
177         // userdefined functions 
178
179         // skip |xns - could not find seperator
180
181         // skip xtype - not pipe 
182
183         // skip |pack - already used 
184
185         // skip items - not pipe 
186
187         // skip xvala_cls - not pipe 
188
189         // skip xvala_xcls - not pipe 
190
191         // skip xvala_id - not pipe 
192     }
193     public class Xcls_Table3
194     {
195         public Gtk.Table el;
196
197             // my vars
198
199             // ctor 
200         public Xcls_Table3()
201         {
202             this.el = new Gtk.Table();
203
204             // my vars
205
206             // set gobject values
207             this.el.homogeneous = false;
208             this.el.n_columns = 2;
209             this.el.n_rows = 3;
210             var child_0 = new Xcls_Label4();
211             this.el.add (  child_0.el  );
212             var child_1 = new Xcls_name();
213             this.el.add (  child_1.el  );
214             var child_2 = new Xcls_Label6();
215             this.el.add (  child_2.el  );
216             var child_3 = new Xcls_title();
217             this.el.add (  child_3.el  );
218             var child_4 = new Xcls_Label8();
219             this.el.add (  child_4.el  );
220             var child_5 = new Xcls_region();
221             this.el.add (  child_5.el  );
222             var child_6 = new Xcls_Label10();
223             this.el.add (  child_6.el  );
224             var child_7 = new Xcls_parent();
225             this.el.add (  child_7.el  );
226             var child_8 = new Xcls_Label12();
227             this.el.add (  child_8.el  );
228             var child_9 = new Xcls_permname();
229             this.el.add (  child_9.el  );
230             var child_10 = new Xcls_Label14();
231             this.el.add (  child_10.el  );
232             var child_11 = new Xcls_modOrder();
233             this.el.add (  child_11.el  );
234         }
235
236         // userdefined functions 
237
238         // skip n_columns - already used 
239
240         // skip n_rows - already used 
241
242         // skip pack - not pipe 
243
244         // skip xtype - not pipe 
245
246         // skip |homogeneous - already used 
247
248         // skip |xns - could not find seperator
249
250         // skip items - not pipe 
251
252         // skip xvala_cls - not pipe 
253
254         // skip xvala_xcls - not pipe 
255
256         // skip xvala_id - not pipe 
257     }
258     public class Xcls_Label4
259     {
260         public Gtk.Label el;
261
262             // my vars
263
264             // ctor 
265         public Xcls_Label4()
266         {
267             this.el = new Gtk.Label();
268
269             // my vars
270
271             // set gobject values
272             this.el.justify = Gtk.Justification.RIGHT;
273             this.el.label = "Component Name";
274             this.el.xalign = 0.9;
275         }
276
277         // userdefined functions 
278
279         // skip label - already used 
280
281         // skip pack - not pipe 
282
283         // skip x_options - not pipe 
284
285         // skip xalign - already used 
286
287         // skip xtype - not pipe 
288
289         // skip |justify - already used 
290
291         // skip |xns - could not find seperator
292
293         // skip xvala_cls - not pipe 
294
295         // skip xvala_xcls - not pipe 
296
297         // skip xvala_id - not pipe 
298     }
299     public class Xcls_name
300     {
301         public Gtk.Entry el;
302
303             // my vars
304
305             // ctor 
306         public Xcls_name()
307         {
308             this.el = new Gtk.Entry();
309             _this.name = this;
310
311             // my vars
312
313             // set gobject values
314             this.el.visible = true;
315         }
316
317         // userdefined functions 
318
319         // skip id - not pipe 
320
321         // skip pack - not pipe 
322
323         // skip xtype - not pipe 
324
325         // skip |visible - already used 
326
327         // skip |xns - could not find seperator
328
329         // skip xvala_cls - not pipe 
330
331         // skip xvala_xcls - not pipe 
332
333         // skip xvala_id - not pipe 
334     }
335     public class Xcls_Label6
336     {
337         public Gtk.Label el;
338
339             // my vars
340
341             // ctor 
342         public Xcls_Label6()
343         {
344             this.el = new Gtk.Label();
345
346             // my vars
347
348             // set gobject values
349             this.el.justify = Gtk.Justification.RIGHT;
350             this.el.label = "Title";
351             this.el.visible = true;
352             this.el.xalign = 0.9;
353         }
354
355         // userdefined functions 
356
357         // skip label - already used 
358
359         // skip pack - not pipe 
360
361         // skip x_options - not pipe 
362
363         // skip xalign - already used 
364
365         // skip xtype - not pipe 
366
367         // skip |justify - already used 
368
369         // skip |visible - already used 
370
371         // skip |xns - could not find seperator
372
373         // skip xvala_cls - not pipe 
374
375         // skip xvala_xcls - not pipe 
376
377         // skip xvala_id - not pipe 
378     }
379     public class Xcls_title
380     {
381         public Gtk.Entry el;
382
383             // my vars
384
385             // ctor 
386         public Xcls_title()
387         {
388             this.el = new Gtk.Entry();
389             _this.title = this;
390
391             // my vars
392
393             // set gobject values
394             this.el.visible = true;
395         }
396
397         // userdefined functions 
398
399         // skip id - not pipe 
400
401         // skip pack - not pipe 
402
403         // skip xtype - not pipe 
404
405         // skip |visible - already used 
406
407         // skip |xns - could not find seperator
408
409         // skip xvala_cls - not pipe 
410
411         // skip xvala_xcls - not pipe 
412
413         // skip xvala_id - not pipe 
414     }
415     public class Xcls_Label8
416     {
417         public Gtk.Label el;
418
419             // my vars
420
421             // ctor 
422         public Xcls_Label8()
423         {
424             this.el = new Gtk.Label();
425
426             // my vars
427
428             // set gobject values
429             this.el.justify = Gtk.Justification.RIGHT;
430             this.el.label = "Region";
431             this.el.tooltip_text = "center, north, south, east, west";
432             this.el.visible = true;
433             this.el.xalign = 0.9;
434         }
435
436         // userdefined functions 
437
438         // skip label - already used 
439
440         // skip pack - not pipe 
441
442         // skip tooltip_text - already used 
443
444         // skip x_options - not pipe 
445
446         // skip xalign - already used 
447
448         // skip xtype - not pipe 
449
450         // skip |justify - already used 
451
452         // skip |visible - already used 
453
454         // skip |xns - could not find seperator
455
456         // skip xvala_cls - not pipe 
457
458         // skip xvala_xcls - not pipe 
459
460         // skip xvala_id - not pipe 
461     }
462     public class Xcls_region
463     {
464         public Gtk.Entry el;
465
466             // my vars
467
468             // ctor 
469         public Xcls_region()
470         {
471             this.el = new Gtk.Entry();
472             _this.region = this;
473
474             // my vars
475
476             // set gobject values
477             this.el.visible = true;
478         }
479
480         // userdefined functions 
481
482         // skip id - not pipe 
483
484         // skip pack - not pipe 
485
486         // skip xtype - not pipe 
487
488         // skip |visible - already used 
489
490         // skip |xns - could not find seperator
491
492         // skip xvala_cls - not pipe 
493
494         // skip xvala_xcls - not pipe 
495
496         // skip xvala_id - not pipe 
497     }
498     public class Xcls_Label10
499     {
500         public Gtk.Label el;
501
502             // my vars
503
504             // ctor 
505         public Xcls_Label10()
506         {
507             this.el = new Gtk.Label();
508
509             // my vars
510
511             // set gobject values
512             this.el.justify = Gtk.Justification.RIGHT;
513             this.el.label = "Parent Name";
514             this.el.visible = true;
515             this.el.xalign = 0.9;
516         }
517
518         // userdefined functions 
519
520         // skip label - already used 
521
522         // skip pack - not pipe 
523
524         // skip x_options - not pipe 
525
526         // skip xalign - already used 
527
528         // skip xtype - not pipe 
529
530         // skip |justify - already used 
531
532         // skip |visible - already used 
533
534         // skip |xns - could not find seperator
535
536         // skip xvala_cls - not pipe 
537
538         // skip xvala_xcls - not pipe 
539
540         // skip xvala_id - not pipe 
541     }
542     public class Xcls_parent
543     {
544         public Gtk.Entry el;
545
546             // my vars
547
548             // ctor 
549         public Xcls_parent()
550         {
551             this.el = new Gtk.Entry();
552             _this.parent = this;
553
554             // my vars
555
556             // set gobject values
557             this.el.visible = true;
558         }
559
560         // userdefined functions 
561
562         // skip id - not pipe 
563
564         // skip pack - not pipe 
565
566         // skip xtype - not pipe 
567
568         // skip |visible - already used 
569
570         // skip |xns - could not find seperator
571
572         // skip xvala_cls - not pipe 
573
574         // skip xvala_xcls - not pipe 
575
576         // skip xvala_id - not pipe 
577     }
578     public class Xcls_Label12
579     {
580         public Gtk.Label el;
581
582             // my vars
583
584             // ctor 
585         public Xcls_Label12()
586         {
587             this.el = new Gtk.Label();
588
589             // my vars
590
591             // set gobject values
592             this.el.justify = Gtk.Justification.RIGHT;
593             this.el.label = "Permission Name";
594             this.el.visible = true;
595             this.el.xalign = 0.9;
596         }
597
598         // userdefined functions 
599
600         // skip label - already used 
601
602         // skip pack - not pipe 
603
604         // skip x_options - not pipe 
605
606         // skip xalign - already used 
607
608         // skip xtype - not pipe 
609
610         // skip |justify - already used 
611
612         // skip |visible - already used 
613
614         // skip |xns - could not find seperator
615
616         // skip xvala_cls - not pipe 
617
618         // skip xvala_xcls - not pipe 
619
620         // skip xvala_id - not pipe 
621     }
622     public class Xcls_permname
623     {
624         public Gtk.Entry el;
625
626             // my vars
627
628             // ctor 
629         public Xcls_permname()
630         {
631             this.el = new Gtk.Entry();
632             _this.permname = this;
633
634             // my vars
635
636             // set gobject values
637             this.el.visible = true;
638         }
639
640         // userdefined functions 
641
642         // skip id - not pipe 
643
644         // skip pack - not pipe 
645
646         // skip xtype - not pipe 
647
648         // skip |visible - already used 
649
650         // skip |xns - could not find seperator
651
652         // skip xvala_cls - not pipe 
653
654         // skip xvala_xcls - not pipe 
655
656         // skip xvala_id - not pipe 
657     }
658     public class Xcls_Label14
659     {
660         public Gtk.Label el;
661
662             // my vars
663
664             // ctor 
665         public Xcls_Label14()
666         {
667             this.el = new Gtk.Label();
668
669             // my vars
670
671             // set gobject values
672             this.el.justify = Gtk.Justification.RIGHT;
673             this.el.label = "Order (for tabs)";
674             this.el.visible = true;
675             this.el.xalign = 0.9;
676         }
677
678         // userdefined functions 
679
680         // skip label - already used 
681
682         // skip pack - not pipe 
683
684         // skip x_options - not pipe 
685
686         // skip xalign - already used 
687
688         // skip xtype - not pipe 
689
690         // skip |justify - already used 
691
692         // skip |visible - already used 
693
694         // skip |xns - could not find seperator
695
696         // skip xvala_cls - not pipe 
697
698         // skip xvala_xcls - not pipe 
699
700         // skip xvala_id - not pipe 
701     }
702     public class Xcls_modOrder
703     {
704         public Gtk.Entry el;
705
706             // my vars
707
708             // ctor 
709         public Xcls_modOrder()
710         {
711             this.el = new Gtk.Entry();
712             _this.modOrder = this;
713
714             // my vars
715
716             // set gobject values
717             this.el.visible = true;
718         }
719
720         // userdefined functions 
721
722         // skip id - not pipe 
723
724         // skip pack - not pipe 
725
726         // skip xtype - not pipe 
727
728         // skip |visible - already used 
729
730         // skip |xns - could not find seperator
731
732         // skip xvala_cls - not pipe 
733
734         // skip xvala_xcls - not pipe 
735
736         // skip xvala_id - not pipe 
737     }
738     public class Xcls_Button16
739     {
740         public Gtk.Button el;
741
742             // my vars
743
744             // ctor 
745         public Xcls_Button16()
746         {
747             this.el = new Gtk.Button();
748
749             // my vars
750
751             // set gobject values
752             this.el.label = "Cancel";
753         }
754
755         // userdefined functions 
756
757         // skip |xns - could not find seperator
758
759         // skip xtype - not pipe 
760
761         // skip pack - not pipe 
762
763         // skip label - already used 
764
765         // skip xvala_cls - not pipe 
766
767         // skip xvala_xcls - not pipe 
768
769         // skip xvala_id - not pipe 
770     }
771     public class Xcls_Button17
772     {
773         public Gtk.Button el;
774
775             // my vars
776
777             // ctor 
778         public Xcls_Button17()
779         {
780             this.el = new Gtk.Button();
781
782             // my vars
783
784             // set gobject values
785             this.el.label = "OK";
786         }
787
788         // userdefined functions 
789
790         // skip |xns - could not find seperator
791
792         // skip xtype - not pipe 
793
794         // skip pack - not pipe 
795
796         // skip label - already used 
797
798         // skip xvala_cls - not pipe 
799
800         // skip xvala_xcls - not pipe 
801
802         // skip xvala_id - not pipe 
803     }
804 }