From 8fe92b94ce5e1e2857d088752d94e19db7e3d8a8 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Sun, 17 Jun 2012 22:31:44 -0700 Subject: montage v11 merge into ninja Signed-off-by: Valerio Virgillito --- node_modules/montage/CHANGES.md | 12 + node_modules/montage/core/core.js | 14 +- node_modules/montage/core/deserializer.js | 64 +- node_modules/montage/core/event/mutable-event.js | 61 +- node_modules/montage/core/promise.js | 42 +- node_modules/montage/core/serializer.js | 4 +- node_modules/montage/data/blueprint.js | 1831 +++++++++------- node_modules/montage/data/change-context.js | 374 ++++ node_modules/montage/data/context.js | 375 ---- node_modules/montage/data/control-listener.js | 47 + node_modules/montage/data/controllistener.js | 47 - .../montage/data/ldap-access/ldap-mapping.js | 61 + .../montage/data/ldap-access/ldap-object-id.js | 20 + .../data/ldap-access/ldap-selector-semantics.js | 5 + .../montage/data/ldap-access/ldap-store.js | 72 + .../montage/data/ldapaccess/ldapblueprint.js | 135 -- .../montage/data/ldapaccess/ldapobjectid.js | 20 - .../data/ldapaccess/ldapselectorevaluator.js | 24 - node_modules/montage/data/ldapaccess/ldapstore.js | 38 - node_modules/montage/data/mapping.js | 632 ++++++ .../montage/data/nosql-access/nosql-mapping.js | 61 + .../montage/data/nosql-access/nosql-object-id.js | 22 + .../data/nosql-access/nosql-selector-semantics.js | 5 + .../montage/data/nosql-access/nosql-store.js | 102 + .../montage/data/nosqlaccess/nosqlblueprint.js | 135 -- .../montage/data/nosqlaccess/nosqlobjectid.js | 22 - .../data/nosqlaccess/nosqlselectorevaluator.js | 24 - .../montage/data/nosqlaccess/nosqlstore.js | 68 - node_modules/montage/data/object-id.js | 96 + node_modules/montage/data/object-property.js | 431 ++++ node_modules/montage/data/objectid.js | 77 - node_modules/montage/data/objectproperty.js | 298 --- node_modules/montage/data/operation.js | 121 ++ node_modules/montage/data/pledge.js | 10 +- node_modules/montage/data/query.js | 123 +- .../montage/data/rest-access/rest-mapping.js | 61 + .../montage/data/rest-access/rest-object-id.js | 21 + .../data/rest-access/rest-selector-semantics.js | 5 + .../montage/data/rest-access/rest-store.js | 221 ++ .../montage/data/restaccess/restblueprint.js | 138 -- .../montage/data/restaccess/restobjectid.js | 21 - .../data/restaccess/restselectorevaluator.js | 24 - node_modules/montage/data/restaccess/reststore.js | 186 -- node_modules/montage/data/restriction.js | 61 +- node_modules/montage/data/selector.js | 2220 -------------------- .../montage/data/sql-access/sql-mapping.js | 61 + .../montage/data/sql-access/sql-object-id.js | 22 + .../data/sql-access/sql-selector-semantics.js | 5 + node_modules/montage/data/sql-access/sql-store.js | 103 + .../montage/data/sqlaccess/sqlblueprint.js | 135 -- node_modules/montage/data/sqlaccess/sqlobjectid.js | 22 - .../montage/data/sqlaccess/sqlselectorevaluator.js | 24 - node_modules/montage/data/sqlaccess/sqlstore.js | 69 - .../montage/data/store-connection-information.js | 126 ++ node_modules/montage/data/store.js | 1421 +++++++------ node_modules/montage/data/transaction-id.js | 267 +++ node_modules/montage/data/transactionid.js | 230 -- node_modules/montage/montage.js | 90 +- node_modules/montage/package.json | 2 +- node_modules/montage/require/browser.js | 4 +- node_modules/montage/require/require.js | 67 +- node_modules/montage/require/worker-script.js | 233 ++ node_modules/montage/require/worker.js | 62 + node_modules/montage/service/service.js | 10 - node_modules/montage/ui/anchor.reel/anchor.js | 80 +- node_modules/montage/ui/application.js | 33 +- .../autocomplete.reel/autocomplete.html | 13 +- .../autocomplete/autocomplete.reel/autocomplete.js | 7 + .../results-list.reel/results-list.html | 16 +- .../bluemoon/button-group.reel/button-group.html | 14 +- .../montage/ui/bluemoon/button.reel/button.html | 8 +- .../ui/bluemoon/checkbox.reel/checkbox.html | 6 +- .../montage/ui/bluemoon/checkbox.reel/checkbox.js | 6 +- .../montage/ui/bluemoon/progress.reel/progress.css | 33 +- .../ui/bluemoon/progress.reel/progress.html | 9 +- .../montage/ui/bluemoon/slider.reel/slider.html | 7 +- .../montage/ui/bluemoon/tabs.reel/tabs.css | 126 ++ .../montage/ui/bluemoon/tabs.reel/tabs.html | 66 + node_modules/montage/ui/bluemoon/tabs.reel/tabs.js | 180 ++ .../ui/bluemoon/textarea.reel/textarea.html | 7 +- .../ui/bluemoon/textfield.reel/textfield.html | 8 +- .../ui/bluemoon/textfield.reel/textfield.js | 6 +- .../montage/ui/bluemoon/toggle.reel/toggle.html | 8 +- node_modules/montage/ui/button.reel/button.css | 55 + node_modules/montage/ui/button.reel/button.html | 14 + node_modules/montage/ui/button.reel/button.js | 457 +--- node_modules/montage/ui/check-input.js | 4 +- node_modules/montage/ui/checkbox.reel/checkbox.js | 79 - node_modules/montage/ui/component.js | 6 +- node_modules/montage/ui/composer/key-composer.js | 16 +- node_modules/montage/ui/composer/press-composer.js | 52 +- .../montage/ui/composer/translate-composer.js | 2 +- .../montage/ui/date-input.reel/date-input.js | 46 - .../ui/dynamic-element.reel/dynamic-element.js | 143 ++ node_modules/montage/ui/flow.reel/flow.css | 32 + node_modules/montage/ui/flow.reel/flow.html | 113 +- node_modules/montage/ui/image.reel/image.js | 54 +- .../montage/ui/input-checkbox.reel/checkbox.png | Bin 0 -> 1087 bytes .../ui/input-checkbox.reel/input-checkbox.css | 36 + .../ui/input-checkbox.reel/input-checkbox.html | 14 + .../ui/input-checkbox.reel/input-checkbox.js | 25 + .../montage/ui/input-date.reel/input-date.html | 14 + .../montage/ui/input-date.reel/input-date.js | 35 + .../montage/ui/input-number.reel/input-number.html | 14 + .../montage/ui/input-number.reel/input-number.js | 35 + .../montage/ui/input-radio.reel/input-radio.css | 36 + .../montage/ui/input-radio.reel/input-radio.html | 14 + .../montage/ui/input-radio.reel/input-radio.js | 25 + node_modules/montage/ui/input-radio.reel/radio.png | Bin 0 -> 1015 bytes .../montage/ui/input-range.reel/input-range.css | 42 + .../montage/ui/input-range.reel/input-range.html | 43 + .../montage/ui/input-range.reel/input-range.js | 343 +++ .../montage/ui/input-text.reel/input-text.css | 41 + .../montage/ui/input-text.reel/input-text.html | 14 + .../montage/ui/input-text.reel/input-text.js | 24 + node_modules/montage/ui/list.reel/list.html | 13 +- node_modules/montage/ui/loader.reel/loader.js | 1 + .../ui/loading-panel.reel/loading-panel.html | 93 +- node_modules/montage/ui/loading.reel/loading.html | 23 +- .../montage/ui/native/anchor.reel/anchor.js | 80 + .../montage/ui/native/button.reel/button.js | 465 ++++ node_modules/montage/ui/native/image.reel/image.js | 54 + .../native/input-checkbox.reel/input-checkbox.js | 77 + .../ui/native/input-date.reel/input-date.js | 46 + .../ui/native/input-number.reel/input-number.js | 48 + .../ui/native/input-radio.reel/input-radio.js | 174 ++ .../ui/native/input-range.reel/input-range.js | 83 + .../ui/native/input-text.reel/input-text.js | 26 + .../montage/ui/native/progress.reel/progress.js | 49 + .../montage/ui/native/select.reel/select.js | 496 +++++ .../montage/ui/native/textarea.reel/textarea.js | 127 ++ .../ui/nearest-neighbor-component-search.js | 232 -- .../montage/ui/number-input.reel/number-input.js | 48 - .../montage/ui/popup/alert.reel/alert.html | 56 +- .../montage/ui/popup/confirm.reel/confirm.html | 59 +- .../montage/ui/popup/notifier.reel/notifier.html | 24 +- .../montage/ui/popup/popup.reel/popup.html | 28 +- node_modules/montage/ui/progress.reel/progress.css | 29 + .../montage/ui/progress.reel/progress.html | 28 + node_modules/montage/ui/progress.reel/progress.js | 127 +- .../montage/ui/radio-button.reel/radio-button.js | 5 +- .../montage/ui/range-input.reel/range-input.js | 83 - .../rich-text-linkpopup.html | 34 +- .../rich-text-resizer.reel/rich-text-resizer.html | 32 +- .../rich-text-resizer.reel/rich-text-resizer.js | 2 +- .../rich-text-editor.reel/rich-text-editor-base.js | 201 +- .../rich-text-editor.reel/rich-text-editor.css | 6 + .../rich-text-editor.reel/rich-text-editor.html | 38 +- .../rich-text-editor.reel/rich-text-editor.js | 78 +- .../montage/ui/scroll-bars.reel/scroll-bars.css | 67 + .../montage/ui/scroll-bars.reel/scroll-bars.html | 120 +- node_modules/montage/ui/scroller.reel/scroller.css | 15 + .../montage/ui/scroller.reel/scroller.html | 132 +- .../montage/ui/scrollview.reel/scrollview.js | 1090 ---------- .../montage/ui/select-input.reel/select-input.js | 496 ----- node_modules/montage/ui/select.reel/select.css | 46 + node_modules/montage/ui/select.reel/select.html | 14 + node_modules/montage/ui/select.reel/select.js | 26 + node_modules/montage/ui/select.reel/select.png | Bin 0 -> 978 bytes .../ui/skeleton/range-input.reel/range-input.css | 27 - .../ui/skeleton/range-input.reel/range-input.html | 45 - .../ui/skeleton/range-input.reel/range-input.js | 300 --- node_modules/montage/ui/tabs.reel/tabs.css | 126 -- node_modules/montage/ui/tabs.reel/tabs.html | 69 - node_modules/montage/ui/tabs.reel/tabs.js | 180 -- node_modules/montage/ui/template.js | 21 +- node_modules/montage/ui/text-input.js | 8 +- .../montage/ui/text-slider.reel/text-slider.css | 15 + .../montage/ui/text-slider.reel/text-slider.html | 102 + .../montage/ui/text-slider.reel/text-slider.js | 473 +++++ node_modules/montage/ui/textarea.reel/textarea.css | 26 + .../montage/ui/textarea.reel/textarea.html | 14 + node_modules/montage/ui/textarea.reel/textarea.js | 125 +- .../montage/ui/textfield.reel/textfield.js | 26 - .../ui/toggle-button.reel/toggle-button.css | 13 + .../ui/toggle-button.reel/toggle-button.html | 15 + .../montage/ui/toggle-button.reel/toggle-button.js | 9 +- .../ui/toggle-switch.reel/toggle-switch.html | 8 +- .../token-field/token-field.reel/token-field.css | 20 +- .../token-field/token-field.reel/token-field.html | 29 +- .../montage/ui/token-field/token.reel/token.html | 16 +- .../montage/ui/video-player.reel/video-player.html | 109 +- 182 files changed, 10212 insertions(+), 10380 deletions(-) create mode 100755 node_modules/montage/data/change-context.js delete mode 100755 node_modules/montage/data/context.js create mode 100755 node_modules/montage/data/control-listener.js delete mode 100755 node_modules/montage/data/controllistener.js create mode 100644 node_modules/montage/data/ldap-access/ldap-mapping.js create mode 100755 node_modules/montage/data/ldap-access/ldap-object-id.js create mode 100644 node_modules/montage/data/ldap-access/ldap-selector-semantics.js create mode 100755 node_modules/montage/data/ldap-access/ldap-store.js delete mode 100755 node_modules/montage/data/ldapaccess/ldapblueprint.js delete mode 100755 node_modules/montage/data/ldapaccess/ldapobjectid.js delete mode 100755 node_modules/montage/data/ldapaccess/ldapselectorevaluator.js delete mode 100755 node_modules/montage/data/ldapaccess/ldapstore.js create mode 100644 node_modules/montage/data/mapping.js create mode 100644 node_modules/montage/data/nosql-access/nosql-mapping.js create mode 100755 node_modules/montage/data/nosql-access/nosql-object-id.js create mode 100644 node_modules/montage/data/nosql-access/nosql-selector-semantics.js create mode 100755 node_modules/montage/data/nosql-access/nosql-store.js delete mode 100755 node_modules/montage/data/nosqlaccess/nosqlblueprint.js delete mode 100755 node_modules/montage/data/nosqlaccess/nosqlobjectid.js delete mode 100755 node_modules/montage/data/nosqlaccess/nosqlselectorevaluator.js delete mode 100755 node_modules/montage/data/nosqlaccess/nosqlstore.js create mode 100755 node_modules/montage/data/object-id.js create mode 100755 node_modules/montage/data/object-property.js delete mode 100755 node_modules/montage/data/objectid.js delete mode 100755 node_modules/montage/data/objectproperty.js create mode 100644 node_modules/montage/data/operation.js create mode 100644 node_modules/montage/data/rest-access/rest-mapping.js create mode 100755 node_modules/montage/data/rest-access/rest-object-id.js create mode 100644 node_modules/montage/data/rest-access/rest-selector-semantics.js create mode 100755 node_modules/montage/data/rest-access/rest-store.js delete mode 100755 node_modules/montage/data/restaccess/restblueprint.js delete mode 100755 node_modules/montage/data/restaccess/restobjectid.js delete mode 100755 node_modules/montage/data/restaccess/restselectorevaluator.js delete mode 100755 node_modules/montage/data/restaccess/reststore.js delete mode 100755 node_modules/montage/data/selector.js create mode 100644 node_modules/montage/data/sql-access/sql-mapping.js create mode 100755 node_modules/montage/data/sql-access/sql-object-id.js create mode 100644 node_modules/montage/data/sql-access/sql-selector-semantics.js create mode 100755 node_modules/montage/data/sql-access/sql-store.js delete mode 100755 node_modules/montage/data/sqlaccess/sqlblueprint.js delete mode 100755 node_modules/montage/data/sqlaccess/sqlobjectid.js delete mode 100755 node_modules/montage/data/sqlaccess/sqlselectorevaluator.js delete mode 100755 node_modules/montage/data/sqlaccess/sqlstore.js create mode 100644 node_modules/montage/data/store-connection-information.js create mode 100755 node_modules/montage/data/transaction-id.js delete mode 100755 node_modules/montage/data/transactionid.js create mode 100644 node_modules/montage/require/worker-script.js create mode 100644 node_modules/montage/require/worker.js delete mode 100755 node_modules/montage/service/service.js create mode 100755 node_modules/montage/ui/bluemoon/tabs.reel/tabs.css create mode 100755 node_modules/montage/ui/bluemoon/tabs.reel/tabs.html create mode 100755 node_modules/montage/ui/bluemoon/tabs.reel/tabs.js create mode 100644 node_modules/montage/ui/button.reel/button.css create mode 100644 node_modules/montage/ui/button.reel/button.html delete mode 100644 node_modules/montage/ui/checkbox.reel/checkbox.js delete mode 100644 node_modules/montage/ui/date-input.reel/date-input.js create mode 100644 node_modules/montage/ui/flow.reel/flow.css create mode 100644 node_modules/montage/ui/input-checkbox.reel/checkbox.png create mode 100644 node_modules/montage/ui/input-checkbox.reel/input-checkbox.css create mode 100644 node_modules/montage/ui/input-checkbox.reel/input-checkbox.html create mode 100644 node_modules/montage/ui/input-checkbox.reel/input-checkbox.js create mode 100644 node_modules/montage/ui/input-date.reel/input-date.html create mode 100644 node_modules/montage/ui/input-date.reel/input-date.js create mode 100644 node_modules/montage/ui/input-number.reel/input-number.html create mode 100644 node_modules/montage/ui/input-number.reel/input-number.js create mode 100644 node_modules/montage/ui/input-radio.reel/input-radio.css create mode 100644 node_modules/montage/ui/input-radio.reel/input-radio.html create mode 100644 node_modules/montage/ui/input-radio.reel/input-radio.js create mode 100644 node_modules/montage/ui/input-radio.reel/radio.png create mode 100644 node_modules/montage/ui/input-range.reel/input-range.css create mode 100644 node_modules/montage/ui/input-range.reel/input-range.html create mode 100644 node_modules/montage/ui/input-range.reel/input-range.js create mode 100644 node_modules/montage/ui/input-text.reel/input-text.css create mode 100644 node_modules/montage/ui/input-text.reel/input-text.html create mode 100644 node_modules/montage/ui/input-text.reel/input-text.js create mode 100644 node_modules/montage/ui/native/anchor.reel/anchor.js create mode 100644 node_modules/montage/ui/native/button.reel/button.js create mode 100644 node_modules/montage/ui/native/image.reel/image.js create mode 100644 node_modules/montage/ui/native/input-checkbox.reel/input-checkbox.js create mode 100644 node_modules/montage/ui/native/input-date.reel/input-date.js create mode 100644 node_modules/montage/ui/native/input-number.reel/input-number.js create mode 100644 node_modules/montage/ui/native/input-radio.reel/input-radio.js create mode 100644 node_modules/montage/ui/native/input-range.reel/input-range.js create mode 100644 node_modules/montage/ui/native/input-text.reel/input-text.js create mode 100644 node_modules/montage/ui/native/progress.reel/progress.js create mode 100644 node_modules/montage/ui/native/select.reel/select.js create mode 100644 node_modules/montage/ui/native/textarea.reel/textarea.js delete mode 100644 node_modules/montage/ui/nearest-neighbor-component-search.js delete mode 100644 node_modules/montage/ui/number-input.reel/number-input.js create mode 100644 node_modules/montage/ui/progress.reel/progress.css create mode 100644 node_modules/montage/ui/progress.reel/progress.html delete mode 100644 node_modules/montage/ui/range-input.reel/range-input.js create mode 100644 node_modules/montage/ui/scroll-bars.reel/scroll-bars.css create mode 100644 node_modules/montage/ui/scroller.reel/scroller.css delete mode 100755 node_modules/montage/ui/scrollview.reel/scrollview.js delete mode 100644 node_modules/montage/ui/select-input.reel/select-input.js create mode 100644 node_modules/montage/ui/select.reel/select.css create mode 100644 node_modules/montage/ui/select.reel/select.html create mode 100644 node_modules/montage/ui/select.reel/select.js create mode 100644 node_modules/montage/ui/select.reel/select.png delete mode 100644 node_modules/montage/ui/skeleton/range-input.reel/range-input.css delete mode 100644 node_modules/montage/ui/skeleton/range-input.reel/range-input.html delete mode 100644 node_modules/montage/ui/skeleton/range-input.reel/range-input.js delete mode 100755 node_modules/montage/ui/tabs.reel/tabs.css delete mode 100755 node_modules/montage/ui/tabs.reel/tabs.html delete mode 100755 node_modules/montage/ui/tabs.reel/tabs.js create mode 100644 node_modules/montage/ui/text-slider.reel/text-slider.css create mode 100644 node_modules/montage/ui/text-slider.reel/text-slider.html create mode 100644 node_modules/montage/ui/text-slider.reel/text-slider.js create mode 100644 node_modules/montage/ui/textarea.reel/textarea.css create mode 100644 node_modules/montage/ui/textarea.reel/textarea.html delete mode 100644 node_modules/montage/ui/textfield.reel/textfield.js create mode 100644 node_modules/montage/ui/toggle-button.reel/toggle-button.css create mode 100644 node_modules/montage/ui/toggle-button.reel/toggle-button.html (limited to 'node_modules/montage') diff --git a/node_modules/montage/CHANGES.md b/node_modules/montage/CHANGES.md index 5b544221..906c3d7c 100755 --- a/node_modules/montage/CHANGES.md +++ b/node_modules/montage/CHANGES.md @@ -1,3 +1,15 @@ +# v0.11.0 + +- **New skeleton components** + +- **New TextSlider component** + +- **New willFinishLoading delegate method on the application delegate** + +- **A classList property on the Dynamic Element to more conveniently toggle classes** + +- **Better support of different document context in serialization** + # v0.10.0 - **New property change API** diff --git a/node_modules/montage/core/core.js b/node_modules/montage/core/core.js index 26733c94..9109b772 100755 --- a/node_modules/montage/core/core.js +++ b/node_modules/montage/core/core.js @@ -635,16 +635,4 @@ Object.defineProperty(Montage, "callDelegateMethod", { return delegateFunction.apply(delegate, arguments); } } -}); - -// XXX Does not presently function server-side -if (typeof window !== "undefined") { - - var EventManager = require("core/event/event-manager").EventManager; - EventManager.create().initWithWindow(window); - - // Now that we have a defaultEventManager we can setup the bindings system - require("core/event/binding"); - -} - +}); \ No newline at end of file diff --git a/node_modules/montage/core/deserializer.js b/node_modules/montage/core/deserializer.js index 86cdc560..424a2bc9 100755 --- a/node_modules/montage/core/deserializer.js +++ b/node_modules/montage/core/deserializer.js @@ -31,7 +31,7 @@ try { @class module:montage/core/deserializer.Deserializer @extends module:montage/core/core.Montage */ -var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deserializer.Deserializer# */ { +var Deserializer = exports.Deserializer = Montage.create(Montage, /** @lends module:montage/core/deserializer.Deserializer# */ { _MONTAGE_ID_ATTRIBUTE: {value: "data-montage-id"}, _objects: {value: null}, @@ -533,7 +533,7 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri var serialization = this._serialization, moduleIds = this._requiredModuleIds = [], modules = this._modules, - desc, moduleId, name, objectLocation; + desc, moduleId; for (var label in serialization) { desc = serialization[label]; @@ -542,16 +542,8 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri if ("module" in desc) { moduleId = desc.module; } else if ("prototype" in desc || "object" in desc) { - name = desc.prototype || desc.object - objectLocation = name.split("["); - moduleId = objectLocation[0]; - desc.module = moduleId; - if (objectLocation.length == 2) { - desc.name = objectLocation[1].slice(0, -1); - } else { - this._findObjectNameRegExp.test(moduleId); - desc.name = RegExp.$1.replace(this._toCamelCaseRegExp, this._replaceToCamelCase); - } + Deserializer.parseForModuleAndName(desc.prototype || desc.object, desc); + moduleId = desc.module; } if (moduleId && !modules[moduleId] && moduleIds.indexOf(moduleId) == -1) { @@ -559,6 +551,34 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri } } }}, + + /** + Sets the module loader used during deserialization. + @function + @param {String} name The string representing a module/name pair, such as "my-module[MyModule]". + @param {Object} description The description object on which the parseForModuleAndName will populate the module and name properties. [Optional] + @returns {Object} The description object with module and name properties populated. + */ + parseForModuleAndName: { + value: function(name, desc) { + var bracketIndex; + + if (typeof desc === "undefined") { + desc = {}; + } + bracketIndex = name.indexOf("["); + if (bracketIndex > 0) { + desc.module = name.substr(0, bracketIndex); + desc.name = name.slice(bracketIndex+1, -1); + } else { + desc.module = name; + Deserializer._findObjectNameRegExp.test(name); + desc.name = RegExp.$1.replace(Deserializer._toCamelCaseRegExp, Deserializer._replaceToCamelCase); + } + return desc; + } + }, + /** @private */ @@ -680,23 +700,25 @@ var Deserializer = Montage.create(Montage, /** @lends module:montage/core/deseri hasObject = object != null, counter, descString, - objectLocation; + objectLocation, + bracketIndex; if ("module" in desc) { moduleId = desc.module; objectName = name = desc.name; } else if ("prototype" in desc || "object" in desc) { - objectLocation = (desc.prototype || desc.object).split("["); + bracketIndex = (desc.prototype || desc.object).indexOf("["); // this code is actually only used when canEval == false, // module+name are added when the modules are parsed but it's // slow to redo the _serializationString in order to keep the // added module+name when we do JSON.parse(_serializationString) // at canEval == false. - moduleId = objectLocation[0]; - if (objectLocation.length == 2) { - objectName = name = objectLocation[1].slice(0, -1); + if (bracketIndex > 0) { + moduleId = name.substr(0, bracketIndex); + objectName = name = name.slice(bracketIndex+1, -1); } else { - self._findObjectNameRegExp.test(moduleId); + moduleId = name; + self._findObjectNameRegExp.test(name); objectName = name = RegExp.$1.replace(self._toCamelCaseRegExp, function(_, g1) { return g1.toUpperCase() }); } } @@ -1142,8 +1164,4 @@ function deserialize(serialization, require, origin) { return deferred.promise; } -if (typeof exports !== "undefined") { - exports.Deserializer = Deserializer; - exports.deserialize = deserialize; -} - +exports.deserialize = deserialize; diff --git a/node_modules/montage/core/event/mutable-event.js b/node_modules/montage/core/event/mutable-event.js index 6f6a0cfd..2ffe2a37 100755 --- a/node_modules/montage/core/event/mutable-event.js +++ b/node_modules/montage/core/event/mutable-event.js @@ -6,18 +6,13 @@ /** @module montage/core/event/mutable-event @requires montage - @requires montage/core/enum */ -var Montage = require("montage").Montage, - Enum = require("core/enum").Enum; +var Montage = require("montage").Montage; // XXX Does not presently function server-side if (typeof window !== "undefined") { -var ChangeTypes = exports.ChangeTypes = Enum.create().initWithMembers("MODIFICATION", "ADDITION", "REMOVAL"); - var _eventConstructorsByType = {}; -var _changeEventConstructor = null; var nullDescriptor = {value: null}; var wrapProperty = function(obj, key) { @@ -84,44 +79,6 @@ var MutableEvent = exports.MutableEvent = Montage.create(Montage,/** @lends modu } }, - /** - @function - @returns new _changeEventConstructor() - */ - changeEvent: { - value: function() { - return new _changeEventConstructor(); - } - }, - -/** - @function - @param {Event} key TODO - @param {Event} minus TODO - @returns changeEvent - */ - changeEventForKeyAndValue: { - value: function(key, minus) { - var changeEvent = new _changeEventConstructor(); - changeEvent.type = "change@" + key; - changeEvent.minus = minus; - changeEvent.plus = undefined; - changeEvent.propertyChange = ChangeTypes.MODIFICATION; - return changeEvent; - } - }, - - /** - @function - @param {String} plus TODO - @returns itself - */ - withPlusValue: { - value: function(plus) { - this.plus = plus; - return this; - } - }, /** @private */ @@ -220,21 +177,5 @@ var MutableEvent = exports.MutableEvent = Montage.create(Montage,/** @lends modu } }); -/** - @private -*/ -_changeEventConstructor = function() { -}; -/** - @private -*/ -_changeEventConstructor.prototype = MutableEvent.create()._initPrototypeWithEvent(document.createEvent("CustomEvent").initCustomEvent("change", true, false, null)); -// TODO this shouldn't be necessary; initWithCustomEvent should be setting the type to "change" but that doesn't seem to be the case -// TODO should file a bug on this with some test reduction -/** - @private -*/ -_changeEventConstructor.prototype.type = "change"; -exports._Change = _changeEventConstructor; } // client-side diff --git a/node_modules/montage/core/promise.js b/node_modules/montage/core/promise.js index 7563a742..6477131d 100755 --- a/node_modules/montage/core/promise.js +++ b/node_modules/montage/core/promise.js @@ -263,6 +263,7 @@ var PrimordialPromise = Creatable.create({ self.Promise = this; rejections.push(self); errors.push(error ? (error.stack ? error.stack : error) : reason); + displayErrors(); return self; } }, @@ -676,22 +677,31 @@ var Promise = PrimordialPromise.create({}, { // Descriptor for each of the three var rejections = []; var errors = []; -// Live console objects are not handled on tablets -if (typeof window !== "undefined" && !window.Touch) { - - /* - * This promise library consumes exceptions thrown in callbacks so - * that they can be handled asynchronously. The exceptions get - * added to ``errors`` when they are consumed, and removed when - * they are handled. In many debuggers, the view of the reported - * array will update to reflect its current contents so you can - * always see if you have missed an error. - * - * This log will appear once for every time this module gets - * instantiated. That should be once per frame. - */ - console.log("Should be empty:", errors); -} +var errorsDisplayed = false; +var displayErrors = function () { + // Live console objects are not handled on tablets or in Node + if ( + !errorsDisplayed && + typeof window !== "undefined" && + !window.Touch && + typeof console === "object" + ) { + + /* + * This promise library consumes exceptions thrown in callbacks so + * that they can be handled asynchronously. The exceptions get + * added to ``errors`` when they are consumed, and removed when + * they are handled. In many debuggers, the view of the reported + * array will update to reflect its current contents so you can + * always see if you have missed an error. + * + * This log will appear once for every time this module gets + * instantiated. That should be once per frame. + */ + console.log("Should be empty:", errors); + errorsDisplayed = true; + } +}; exports.Promise = Promise; diff --git a/node_modules/montage/core/serializer.js b/node_modules/montage/core/serializer.js index 72543328..deadbc68 100755 --- a/node_modules/montage/core/serializer.js +++ b/node_modules/montage/core/serializer.js @@ -529,10 +529,10 @@ var Serializer = Montage.create(Montage, /** @lends module:montage/serializer.Se return this._serializeElement(value); } else if (Array.isArray(value)) { return this._serializeArray(value, indent + 1); - } else if (Object.getPrototypeOf(value) === Object.prototype) { - return this._serializeObjectLiteral(value, null, indent + 1); } else if (value.constructor === Function) { return this._serializeFunction(value, indent); + } else if (!("getInfoForObject" in value)) { // we consider object literals the ones who aren't a Montage object + return this._serializeObjectLiteral(value, null, indent + 1); } else { // TODO: should refactor this to handle references here, doesn't make // sense to wait until it hits _serializeObject for that to happen diff --git a/node_modules/montage/data/blueprint.js b/node_modules/montage/data/blueprint.js index b3a66167..86a99ee7 100755 --- a/node_modules/montage/data/blueprint.js +++ b/node_modules/montage/data/blueprint.js @@ -4,94 +4,338 @@ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. */ /** - @module montage/data/blueprint - @requires montage/core/core - @requires montage/data/store - @requires montage/data/objectid - @requires data/query - @requires core/exception - @requires data/objectproperty - @requires core/promise - @requires core/logger -*/ + @module montage/data/blueprint + @requires montage/core/core + @requires montage/data/store + @requires montage/data/object-id + @requires data/query + @requires core/exception + @requires data/object-property + @requires core/promise + @requires core/logger + */ var Montage = require("montage").Montage; -var Store = require("data/store").Store; -var TemporaryObjectId = require("data/objectid").TemporaryObjectId; +var MappingFolder = require("data/mapping").MappingFolder; +var TemporaryObjectId = require("data/object-id").TemporaryObjectId; var Query = require("data/query").Query; -var Exception = require("core/exception").Exception; -var ObjectProperty = require("data/objectproperty").ObjectProperty; +var ObjectProperty = require("data/object-property").ObjectProperty; var Promise = require("core/promise").Promise; +var Exception = require("core/exception").Exception; var logger = require("core/logger").logger("blueprint"); -/** - @class module:montage/data/blueprint.BlueprintBinder - @classdesc A blueprint binder is a collection of of blueprints for a specific access type. It also includes the connection information. - @extends module:montage/core/core.Montage -*/ -var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lends module:montage/data/blueprint.BlueprintBinder# */ { /** - Description TODO - @private -*/ - _blueprintForPrototypeTable: { - value: {}, - serializable: false, - distinct: true, - enumerable: false, - writable: false - }, + @private + */ +var _binderManager = null; /** - Description TODO - @type {Property} - @default {Table} {} - */ - restrictionsTable: { - value: {}, - serializable: true, - distinct: true, - enumerable: false, - writable: false + @class module:montage/data/blueprint.BlueprintBinderManager + @classdesc A blueprint binder manager is a singleton that is responsible for loading and dispaching binders and blueprints. + @extends module:montage/core/core.Montage + */ +var BlueprintBinderManager = exports.BlueprintBinderManager = Montage.create(Montage, /** @lends module:montage/data/blueprint.BlueprintBinderManager# */ { + + /** + Description TODO + @function + @returns itself + */ + init:{ + serializable:false, + enumerable:false, + value:function () { + return this; + } }, -/** - Description TODO - @type {Property} - @default {String} null - */ - name: { - value: null, - serializable: true + + /** + Description TODO + @type {Property} Function + @default {Array} new Array(10) + */ + blueprintBinders:{ + serializable:true, + writable:false, + distinct:true, + value:new Array(10) + }, + + /** + Add a new blueprint binder. + @function + @param {Property} binder TODO + */ + addBlueprintBinder:{ + value:function (binder) { + if (binder !== null) { + var index = this.blueprintBinders.indexOf(binder); + if (index >= 0) { + this.blueprintBinders.splice(index, 1); + } + this.blueprintBinders.push(binder); + } + } + }, + + /** + Description TODO + @function + @param {Property} binder TODO + */ + removeBlueprintBinder:{ + value:function (binder) { + if (binder !== null) { + var index = this.blueprintBinders.indexOf(binder); + if (index >= 0) { + this.blueprintBinders.splice(index, 1); + } + } + } }, + + /** + Search through the binders for a blueprint that extends that prototype. + @function + @param {Property} prototypeName TODO + @param {Property} moduleId TODO + @returns The requested blueprint or null if this prototype is not managed. + */ + blueprintForPrototype: { + value: function(prototypeName, moduleId) { + var binder, blueprint, index; + for (index = 0; typeof (binder = this.blueprintBinders[index]) !== "undefined"; index++) { + blueprint = binder.blueprintForPrototype(prototypeName, moduleId); + if (blueprint !== null) { + return blueprint; + } + } + return null; + } + } + +}); + +var BlueprintObject = exports.BlueprintObject = Montage.create(Montage, /** @lends module:montage/data/blueprint.BlueprintObject# */ { + + /** + @private + */ + _name:{ + serializable:true, + enumerable:false, + value:null + }, + + /** + Name of the object. The name is used to define the property on the object. + @function + @returns {String} this._name + */ + name:{ + get:function () { + return this._name; + } + }, + + /** + @private + */ + _mappings:{ + serializable:true, + enumerable:false, + distinct:true, + value: new Array(5) + }, + + /** + @private + */ + _mappingForName:{ + value:{}, + serializable:false, + distinct:true, + enumerable:false, + writable:false + }, + + deserializedFromSerialization:{ + value:function () { + var aMapping, index; + for (index = 0; typeof (aMapping = this._mappings[index]) !== "undefined"; index++) { + this._mappingForName[aMapping.name] = aMapping; + } + } + }, + + /** + List of mappings attached to this object. + @function + @returns mappings + */ + mappings:{ + get:function () { + return this._mappings; + } + }, + + /** + Add a mapping to the list of mappings. + @function + @param {mapping} mapping to add. + @returns mapping + */ + addMapping:{ + value:function (mapping) { + if (mapping !== null) { + var index = this.mappings.indexOf(mapping); + if (index < 0) { + if (mapping.owner !== this) { + throw new Error( + "Mapping already owned: " + JSON.stringify(mapping)); + } + this.mappings.push(mapping); + // + this._addMappingForName(mapping); + } + } + return mapping; + } + }, + + /** + Remove a mapping to the list of mappings. + @function + @param {mapping} mapping to remove. + @returns mapping + */ + removeMapping:{ + value:function (mapping) { + if (mapping !== null) { + var index = this.mappings.indexOf(mapping); + if (index >= 0) { + this.mappings.splice(index, 1); + // Remove the cached entry + this._removeMappingForName(mapping); + } + } + return mapping; + } + }, + + /* + * @private + */ + _addMappingForName:{ + value:function (mapping) { + this._mappingForName[mapping.name] = mapping; + return mapping; + } + }, + + /* + * @private + */ + _removeMappingForName:{ + value:function (mapping) { + delete this._mappingForName[mapping.name]; + return mapping; + } + }, + + /** + Retrieve a mapping from the list of mappings.
+ Note: For Binder objects this function will return an array of mapping: One for each of the store used by the mapping name. + @function + @param {name} name of the mapping to retrieve. + @returns mapping + */ + mappingForName:{ + value:function (name) { + return this._mappingForName[name]; + } + } + + +}); + /** - Description TODO - @function - @param {String} name TODO - @returns itself - */ - initWithName: { - value: function(name) { + @class module:montage/data/blueprint.BlueprintBinder + @classdesc A blueprint binder is a collection of of blueprints for a specific access type. It also includes the connection information. + @extends module:montage/core/core.Montage + */ +var BlueprintBinder = exports.BlueprintBinder = Montage.create(BlueprintObject, /** @lends module:montage/data/blueprint.BlueprintBinder# */ { + + /** + Returns the blueprint binder manager. + @type {Property} + @returns Blueprint Binder Manager + */ + manager:{ + get:function () { + if (_binderManager === null) { + _binderManager = BlueprintBinderManager.create().init(); + } + return _binderManager; + } + }, + + /** + Description TODO + @private + */ + _blueprintForPrototypeTable:{ + value:{}, + serializable:false, + distinct:true, + enumerable:false, + writable:false + }, + + /** + Description TODO + @type {Property} + @default {Table} {} + */ + restrictionsTable:{ + value:{}, + serializable:true, + distinct:true, + enumerable:false, + writable:false + }, + + /** + Description TODO + @function + @param {String} name TODO + @returns itself + */ + initWithName:{ + value:function (name) { this.name = (name !== null ? name : "default"); return this; } }, -/** - Description TODO - @type {Property} - @default {Array} new Array(30) - */ - blueprints: { - serializable: true, - distinct: true, - writable: false, - value: new Array(30) + + /** + Description TODO + @type {Property} + @default {Array} new Array(30) + */ + blueprints:{ + serializable:true, + distinct:true, + writable:false, + value:new Array(30) }, -/** - Description TODO - @function - @param {Array} blueprint TODO - @returns blueprint - */ - addBlueprint: { - value: function(blueprint) { + + /** + Description TODO + @function + @param {Array} blueprint TODO + @returns blueprint + */ + addBlueprint:{ + value:function (blueprint) { if (blueprint !== null) { var index = this.blueprints.indexOf(blueprint); if (index < 0) { @@ -108,14 +352,15 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend return blueprint; } }, -/** - Description TODO - @function - @param {Array} blueprint TODO - @returns blueprint - */ - removeBlueprint: { - value: function(blueprint) { + + /** + Description TODO + @function + @param {Array} blueprint TODO + @returns blueprint + */ + removeBlueprint:{ + value:function (blueprint) { if (blueprint !== null) { var index = this.blueprints.indexOf(blueprint); if (index >= 0) { @@ -129,37 +374,29 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend return blueprint; } }, -/** - Description TODO - @function - @param {String} name TODO - @param {String} moduleID TODO - @returns this.addBlueprint(this.createBlueprint().initWithNameAndModuleId(name, moduleId)) - */ - addBlueprintNamed : { - value: function(name, moduleId) { - return this.addBlueprint(this.createBlueprint().initWithNameAndModuleId(name, moduleId)); - } - }, -/** - Description TODO - @function - @returns Blueprint.create() - */ - createBlueprint: { - value: function() { - return Blueprint.create(); + + /** + Description TODO + @function + @param {String} name TODO + @param {String} moduleID TODO + @returns this.addBlueprint(this.createBlueprint().initWithNameAndModuleId(name, moduleId)) + */ + addBlueprintNamed:{ + value:function (name, moduleId) { + return this.addBlueprint(Blueprint.create().initWithNameAndModuleId(name, moduleId)); } }, -/** - Description TODO - @function - @param {String} name TODO - @param {Selector} defaultSelector TODO - @returns restriction - */ - addRestriction: { - value: function(name, defaultSelector) { + + /** + Description TODO + @function + @param {String} name TODO + @param {Selector} defaultSelector TODO + @returns restriction + */ + addRestriction:{ + value:function (name, defaultSelector) { var restriction = null; if (name != null && defaultSelector != null) { restriction = this.restrictionsTable[name] = defaultSelector; @@ -167,14 +404,15 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend return restriction; } }, -/** - Description TODO - @function - @param {String} name TODO - @returns restriction - */ - removeRestriction: { - value: function(name) { + + /** + Description TODO + @function + @param {String} name TODO + @returns restriction + */ + removeRestriction:{ + value:function (name) { if (name !== null) { var restriction = this.restrictionsTable[name] if (restriction != null) { @@ -185,14 +423,14 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend } }, -/** - Description TODO - @function - @param {String} restriction TODO - @returns selector - */ - defaultSelectorForRestriction: { - value: function(restriction) { + /** + Description TODO + @function + @param {String} restriction TODO + @returns selector + */ + defaultSelectorForRestriction:{ + value:function (restriction) { var selector = null; if (restriction != null) { selector = this.restrictionsTable[restriction.name]; @@ -203,35 +441,19 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend return selector; } }, - /** - Description TODO - @type {Property} - @default {ID} montage/data/store - */ - storeModuleId: { - value: "data/store" - }, - /** - Description TODO - @type {Property} - @default {String} "Store" - */ - storePrototypeName: { - value: "Store" - }, - /** - Return the blueprint associated with this prototype. - @function - @param {String} prototypeName TODO - @param {ID} moduleId TODO - @returns blueprint - */ - blueprintForPrototype: { - value: function(prototypeName, moduleId) { + + /** + Return the blueprint associated with this prototype. + @function + @param {String} prototypeName TODO + @param {ID} moduleId TODO + @returns blueprint + */ + blueprintForPrototype:{ + value:function (prototypeName, moduleId) { var key = moduleId + "." + prototypeName; var blueprint = this._blueprintForPrototypeTable[key]; if (typeof blueprint === "undefined") { - blueprint = UnknownBlueprint; var aBlueprint, index; for (index = 0; typeof (aBlueprint = this.blueprints[index]) !== "undefined"; index++) { if ((aBlueprint.prototypeName === prototypeName) && (aBlueprint.moduleId === moduleId)) { @@ -241,30 +463,122 @@ var BlueprintBinder = exports.BlueprintBinder = Montage.create(Montage,/** @lend } this._blueprintForPrototypeTable[key] = blueprint; } - if (blueprint === UnknownBlueprint) { - blueprint = null; + if (!blueprint) { + throw new Error( + "No such blueprint: " + JSON.stringify(prototypeName) + + " in " + JSON.stringify(moduleId) + ". Consider: " + + JSON.stringify(Object.keys(this._blueprintForPrototypeTable)) + ); } return blueprint; } + }, + + /** + Create a new mapping. + @function + @param {store} store to create the mapping for. + @param {name} identifier for the new mapping. + @param {recursive} create mapping for all blueprints in this binder. + @returns binderMapping + */ + createMappingForStore:{ + value:function (store, name, recursive) { + var folder = this.mappingForName(name); + if (!folder) { + folder = MappingFolder.create().initWithBinderAndName(this, name); + this.addMapping(folder); + if (this._defaultMappingFolderName.length == 0) { + this._defaultMappingFolderName = folder.name; + } + } + var metadata = Montage.getInfoForObject(store); + var aMapping = folder.mappingForStoreId(metadata.objectName, metadata.moduleId); + if (!aMapping) { + aMapping = store.createBinderMapping.initWithOwnerAndParent(this, folder); + folder.addMapping(aMapping); + } + if (recursive || (typeof recursive === "undefined")) { + var aBlueprint, index; + for (index = 0; typeof (aBlueprint = this.blueprints[index]) !== "undefined"; index++) { + aBlueprint.createMappingForStore(store, aMapping, name); + } + } + return aMapping; + } + }, + + /** + Delete a mapping for a given store. + @function + @param {store} store to delete the mapping for. + @param {name} identifier for the mapping. + @returns binderMapping + */ + deleteMappingForStore:{ + value:function (store, name) { + var folder = this.mappingForName(name); + if (folder) { + var metadata = Montage.getInfoForObject(store); + var aMapping = folder.mappingForStoreId(metadata.objectName, metadata.moduleId); + folder.removeMapping(aMapping); + var aBlueprint, index; + for (index = 0; typeof (aBlueprint = this.blueprints[index]) !== "undefined"; index++) { + aBlueprint.deleteMappingForStore(store, aMapping, name); + } + if (folder.mappings.length == 0) { + this.removeMapping(folder); + if ((this._defaultMappingFolderName.length > 0) && (this._defaultMappingFolderName === folder.name)) { + if (this.mappings.length > 0) { + this._defaultMappingFolderName = this.mappings[0].name; + } else { + this._defaultMappingFolderName = ""; + } + } + } + } + } + }, + + _defaultMappingFolderName:{ + serializable:true, + enumerable:false, + value:"" + }, + + defaultMappingFolderName:{ + get:function () { + if (this._defaultMappingFolderName.length == 0) { + if (this.mappings.length > 0) { + this._defaultMappingFolderName = this.mappings[0].name; + } + } + return this._defaultMappingFolderName; + }, + set:function (name) { + this._defaultMappingFolderName = name; + } } }); + /** - @class module:montage/data/bluprint.Blueprint -*/ -var Blueprint = exports.Blueprint = Montage.create(Montage,/** @lends module:montage/data/bluprint.Blueprint# */ { - /** - This is the canonical way of creating managed objects prototypes.
- Newly created prototype will be blessed with all the required properties to be well behaved. - @function - @param {Object} aPrototype TODO - @param {String} propertyDescriptor TODO - @returns newPrototype - */ - create: { - configurable: true, - value: function(aPrototype, propertyDescriptor) { - if ((typeof aPrototype === 'undefined') || (Blueprint.isPrototypeOf(aPrototype))) { + @class module:montage/data/bluprint.Blueprint + */ +var Blueprint = exports.Blueprint = Montage.create(BlueprintObject, /** @lends module:montage/data/bluprint.Blueprint# */ { + + /** + This is the canonical way of creating managed objects prototypes.
+ Newly created prototype will be blessed with all the required properties to be well behaved. + @function + @param {Object} aPrototype TODO + @param {String} propertyDescriptor TODO + @returns newPrototype + */ + create:{ + configurable:true, + value:function (aPrototype, propertyDescriptor) { + if ((typeof aPrototype === "undefined") || (Blueprint.isPrototypeOf(aPrototype))) { var parentCreate = Object.getPrototypeOf(Blueprint)["create"]; return parentCreate.call(this, (typeof aPrototype === "undefined" ? this : aPrototype), propertyDescriptor); } @@ -275,42 +589,49 @@ var Blueprint = exports.Blueprint = Montage.create(Montage,/** @lends module:mon return newPrototype; } }, -/** - Create a new instance of the target prototype for the blueprint. - @function - @return new instance - */ - newInstance: { - value: function() { + + /** + Create a new instance of the target prototype for the blueprint. + @function + @return new instance + */ + newInstance:{ + value:function () { var prototype = this.newInstancePrototype(); return (prototype ? prototype.create() : null); } }, - /** - Returns the target prototype for this blueprint.
- Note: This method uses the customPrototype property to determine if it needs to require a custom prototype or create a default prototype. - @function - @return new prototype - */ - newInstancePrototype: { - value: function() { + + /** + Returns the target prototype for this blueprint.
+ Note: This method uses the customPrototype property to determine if it needs to require a custom prototype or create a default prototype. + @function + @return new prototype + */ + newInstancePrototype:{ + value:function () { + var self = this; if (this.customPrototype) { var results = Promise.defer(); require.async(this.moduleId, - function(exports) { + function (exports) { results.resolve(exports); }); - var self = this; - return results.promise.then(function(exports) { + return results.promise.then(function (exports) { var prototype = exports[self.prototypeName]; return (prototype ? prototype : null) } ) } else { - if (exports[self.prototypeName]) { + if (typeof exports[self.prototypeName] === "undefined") { var parentInstancePrototype = (this.parent ? this.parent.newInstancePrototype() : Montage ); var newPrototype = Montage.create(parentInstancePrototype, { // Token class + init:{ + value:function () { + return this; + } + } }); ObjectProperty.manager.applyWithBlueprint(newPrototype, this); exports[self.prototypeName] = newPrototype; @@ -320,36 +641,39 @@ var Blueprint = exports.Blueprint = Montage.create(Montage,/** @lends module:mon } } }, -/** - Description TODO - @type {Property} - @default {String} null - */ - name: { - value: null, - serializable: true + /** + The identifier is the same as the name and is used to make the + serialization of a blueprint humane. + @type {Property} + @default {String} this.name + */ + identifier:{ + get:function () { + // TODO convert UpperCase to lower-case instead of lowercase + return this.name.toLowerCase(); + } }, -/** - Description TODO - @function - @param {String} name TODO - @returns this.initWithNameAndModuleId(name, null) - */ - initWithName: { - value: function(name) { + /** + Description TODO + @function + @param {String} name TODO + @returns this.initWithNameAndModuleId(name, null) + */ + initWithName:{ + value:function (name) { return this.initWithNameAndModuleId(name, null); } }, -/** - Description TODO - @function - @param {String} name TODO - @param {String} moduleId TODO - @returns itself - */ - initWithNameAndModuleId: { - value: function(name, moduleId) { - this.name = (name !== null ? name : "default"); + /** + Description TODO + @function + @param {String} name TODO + @param {String} moduleId TODO + @returns itself + */ + initWithNameAndModuleId:{ + value:function (name, moduleId) { + this._name = (name !== null ? name : "default"); // The default is that the prototype name is the name this.prototypeName = this.name; this.moduleId = moduleId; @@ -357,117 +681,118 @@ var Blueprint = exports.Blueprint = Montage.create(Montage,/** @lends module:mon return this; } }, -/** - Description TODO - @type {Property} - @default null - */ - binder: { - value: null, - serializable: true + /** + Description TODO + @type {Property} + @default null + */ + binder:{ + value:null, + serializable:true }, -/** - Description TODO - @type {Property} - @default null - */ - parent: { - value: null, - serializable: true + /** + Description TODO + @type {Property} + @default null + */ + parent:{ + value:null, + serializable:true }, -/** - Description TODO - @type {Property} - @default null - */ - moduleId: { - value: null, - serializable: true + /** + Description TODO + @type {Property} + @default null + */ + moduleId:{ + value:null, + serializable:true }, -/** - Description TODO - @type {Property} - @default null - */ - prototypeName: { - value: null, - serializable: true + /** + Description TODO + @type {Property} + @default null + */ + prototypeName:{ + value:null, + serializable:true }, -/** - Defines if the blueprint should use custom prototype for new instances.
- Returns true if the blueprint needs to require a custom prototype for creating new instances, false if new instance are generic prototypes. - @type {Boolean} - @default false - */ - customPrototype: { - value: false, - serializable: true + /** + Defines if the blueprint should use custom prototype for new instances.
+ Returns true if the blueprint needs to require a custom prototype for creating new instances, false if new instance are generic prototypes. + @type {Boolean} + @default false + */ + customPrototype:{ + value:false, + serializable:true }, -/** - Description TODO - @type {Property} - @default {Array} new Array(10) - */ - attributes: { - value: new Array(10), - serializable: true, - distinct: true, - writable: false + /** + Description TODO + @type {Property} + @default {Array} new Array(10) + */ + attributes:{ + value:new Array(10), + serializable:true, + distinct:true, + writable:false }, -/** - Description TODO - @private -*/ - _attributesTable: { - value: {}, - serializable: false, - distinct: true, - enumerable: false, - writable: false + /** + Description TODO + @private + */ + _attributesTable:{ + value:{}, + serializable:false, + distinct:true, + enumerable:false, + writable:false }, -/** - Description TODO - @type {Property} - @default {Array} new Array(10) - */ - queries: { - value: new Array(10), - serializable: true, - distinct: true, - writable: false + /** + Description TODO + @type {Property} + @default {Array} new Array(10) + */ + queries:{ + value:new Array(10), + serializable:true, + distinct:true, + writable:false }, -/** - Description TODO - @private -*/ - _queriesTable: { - value: {}, - serializable: false, - distinct: true, - enumerable: false, - writable: false + /** + Description TODO + @private + */ + _queriesTable:{ + value:{}, + serializable:false, + distinct:true, + enumerable:false, + writable:false }, -/** - Description TODO - @type {Property} - @default {Table} {} - */ - restrictionsTable: { - value: {}, - serializable: true, - distinct: true, - enumerable: false, - writable: false - }, - /** - Add a new attribute to this blueprint.
- If that attribute was associated with another blueprint it will be removed first. - @function - @param {String} attribute The attribute to be added. - @returns attribute - */ - addAttribute: { - value: function(attribute) { + /** + Description TODO + @type {Property} + @default {Table} {} + */ + restrictionsTable:{ + value:{}, + serializable:true, + distinct:true, + enumerable:false, + writable:false + }, + + /** + Add a new attribute to this blueprint.
+ If that attribute was associated with another blueprint it will be removed first. + @function + @param {String} attribute The attribute to be added. + @returns attribute + */ + addAttribute:{ + value:function (attribute) { if (attribute !== null && attribute.name !== null) { var index = this.attributes.indexOf(attribute); if (index < 0) { @@ -482,14 +807,15 @@ var Blueprint = exports.Blueprint = Montage.create(Montage,/** @lends module:mon return attribute; } }, -/** - Description TODO - @function - @param {String} attribute The attribute to be removed. - @returns attribute - */ - removeAttribute: { - value: function(attribute) { + + /** + Removes an attribute from teh attribute list of this blueprint. + @function + @param {St