aboutsummaryrefslogtreecommitdiff
path: root/js/panels/PanelContainer
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/PanelContainer
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/PanelContainer')
-rw-r--r--js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html62
-rw-r--r--js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js382
2 files changed, 444 insertions, 0 deletions
diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html
new file mode 100644
index 00000000..5c6ac227
--- /dev/null
+++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.html
@@ -0,0 +1,62 @@
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
10 <script type="text/montage-serialization">
11 {
12 "panel": {
13 "module": "js/panels/Panel.reel",
14 "name": "Panel",
15 "properties": {
16 "element": {"#": "panel"}
17 },
18 "bindings": {
19 "panelBase": {
20 "boundObject": {"@": "repetition1"},
21 "boundObjectPropertyPath": "objectAtCurrentIteration",
22 "oneway": true
23 }
24 }
25 },
26
27
28 "repetition1": {
29 "module": "montage/ui/repetition.reel",
30 "name": "Repetition",
31 "properties": {
32 "element": {"#": "panels"}
33 },
34 "bindings": {
35 "objects": {
36 "boundObject": {"@": "owner"},
37 "boundObjectPropertyPath": "_panels",
38 "oneway": true
39 }
40 }
41 },
42
43 "owner": {
44 "module": "js/panels/PanelContainer/PanelContainer.reel",
45 "name": "PanelContainer",
46 "properties": {
47 "element": {"#": "panelContainer"},
48 "repeater": {"@": "repetition1"}
49 }
50 }
51 }
52 </script>
53
54 </head>
55<body>
56 <section id="panelContainer">
57 <article id="panels" class="panels">
58 <article id="panel" class="panel"></article>
59 </article>
60 </section>
61</body>
62</html> \ No newline at end of file
diff --git a/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
new file mode 100644
index 00000000..57187af1
--- /dev/null
+++ b/js/panels/PanelContainer/PanelContainer.reel/PanelContainer.js
@@ -0,0 +1,382 @@
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
7/*
8Panel Container - A container for other panels
9*/
10var Montage = require("montage/core/core").Montage;
11var Component = require("montage/ui/component").Component;
12var PropertiesPanel = require("js/panels/Properties/properties-panel").PropertiesPanel;
13var ColorPanel = require("js/panels/Color/ColorPanel").ColorPanel;
14var CSSPanel = require("js/panels/CSSPanel/CSSPanel").CSSPanel;
15var ComponentsPanel = require("js/panels/Components/ComponentsPanel").ComponentsPanel;
16var ProjectPanel = require("js/panels/Project/ProjectPanel").ProjectPanel;
17var MaterialsPanel = require("js/panels/Materials/MaterialsPanel").MaterialsPanel;
18
19exports.PanelContainer = Montage.create(Component, {
20 lastOffset: {
21 value:null
22 },
23 _collapsedHeight: {
24 value: 26
25 },
26 _isFirstAdjustableNonCollapsed: {
27 value:true
28 },
29 _spaceAvailable: {
30 value:null
31 },
32 _panelSelected : {
33 value: null
34 },
35 _isFirstDraw: {
36 value: false
37 },
38 _panels: {
39 value: []
40 },
41
42 skipPanelIndex: {
43 value: null
44 },
45
46 initPanelOrder: {
47 value: ['PropertiesPanel','ColorPanel','ComponentsPanel','ProjectPanel','CSSPanel','MaterialsPanel']
48 },
49
50 panelOrder: {
51 value: []
52 },
53
54 deserializedFromTemplate : {
55 value: function() {
56 this.eventManager.addEventListener( "appLoaded", this, false);
57
58 }
59 },
60
61 handleAppLoaded: {
62 value: function() {
63 //Panels Loading
64 this.lastOffset = this.element.offsetHeight;
65 if( this.application.ninja.settings.getSetting(this.element.id, "panelOrder") != null) {
66 this.initPanelOrder = this.application.ninja.settings.getSetting(this.element.id, "panelOrder")
67 }
68 // if Panels already loaded no need to load again.
69 for(var i = 0; i < this.initPanelOrder.length; i++) {
70 this.addPanel(eval(this.initPanelOrder[i]));
71 this.panelOrder.push(this.initPanelOrder[i]);
72 this.application.ninja.settings.setSetting(this.element.id, "panelOrder", this.panelOrder);
73 }
74
75 var hideSplitter = true;
76
77 var that = this;
78 this._panels.forEach(function(obj) {
79
80 var panelMenuName = obj.panelName.substring(0, obj.panelName.indexOf('/') !== -1 ? obj.panelName.indexOf('/'): obj.panelName.length) + "Panel";
81
82 that.application.ninja.appModel[panelMenuName] = obj.visible;
83
84 if (obj.visible) {
85 hideSplitter = false;
86 }
87 });
88
89 if (hideSplitter) {
90 this.panelSplitter.toggle();
91 this.panelSplitter.disabled = true;
92 }
93
94 this.needsDraw = true;
95
96 this.addEventListener("change@appModel.PropertiesPanel", this, false);
97 this.addEventListener("change@appModel.ProjectPanel", this, false);
98 this.addEventListener("change@appModel.ColorPanel", this, false);
99 this.addEventListener("change@appModel.ComponentsPanel", this, false);
100 this.addEventListener("change@appModel.CSSPanel", this, false);
101 this.addEventListener("change@appModel.MaterialsPanel", this, false);
102 }
103 },
104
105 handleEvent: {
106 value: function(e) {
107 this.togglePanel(e.propertyName);
108 }
109 },
110
111 addPanel: {
112 value: function(panel) {
113 if (panel.init) {
114 panel.init();
115 }
116 this._panels.push(panel);
117 if (this.panelSplitter.disabled) {
118 this.panelSplitter.disabled = false;
119 this.panelSplitter.toggle();
120 }
121 }
122 },
123 handlePanelCollapsed: {
124 value: function(e) {
125
126 for(var i=0; i < this._panels.length; i++) {
127 if (e._event.detail.panelBase._uuid == this._panels[i]._uuid) {
128 this.skipPanelIndex = i;
129 this.handlePanelResized(i, true);
130 }
131 }
132 }
133 },
134
135 handlePanelResizedStart : {
136 value: function(e) {
137 for (var i = 0; i < this._panels.length; i++) {
138 if ( e._event.detail.element.parentNode.uuid == this.repeater.childComponents[i].element.uuid) {
139 this.handlePanelResized(i);
140 }
141 }
142 }
143 },