From ab7f00cdf7941bd788fcf44e70e4d2a6ad8b2012 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 16 May 2012 22:18:39 -0700 Subject: Objects Panel - Hook in objects panel --- js/data/panels-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/data/panels-data.js b/js/data/panels-data.js index 38fa3426..37957892 100644 --- a/js/data/panels-data.js +++ b/js/data/panels-data.js @@ -136,7 +136,7 @@ exports.PanelsData = Montage.create(Montage, { collapsed: true, scrollable: true, open: true, - modulePath: "js/panels/objects.reel", + modulePath: "js/panels/objects/objects-panel.reel", moduleName: "ObjectsPanel" } ] -- cgit v1.2.3 From a40184e08a7ee2f189f133fd7bd83480e4bfc7f2 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 16 May 2012 22:19:34 -0700 Subject: Objects Panel - Add object component --- js/panels/objects/object.reel/object.css | 28 ++++++ js/panels/objects/object.reel/object.html | 47 ++++++++++ js/panels/objects/object.reel/object.js | 101 +++++++++++++++++++++ .../objects/objects-panel.reel/objects-panel.css | 37 ++++++++ .../objects/objects-panel.reel/objects-panel.html | 70 ++++++++++++++ .../objects/objects-panel.reel/objects-panel.js | 53 +++++++++++ 6 files changed, 336 insertions(+) create mode 100644 js/panels/objects/object.reel/object.css create mode 100644 js/panels/objects/object.reel/object.html create mode 100644 js/panels/objects/object.reel/object.js create mode 100644 js/panels/objects/objects-panel.reel/objects-panel.css create mode 100644 js/panels/objects/objects-panel.reel/objects-panel.html create mode 100644 js/panels/objects/objects-panel.reel/objects-panel.js diff --git a/js/panels/objects/object.reel/object.css b/js/panels/objects/object.reel/object.css new file mode 100644 index 00000000..6ca759ba --- /dev/null +++ b/js/panels/objects/object.reel/object.css @@ -0,0 +1,28 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
+ No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+ (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +/* + +
+ +
+ +*/ + +.objects-list { + margin: 0; + padding: 0; +} +.objects-list list-item { + width: 200px; + height: 200px; + float: left; + margin: 0 18px 18px; + border-radius: 20px; + box-shadow: inset 0 0 4px rgba(0,0,0,0.5); +} \ No newline at end of file diff --git a/js/panels/objects/object.reel/object.html b/js/panels/objects/object.reel/object.html new file mode 100644 index 00000000..efc66d79 --- /dev/null +++ b/js/panels/objects/object.reel/object.html @@ -0,0 +1,47 @@ + + + + + + + + + + + + + +
  • +
    + +
  • + + + diff --git a/js/panels/objects/object.reel/object.js b/js/panels/objects/object.reel/object.js new file mode 100644 index 00000000..953c1baf --- /dev/null +++ b/js/panels/objects/object.reel/object.js @@ -0,0 +1,101 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
    + No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
    + (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
    */ + +/** + @requires montage/core/core + @requires montage/ui/component + */ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.Object = Montage.create(Component, { + _needsPropertyInspection : { value: null }, + + _sourceObject : { value: null }, + sourceObject : { + get: function() { + return this._sourceObject; + }, + set: function(object) { + if(this._sourceObject === object) { return false; } + + if(object._montage_metadata) { + this.montageMetaData = object._montage_metadata; + } + + this._needsPropertyInspection = this.needsDraw = true; + } + + }, + + _identifier : { + value: null + }, + identifier : { + get: function() { + return this._identifier; + }, + set: function(value) { + if(this._identifier === value || !value) { return false; } + + this._identifier = value; + + this.label = value; + + this.needsDraw = true; + } + + }, + + _montageMetaData : { + value: null + }, + montageMetaData : { + get: function() { + return this._montageLabel; + }, + set: function(value) { + if(this._montageMetaData === value) { return false; } + + this._montageMetaData = value; + + if(!this.identifier && value.label) { + this.label = value.label; + this.needsDraw = true; + } + } + + }, + + templateDidLoad: { + value: function() { + console.log('object loaded'); + } + }, + + prepareForDraw : { + value: function() { + + } + }, + + willDraw : { + value: function() { + if(this._needsPropertyInspection) { + + } + + console.log("This label ", this.label); + } + }, + + draw : { + value: function() { + + } + } + +}); \ No newline at end of file diff --git a/js/panels/objects/objects-panel.reel/objects-panel.css b/js/panels/objects/objects-panel.reel/objects-panel.css new file mode 100644 index 00000000..3fa3c479 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.css @@ -0,0 +1,37 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
    + No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
    + (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
    */ + +/* + +
    + +
    + +*/ + +.objects-list { + margin: 10px 0 0 0; + padding: 0; +} +.objects-list .list-item { + list-style-type: none; + float: left; +} +.object-icon { + background-color: #fff; + border: 1px solid #353535; + border-radius: 5px; + height: 50px; + margin: 0 15px 5px; + width: 50px; +} +.object-label { + color: #fff; + display: block; + text-align: center; +} \ No newline at end of file diff --git a/js/panels/objects/objects-panel.reel/objects-panel.html b/js/panels/objects/objects-panel.reel/objects-panel.html new file mode 100644 index 00000000..d68a59c0 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.html @@ -0,0 +1,70 @@ + + + + + + + + + + + + + +
    + +
    + + + diff --git a/js/panels/objects/objects-panel.reel/objects-panel.js b/js/panels/objects/objects-panel.reel/objects-panel.js new file mode 100644 index 00000000..a1c381a2 --- /dev/null +++ b/js/panels/objects/objects-panel.reel/objects-panel.js @@ -0,0 +1,53 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
    + No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
    + (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
    */ + +/** + @requires montage/core/core + @requires montage/ui/component + */ +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +exports.ObjectsPanel = Montage.create(Component, { + _objects: { value: null }, + objects: { + get: function() { + return this._objects; + }, + set: function(value) { + this._objects = value; + this.needsDraw = true; + } + }, + + + templateDidLoad: { + value: function() { + console.log('objects panel loaded'); + } + }, + + prepareForDraw : { + value: function() { + + Object.defineBinding(this, 'objects', { + "boundObject": this.application.ninja.objectsController, + "boundObjectPropertyPath": "objects", + "oneway": true + }); + + } + }, + draw : { + value: function() { + console.log("objects panel draw"); + if(this.objects) { + + } + } + } + +}); \ No newline at end of file -- cgit v1.2.3 From 7e94d5786df400b599df3233b3086bfe9eff2bde Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Wed, 16 May 2012 22:58:24 -0700 Subject: Objects Panel - Add Objects controller and montage/application hack to expose template --- js/controllers/objects-controller.js | 59 ++++++++++++++++++++++++++++++++++ js/ninja.reel/ninja.html | 5 +++ node_modules/montage/ui/application.js | 3 ++ 3 files changed, 67 insertions(+) create mode 100644 js/controllers/objects-controller.js diff --git a/js/controllers/objects-controller.js b/js/controllers/objects-controller.js new file mode 100644 index 00000000..70a3974c --- /dev/null +++ b/js/controllers/objects-controller.js @@ -0,0 +1,59 @@ +/* + This file contains proprietary software owned by Motorola Mobility, Inc.
    + No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
    + (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
    */ + +var Montage = require("montage/core/core").Montage, + Component = require("montage/ui/component").Component; + +var objectsController = exports.ObjectsController = Montage.create(Component, { + objects : { + value: [] + }, + + handleAppLoaded : { + value: function() { + ///// Bind app's activeDocument property to + ///// objects controller's _activeDocument property + + Object.defineBinding(this, "activeDocument", { + boundObject: this.application.ninja, + boundObjectPropertyPath: "currentDocument", + oneway: true + }); + } + }, + + deserializedFromTemplate : { + value: function() { + this.eventManager.addEventListener( "appLoaded", this, false); + }, + enumerable : false + }, + + _activeDocument : { + value : null, + enumerable : false + }, + + activeDocument : { + get : function() { + return this._activeDocument; + }, + set : function(document) { + ///// If the document is null set default stylesheets to null + if(!document) { return false; } + + setTimeout(function() { + this.objects = document._document.application._template._deserializer.getObjectsFromLastDeserialization(); + }.bind(this), 1000); + + + ///// setting document via binding + this._activeDocument = document; + }, + enumerable : false + } + +}); \ No newline at end of file diff --git a/js/ninja.reel/ninja.html b/js/ninja.reel/ninja.html index 52a6daa2..7c3bc2c4 100755 --- a/js/ninja.reel/ninja.html +++ b/js/ninja.reel/ninja.html @@ -321,6 +321,10 @@ "prototype": "js/controllers/code-editor-controller" }, + "objectsController" : { + "prototype": "js/controllers/objects-controller" + }, + "owner": { "prototype": "js/ninja.reel", "properties": { @@ -350,6 +354,7 @@ "timeline": {"@": "timeline"}, "mainMenuController": {"@": "mainMenuController"}, "codeEditorController": {"@": "codeEditorController"}, + "objectsController": {"@": "objectsController"}, "rightPanelContainer": {"#": "rightPanelContainer" }, "panelSplitter": {"@": "splitter3"}, "timelineSplitter": {"@": "splitter4"}, diff --git a/node_modules/montage/ui/application.js b/node_modules/montage/ui/application.js index bbce6835..43443ecc 100755 --- a/node_modules/montage/ui/application.js +++ b/node_modules/montage/ui/application.js @@ -153,6 +153,9 @@ var Application = exports.Application = Montage.create(Montage, /** @lends monta // assign to the exports so that it is available in the deserialization of the template exports.application = self; + ///// TODO: Remove this hack when montage exposes this + this._template = template; + template.instantiateWithOwnerAndDocument(null, window.document, function() { require("ui/component").__root__.needsDraw = true; if (callback) { -- cgit v1.2.3