Fix #8101 - new roo bjs files fail and fix top drop
[roobuilder] / src / Builder4 / PopoverFileDetails.bjs
1 {
2  "build_module" : "builder",
3  "gen_extended" : false,
4  "items" : [
5   {
6    "# JsRender.JsRender file" : "null",
7    "# Project.Project project" : "",
8    "# bool new_window" : true,
9    "$ xns" : "Gtk",
10    "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
11    "Xcls_MainWindow mainwindow" : "null",
12    "bool done" : false,
13    "bool is_new" : true,
14    "bool modal" : true,
15    "id" : "PopoverFileDetails",
16    "items" : [
17     {
18      "$ pack" : "add",
19      "$ xns" : "Gtk",
20      "* pack" : "set_child",
21      "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL",
22      "bool hexpand" : true,
23      "bool homogeneous" : false,
24      "int margin_bottom" : 4,
25      "int margin_end" : 4,
26      "int margin_start" : 4,
27      "int margin_top" : 4,
28      "items" : [
29       {
30        "$ xns" : "Gtk",
31        "* columns" : 2,
32        "* pack" : "append",
33        "bool hexpand" : true,
34        "id" : "grid",
35        "int column_spacing" : 4,
36        "int margin_end" : 4,
37        "int margin_start" : 4,
38        "items" : [
39         {
40          "$ justify" : "Gtk.Justification.RIGHT",
41          "$ xns" : "Gtk",
42          "id" : "filetype_lbl",
43          "label" : "File type",
44          "x_options" : 4,
45          "xalign" : 0.90000000000000002,
46          "xtype" : "Label"
47         },
48         {
49          "$ xns" : "Gtk",
50          "bool hexpand" : true,
51          "bool in_showhide" : false,
52          "id" : "filetype",
53          "items" : [
54           {
55            "$ xns" : "Gtk",
56            "* prop" : "model",
57            "id" : "filetype_model",
58            "strings" : "{}",
59            "xtype" : "StringList",
60            "| void load" : [
61             "() {",
62             "    var el = this.el;",
63             "    ",
64             "    while (el.get_n_items() > 0) {",
65             "    \tel.remove(0);",
66             "\t}",
67             " \tel.append(\"bjs - User Interface File\");",
68             " ",
69             "    ",
70             " switch(_this.project.xtype) {",
71             " \tcase \"Roo\":",
72             " \t \tel.append(\"js - Javascript File\");",
73             " \t \tel.append(\"css - CSS File\");",
74             " \t \tel.append(\"php - Javascript File\");",
75             " \t \t",
76             "\t\tbreak;",
77             "",
78             "\tcase \"Gtk\":\t\t",
79             "\t\t\t",
80             " \t \tel.append(\"vala - Vala File\");",
81             " \t \tel.append(\"css - CSS File\");",
82             " \t \tel.append(\"other - Other Type\");",
83             " \t \tbreak;",
84             " \t default : ",
85             " \t \tbreak;",
86             "\t}",
87             "",
88             "\t",
89             "\t",
90             "\t",
91             "}"
92            ]
93           }
94          ],
95          "listeners" : {
96           "notify[\"selected\"]" : [
97            "() => {",
98            "",
99            " \t_this.onFileTypeChange();",
100            "",
101            " }"
102           ]
103          },
104          "xtype" : "DropDown",
105          "| string getValue" : [
106           "() {",
107           "\t",
108           "\tif (!_this.is_new) {",
109           "\t\treturn _this.file.xtype != \"Plainfile\" ? \"bjs\" :  _this.file.file_ext;",
110           "\t}",
111           "\t",
112           "\tif (this.el.selected == Gtk.INVALID_LIST_POSITION) {",
113           "\t\treturn \"\";",
114           "\t}",
115           "\t",
116           "\treturn _this.filetype_model.el.get_string(this.el.selected).split(\" \")[0];",
117           "}"
118          ],
119          "| void setValue" : [
120           "(string cur) {",
121           "\tvar el  = _this.filetype_model.el;",
122           "\tfor(var i= 0; i < el.get_n_items();i++)  {",
123           "\t\tif (el.get_string(i).has_prefix(cur)) {",
124           "\t\t\tthis.el.selected = i;",
125           "\t\t\tbreak;",
126           "\t\t}",
127           "\t}",
128           "}"
129          ]
130         },
131         {
132          "$ justify" : "Gtk.Justification.RIGHT",
133          "$ visible" : true,
134          "$ xns" : "Gtk",
135          "id" : "dir_dropdown_lbl",
136          "label" : "Create File in this Directory",
137          "x_options" : 4,
138          "xalign" : 0.90000000000000002,
139          "xtype" : "Label"
140         },
141         {
142          "$ xns" : "Gtk",
143          "id" : "dir_dropdown",
144          "int colspan" : 1,
145          "items" : [
146           {
147            "$ xns" : "Gtk",
148            "* prop" : "model",
149            "id" : "dir_model",
150            "strings" : "{}",
151            "xtype" : "StringList"
152           }
153          ],
154          "listeners" : {
155           "notify[\"selected\"]" : [
156            "() => {",
157            "",
158            "\t _this.onDirChanged();",
159            "\t",
160            "\t",
161            "\t",
162            " } "
163           ]
164          },
165          "xtype" : "DropDown",
166          "| string getValue" : [
167           "() {",
168           "\treturn _this.dir_model.el.get_string(this.el.selected);",
169           "}"
170          ],
171          "| void setValue" : [
172           "(string cur) {",
173           "\tvar el  = _this.dir_model.el;",
174           "\tfor(var i= 0; i < el.get_n_items();i++)  {",
175           "\t\tif (el.get_string(i) == cur) {",
176           "\t\t\tthis.el.selected = i;",
177           "\t\t\tbreak;",
178           "\t\t}",
179           "\t}",
180           "}"
181          ]
182         },
183         {
184          "$ justify" : "Gtk.Justification.RIGHT",
185          "$ xns" : "Gtk",
186          "id" : "name_lbl",
187          "label" : "Component Name (File name without extension)",
188          "x_options" : 4,
189          "xalign" : 0.90000000000000002,
190          "xtype" : "Label"
191         },
192         {
193          "$ visible" : true,
194          "$ xns" : "Gtk",
195          "bool hexpand" : true,
196          "id" : "name",
197          "xtype" : "Entry"
198         },
199         {
200          "$ justify" : "Gtk.Justification.RIGHT",
201          "$ visible" : true,
202          "$ xns" : "Gtk",
203          "id" : "title_lbl",
204          "label" : "Title",
205          "x_options" : 4,
206          "xalign" : 0.90000000000000002,
207          "xtype" : "Label"
208         },
209         {
210          "$ visible" : true,
211          "$ xns" : "Gtk",
212          "bool hexpand" : true,
213          "id" : "title",
214          "xtype" : "Entry"
215         },
216         {
217          "$ justify" : "Gtk.Justification.RIGHT",
218          "$ visible" : true,
219          "$ xns" : "Gtk",
220          "id" : "region_lbl",
221          "label" : "Region",
222          "tooltip_text" : "center, north, south, east, west",
223          "x_options" : 4,
224          "xalign" : 0.90000000000000002,
225          "xtype" : "Label"
226         },
227         {
228          "$ visible" : true,
229          "$ xns" : "Gtk",
230          "bool hexpand" : true,
231          "id" : "region",
232          "xtype" : "Entry"
233         },
234         {
235          "$ justify" : "Gtk.Justification.RIGHT",
236          "$ visible" : true,
237          "$ xns" : "Gtk",
238          "id" : "parent_lbl",
239          "label" : "Parent Name",
240          "x_options" : 4,
241          "xalign" : 0.90000000000000002,
242          "xtype" : "Label"
243         },
244         {
245          "$ visible" : true,
246          "$ xns" : "Gtk",
247          "id" : "parent",
248          "xtype" : "Entry"
249         },
250         {
251          "$ justify" : "Gtk.Justification.RIGHT",
252          "$ visible" : true,
253          "$ xns" : "Gtk",
254          "id" : "permname_lbl",
255          "label" : "Permission Name",
256          "x_options" : 4,
257          "xalign" : 0.90000000000000002,
258          "xtype" : "Label"
259         },
260         {
261          "$ visible" : true,
262          "$ xns" : "Gtk",
263          "id" : "permname",
264          "xtype" : "Entry"
265         },
266         {
267          "$ justify" : "Gtk.Justification.RIGHT",
268          "$ visible" : true,
269          "$ xns" : "Gtk",
270          "id" : "modOrder_lbl",
271          "label" : "Order (for tabs)",
272          "x_options" : 4,
273          "xalign" : 0.90000000000000002,
274          "xtype" : "Label"
275         },
276         {
277          "$ visible" : true,
278          "$ xns" : "Gtk",
279          "id" : "modOrder",
280          "xtype" : "Entry"
281         },
282         {
283          "$ justify" : "Gtk.Justification.RIGHT",
284          "$ visible" : true,
285          "$ xns" : "Gtk",
286          "id" : "build_module_lbl",
287          "label" : "Module to build",
288          "x_options" : 4,
289          "xalign" : 0.90000000000000002,
290          "xtype" : "Label"
291         },
292         {
293          "$ xns" : "Gtk",
294          "id" : "build_module",
295          "items" : [
296           {
297            "$ xns" : "Gtk",
298            "* prop" : "model",
299            "id" : "build_module_model",
300            "strings" : "{}",
301            "xtype" : "StringList",
302            "| void load" : [
303             "(Gee.HashMap<string,Project.GtkValaSettings>? compilegroups)",
304             "{",
305             "\t",
306             "\t_this.build_module.el.hide();",
307             "\t\t_this.build_module_lbl.el.hide();",
308             "\tvar el = _this.build_module_model.el;",
309             "\t while (el.get_n_items() > 0) {",
310             "\t\t\tel.remove(0);",
311             "\t}",
312             "\t",
313             "\tif (compilegroups == null) {",
314             "\t\treturn;",
315             "\t}",
316             "\tforeach(var k in compilegroups.keys) {",
317             "\t\tthis.el.append(k);",
318             "\t}",
319             "\tif (compilegroups.keys.size > 0) {",
320             "\t\t_this.build_module.el.selected = 0;",
321             "\t\t_this.build_module.el.show();",
322             "\t\t_this.build_module_lbl.el.show();",
323             "\t} else {",
324             "\t\t",
325             "\t}",
326             "\t",
327             "}"
328            ]
329           }
330          ],
331          "xtype" : "DropDown",
332          "| string getValue" : [
333           " ",
334           "() {",
335           "\tif (this.el.selected < 0) {",
336           "\t\treturn \"\";",
337           "\t}",
338           "\t",
339           "\treturn _this.build_module_model.el.get_string(this.el.selected);",
340           "}",
341           " "
342          ],
343          "| void setValue" : [
344           "(string str) {",
345           "\tvar m = _this.build_module_model.el;",
346           "\tfor(var i = 0; i < m.get_n_items(); i++) {",
347           "\t\tif (m.get_string(i) == str) {",
348           "\t\t\tthis.el.selected = i;",
349           "\t\t\treturn;",
350           "\t\t}",
351           "\t}",
352           "\t\t",
353           "}"
354          ]
355         },
356         {
357          "$ justify" : "Gtk.Justification.RIGHT",
358          "$ visible" : true,
359          "$ xns" : "Gtk",
360          "id" : "path_lbl",
361          "int colspan" : 1,
362          "label" : "Full path",
363          "x_options" : 4,
364          "xalign" : 0.90000000000000002,
365          "xtype" : "Label"
366         },
367         {
368          "$ visible" : true,
369          "$ xns" : "Gtk",
370          "bool editable" : false,
371          "bool hexpand" : true,
372          "id" : "path",
373          "int colspan" : 1,
374          "xtype" : "Entry"
375         },
376         {
377          "$ justify" : "Gtk.Justification.RIGHT",
378          "$ visible" : true,
379          "$ xns" : "Gtk",
380          "id" : "gen_lbl",
381          "int colspan" : 1,
382          "label" : "Generate as Extended (no working)",
383          "x_options" : 4,
384          "xalign" : 0.90000000000000002,
385          "xtype" : "Label"
386         },
387         {
388          "$ xns" : "Gtk",
389          "id" : "gen",
390          "listeners" : {
391           "toggled" : [
392            "( ) => {",
393            "\t  ",
394            "\tthis.el.label = this.el.active ? \"Extended\" : \"Wrapped\";",
395            "",
396            "}",
397            ""
398           ]
399          },
400          "string label" : "Wrapped",
401          "xtype" : "CheckButton"
402         }
403        ],
404        "uint row_spacing" : 2,
405        "xtype" : "Grid",
406        "| void xhideRow" : [
407         "(int row) ",
408         "{",
409         "\tvar el = _this.grid.el.get_child_at(0,row);",
410         "",
411         "\tel.hide();",
412         "\tel = _this.grid.el.get_child_at(1,row);",
413         "\tel.hide();",
414         "",
415         "}"
416        ],
417        "| void xshowAllRows" : [
418         "() {",
419         "\tfor (var i = 2; i < 10;i++) {",
420         "\t\tvar el = _this.grid.el.get_child_at(0,i);",
421         "\t\tel.show();",
422         "\t\tel = _this.grid.el.get_child_at(1,i);",
423         "\t\tel.show();",
424         "    }",
425         "}"
426        ]
427       }
428      ],
429      "xtype" : "Box"
430     },
431     {
432      "$ xns" : "Gtk",
433      "* prop" : "titlebar",
434      "bool show_title_buttons" : false,
435      "items" : [
436       {
437        "$ xns" : "Gtk",
438        "* pack" : "pack_start",
439        "listeners" : {
440         "clicked" : [
441          "() => { ",
442          "  \t_this.done = true;",
443          "    _this.el.hide(); ",
444          "}"
445         ]
446        },
447        "string label" : "Cancel",
448        "xtype" : "Button"
449       },
450       {
451        "$ css_classes" : "{ \"suggested-action\" }",
452        "$ xns" : "Gtk",
453        "* pack" : "pack_end",
454        "bool always_show_image" : true,
455        "bool hexpand" : false,
456        "id" : "save_btn",
457        "listeners" : {
458         "clicked" : [
459          "( ) =>  { ",
460          "",
461          " ",
462          "",
463          "",
464          "\tif (_this.name.el.get_text().length  < 1) {",
465          "\t   var msg = new Adw.MessageDialog(",
466          "\t        _this.mainwindow.el,",
467          "\t        \"Opps\",",
468          "\t        \"You have to set a Component name \"",
469          "\t    );",
470          "\t    msg.modal = true;",
471          "\t    msg.present();",
472          "\t     ",
473          "\t    return;",
474          "\t}",
475          "\t ",
476          "",
477          "\tif (!_this.is_new) {",
478          "\t  //  try {",
479          "\t  ",
480          "\t  \tvar old_target = _this.file.build_module;",
481          "         _this.updateFileFromEntry();",
482          "\t    if (_this.project.xtype == \"Gtk\" && old_target != _this.file.build_module) {",
483          "\t    \tvar gp = (JsRender.Gtk)_this.file;",
484          "\t    \tgp.updateCompileGroup(old_target,  _this.file.build_module);",
485          "    \t}",
486          "",
487          "\t      _this.done = true;",
488          "\t    _this.file.save();",
489          "\t    _this.el.hide();",
490          "\t    return;",
491          "\t}  ",
492          "\t",
493          "\t// ---------------- NEW FILES...",
494          "\tvar ftype = _this.filetype.getValue();",
495          "",
496          "\tif (ftype == \"\") {",
497          "\t\t// should not happen...",
498          "\t\t// so we are jut going to return without ",
499          "\t\tXcls_StandardErrorDialog.singleton().show(",
500          "\t        _this.mainwindow.el,",
501          "\t        \"You must select a file type. \"",
502          "\t    );",
503          "\t    return;",
504          "\t\t ",
505          "\t}",
506          "\t",
507          "\t",
508          "\tvar fn = _this.name.el.get_text();",
509          "\t",
510          "\t ",
511          "\tvar ext = ftype;",
512          "\t//var dir = _this.project.path; ",
513          "\t ",
514          "\t var dir = _this.dir_dropdown.getValue();",
515          "\t",
516          "\t ",
517          "\t",
518          "\t ",
519          "\tvar targetfile  = _this.project.path;",
520          "\tif (dir != \"\") {",
521          "\t\ttargetfile += dir;",
522          "\t}",
523          "\ttargetfile += \"/\" + fn;",
524          "\t",
525          "\t// strip the file type off the end..",
526          "\t",
527          "\ttry {",
528          "\t\tvar rx = new GLib.Regex(\"\\\\.\" + ext + \"$\",GLib.RegexCompileFlags.CASELESS);",
529          "\t\tfn = rx.replace(targetfile, targetfile.length, 0, \"\"); ",
530          "\t  } catch (RegexError e) {} // ignore.",
531          "\t  ",
532          "\t  targetfile += \".\" + ext;",
533          "\t  ",
534          "\t  ",
535          "\tif (GLib.FileUtils.test(targetfile, GLib.FileTest.EXISTS)) {",
536          "\t    Xcls_StandardErrorDialog.singleton().show(",
537          "\t        _this.mainwindow.el,",
538          "\t        \"That file already exists\"",
539          "\t    ); ",
540          "\t    return;",
541          "\t}",
542          "\tJsRender.JsRender f;",
543          "   try {",
544          "\t   f =  JsRender.JsRender.factory(",
545          "\t\t\text == \"bjs\" ? _this.file.project.xtype : \"PlainFile\",  ",
546          "\t\t\t_this.file.project, ",
547          "\t\t\ttargetfile);",
548          "\t} catch (JsRender.Error e) {",
549          "\t\tXcls_StandardErrorDialog.singleton().show(",
550          "\t        _this.mainwindow.el,",
551          "\t        \"Error creating file\"",
552          "\t    ); ",
553          "\t\treturn;",
554          "\t}",
555          "\t_this.file = f;",
556          "\t",
557          "\t",
558          "",
559          "\t",
560          "\t_this.updateFileFromEntry();",
561          "\t_this.file.loaded = true;",
562          "\t_this.file.save();",
563          "     _this.file.project.addFile(_this.file);",
564          "     var sel = _this.filetype.getValue();",
565          "\t if (_this.file.project.xtype == \"Gtk\" && ",
566          "\t \t_this.file.build_module.length > 0 &&",
567          "\t \t( sel == \"bjs\" || sel == \"vala\")) {",
568          "\t ",
569          "\t\tvar pr = (Project.Gtk) _this.file.project;",
570          "\t\tif (pr.compilegroups.has_key(_this.file.build_module)) {",
571          "\t\t\tvar cg = pr.compilegroups.get(_this.file.build_module);",
572          "\t\t\tif (!cg.sources.contains(_this.file.relpath)) {",
573          "\t\t\t\tcg.sources.add(_this.file.relpath);",
574          "\t\t\t}",
575          "\t\t}",
576          "\t",
577          "\t}",
578          "\t ",
579          " ",
580          "\t// what about .js ?",
581          "   _this.done = true;",
582          "\t_this.el.hide();",
583          "",
584          "// hopefull this will work with bjs files..",
585          "\t",
586          "\t_this.success(_this.project, _this.file);",
587          "   ",
588          "}"
589         ]
590        },
591        "string icon_name" : "document-save",
592        "string label" : "Save",
593        "xtype" : "Button"
594       }
595      ],
596      "title" : "Add / Edit File",
597      "xtype" : "HeaderBar"
598     }
599    ],
600    "listeners" : {
601     "close_request" : [
602      "( ) => {",
603      "\t_this.el.hide();",
604      "\treturn true;",
605      "}",
606      ""
607     ]
608    },
609    "string title" : "Add / Edit File",
610    "uint border_width" : 0,
611    "xtype" : "Window",
612    "| void hideAll" : [
613     "() {",
614     "",
615     "\t// exiting only",
616     "\tthis.path_lbl.el.hide();",
617     "    this.path.el.hide();",
618     "     ",
619     "    // new ",
620     "    this.name_lbl.el.hide();",
621     "    this.name.el.hide();",
622     "    //new ",
623     "    this.dir_dropdown_lbl.el.hide();",
624     "    this.dir_dropdown.el.hide();",
625     "\t// roo",
626     "\tthis.title_lbl.el.hide();",
627     "\tthis.title.el.hide();",
628     "\t",
629     "\tthis.region_lbl.el.hide();",
630     "\tthis.region.el.hide();",
631     "\t",
632     "\tthis.parent_lbl.el.hide();",
633     "\tthis.parent.el.hide();",
634     "\t",
635     "\tthis.permname_lbl.el.hide();",
636     "\tthis.permname.el.hide();",
637     "\t",
638     "\tthis.modOrder_lbl.el.hide();",
639     "\tthis.modOrder.el.hide();",
640     "\t",
641     "\tthis.build_module_lbl.el.hide();",
642     "\tthis.build_module.el.hide();",
643     "\t",
644     "\tthis.gen_lbl.el.hide();",
645     "\tthis.gen.el.hide();",
646     "\t\tthis.filetype_lbl.el.hide();",
647     "\t\tthis.filetype.el.hide();",
648     "}\t"
649    ],
650    "| void onDirChanged" : [
651     "() {",
652     "if (this.dir_dropdown.el.selected == Gtk.INVALID_LIST_POSITION) {",
653     "\t\tthis.build_module_lbl.el.hide();",
654     "\t\tthis.build_module.el.hide();",
655     "\t\tthis.name_lbl.el.hide();",
656     "\t\tthis.name.el.hide();",
657     "\t\t ",
658     "    \tthis.gen_lbl.el.hide();",
659     "\t\tthis.gen.el.hide();",
660     "    ",
661     "\t\treturn;",
662     "\t\t",
663     "\t",
664     "\t}",
665     "\t// directory selected",
666     "\tvar sel = this.filetype.getValue();",
667     "\t",
668     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
669     "\t\tthis.build_module_lbl.el.show();",
670     "\t\tthis.build_module.el.show();",
671     "\t}",
672     "\tthis.name_lbl.el.show();",
673     "\tthis.name.el.show();",
674     "\t",
675     "\tif (sel == \"bjs\") {",
676     "        _this.gen_lbl.el.show();",
677     "        _this.gen.el.show();",
678     "    }",
679     "    ",
680     "    if (this.file.project.xtype == \"Roo\" && sel == \"bjs\") {",
681     "    \tthis.title_lbl.el.show();",
682     "\t\tthis.title.el.show();",
683     "\t\t",
684     "\t\tthis.region_lbl.el.show();",
685     "\t\tthis.region.el.show();",
686     "\t\t",
687     "\t\tthis.parent_lbl.el.show();",
688     "\t\tthis.parent.el.show();",
689     "\t\t",
690     "\t\tthis.permname_lbl.el.show();",
691     "\t\tthis.permname.el.show();",
692     "\t\t",
693     "\t\tthis.modOrder_lbl.el.show();",
694     "\t\tthis.modOrder.el.show();",
695     "\t}",
696     "    ",
697     "        ",
698     "}"
699    ],
700    "| void onFileTypeChange" : [
701     "() {",
702     "\tif (this.filetype.el.selected == Gtk.INVALID_LIST_POSITION) {",
703     "\t\tthis.dir_dropdown.el.hide();",
704     "\t\tthis.dir_dropdown_lbl.el.hide();",
705     "\t\tthis.build_module_lbl.el.hide();",
706     "\t\tthis.build_module.el.hide();",
707     "\t\tthis.name_lbl.el.hide();",
708     "\t\tthis.name.el.hide();",
709     "\t ",
710     "    \tthis.gen_lbl.el.hide();",
711     "\t\tthis.gen.el.hide();",
712     "    ",
713     "    ",
714     "    \tthis.title_lbl.el.hide();",
715     "\t\tthis.title.el.hide();",
716     "\t\t",
717     "\t\tthis.region_lbl.el.hide();",
718     "\t\tthis.region.el.hide();",
719     "\t\t",
720     "\t\tthis.parent_lbl.el.hide();",
721     "\t\tthis.parent.el.hide();",
722     "\t\t",
723     "\t\tthis.permname_lbl.el.hide();",
724     "\t\tthis.permname.el.hide();",
725     "\t\t",
726     "\t\tthis.modOrder_lbl.el.hide();",
727     "\t\tthis.modOrder.el.hide();",
728     " ",
729     "\t\treturn;",
730     "\t\t ",
731     "\t}",
732     "\t",
733     "\tthis.dir_dropdown.el.show();",
734     "\tthis.dir_dropdown_lbl.el.show();",
735     "\tvar sel = this.filetype.getValue();",
736     "\t",
737     "\tvar old_sel = _this.dir_dropdown.el.selected != Gtk.INVALID_LIST_POSITION;",
738     "\tvar olddir = this.dir_dropdown.getValue();",
739     "\tGLib.debug(\"old dir = %s\", olddir);",
740     "\tif (this.file.project.xtype==\"Gtk\" && (sel == \"bjs\" || sel == \"vala\")) {",
741     "\t\t_this.project.loadDirsToStringList(_this.dir_model.el, \"/src\");",
742     "\t\tif (old_sel && olddir.has_prefix(\"/src\")) {",
743     "\t\t \tthis.dir_dropdown.setValue(olddir);",
744     " \t\t} else {",
745     "\t \t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
746     " \t    }",
747     "         ",
748     "\t} else {",
749     "",
750     "        _this.project.loadDirsToStringList(_this.dir_model.el, \"\");",
751     "\t\tif (old_sel) {",
752     "\t\t\tthis.dir_dropdown.setValue(olddir);",
753     "\t\t} else {",
754     "\t\t     _this.dir_dropdown.el.selected = Gtk.INVALID_LIST_POSITION;",
755     "\t     }",
756     "       ",
757     "    }",
758     "",
759     " ",
760     "    // is this confusing?  - should we just strip out / add if necessary..",
761     "    if (sel == \"bjs\" || sel == \"vala\" || sel == \"js\" || sel == \"css\" || sel == \"php\") {",
762     "        _this.name_lbl.el.label = \"Component Name (Filename with-out extension)\";\t\t\t\t ",
763     "    } else {",
764     "\t    _this.name_lbl.el.label = \"File Name (with extension)\";",
765     "    }",
766     " ",
767     "}"
768    ],
769    "| void show" : [
770     "(JsRender.JsRender  c, Gtk.Window pwin, bool new_window) ",
771     "{",
772     "    ",
773     "    this.project = c.project;",
774     "    this.done = false;",
775     "    this.new_window = new_window;",
776     "    ",
777     "    //if (!this.el) {",
778     "        //this.init();",
779     "     //} ",
780     "     ",
781     "      this.is_new = c.name == \"\";",
782     "",
783     "    _this.name.el.set_text(c.name);",
784     "    _this.title.el.set_text(c.title);",
785     "    _this.parent.el.set_text(c.parent);    ",
786     "    _this.region.el.set_text(c.region);",
787     "    _this.modOrder.el.set_text(c.modOrder);",
788     "    _this.permname.el.set_text(c.permname);",
789     " ",
790     "   _this.gen.el.active = c.gen_extended;",
791     "   ",
792     "",
793     "    ",
794     "    if (this.project.xtype == \"Gtk\") {",
795     "    \tvar p = (Project.Gtk) this.project;",
796     "\t    this.build_module_model.load(p.compilegroups);",
797     "\t    // it will select first if available...",
798     "\t    // only for new files.",
799     "\t    if (!this.is_new) {",
800     "\t\t    this.build_module.setValue(c.build_module);",
801     "\t    }",
802     "    }",
803     "\t     ",
804     "     ",
805     "    _this.file = c;",
806     "   ",
807     "   // this.el.set_size_request( 550, 100); // should expand height, but give  a min width.",
808     "",
809     "    this.el.set_transient_for(pwin);",
810     "    ",
811     "    // window + header?",
812     "     this.hideAll();",
813     "    this.el.show();",
814     "   // this.name.el.grab_focus();",
815     "    ",
816     "    ",
817     "    if (!this.is_new) {",
818     "\t   this.showEditFile();",
819     "    } else {",
820     "    \tthis.showNewFile();",
821     "\t\t ",
822     "      ",
823     "\t    ",
824     "    }",
825     "    ",
826     "    ",
827     "    //this.success = c.success;",
828     "    ",
829     "    ",
830     "}"
831    ],
832    "| void showEditFile" : [
833     "() {",
834     " \tthis.save_btn.el.set_label(\"Save\");",
835     "\tthis.filetype_lbl.el.hide();",
836     "\tthis.filetype.el.hide();",
837     "\t\t ",
838     "\tvar sel = this.filetype.getValue();",
839     "\tswitch(_this.project.xtype) {",
840     "\t\tcase \"Roo\":\t ",
841     "\t\t\t if (sel == \"bjs\") {",
842     "\t\t\t\t_this.title_lbl.el.show();",
843     "\t\t\t\t_this.title.el.show();",
844     "\t\t\t\t",
845     "\t\t\t\t_this.region_lbl.el.show();",
846     "\t\t\t\t_this.region.el.show();",
847     "\t\t\t\t",
848     "\t\t\t\t_this.parent_lbl.el.show();",
849     "\t\t\t\t_this.parent.el.show();",
850     "\t\t\t\t",
851     "\t\t\t\t_this.permname_lbl.el.show();",
852     "\t\t\t\t_this.permname.el.show();",
853     "\t\t\t\t",
854     "\t\t\t\t_this.modOrder_lbl.el.show();",
855     "\t\t\t\t_this.modOrder.el.show();",
856     "\t\t\t",
857     "\t\t\t}",
858     "\t\t\tbreak;",
859     "\t\tdefault:",
860     "\t\t\t_this.build_module_lbl.el.show();",
861     "\t\t\t_this.build_module.el.show();\t",
862     "\t\t\t",
863     "\t\t\tif (sel == \"bjs\") {",
864     "\t\t\t",
865     "\t\t\t\t _this.gen_lbl.el.show();",
866     "\t\t\t\t_this.gen.el.show();",
867     "\t\t\t}",
868     "\t\t\tbreak;",
869     "\t}",
870     "\tthis.path.el.show();",
871     "\tthis.path_lbl.el.show();",
872     "\tthis.path.el.set_text(_this.file.relpath);",
873     "}"
874    ],
875    "| void showNewFile" : [
876     "() {",
877     " \tthis.save_btn.el.set_label(\"Create\");",
878     " \tthis.hideAll();",
879     " \tthis.filetype.el.show();",
880     "    this.filetype_lbl.el.show();",
881     "    this.filetype_model.load();",
882     "\tthis.filetype.el.selected = Gtk.INVALID_LIST_POSITION;",
883     " ",
884     "\t    ",
885     "}"
886    ],
887    "| void updateFileFromEntry" : [
888     "() {",
889     "",
890     "        _this.file.title = _this.title.el.get_text();",
891     "        _this.file.region = _this.region.el.get_text();            ",
892     "        _this.file.parent = _this.parent.el.get_text();                        ",
893     "        _this.file.permname = _this.permname.el.get_text();                                    ",
894     "        _this.file.modOrder = _this.modOrder.el.get_text();",
895     "        _this.file.gen_extended = _this.gen.el.active;",
896     "        var new_name =  _this.name.el.get_text();",
897     "        if (_this.file.name.length  > 0 && _this.file.name != new_name) {",
898     "            try {",
899     "            \t_this.file.renameTo( new_name );",
900     "        \t} catch (JsRender.Error e) { } // do nothing?",
901     "        }",
902     "        ",
903     "        _this.file.build_module = _this.build_module.getValue();",
904     "\t\t",
905     "        ",
906     "        ",
907     "",
908     "                                                    ",
909     "}    "
910    ]
911   }
912  ],
913  "name" : "PopoverFileDetails"
914 }