aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Materials
diff options
context:
space:
mode:
authorPierre Frisch2011-12-22 07:25:50 -0800
committerValerio Virgillito2012-01-27 11:18:17 -0800
commitb89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch)
tree0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/panels/Materials
parent2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff)
downloadninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
Diffstat (limited to 'js/panels/Materials')
-rw-r--r--js/panels/Materials/Materials.xml11
-rw-r--r--js/panels/Materials/MaterialsPanel.js44
-rw-r--r--js/panels/Materials/materials-library-panel.reel/materials-library-panel.css47
-rw-r--r--js/panels/Materials/materials-library-panel.reel/materials-library-panel.html40
-rw-r--r--js/panels/Materials/materials-library-panel.reel/materials-library-panel.js205
-rw-r--r--js/panels/Materials/materials-popup.reel/materials-popup.css162
-rw-r--r--js/panels/Materials/materials-popup.reel/materials-popup.html122
-rw-r--r--js/panels/Materials/materials-popup.reel/materials-popup.js674
8 files changed, 1305 insertions, 0 deletions
diff --git a/js/panels/Materials/Materials.xml b/js/panels/Materials/Materials.xml
new file mode 100644
index 00000000..de07990e
--- /dev/null
+++ b/js/panels/Materials/Materials.xml
@@ -0,0 +1,11 @@
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 </folder>
7 <folder id="customMaterials" label="Custom Materials">
8 <leaf id="CheckerBoard" label="CheckerBoard" />
9 <leaf id="ShinyMetal" label="Shiny Metal" />
10 </folder>
11</tree> \ No newline at end of file
diff --git a/js/panels/Materials/MaterialsPanel.js b/js/panels/Materials/MaterialsPanel.js
new file mode 100644
index 00000000..a63ed860
--- /dev/null
+++ b/js/panels/Materials/MaterialsPanel.js
@@ -0,0 +1,44 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Montage = require("montage/core/core").Montage,
8 PanelBase = require("js/panels/PanelBase").PanelBase,
9 MaterialsLibraryPanel = require("js/panels/Materials/materials-library-panel.reel").MaterialsLibraryPanel;
10
11exports.MaterialsPanel = Montage.create(PanelBase, {
12 id : {value : "materialsPanel", writable:true, enumerable:true, configurable:true},
13 panelName : {value : "Materials", writable:true, enumerable:true, configurable:true},
14 panelHeaderID : {value : "materialsPanelHeader", writable:true, enumerable:true, configurable:true},
15 disclosureIconID : {value : "materialsPanelDisclosureIcon", writable:true, enumerable:true, configurable:true},
16 closeButtonID : {value : "materialsPanelCloseButton", writable:true, enumerable:true, configurable:true},
17 panelContentID : {value : "materialsPanelContent", writable:true, enumerable:true, configurable:true},
18
19 _materialsLibraryPanel : {
20 enumerable: true,
21 value: null,
22 writable:true
23 },
24
25 init : {
26 enumerable:true,
27 value : function (){
28 /* OLD WAY -- Removing the temporary div
29 // TODO: Remove this comment once this is tested.
30 var panelContainer = document.createElement("div");
31
32 panelContainer.setAttribute("id", "materialsLibraryPanel");
33 this._materialsLibraryPanel = MaterialsLibraryPanel.create();
34 this._materialsLibraryPanel.element = panelContainer;
35 //Adding container to the parent
36
37 this.content = this._materialsLibraryPanel;
38 this._materialsLibraryPanel.needsDraw = true;
39 */
40 this.content = MaterialsLibraryPanel.create();
41 }
42 }
43
44}); \ No newline at end of file
diff --git a/js/panels/Materials/materials-library-panel.reel/materials-library-panel.css b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.css
new file mode 100644
index 00000000..07488da1
--- /dev/null
+++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.css
@@ -0,0 +1,47 @@
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.materials_library_panel hr {
8 float: left;
9 clear: both;
10 width: 100%;
11 display: block;
12 background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0.5, #1d1d1d), color-stop(0.75, #424242));
13 border: none;
14 height: 2px;
15 margin: 4px 0px 4px 0px;
16}
17
18
19#ml_buttons {
20 clear:both;
21 float: left;
22 margin: 0px -4px 0px 4px;
23 width: 97%;
24}
25
26#ml_buttons button {
27 height: 22px;
28 overflow: hidden;
29 display: block;
30 cursor: pointer;
31 margin: 0px 1px;
32}
33
34#materialsLibraryPanel-ml_add_btn {
35 float: left;
36 width: 60px;
37}
38
39#materialsLibraryPanel-ml_copy_btn {
40 float: left;
41 width: 60px;
42}
43
44#materialsLibraryPanel-ml_delete_btn {
45 float: right;
46 width: 60px;
47} \ 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
new file mode 100644
index 00000000..eede02bd
--- /dev/null
+++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.html
@@ -0,0 +1,40 @@
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 lang="en">
8 <head>
9 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
10 <link rel="stylesheet" type="text/css" href="materials-library-panel.css">
11 <script type="text/montage-serialization">
12 {
13 "owner": {
14 "module": "js/panels/Materials/materials-library-panel.reel",
15 "name": "MaterialsLibraryPanels",
16 "properties": {
17 "element": {"#": "materials_library_panel"}
18 }
19 }
20
21 }
22 </script>
23
24 </head>
25 <body>
26
27 <div id="materials_library_panel" class="materials_library_panel">
28 <div id="ml_tree_holder">
29 <ul id="materials_library_tree"></ul>
30 </div>
31 <hr />
32 <div id="ml_buttons">
33 <button id="ml_add_btn">Add</button>
34 <button id="ml_copy_btn">Copy</button>
35 <button id="ml_delete_btn">Delete</button>
36 </div>
37 </div>
38
39 </body>
40</html> \ No newline at end of file
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
new file mode 100644
index 00000000..f97e1a27
--- /dev/null
+++ b/js/panels/Materials/materials-library-panel.reel/materials-library-panel.js
@@ -0,0 +1,205 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No 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
7var Tree = require("js/components/tree.reel").Tree,
8 Button = require("js/components/button.reel").Button,
9 MaterialsPopup = require("js/panels/Materials/materials-popup.reel").MaterialsPopup,
10 PopupMananger = require("js/components/popup-manager.reel").PopupMananger;
11
12exports.MaterialsLibraryPanel = (require("montage/core/core").Montage).create(require("montage/ui/component").Component, {
13
14 _hasFocus: {
15 enumerable: false,
16 value: false
17 },
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
28 materialsTree.addEventListener("change", this, true);
29
30 var addButton = Button.create();
31 addButton.element = document.getElementById("ml_add_btn");
32 addButton.label = "Add";
33 addButton.needsDraw = true;
34 addButton.addEventListener("action", this, true);
35
36 var copyButton = Button.create();
37 copyButton.element = document.getElementById("ml_copy_btn");
38 copyButton.label = "Copy";
39 copyButton.needsDraw = true;
40 copyButton.addEventListener("action", this, true);
41
42 var deleteButton = Button.create();
43