3 * this is the code represents a File when using the Gtk view..
17 public class Flutter : JsRender
21 public Flutter(Project.Project project, string path) {
24 this.xtype = "Flutter";
25 this.language = "dart";
27 this.id = "file-flutter-%d".printf(fid++);
36 public override void removeFiles() {
38 var js = GLib.Path.get_dirname(this.path) +"/" + name + ".js";
39 if (FileUtils.test(js, FileTest.EXISTS)) {
40 GLib.FileUtils.remove(js);
42 var vala = GLib.Path.get_dirname(this.path) +"/" + name + ".vala";
43 if (FileUtils.test(vala, FileTest.EXISTS)) {
44 GLib.FileUtils.remove(vala);
49 public override void loadItems() throws GLib.Error // : function(cb, sync) == original was async.
52 print("load Items!\n");
53 if (this.tree != null) {
59 print("load: %s\n" , this.path);
60 if (!GLib.FileUtils.test(this.path, GLib.FileTest.EXISTS)) {
68 var pa = new Json.Parser();
69 pa.load_from_file(this.path);
70 var node = pa.get_root();
72 if (node.get_node_type () != Json.NodeType.OBJECT) {
73 throw new Error.INVALID_FORMAT ("Unexpected element type %s", node.type_name ());
75 var obj = node.get_object ();
77 this.name = obj.get_string_member("name");
78 this.parent = obj.get_string_member("parent");
79 this.title = obj.get_string_member("title");
82 // load items[0] ??? into tree...
83 var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
84 bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
86 if (obj.has_member("items")
88 obj.get_member("items").get_node_type() == Json.NodeType.ARRAY
90 obj.get_array_member("items").get_length() > 0
92 var ar = obj.get_array_member("items");
93 var tree_base = ar.get_object_element(0);
94 this.tree = new Node();
95 this.tree.loadFromJson(tree_base, int.parse(bjs_version_str));
98 //NodeToVala.mungeFile(this); // force line numbering..
105 public override string toSourcePreview()
109 public override void setSource(string str) {}
111 public override string toSourceCode() // no seed support currently.
113 return ""; ///NodeToVala.mungeFile(this);
116 // this is only used by dumping code...
117 public override string toSource() // no seed support currently.
126 public override void save() {
128 // this.saveJS(); - disabled at present.. project settings will probably enable this later..
132 // ignore these calls.
133 public override void saveHTML ( string html ) {}
139 * save as a javascript file. - not used currently
140 * why is this not save...???
147 var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".js";
148 print("WRITE :%s\n " , fn);
149 this.writeFile(fn, this.toSource());
155 /*if (this.tree == null) {
158 var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".vala";
159 print("WRITE :%s\n " , fn);
160 this.writeFile(fn, NodeToVala.mungeFile(this));
167 string getHelpUrl(string cls)
169 return "http://devel.akbkhome.com/seed/" + cls + ".html";
171 public override void findTransStrings(Node? node )