Test.GtkWriter.vala.c
[app.Builder.js] / Builder4 / DialogNewComponent.bjs
1 {
2     "id": "file-gtk-3",
3     "name": "DialogNewComponent",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/app.Builder.js/Builder4/DialogNewComponent.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "delete_event": "(self, event) => {\n    this.el.hide();\n    return true;   \n}\n ",
11                 "response": " (self, response_id) =>  { \n  \n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n        if (_this.name.el.get_text().length  < 1) {\n            StandardErrorDialog.show(\n                \"You have to set Project name \"\n            );\n             \n            return;\n        }\n        // what does this do?\n        \n        var isNew = _this.file.name.length  > 0 ? false : true;\n        \n        if (_this.file.name.length > 0 && this.file.name != _this.name.el.get_text()) {\n            StandardErrorDialog.show(\n                \"Sorry changing names does not work yet. \"\n            );\n             \n            return;\n        }\n\n        // FIXME - this may be more complicated...\n        //for (var i in this.def) {\n        //    this.file[i] =  this.get(i).el.get_text();\n        //}\n\n        if (!isNew) {\n            _this.file.save();\n            this.el.hide();\n            return;\n        }\n\n    \n\tvar dir = _this.project.firstPath();\n\t//FIXME...\n        //for (var i in this.project.paths) {\n \t//\tdir = i;\n\t//\tbreak;\n\t//}\n\n \n        \n        // what about .js ?\n        if (GLib.FileUtils.test(_this.file.name + \".bjs\", GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n         \n        var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n        //for (var i in this.file) {\n        //    nf[i] = this.file[i];\n        //}\n        _this.success(_this.project, nf);\n        /*\n\n        -- fixme -- needs to be a signal..\n        if (DialogNewComponent.success != null) {\n            DialogNewComponent.success(_this.project, nf);\n        }\n        */\n}",
12                 "show": "(self)  => {\n  this.el.show_all();\n  \n}"
13             },
14             ".JsRender.JsRender:file": "",
15             ".Project.Project:project": "",
16             ".signal:void:success": "(Project.Project pr, JsRender.JsRender file)",
17             "default_height": 200,
18             "default_width": 500,
19             "id": "DialogNewComponent",
20             "title": "New Component",
21             "xtype": "Dialog",
22             "|deletable": "false",
23             "|modal": "true",
24             "|void:show": "(JsRender.JsRender c) \n{\n    this.project = c.project;\n    \n    //if (!this.el) {\n        //this.init();\n     //}\n    \n    _this.name.el.set_text(c.name);\n    _this.title.el.set_text(c.title);\n    _this.parent.el.set_text(c.parent);    \n    _this.region.el.set_text(c.region);\n    _this.modOrder.el.set_text(c.modOrder);\n     _this.permname.el.set_text(c.permname);\n    \n    if (c.path.length > 0) {\n        this.el.set_title(\"Edit File Details - \" + c.name);\n    } else {\n        this.el.set_title(\"Create New File\");\n    }\n     \n    _this.file = c;\n    //console.log('show all');\n    this.el.show_all();\n    \n    //this.success = c.success;\n    \n    \n}",
25             "|xns": "Gtk",
26             "items": [
27                 {
28                     "|xns": "Gtk",
29                     "xtype": "VBox",
30                     "|pack": "function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n",
31                     "items": [
32                         {
33                             "n_columns": 2,
34                             "n_rows": 3,
35                             "pack": "pack_start,false,false,0",
36                             "xtype": "Table",
37                             "|homogeneous": false,
38                             "|xns": "Gtk",
39                             "items": [
40                                 {
41                                     "label": "Component Name",
42                                     "pack": "add",
43                                     "x_options": 4,
44                                     "xalign": 0.9,
45                                     "xtype": "Label",
46                                     "|justify": "Gtk.Justification.RIGHT",
47                                     "|xns": "Gtk"
48                                 },
49                                 {
50                                     "id": "name",
51                                     "pack": "add",
52                                     "xtype": "Entry",
53                                     "|visible": true,
54                                     "|xns": "Gtk"
55                                 },
56                                 {
57                                     "label": "Title",
58                                     "pack": "add",
59                                     "x_options": 4,
60                                     "xalign": 0.9,
61                                     "xtype": "Label",
62                                     "|justify": "Gtk.Justification.RIGHT",
63                                     "|visible": true,
64                                     "|xns": "Gtk"
65                                 },
66                                 {
67                                     "id": "title",
68                                     "pack": "add",
69                                     "xtype": "Entry",
70                                     "|visible": true,
71                                     "|xns": "Gtk"
72                                 },
73                                 {
74                                     "label": "Region",
75                                     "pack": "add",
76                                     "tooltip_text": "center, north, south, east, west",
77                                     "x_options": 4,
78                                     "xalign": 0.9,
79                                     "xtype": "Label",
80                                     "|justify": "Gtk.Justification.RIGHT",
81                                     "|visible": true,
82                                     "|xns": "Gtk"
83                                 },
84                                 {
85                                     "id": "region",
86                                     "pack": "add",
87                                     "xtype": "Entry",
88                                     "|visible": true,
89                                     "|xns": "Gtk"
90                                 },
91                                 {
92                                     "label": "Parent Name",
93                                     "pack": "add",
94                                     "x_options": 4,
95                                     "xalign": 0.9,
96                                     "xtype": "Label",
97                                     "|justify": "Gtk.Justification.RIGHT",
98                                     "|visible": true,
99                                     "|xns": "Gtk"
100                                 },
101                                 {
102                                     "id": "parent",
103                                     "pack": "add",
104                                     "xtype": "Entry",
105                                     "|visible": true,
106                                     "|xns": "Gtk"
107                                 },
108                                 {
109                                     "label": "Permission Name",
110                                     "pack": "add",
111                                     "x_options": 4,
112                                     "xalign": 0.9,
113                                     "xtype": "Label",
114                                     "|justify": "Gtk.Justification.RIGHT",
115                                     "|visible": true,
116                                     "|xns": "Gtk"
117                                 },
118                                 {
119                                     "id": "permname",
120                                     "pack": "add",
121                                     "xtype": "Entry",
122                                     "|visible": true,
123                                     "|xns": "Gtk"
124                                 },
125                                 {
126                                     "label": "Order (for tabs)",
127                                     "pack": "add",
128                                     "x_options": 4,
129                                     "xalign": 0.9,
130                                     "xtype": "Label",
131                                     "|justify": "Gtk.Justification.RIGHT",
132                                     "|visible": true,
133                                     "|xns": "Gtk"
134                                 },
135                                 {
136                                     "id": "modOrder",
137                                     "pack": "add",
138                                     "xtype": "Entry",
139                                     "|visible": true,
140                                     "|xns": "Gtk"
141                                 }
142                             ]
143                         }
144                     ]
145                 },
146                 {
147                     "|xns": "Gtk",
148                     "xtype": "Button",
149                     "pack": "add_action_widget,0",
150                     "label": "Cancel"
151                 },
152                 {
153                     "|xns": "Gtk",
154                     "xtype": "Button",
155                     "pack": "add_action_widget,1",
156                     "label": "OK"
157                 }
158             ]
159         }
160     ],
161     "permname": "",
162     "modOrder": ""
163 }