public string region; // RooJS - insert region.
public string title; // a title.. ?? nickname.. ??? -
+ public string build_module; // module to build if we compile (or are running tests...)
+
public string permname;
public string language;
public signal void changed (Node? node, string source);
-
+
+
+ public signal void compile_notice(string type, string file, int line, string message);
/**
* UI componenets
*
this.permname = "";
this.modOrder = "";
this.language = "";
+ this.build_module = "";
+ print("JsRender.cto() - reset transStrings\n");
this.transStrings = new Gee.HashMap<string,string> ();
// should use basename reallly...
public void renameTo(string name)
{
-
+ if (this.xtype == "PlainFile") {
+ return;
+ }
var bjs = GLib.Path.get_dirname(this.path) +"/" + name + ".bjs";
if (FileUtils.test(bjs, FileTest.EXISTS)) {
throw new Error.RENAME_FILE_EXISTS("File exists %s\n",name);
return new Gtk(project, path);
case "Roo":
return new Roo(project, path);
+ case "PlainFile":
+ return new PlainFile(project, path);
}
throw new Error.INVALID_FORMAT("JsRender Factory called with xtype=%s", xt);
return null;
public string toJsonString()
{
+ if (this.xtype == "PlainFile") {
+ return "";
+ }
var generator = new Json.Generator ();
generator.indent = 4;
generator.pretty = true;
public void saveBJS()
{
-
+ if (this.xtype == "PlainFile") {
+ return;
+ }
var generator = new Json.Generator ();
generator.indent = 1;
generator.pretty = true;
public abstract void loadItems() throws GLib.Error;
-
- /**
- *
- * load from a javascript file.. rather than bjs..
- *
- *
- */
- /*
- _loadItems : function(cb)
- {
- // already loaded..
- if (this.items !== false) {
- return false;
- }
-
-
-
- var tr = new TokenReader( {
- keepDocs :true,
- keepWhite : true,
- keepComments : true,
- sepIdents : false,
- collapseWhite : false,
- filename : args[0],
- ignoreBadGrammer: true
- });
-
- var str = File.read(this.path);
- var toks = tr.tokenize(new TextStream(str));
- var rf = new JsParser(toks);
- rf.parse();
- var cfg = rf.cfg;
-
- this.modOrder = cfg.modOrder || '001';
- this.name = cfg.name.replace(/\.bjs/, ''); // BC!
- this.parent = cfg.parent;
- this.permname = cfg.permname || '';
- this.title = cfg.title || cfg.name;;
- this.items = cfg.items || [];
- //???
- //this.fixItems(_this, false);
- cb();
- return true;
-
- },
- */
- /**
- * accepts:
- * { success : , failure : , scope : }
- *
- *
- *
- */
- /*
- void getTree ( o ) {
- print("File.getTree tree called on base object?!?!");
- }
- */
+
+
+
+
public string jsonHasOrEmpty(Json.Object obj, string key) {
return obj.has_member(key) ?
obj.get_string_member(key) : "";
var ret = new Json.Object();
+ if (this.xtype == "PlainFile") {
+ return ret;
+ }
+
//ret.set_string_member("id", this.id); // not relivant..
ret.set_string_member("name", this.name);
ret.set_string_member("parent", this.parent == null ? "" : this.parent);
//ret.set_string_member("items", this.items);
ret.set_string_member("permname", this.permname == null ? "" : this.permname);
ret.set_string_member("modOrder", this.modOrder == null ? "" : this.modOrder);
+ if (this.project.xtype == "Gtk") {
+ ret.set_string_member("build_module", this.build_module == null ? "" : this.build_module);
+ }
if (this.transStrings.size > 0) {
var tr = new Json.Object();
public Palete.Palete palete()
{
+ // error on plainfile?
return Palete.factory(this.xtype);
}
data_out.put_string(contents, null);
data_out.close(null);
}
- /*
- copyTo: function(path, cb)
- {
- var _this = this;
- this.loadItems(function() {
-
- _this.path = path;
- cb();
- });
-
- },
- */
+
/**
*
}
+ public Node? lineToNode(int line)
+ {
+ if (this.tree == null) {
+ return null;
+ }
+ return this.tree.lineToNode(line);
+
+
+ }
+
+
public abstract void save();
public abstract void saveHTML(string html);
public abstract string toSource() ;
+ public abstract void setSource(string str);
public abstract string toSourcePreview() ;
public abstract void removeFiles() ;
-
+ public abstract void findTransStrings(Node? node );
}
}