From 8169b17eb4dcc7886b079332aabbf411a63cedbf Mon Sep 17 00:00:00 2001 From: Kevin Jahns Date: Sat, 2 Aug 2014 01:39:30 +0200 Subject: [PATCH] Completed JsonYatta. Added IwcConnector --- .gitignore | 3 + Gruntfile.coffee | 26 +- dest/browser/Connectors/IwcConnector.js | 130 ++ dest/browser/Frameworks/JsonIwcYatta.js | 1163 +++++++++++++++++ dest/browser/Widgets/CollaborationWidget.xml | 31 + dest/browser/Widgets/CollaborationWidget2.xml | 32 + dest/browser/Widgets/iwc-teststub.xml | 241 ++++ dest/browser/Widgets/libs/DUIClient.js | 368 ++++++ dest/browser/Yatta.js | 1 - dest/browser/Yatta_test.js | 924 +++++++++---- dest/lib/lib/Connectors/IwcConnector.js | 128 ++ dest/lib/lib/Connectors/IwcConnector.js.map | 10 + dest/lib/lib/Connectors/TestConnector.js | 20 +- dest/lib/lib/Connectors/TestConnector.js.map | 2 +- dest/lib/lib/Engine.js | 61 +- dest/lib/lib/Engine.js.map | 2 +- dest/lib/lib/Frameworks/JsonYatta.js | 61 + dest/lib/lib/Frameworks/JsonYatta.js.map | 10 + dest/lib/lib/Frameworks/TextYatta.js | 8 +- dest/lib/lib/Frameworks/TextYatta.js.map | 2 +- dest/lib/lib/HistoryBuffer.js | 28 +- dest/lib/lib/HistoryBuffer.js.map | 2 +- dest/lib/lib/Types/BasicTypes.js | 35 +- dest/lib/lib/Types/BasicTypes.js.map | 2 +- dest/lib/lib/Types/JsonTypes.js | 67 + dest/lib/lib/Types/JsonTypes.js.map | 10 + dest/lib/lib/Types/StructuredTypes.js | 110 +- dest/lib/lib/Types/StructuredTypes.js.map | 2 +- dest/lib/lib/Types/TextTypes.js | 24 +- dest/lib/lib/Types/TextTypes.js.map | 2 +- dest/lib/lib/Types/XmlTypes.js | 2 - dest/lib/lib/Types/XmlTypes.js.map | 2 +- dest/test/test/JsonYatta_test.js | 173 +++ dest/test/test/TextYatta_test.js | 101 +- doc/alphabetical_index.html | 71 +- doc/class/AddName.html | 173 +++ doc/class/Engine.html | 26 +- doc/class/HistoryBuffer.html | 2 +- doc/class/IwcConnector.html | 227 ++++ doc/class/JsonType.html | 173 +++ doc/class/JsonYatta.html | 247 ++++ doc/class/ListManager.html | 2 +- doc/class/MapManager.html | 18 +- doc/class/Operation.html | 2 +- doc/class/ReplaceManager.html | 2 +- doc/class/Replaceable.html | 2 +- doc/class/TestConnector.html | 2 +- doc/class/TextDelete.html | 2 +- doc/class/TextInsert.html | 2 +- doc/class/TextYatta.html | 2 +- doc/class/Word.html | 4 +- doc/class_list.html | 44 + doc/extra/LICENSE-LGPL.html | 2 +- doc/extra/README.md.html | 4 +- .../lib/Connectors/IwcConnector.coffee.html | 158 +++ .../lib/Connectors/TestConnector.coffee.html | 2 +- doc/file/lib/Engine.coffee.html | 2 +- doc/file/lib/Frameworks/JsonYatta.coffee.html | 142 ++ doc/file/lib/Frameworks/TextYatta.coffee.html | 2 +- doc/file/lib/HistoryBuffer.coffee.html | 2 +- doc/file/lib/Types/BasicTypes.coffee.html | 2 +- doc/file/lib/Types/JsonTypes.coffee.html | 113 ++ .../lib/Types/StructuredTypes.coffee.html | 2 +- doc/file/lib/Types/TextTypes.coffee.html | 2 +- doc/file/lib/Types/XmlTypes.coffee.html | 2 +- doc/file_list.html | 24 + doc/javascript/search.js | 2 +- doc/method_list.html | 310 ++++- lib/Connectors/IwcConnector.coffee | 94 ++ lib/Connectors/TestConnector.coffee | 18 +- lib/Engine.coffee | 33 +- lib/Frameworks/JsonYatta.coffee | 40 + lib/Frameworks/TextYatta.coffee | 6 +- lib/HistoryBuffer.coffee | 16 +- lib/Types/BasicTypes.coffee | 27 +- lib/Types/JsonTypes.coffee | 49 + lib/Types/StructuredTypes.coffee | 85 +- lib/Types/TextTypes.coffee | 17 +- lib/Types/XmlTypes.coffee | 1 - package.json | 21 +- test/JsonYatta_test.coffee | 144 ++ test/TextYatta_test.coffee | 32 +- 82 files changed, 5547 insertions(+), 591 deletions(-) create mode 100644 dest/browser/Connectors/IwcConnector.js create mode 100644 dest/browser/Frameworks/JsonIwcYatta.js create mode 100644 dest/browser/Widgets/CollaborationWidget.xml create mode 100644 dest/browser/Widgets/CollaborationWidget2.xml create mode 100644 dest/browser/Widgets/iwc-teststub.xml create mode 100644 dest/browser/Widgets/libs/DUIClient.js delete mode 100644 dest/browser/Yatta.js create mode 100644 dest/lib/lib/Connectors/IwcConnector.js create mode 100644 dest/lib/lib/Connectors/IwcConnector.js.map create mode 100644 dest/lib/lib/Frameworks/JsonYatta.js create mode 100644 dest/lib/lib/Frameworks/JsonYatta.js.map create mode 100644 dest/lib/lib/Types/JsonTypes.js create mode 100644 dest/lib/lib/Types/JsonTypes.js.map create mode 100644 dest/test/test/JsonYatta_test.js create mode 100644 doc/class/AddName.html create mode 100644 doc/class/IwcConnector.html create mode 100644 doc/class/JsonType.html create mode 100644 doc/class/JsonYatta.html create mode 100644 doc/file/lib/Connectors/IwcConnector.coffee.html create mode 100644 doc/file/lib/Frameworks/JsonYatta.coffee.html create mode 100644 doc/file/lib/Types/JsonTypes.coffee.html create mode 100644 lib/Connectors/IwcConnector.coffee create mode 100644 lib/Frameworks/JsonYatta.coffee create mode 100644 lib/Types/JsonTypes.coffee create mode 100644 test/JsonYatta_test.coffee diff --git a/.gitignore b/.gitignore index 2ccbe465..205c19db 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ /node_modules/ +.kateproject.d +.kateproject +.directory diff --git a/Gruntfile.coffee b/Gruntfile.coffee index e59201cb..1792633f 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -72,16 +72,36 @@ module.exports = (grunt) -> browserify: dist: files: - 'dest/browser/Yatta.js': ['lib/index.coffee'] 'dest/browser/Yatta_test.js': ['test/**/*.coffee'] + 'dest/browser/Connectors/IwcConnector.js': ['lib/Connectors/IwcConnector.coffee'] + 'dest/browser/Frameworks/JsonIwcYatta.js': ['./lib/Frameworks/JsonYatta.coffee', './lib/Connectors/IwcConnector.coffee'] options: transform: ['coffeeify'] - debug: true - bundleOptions: {debug: true} + debug: false + bundleOptions: {debug: false} + # Serve files via http-server + connect: + server: + options: + hostname: '*' + port: 1337 + base: './dest/browser/' + keepalive: true + middleware: (connect, options, middlewares)-> + middlewares.push (req, res, next)-> + if res.header? + res.header('Access-Control-Allow-Origin', "*") + res.header('Access-Control-Allow-Credentials', true) + res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept") + res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS') + res.header('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0') + return next() + return middlewares # These plugins provide necessary tasks. grunt.loadNpmTasks "grunt-browserify" grunt.loadNpmTasks "grunt-contrib-coffee" + grunt.loadNpmTasks 'grunt-contrib-connect' grunt.loadNpmTasks "grunt-contrib-watch" grunt.loadNpmTasks "grunt-simple-mocha" grunt.loadNpmTasks "grunt-coffeelint" diff --git a/dest/browser/Connectors/IwcConnector.js b/dest/browser/Connectors/IwcConnector.js new file mode 100644 index 00000000..69fb9d8e --- /dev/null +++ b/dest/browser/Connectors/IwcConnector.js @@ -0,0 +1,130 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 0; + }; + + Insert.prototype.getDistanceToOrigin = function() { + var d, o; + d = 0; + o = this.prev_cl; + while (true) { + if (this.origin === o) { + break; + } + d++; + if (this === this.prev_cl) { + throw new Error("this should not happen ;) "); + } + o = o.prev_cl; + } + return d; + }; + + Insert.prototype.update_sl = function() { + var o; + o = this.prev_cl; + ({ + update: function(dest_cl, dest_sl) { + var _results; + _results = []; + while (true) { + if (o.isDeleted()) { + _results.push(o = o[dest_cl]); + } else { + this[dest_sl] = o; + break; + } + } + return _results; + } + }); + update("prev_cl", "prev_sl"); + return update("next_cl", "prev_sl"); + }; + + Insert.prototype.execute = function() { + var distance_to_origin, i, o, _ref, _ref1; + if (this.is_executed != null) { + return this; + } + if (!this.validateSavedOperations()) { + return false; + } else { + if (((_ref = this.prev_cl) != null ? _ref.validateSavedOperations() : void 0) && ((_ref1 = this.next_cl) != null ? _ref1.validateSavedOperations() : void 0) && this.prev_cl.next_cl !== this) { + distance_to_origin = 0; + o = this.prev_cl.next_cl; + i = 0; + while (true) { + if (o == null) { + console.log(JSON.stringify(this.prev_cl.getUid())); + console.log(JSON.stringify(this.next_cl.getUid())); + } + if (o !== this.next_cl) { + if (o.getDistanceToOrigin() === i) { + if (o.creator < this.creator) { + this.prev_cl = o; + distance_to_origin = i + 1; + } else { + + } + } else if (o.getDistanceToOrigin() < i) { + if (i - distance_to_origin <= o.getDistanceToOrigin()) { + this.prev_cl = o; + distance_to_origin = i + 1; + } else { + + } + } else { + break; + } + i++; + o = o.next_cl; + } else { + break; + } + } + this.next_cl = this.prev_cl.next_cl; + this.prev_cl.next_cl = this; + this.next_cl.prev_cl = this; + } + Insert.__super__.execute.apply(this, arguments); + return this; + } + }; + + Insert.prototype.val = function() { + throw new Error("Implement this function!"); + }; + + return Insert; + + })(Operation); + Delimiter = (function(_super) { + __extends(Delimiter, _super); + + function Delimiter() { + return Delimiter.__super__.constructor.apply(this, arguments); + } + + Delimiter.prototype.isDeleted = function() { + return false; + }; + + Delimiter.prototype.getDistanceToOrigin = function() { + return 0; + }; + + Delimiter.prototype.execute = function() { + var l, _i, _len; + if (this.validateSavedOperations()) { + for (_i = 0, _len = execution_listener.length; _i < _len; _i++) { + l = execution_listener[_i]; + l(this.toJson()); + } + return this; + } else { + return false; + } + }; + + Delimiter.prototype.toJson = function() { + var _ref, _ref1; + return { + 'type': "Delimiter", + 'uid': this.getUid(), + 'prev': (_ref = this.prev_cl) != null ? _ref.getUid() : void 0, + 'next': (_ref1 = this.next_cl) != null ? _ref1.getUid() : void 0 + }; + }; + + return Delimiter; + + })(Insert); + parser['Delimiter'] = function(json) { + var next, prev, uid; + uid = json['uid'], prev = json['prev'], next = json['next']; + return new Delimiter(uid, prev, next); + }; + return { + 'types': { + 'Delete': Delete, + 'Insert': Insert, + 'Delimiter': Delimiter, + 'Operation': Operation + }, + 'parser': parser, + 'execution_listener': execution_listener + }; +}; + + +},{}],6:[function(require,module,exports){ +var text_types_uninitialized, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +text_types_uninitialized = require("./TextTypes.coffee"); + +module.exports = function(HB) { + var JsonType, parser, text_types, types; + text_types = text_types_uninitialized(HB); + types = text_types.types; + parser = text_types.parser; + JsonType = (function(_super) { + __extends(JsonType, _super); + + function JsonType(uid, initial_value) { + var name, o; + JsonType.__super__.constructor.call(this, uid); + if (initial_value != null) { + if (typeof initial_value !== "object") { + throw new Error("The initial value of JsonTypes must be of type Object! (current type: " + (typeof initial_value) + ")"); + } + for (name in initial_value) { + o = initial_value[name]; + this.val(name, o); + } + } + } + + JsonType.prototype.val = function(name, content) { + var json, word; + if ((name != null) && (content != null)) { + if (typeof content === 'string') { + word = HB.addOperation(new types.Word(HB.getNextOperationIdentifier(), content)).execute(); + JsonType.__super__.val.call(this, name, word); + return content; + } else if (typeof content === 'object') { + json = HB.addOperation(JsonType(HB.getNextOperationIdentifier(), content)).execute(); + JsonType.__super__.val.call(this, name, json); + return content; + } else { + throw new Error("You must not set " + (typeof content) + "-types in collaborative Json-objects!"); + } + } else { + return JsonType.__super__.val.call(this, name, content); + } + }; + + JsonType.prototype.toJson = function() { + return { + 'type': "JsonType", + 'uid': this.getUid() + }; + }; + + return JsonType; + + })(types.MapManager); + parser['JsonType'] = function(json) { + var uid; + uid = json['uid']; + return new JsonType(uid); + }; + types['JsonType'] = JsonType; + return text_types; +}; + + +},{"./TextTypes.coffee":8}],7:[function(require,module,exports){ +var basic_types_uninitialized, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +basic_types_uninitialized = require("./BasicTypes.coffee"); + +module.exports = function(HB) { + var AddName, ListManager, MapManager, ReplaceManager, Replaceable, basic_types, parser, types; + basic_types = basic_types_uninitialized(HB); + types = basic_types.types; + parser = basic_types.parser; + MapManager = (function(_super) { + __extends(MapManager, _super); + + function MapManager(uid) { + this.map = {}; + MapManager.__super__.constructor.call(this, uid); + } + + MapManager.prototype.val = function(name, content) { + var o, result, _ref, _ref1; + if (content != null) { + if (this.map[name] == null) { + HB.addOperation(new AddName(HB.getNextOperationIdentifier(), this, name)).execute(); + } + return this.map[name].replace(content); + } else if (name != null) { + return (_ref = this.map[name]) != null ? _ref.val() : void 0; + } else { + result = {}; + _ref1 = this.map; + for (name in _ref1) { + o = _ref1[name]; + result[name] = o.val(); + } + return result; + } + }; + + return MapManager; + + })(types.Operation); + AddName = (function(_super) { + __extends(AddName, _super); + + function AddName(uid, map_manager, name) { + this.name = name; + this.saveOperation('map_manager', map_manager); + AddName.__super__.constructor.call(this, uid); + } + + AddName.prototype.execute = function() { + var beg, end, uid_beg, uid_end, uid_r; + if (!this.validateSavedOperations()) { + return false; + } else { + uid_r = this.map_manager.getUid(); + uid_r.op_number = "_" + uid_r.op_number + "_RM_" + this.name; + if (HB.getOperation(uid_r) == null) { + uid_beg = this.map_manager.getUid(); + uid_beg.op_number = "_" + uid_beg.op_number + "_RM_" + this.name + "_beginning"; + uid_end = this.map_manager.getUid(); + uid_end.op_number = "_" + uid_end.op_number + "_RM_" + this.name + "_end"; + beg = HB.addOperation(new types.Delimiter(uid_beg, void 0, uid_end)); + end = HB.addOperation(new types.Delimiter(uid_end, beg, void 0)).execute(); + beg.execute(); + this.map_manager.map[this.name] = HB.addOperation(new ReplaceManager(void 0, uid_r, beg, end)).execute(); + } + return AddName.__super__.execute.apply(this, arguments); + } + }; + + AddName.prototype.toJson = function() { + return { + 'type': "AddName", + 'uid': this.getUid(), + 'map_manager': this.map_manager.getUid(), + 'name': this.name + }; + }; + + return AddName; + + })(types.Operation); + parser['AddName'] = function(json) { + var map_manager, name, uid; + map_manager = json['map_manager'], uid = json['uid'], name = json['name']; + return new AddName(uid, map_manager, name); + }; + ListManager = (function(_super) { + __extends(ListManager, _super); + + function ListManager(uid, beginning, end, prev, next, origin) { + if ((beginning != null) && (end != null)) { + this.saveOperation('beginning', beginning); + this.saveOperation('end', end); + } else { + this.beginning = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), void 0, void 0)); + this.end = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), this.beginning, void 0)); + this.beginning.next_cl = this.end; + this.beginning.execute(); + this.end.execute(); + } + ListManager.__super__.constructor.call(this, uid, prev, next, origin); + } + + ListManager.prototype.getLastOperation = function() { + return this.end.prev_cl; + }; + + ListManager.prototype.getFirstOperation = function() { + return this.beginning.next_cl; + }; + + ListManager.prototype.toArray = function() { + var o, result; + o = this.beginning.next_cl; + result = []; + while (o !== this.end) { + result.push(o); + o = o.next_cl; + } + return result; + }; + + ListManager.prototype.getOperationByPosition = function(position) { + var o; + o = this.beginning.next_cl; + if (position > 0) { + while (true) { + o = o.next_cl; + if (!o.isDeleted()) { + position -= 1; + } + if (position === 0) { + break; + } + if (o instanceof types.Delimiter) { + throw new Error("position parameter exceeded the length of the document!"); + } + } + } + return o; + }; + + return ListManager; + + })(types.Insert); + ReplaceManager = (function(_super) { + __extends(ReplaceManager, _super); + + function ReplaceManager(initial_content, uid, beginning, end, prev, next, origin) { + ReplaceManager.__super__.constructor.call(this, uid, beginning, end, prev, next, origin); + if (initial_content != null) { + this.replace(initial_content); + } + } + + ReplaceManager.prototype.replace = function(content) { + var o, op; + o = this.getLastOperation(); + op = new Replaceable(content, this, HB.getNextOperationIdentifier(), o, o.next_cl); + return HB.addOperation(op).execute(); + }; + + ReplaceManager.prototype.val = function() { + var o; + o = this.getLastOperation(); + if (o instanceof types.Delimiter) { + throw new Error("dtrn"); + } + return o.val(); + }; + + ReplaceManager.prototype.toJson = function() { + var json; + json = { + 'type': "ReplaceManager", + 'uid': this.getUid(), + 'beginning': this.beginning.getUid(), + 'end': this.end.getUid() + }; + if ((this.prev_cl != null) && (this.next_cl != null)) { + json['prev'] = this.prev_cl.getUid(); + json['next'] = this.next_cl.getUid(); + } + if ((this.origin != null) && this.origin !== this.prev_cl) { + json["origin"] = this.origin.getUid(); + } + return json; + }; + + return ReplaceManager; + + })(ListManager); + parser["ReplaceManager"] = function(json) { + var beginning, content, end, next, origin, prev, uid; + content = json['content'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin'], beginning = json['beginning'], end = json['end']; + return new ReplaceManager(content, uid, beginning, end, prev, next, origin); + }; + Replaceable = (function(_super) { + __extends(Replaceable, _super); + + function Replaceable(content, parent, uid, prev, next, origin) { + this.saveOperation('content', content); + this.saveOperation('parent', parent); + if (!((prev != null) && (next != null) && (content != null))) { + throw new Error("You must define content, prev, and next for Replaceable-types!"); + } + Replaceable.__super__.constructor.call(this, uid, prev, next, origin); + } + + Replaceable.prototype.val = function() { + return this.content; + }; + + Replaceable.prototype.replace = function(content) { + return this.parent.replace(content); + }; + + Replaceable.prototype.execute = function() { + var _base; + if (!this.validateSavedOperations()) { + return false; + } else { + if (typeof (_base = this.content).setReplaceManager === "function") { + _base.setReplaceManager(this.parent); + } + Replaceable.__super__.execute.apply(this, arguments); + return this; + } + }; + + Replaceable.prototype.toJson = function() { + var json; + json = { + 'type': "Replaceable", + 'content': this.content.getUid(), + 'ReplaceManager': this.parent.getUid(), + 'prev': this.prev_cl.getUid(), + 'next': this.next_cl.getUid(), + 'uid': this.getUid() + }; + if ((this.origin != null) && this.origin !== this.prev_cl) { + json["origin"] = this.origin.getUid(); + } + return json; + }; + + return Replaceable; + + })(types.Insert); + parser["Replaceable"] = function(json) { + var content, next, origin, parent, prev, uid; + content = json['content'], parent = json['ReplaceManager'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin']; + return new Replaceable(content, parent, uid, prev, next, origin); + }; + types['ListManager'] = ListManager; + types['MapManager'] = MapManager; + types['ReplaceManager'] = ReplaceManager; + types['Replaceable'] = Replaceable; + return basic_types; +}; + + +},{"./BasicTypes.coffee":5}],8:[function(require,module,exports){ +var structured_types_uninitialized, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +structured_types_uninitialized = require("./StructuredTypes.coffee"); + +module.exports = function(HB) { + var TextDelete, TextInsert, Word, parser, structured_types, types; + structured_types = structured_types_uninitialized(HB); + types = structured_types.types; + parser = structured_types.parser; + TextDelete = (function(_super) { + __extends(TextDelete, _super); + + function TextDelete() { + return TextDelete.__super__.constructor.apply(this, arguments); + } + + return TextDelete; + + })(types.Delete); + parser["TextDelete"] = parser["Delete"]; + TextInsert = (function(_super) { + __extends(TextInsert, _super); + + function TextInsert(content, uid, prev, next, origin) { + this.content = content; + if (!((prev != null) && (next != null))) { + throw new Error("You must define prev, and next for TextInsert-types!"); + } + TextInsert.__super__.constructor.call(this, uid, prev, next, origin); + } + + TextInsert.prototype.getLength = function() { + if (this.isDeleted()) { + return 0; + } else { + return this.content.length; + } + }; + + TextInsert.prototype.val = function(current_position) { + if (this.isDeleted()) { + return ""; + } else { + return this.content; + } + }; + + TextInsert.prototype.toJson = function() { + var json; + json = { + 'type': "TextInsert", + 'content': this.content, + 'uid': this.getUid(), + 'prev': this.prev_cl.getUid(), + 'next': this.next_cl.getUid() + }; + if ((this.origin != null) && this.origin !== this.prev_cl) { + json["origin"] = this.origin.getUid(); + } + return json; + }; + + return TextInsert; + + })(types.Insert); + parser["TextInsert"] = function(json) { + var content, next, origin, prev, uid; + content = json['content'], uid = json['uid'], prev = json['prev'], next = json['next'], origin = json['origin']; + return new TextInsert(content, uid, prev, next, origin); + }; + Word = (function(_super) { + __extends(Word, _super); + + function Word(uid, initial_content, beginning, end, prev, next, origin) { + Word.__super__.constructor.call(this, uid, beginning, end, prev, next, origin); + if (initial_content != null) { + this.insertText(0, initial_content); + } + } + + Word.prototype.insertText = function(position, content) { + var c, o, op, _i, _len, _results; + o = this.getOperationByPosition(position); + _results = []; + for (_i = 0, _len = content.length; _i < _len; _i++) { + c = content[_i]; + op = new TextInsert(c, HB.getNextOperationIdentifier(), o.prev_cl, o); + _results.push(HB.addOperation(op).execute()); + } + return _results; + }; + + Word.prototype.deleteText = function(position, length) { + var d, i, o, _i, _results; + o = this.getOperationByPosition(position); + _results = []; + for (i = _i = 0; 0 <= length ? _i < length : _i > length; i = 0 <= length ? ++_i : --_i) { + d = HB.addOperation(new TextDelete(HB.getNextOperationIdentifier(), o)).execute(); + o = o.next_cl; + while (o.isDeleted()) { + if (o instanceof types.Delimiter) { + throw new Error("You can't delete more than there is.."); + } + o = o.next_cl; + } + _results.push(d.toJson()); + } + return _results; + }; + + Word.prototype.replaceText = function(text) { + var word; + if (this.replace_manager != null) { + word = HB.addOperation(new Word(HB.getNextOperationIdentifier())).execute(); + word.insertText(0, text); + return this.replace_manager.replace(word); + } else { + throw new Error("This type is currently not maintained by a ReplaceManager!"); + } + }; + + Word.prototype.val = function() { + var c, o; + c = (function() { + var _i, _len, _ref, _results; + _ref = this.toArray(); + _results = []; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + o = _ref[_i]; + if (o.val != null) { + _results.push(o.val()); + } else { + _results.push(""); + } + } + return _results; + }).call(this); + return c.join(''); + }; + + Word.prototype.setReplaceManager = function(op) { + this.saveOperation('replace_manager', op); + return this.validateSavedOperations; + }; + + Word.prototype.toJson = function() { + var json; + json = { + 'type': "Word", + 'uid': this.getUid(), + 'beginning': this.beginning.getUid(), + 'end': this.end.getUid() + }; + if (this.prev_cl != null) { + json['prev'] = this.prev_cl.getUid(); + } + if (this.next_cl != null) { + json['next'] = this.next_cl.getUid(); + } + if ((this.origin != null) && this.origin !== this.prev_cl) { + json["origin"] = this.origin.getUid(); + } + return json; + }; + + return Word; + + })(types.ListManager); + parser['Word'] = function(json) { + var beginning, end, next, origin, prev, uid; + uid = json['uid'], beginning = json['beginning'], end = json['end'], prev = json['prev'], next = json['next'], origin = json['origin']; + return new Word(uid, void 0, beginning, end, prev, next, origin); + }; + types['TextInsert'] = TextInsert; + types['TextDelete'] = TextDelete; + types['Word'] = Word; + return structured_types; +}; + + +},{"./StructuredTypes.coffee":7}]},{},[3,1]); \ No newline at end of file diff --git a/dest/browser/Widgets/CollaborationWidget.xml b/dest/browser/Widgets/CollaborationWidget.xml new file mode 100644 index 00000000..72f64c83 --- /dev/null +++ b/dest/browser/Widgets/CollaborationWidget.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + +

