diff options
author | Valerio Virgillito | 2012-03-21 13:24:51 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-03-21 13:24:51 -0700 |
commit | 3f71deb9b8d1c99dbcf8c8a251903dab7c92dce0 (patch) | |
tree | e94c5619282b38ed0d0d3c826d6dbedac279e544 /js/panels | |
parent | 8ee7f05753e84def43c158c30af7ecac68523847 (diff) | |
parent | 9facfb41b0b0f9fab9ddc9c8473af1d1d7e1ff18 (diff) | |
download | ninja-3f71deb9b8d1c99dbcf8c8a251903dab7c92dce0.tar.gz |
Merge branch 'refs/heads/master' into montage-integration
Diffstat (limited to 'js/panels')
7 files changed, 160 insertions, 64 deletions
diff --git a/js/panels/Materials/Materials.xml b/js/panels/Materials/Materials.xml deleted file mode 100755 index a958575e..00000000 --- a/js/panels/Materials/Materials.xml +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="ISO-8859-1"?> | ||
2 | <tree id="Materials"> | ||
3 | <folder id="ninjaMaterials" label="Ninja Materials"> | ||
4 | <leaf id="UberMaterial" label="Uber" /> | ||
5 | <leaf id="BumpMetalMaterial" label="Bump Metal" /> | ||
6 | <leaf id="LinearGradientMaterial" label="Linear Gradient" /> | ||
7 | <leaf id="RadialGradientMaterial" label="Radial Gradient" /> | ||
8 | <leaf id="FlatMaterial" label="Flat" /> | ||
9 | </folder> | ||
10 | <folder id="customMaterials" label="Custom Materials"> | ||
11 | <leaf id="CheckerBoard" label="CheckerBoard" /> | ||
12 | <leaf id="ShinyMetal" label="Shiny Metal" /> | ||
13 | </folder> | ||
14 | </tree> \ No newline at end of file | ||
diff --git a/js/panels/Materials/materials-data.json b/js/panels/Materials/materials-data.json new file mode 100644 index 00000000..f06ab6c8 --- /dev/null +++ b/js/panels/Materials/materials-data.json | |||
@@ -0,0 +1,43 @@ | |||
1 | { | ||
2 | "label": "materials", | ||
3 | "children": [ | ||
4 | { | ||
5 | "label": "Ninja Materials", | ||
6 | "children": [ | ||
7 | { | ||
8 | "label": "Uber", | ||
9 | "id" : "UberMaterial" | ||
10 | }, | ||
11 | { | ||
12 | "label": "Bump Metal", | ||
13 | "id" : "BumpMetalMaterial" | ||
14 | }, | ||
15 | { | ||
16 | "label": "Linear Gradient", | ||
17 | "id" : "LinearGradientMaterial" | ||
18 | }, | ||
19 | { | ||
20 | "label": "Radial Gradient", | ||
21 | "id" : "RadialGradientMaterial" | ||
22 | }, | ||
23 | { | ||
24 | "label": "Flat", | ||
25 | "id" : "FlatMaterial" | ||
26 | } | ||
27 | ] | ||
28 | }, | ||
29 | { | ||
30 | "label": "Custom Materials", | ||
31 | "children": [ | ||
32 | { | ||
33 | "label": "Checker Board", | ||
34 | "id" : "CheckerBoard" | ||
35 | }, | ||
36 | { | ||
37 | "label": "Shiny Metal", | ||
38 | "id" : "ShinyMetal" | ||
39 | } | ||
40 | ] | ||
41 | } | ||
42 | ] | ||
43 | } \ No newline at end of file | ||
diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html index fe17d0f8..4e41512f 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html | |||
@@ -46,10 +46,39 @@ | |||
46 | } | 46 | } |
47 | ] | 47 | ] |
48 | }, | 48 | }, |
49 | "materialInfo": { | 49 | "materialInfo": { |
50 | "module": "js/panels/Materials/materials-popup.reel", | 50 | "module": "js/panels/Materials/materials-popup.reel", |
51 | "name": "MaterialsPopup" | 51 | "name": "MaterialsPopup" |
52 | }, | 52 | }, |
53 | "materialsController" : { | ||
54 | "module": "js/controllers/tree-controller", | ||
55 | "name": "TreeController", | ||
56 | "properties" : { | ||
57 | "branchKey" : "children", | ||
58 | "labelKey" : "label", | ||
59 | "delegate": {"@": "owner" } | ||
60 | }, | ||
61 | "bindings": { | ||
62 | "content": { | ||
63 | "boundObject": {"@": "owner"}, | ||
64 | "boundObjectPropertyPath": "materialsData" | ||
65 | } | ||
66 | } | ||
67 | }, | ||
68 | "materialsContainer" : { | ||
69 | "module" : "js/components/treeview/treeview.reel", | ||
70 | "name" : "Treeview", | ||
71 | "properties" : { | ||
72 | "element" : {"#": "materials_library_tree"}, | ||
73 | "branchComponent" : {"@": "branch" }, | ||
74 | "contentController": {"@": "materialsController"}, | ||
75 | "showRoot": false | ||
76 | } | ||
77 | }, | ||
78 | "branch" : { | ||
79 | "module" : "js/components/treeview/ninja-branch.reel", | ||
80 | "name" : "Branch" | ||
81 | }, | ||
53 | "owner": { | 82 | "owner": { |
54 | "module": "js/panels/Materials/materials-library-panel.reel", | 83 | "module": "js/panels/Materials/materials-library-panel.reel", |
55 | "name": "MaterialsLibraryPanels", | 84 | "name": "MaterialsLibraryPanels", |
@@ -65,9 +94,9 @@ | |||
65 | <body> | 94 | <body> |
66 | 95 | ||
67 | <div id="materials_library_panel" class="materials_library_panel"> | 96 | <div id="materials_library_panel" class="materials_library_panel"> |
68 | <div id="ml_tree_holder"> | 97 | <section id="ml_tree_holder" class="animationsLibrary"> |
69 | <ul id="materials_library_tree"></ul> | 98 | <div id="materials_library_tree"></div> |
70 | </div> | 99 | </section> |
71 | <hr /> | 100 | <hr /> |
72 | <div id="ml_buttons"> | 101 | <div id="ml_buttons"> |
73 | <button id="ml_add_btn" class="nj-skinned">Add</button> | 102 | <button id="ml_add_btn" class="nj-skinned">Add</button> |
diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js index bb550598..2176c6d5 100755 --- a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js +++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js | |||
@@ -4,53 +4,31 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot | |||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | 4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. |
5 | </copyright> */ | 5 | </copyright> */ |
6 | 6 | ||
7 | var Tree = require("js/components/tree.reel").Tree, | 7 | var Montage = require("montage/core/core").Montage, |
8 | MaterialsPopup = require("js/panels/Materials/materials-popup.reel").MaterialsPopup, | 8 | Component = require("montage/ui/component").Component, |
9 | PopupMananger = require("js/components/popup-manager.reel").PopupMananger, | 9 | MaterialsData = require("js/panels/Materials/materials-data.json"), |
10 | Popup = require("montage/ui/popup/popup.reel").Popup; | 10 | Popup = require("montage/ui/popup/popup.reel").Popup; |
11 | 11 | ||
12 | exports.MaterialsLibraryPanel = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, { | 12 | exports.MaterialsLibraryPanel = Montage.create(Component, { |
13 | 13 | ||
14 | _hasFocus: { | 14 | materialsData: { |
15 | enumerable: false, | 15 | value: null |
16 | value: false | ||
17 | }, | 16 | }, |
18 | |||
19 | prepareForDraw: { | ||
20 | enumerable: false, | ||
21 | value: function() { | ||
22 | var treeHolderDiv = document.getElementById("materials_library_tree"); | ||
23 | var materialsTree = Tree.create(); | ||
24 | materialsTree.element = treeHolderDiv; | ||
25 | materialsTree.dataProvider = this._loadXMLDoc("js/panels/Materials/Materials.xml"); | ||
26 | materialsTree.needsDraw = true; | ||
27 | 17 | ||
28 | materialsTree.addEventListener("change", this, true); | 18 | _hasFocus: { |
29 | } | ||
30 | }, | ||
31 | |||
32 | willDraw: { | ||
33 | enumerable: false, | 19 | enumerable: false, |
34 | value: function() { | 20 | value: false |
35 | |||
36 | } | ||
37 | }, | 21 | }, |
38 | |||
39 | draw: { | ||
40 | enumerable: false, | ||
41 | value: function() { | ||
42 | 22 | ||
43 | } | 23 | didCreate: { |
24 | value: function() { | ||
25 | this.materialsData = MaterialsData; | ||
26 | } | ||
44 | }, | 27 | }, |
45 | 28 | ||
46 | _loadXMLDoc: { | 29 | prepareForDraw: { |
47 | value:function(dname) { | 30 | value : function() { |
48 | if (window.XMLHttpRequest) { | 31 | this.eventManager.addEventListener("showMaterialPopup", this, false); |
49 | xhttp = new XMLHttpRequest(); | ||