aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Components
diff options
context:
space:
mode:
Diffstat (limited to 'js/panels/Components')
-rw-r--r--js/panels/Components/Components.xml22
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html11
-rw-r--r--js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js211
3 files changed, 186 insertions, 58 deletions
diff --git a/js/panels/Components/Components.xml b/js/panels/Components/Components.xml
index b3056330..e076602e 100644
--- a/js/panels/Components/Components.xml
+++ b/js/panels/Components/Components.xml
@@ -2,27 +2,5 @@
2<tree id="Components"> 2<tree id="Components">
3 <folder id="montageComponents" label="Montage Components"> 3 <folder id="montageComponents" label="Montage Components">
4 <leaf id="Button" label="Button" /> 4 <leaf id="Button" label="Button" />
5 <leaf id="Checkbox" label="Checkbox" />
6 <leaf id="DynamicText" label="Dynamic Text" />
7 <leaf id="FlowController" label="FlowController" />
8 <leaf id="HotText" label="HotText" />
9 <leaf id="HotTextUnit" label="HotTextUnit" />
10 <leaf id="ImageContainer" label="Image Container" />
11 <leaf id="Progress" label="Progress" />
12 <leaf id="Scrollview" label="Scrollview" />
13 <leaf id="Slider" label="Slider" />
14 <leaf id="TextArea" label="TextArea" />
15 <leaf id="Textfield" label="Textfield" />
16 <leaf id="Toggle" label="Toggle" />
17 </folder>
18 <folder id="metaComponents" label="Meta Components">
19 <leaf id="Condition" label="Condition" />
20 <leaf id="Repetition" label="Repetition" />
21 <leaf id="Slot" label="Slot" />
22 <leaf id="Substitution" label="Substitution" />
23 </folder>
24 <folder id="htmlPresets" label="HTML Components">
25 <leaf id="html_button" label="Button" />
26 <leaf id="html_input" label="Text Input" />
27 </folder> 5 </folder>
28</tree> \ No newline at end of file 6</tree> \ No newline at end of file
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
index df104ecc..1e040e35 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.html
@@ -11,6 +11,17 @@
11 11
12 <script type="text/montage-serialization"> 12 <script type="text/montage-serialization">
13 { 13 {
14 "componentController": {
15 "module": "montage/ui/controller/array-controller",
16 "name": "ArrayController",
17 "bindings": {
18 "content": {
19 "boundObject": {"@": "owner"},
20 "boundObjectPropertyPath": "components"
21 }
22 }
23 },
24
14 "owner": { 25 "owner": {
15 "module": "js/panels/Components/ComponentsPanelBase.reel", 26 "module": "js/panels/Components/ComponentsPanelBase.reel",
16 "name": "ComponentsPanelBase", 27 "name": "ComponentsPanelBase",
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 41afefa5..d9decd2c 100644
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -4,17 +4,96 @@ 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
7var Montage = require("montage/core/core").Montage, 7var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component, 8 Component = require("montage/ui/component").Component,
9 NJUtils = require("js/lib/NJUtils").NJUtils; 9 NJUtils = require("js/lib/NJUtils").NJUtils;
10 10
11var treeControlModule = require("js/components/tree.reel"); 11var treeControlModule = require("js/components/tree.reel");
12var PIData = require("js/data/pi/pi-data").PiData;
12 13
13var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, { 14var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component, {
14 _hasFocus: { 15
15 enumerable: false, 16 components: {
16 value: false 17 value: null
18 },
19
20 _testButtonJson: {
21 value: {
22 "component": "button",
23
24 "module": "montage/ui/button.reel",
25
26 "name": "Button",
27
28 "properties": [
29 {
30 "name": "label",
31 "type": "string",
32 "default": "Button"
33 },
34 {
35 "name": "enabled",
36 "type": "boolean",
37 "default": "true"
38 }
39 ]
40 }
41 },
42
43 didCreate: {
44 value: function() {
45 this._loadComponents();
46 }
47 },
48
49 _loadComponents: {
50 value: function() {
51 this.components = [
52 {name: "Button", data: "montage/ui/button.reel/button.json"}
53 ];
54
55 // Build the PI objects for each component
56 for(var i = 0, component; component = this.components[i]; i++) {
57 var piIdentifier = component.name + "Pi";
58 var piObj = [];
59 var section = {};
60
61
62 section.label = component.name + " Properties";
63 section.Section = [];
64
65 for(var j = 0, props; props = this._testButtonJson.properties[j]; j++) {
66 var row = {};
67 row.type = this.getControlType(props.type);
68 row.id = props.name;
69 row.prop = props.name;
70 row.defaultValue = props["default"];
71 row.label = props.name;
72
73 section.Section.push([row]);
74 }
75
76 PIData[piIdentifier] = [];
77 PIData[piIdentifier].push(section);
78
79 }
80
81 }
82 },
83
84 getControlType: {
85 value: function(type) {
86 switch(type) {
87 case "string":
88 return "textbox";
89 case "boolean":
90 return "checkbox";
91 default:
92 alert("Conversion not implemented for ", type);
93 }
94 }
17 }, 95 },
96
18 prepareForDraw: { 97 prepareForDraw: {
19 enumerable: false, 98 enumerable: false,
20 value: function() { 99 value: function() {
@@ -27,18 +106,6 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
27 this.eventManager.addEventListener( "executeAddComponent", this, false); 106 this.eventManager.addEventListener( "executeAddComponent", this, false);
28 } 107 }
29 }, 108 },
30 willDraw: {
31 enumerable: false,
32 value: function() {
33
34 }
35 },
36 draw: {
37 enumerable: false,
38 value: function() {
39
40 }
41 },
42 109
43 _loadXMLDoc: { 110 _loadXMLDoc: {
44 value:function(dname) { 111 value:function(dname) {
@@ -51,23 +118,88 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
51 } 118 }
52 }, 119 },
53 120
121 _stash: {
122 value: {}
123 },
124
54 handleExecuteAddComponent: { 125 handleExecuteAddComponent: {
55 value: function(evt) { 126 value: function(evt) {
56 this.addComponentToStage(evt.detail.component, evt.detail.dropX, evt.detail.dropY) 127 //var component = evt.detail.component;
128 // Get the data from the event detail component
129 var component = this._testButtonJson;
130 this._stash.dropx = evt.detail.dropX;
131 this._stash.dropy = evt.detail.dropY;
132 this.addComponentToStage(component);// evt.detail.dropX, evt.detail.dropY);
133 }
134 },
135