awesomewidget

+ ]]>
+
diff --git a/dest/browser/Widgets/CollaborationWidget2.xml b/dest/browser/Widgets/CollaborationWidget2.xml new file mode 100644 index 00000000..76968efe --- /dev/null +++ b/dest/browser/Widgets/CollaborationWidget2.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + +

awesomewidget

+ ]]>
+
diff --git a/dest/browser/Widgets/iwc-teststub.xml b/dest/browser/Widgets/iwc-teststub.xml new file mode 100644 index 00000000..d691c914 --- /dev/null +++ b/dest/browser/Widgets/iwc-teststub.xml @@ -0,0 +1,241 @@ + + + + + + + + * { + font-family: Verdana; + font-size: 8pt; + } + + #accordion { + overflow: auto; + height: 310px; + } + + #pubform, .entry { + border: 1pt solid black + width: 100%; + } + + tr td.ui-state-default{ + width: 20%; + } + + tr td.input, tr td.ui-widget-content { + width: 80%; + } + + #pub_form tr td input { + width: 100%; + } + + #pub_form tr td textarea { + width: 100%; + } + + + + + + + + + + + + +

Received Intents

+
+
+ +
+ + + + + + + + + + +
Publisher
Source
Component
Action
Data
Data Type
Flags
Categories
Extras