diff options
author | Armen Kesablyan | 2012-05-17 13:33:28 -0700 |
---|---|---|
committer | Armen Kesablyan | 2012-05-17 13:33:28 -0700 |
commit | ee3702894b5c69a74f47b22aa5f2c8f58ad0179c (patch) | |
tree | 7b4dba1e5a4212c770c95aef9e45c81ce5626007 /js | |
parent | c8d61c8e72e0eba266575f9df54325fa77fde73d (diff) | |
parent | 7e94d5786df400b599df3233b3086bfe9eff2bde (diff) | |
download | ninja-ee3702894b5c69a74f47b22aa5f2c8f58ad0179c.tar.gz |
Merge pull request #3 from ericguzman/binding
Binding: Objects Panel Initialization
Diffstat (limited to 'js')
-rw-r--r-- | js/controllers/objects-controller.js | 59 | ||||
-rw-r--r-- | js/data/panels-data.js | 2 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.html | 5 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.css | 28 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.html | 47 | ||||
-rw-r--r-- | js/panels/objects/object.reel/object.js | 101 | ||||
-rw-r--r-- | js/panels/objects/objects-panel.reel/objects-panel.css | 37 | ||||
-rw-r--r-- | js/panels/objects/objects-panel.reel/objects-panel.html | 70 | ||||
-rw-r--r-- | js/panels/objects/objects-panel.reel/objects-panel.js | 53 |
9 files changed, 401 insertions, 1 deletions
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 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | Component = require("montage/ui/component").Component; | ||
9 | |||
10 | var objectsController = exports.ObjectsController = Montage.create(Component, { | ||
11 | objects : { | ||
12 | value: [] | ||
13 | }, | ||
14 | |||
15 | handleAppLoaded : { | ||
16 | value: function() { | ||
17 | ///// Bind app's activeDocument property to | ||
18 | ///// objects controller's _activeDocument property | ||
19 | |||
20 | Object.defineBinding(this, "activeDocument", { | ||
21 | boundObject: this.application.ninja, | ||
22 | boundObjectPropertyPath: "currentDocument", | ||
23 | oneway: true | ||
24 | }); | ||
25 | } | ||
26 | }, | ||
27 | |||
28 | deserializedFromTemplate : { | ||
29 | value: function() { | ||
30 | this.eventManager.addEventListener( "appLoaded", this, false); | ||
31 | }, | ||
32 | enumerable : false | ||
33 | }, | ||
34 | |||
35 | _activeDocument : { | ||
36 | value : null, | ||
37 | enumerable : false | ||
38 | }, | ||
39 | |||
40 | activeDocument : { | ||
41 | get : function() { | ||
42 | return this._activeDocument; | ||
43 | }, | ||
44 | set : function(document) { | ||
45 | ///// If the document is null set default stylesheets to null | ||
46 | if(!document) { return false; } | ||
47 | |||
48 | setTimeout(function() { | ||
49 | this.objects = document._document.application._template._deserializer.getObjectsFromLastDeserialization(); | ||
50 | }.bind(this), 1000); | ||
51 | |||
52 | |||
53 | ///// setting document via binding | ||
54 | this._activeDocument = document; | ||
55 | }, | ||
56 | enumerable : false | ||
57 | } | ||
58 | |||
59 | }); \ No newline at end of file | ||
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, { | |||
136 | collapsed: true, | 136 | collapsed: true, |
137 | scrollable: true, | 137 | scrollable: true, |
138 | open: true, | 138 | open: true, |
139 | modulePath: "js/panels/objects.reel", | 139 | modulePath: "js/panels/objects/objects-panel.reel", |
140 | moduleName: "ObjectsPanel" | 140 | moduleName: "ObjectsPanel" |
141 | } | 141 | } |
142 | ] | 142 | ] |
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 @@ | |||
321 | "prototype": "js/controllers/code-editor-controller" | 321 | "prototype": "js/controllers/code-editor-controller" |
322 | }, | 322 | }, |
323 | 323 | ||
324 | "objectsController" : { | ||
325 | "prototype": "js/controllers/objects-controller" | ||
326 | }, | ||
327 | |||
324 | "owner": { | 328 | "owner": { |
325 | "prototype": "js/ninja.reel", | 329 | "prototype": "js/ninja.reel", |
326 | "properties": { | 330 | "properties": { |
@@ -350,6 +354,7 @@ | |||
350 | "timeline": {"@": "timeline"}, | 354 | "timeline": {"@": "timeline"}, |
351 | "mainMenuController": {"@": "mainMenuController"}, | 355 | "mainMenuController": {"@": "mainMenuController"}, |
352 | "codeEditorController": {"@": "codeEditorController"}, | 356 | "codeEditorController": {"@": "codeEditorController"}, |
357 | "objectsController": {"@": "objectsController"}, | ||
353 | "rightPanelContainer": {"#": "rightPanelContainer" }, | 358 | "rightPanelContainer": {"#": "rightPanelContainer" }, |
354 | "panelSplitter": {"@": "splitter3"}, | 359 | "panelSplitter": {"@": "splitter3"}, |
355 | "timelineSplitter": {"@": "splitter4"}, | 360 | "timelineSplitter": {"@": "splitter4"}, |
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 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /* | ||
8 | |||
9 | <section data-montage-id="objects-panel" class="objects-panel"> | ||
10 | <ul data-montage-id="list" class="objects-list"> | ||
11 | <li data-montage-id="list-item" class="list-item"></li> | ||
12 | </ul> | ||
13 | </section> | ||
14 | |||
15 | */ | ||
16 | |||
17 | .objects-list { | ||
18 | margin: 0; | ||
19 | padding: 0; | ||
20 | } | ||
21 | .objects-list list-item { | ||
22 | width: 200px; | ||
23 | height: 200px; | ||
24 | float: left; | ||
25 | margin: 0 18px 18px; | ||
26 | border-radius: 20px; | ||
27 | box-shadow: inset 0 0 4px rgba(0,0,0,0.5); | ||
28 | } \ 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 @@ | |||
1 | <!DOCTYPE html> | ||
2 | <!-- <copyright> | ||
3 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
4 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
5 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
6 | </copyright> --> | ||
7 | <html> | ||
8 | <head> | ||
9 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
10 | <link rel="stylesheet" type="text/css" href="object.css"> | ||
11 | |||
12 | <script type="text/montage-serialization"> | ||
13 | { | ||
14 | "owner": { | ||
15 | "prototype": "js/panels/objects/object.reel", | ||
16 | "properties": { | ||
17 | "element": {"#": "object"} | ||
18 | } | ||
19 | }, | ||
20 | "labelText": { | ||
21 | "prototype": "montage/ui/dynamic-text.reel", | ||
22 | "properties": { | ||
23 | "element": {"#": "label" } | ||
24 | }, | ||
25 | "bindings": { | ||
26 | "value" : { | ||
27 | "boundObject": {"@": "owner"}, | ||
28 | "boundObjectPropertyPath": "label", | ||
29 | "oneway": true | ||
30 | } | ||
31 | } | ||
32 | } | ||
33 | |||
34 | } | ||
35 | </script> | ||
36 | |||
37 | </head> | ||
38 | <body> | ||
39 | |||
40 | |||
41 | <li data-montage-id="object"> | ||
42 | <div class="object-icon"></div> | ||
43 | <span data-montage-id="label" class="object-label"></span> | ||
44 | </li> | ||
45 | |||
46 | </body> | ||
47 | </html> | ||
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 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | /** | ||
8 | @requires montage/core/core | ||
9 | @requires montage/ui/component | ||
10 | */ | ||
11 | var Montage = require("montage/core/core").Montage, | ||
12 | Component = require("montage/ui/component").Component; | ||
13 | |||
14 | exports.Object = Montage.create(Component, { | ||
15 | _needsPropertyInspection : { value: null }, | ||
16 | |||
17 | _sourceObject : { value: null }, | ||
18 | sourceObject : { | ||
19 | get: function() { | ||
20 | return this._sourceObject; | ||
21 | }, | ||
22 | set: function(object) { | ||
23 | if(this._sourceObject === object) { return false; } | ||
24 | |||
25 | if(object._montage_metadata) { | ||
26 | this.montageMetaData = object._montage_metadata; | ||
27 | } | ||
28 | |||
29 | this._needsPropertyInspection = this.needsDraw = true; | ||
30 | } | ||
31 | |||
32 | }, | ||
33 | |||
34 | _identifier : { | ||
35 | value: null | ||
36 | }, | ||
37 | identifier : { | ||
38 | get: function() { | ||
39 | return this._identifier; | ||