diff options
Diffstat (limited to 'js/panels/Materials/materials-library-panel.reel/materials-library-panel.js')
-rwxr-xr-x | js/panels/Materials/materials-library-panel.reel/materials-library-panel.js | 66 |
1 files changed, 25 insertions, 41 deletions
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(); | ||
50 | } | ||
51 | xhttp.open("GET", dname, false); | ||
52 | xhttp.send(); | ||
53 | return xhttp.responseXML; | ||
54 | } | 32 | } |
55 | }, | 33 | }, |
56 | 34 | ||
@@ -71,10 +49,16 @@ exports.MaterialsLibraryPanel = (require("montage/core/core").Montage).create(re | |||
71 | } | 49 | } |
72 | }, | 50 | }, |
73 | 51 | ||
74 | captureChange: { | 52 | handleNodeActivation: { |
75 | value:function(e) { | 53 | value:function(obj) { |
76 | var tNode = e._event.treeNode; | 54 | this._showMaterialPopup(obj.id); |
77 | this._showMaterialPopup(tNode.id); | 55 | } |
56 | }, | ||
57 | |||
58 | handleShowMaterialPopup: { | ||
59 | enumerable: false, | ||
60 | value: function (event) { | ||
61 | this._showMaterialPopup(event.detail.materialId); | ||
78 | } | 62 | } |
79 | }, | 63 | }, |
80 | 64 | ||