aboutsummaryrefslogtreecommitdiff
path: root/js/panels/Components
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-16 23:12:11 -0800
committerJose Antonio Marquez2012-02-16 23:12:11 -0800
commite404c691b84ca8fd1ab17fc6187bccb3f94258fb (patch)
tree7547d267a629ac717553e98e34a4d02543d529b7 /js/panels/Components
parentcfc2a432323d4620b1f4ca2061bbe57f46e7eaf7 (diff)
parente67d1f472dab28b4ff6afc9d9cc06b34756e26b5 (diff)
downloadninja-e404c691b84ca8fd1ab17fc6187bccb3f94258fb.tar.gz
Merge branch 'refs/heads/NinjaInternal' into FileIO
Diffstat (limited to 'js/panels/Components')
-rwxr-xr-xjs/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js99
1 files changed, 97 insertions, 2 deletions
diff --git a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
index 7e5a76ee..b4eec771 100755
--- a/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
+++ b/js/panels/Components/ComponentsPanelBase.reel/ComponentsPanelBase.js
@@ -26,14 +26,59 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
26 "text": "Montage Components", 26 "text": "Montage Components",
27 "children": [ 27 "children": [
28 { 28 {
29 "text": "Anchor",
30 "dataFile" : "node_modules/components-data/anchor.json",
31 "component": "anchor"
32 },
33 {
29 "text": "Button", 34 "text": "Button",
30 "dataFile" : "node_modules/components-data/button.json", 35 "dataFile" : "node_modules/components-data/button.json",
31 "component": "button" 36 "component": "button"
32 }, 37 },
33 { 38 {
39 "text": "Checkbox",
40 "dataFile" : "node_modules/components-data/checkbox.json",
41 "component": "checkbox"
42 },
43 {
44 "text": "Image Component",
45 "dataFile" : "node_modules/components-data/image.json",
46 "component": "imageComponent"
47 },
48 {
49 "text": "NumberInput",
50 "dataFile" : "node_modules/components-data/number-input.json",
51 "component": "numberInput"
52 },
53 {
54 "text": "Select Input",
55 "dataFile" : "node_modules/components-data/select.json",
56 "component": "select"
57 },
58 {
59 "text": "Radio Button",
60 "dataFile" : "node_modules/components-data/radio-button.json",
61 "component": "radioButton"
62 },
63 {
64 "text": "Range Input",
65 "dataFile" : "node_modules/components-data/range-input.json",
66 "component": "rangeInput"
67 },
68 {
69 "text": "TextArea",
70 "dataFile" : "node_modules/components-data/textarea.json",
71 "component": "textarea"
72 },
73 {
34 "text": "Textfield", 74 "text": "Textfield",
35 "dataFile" : "node_modules/components-data/textfield.json", 75 "dataFile" : "node_modules/components-data/textfield.json",
36 "component": "textfield" 76 "component": "textfield"
77 },
78 {
79 "text": "Toogle Button",
80 "dataFile" : "node_modules/components-data/toggle-button.json",
81 "component": "toggleButton"
37 } 82 }
38 ] 83 ]
39 } 84 }
@@ -119,6 +164,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
119 row.prop = props.name; 164 row.prop = props.name;
120 row.defaultValue = props["default"]; 165 row.defaultValue = props["default"];
121 row.label = props.name; 166 row.label = props.name;
167 row.items = props.possibleValues;
122 168
123 section.Section.push([row]); 169 section.Section.push([row]);
124 } 170 }
@@ -147,6 +193,10 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
147 return "textbox"; 193 return "textbox";
148 case "boolean": 194 case "boolean":
149 return "checkbox"; 195 return "checkbox";
196 case "select":
197 return "dropdown";
198 case "number":
199 return "hottext";
150 default: 200 default:
151 alert("Conversion not implemented for ", type); 201 alert("Conversion not implemented for ", type);
152 } 202 }
@@ -211,6 +261,7 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
211 261
212 NJevent("elementAdding", {"el": element, "data":styles}); 262 NJevent("elementAdding", {"el": element, "data":styles});
213 }); 263 });
264
214 } 265 }
215 }, 266 },
216 267
@@ -219,18 +270,62 @@ var ComponentsPanelBase = exports.ComponentsPanelBase = Montage.create(Component
219 var el; 270 var el;
220 271
221 switch(name) { 272 switch(name) {
273 case "anchor":
274 el = NJUtils.makeNJElement("a", "Anchor", "component");
275 el.elementModel.pi = "AnchorPi";
276 el.setAttribute("href", "http://www.motorola.com");
277 el.innerHTML = "link";
278 break;
222 case "button": 279 case "button":
223 el = NJUtils.makeNJElement(name, "Button", "component"); 280 el = NJUtils.makeNJElement(name, "Button", "component");
224 el.elementModel.pi = "ButtonPi"; 281 el.elementModel.pi = "ButtonPi";
225 el.setAttribute("type", "button"); 282 el.setAttribute("type", "button");
226 el.innerHTML = "Button"; 283 el.innerHTML = "Button";
227 break; 284 break;
228 case "textfield": { 285 case "checkbox":
286 el = NJUtils.makeNJElement("input", "Checkbox", "component");
287 el.elementModel.pi = "CheckboxPi";
288 el.setAttribute("type", "checkbox");
289 break;
290 case "imageComponent":
291 el = NJUtils.makeNJElement("image", "Image", "component");
292 el.elementModel.pi = "ImagePi";
293 el.setAttribute("width", 200);
294 el.setAttribute("height", 200);
295 break;
296 case "numberInput":
297 el = NJUtils.makeNJElement("input", "Number Input", "component");
298 el.elementModel.pi = "NumberInputPi";
299 el.setAttribute("type", "number");
300 break;
301 case "select":
302 el = NJUtils.makeNJElement("select", "Select", "component");
303 el.elementModel.pi = "SelectInputPi";
304 break;
305 case "radioButton":
306 el = NJUtils.makeNJElement("input", "Radio Button", "component");
307 el.elementModel.pi = "RadioButtonPi";
308 el.setAttribute("type", "radio");
309 break;
310 case "rangeInput":
311 el = NJUtils.makeNJElement("input", "Range Input", "component");
312 el.elementModel.pi = "RangeInputPi";
313 el.setAttribute("type", "range");
314 break;
315 case "textfield":
229 el = NJUtils.makeNJElement("input", "Textfield", "component"); 316 el = NJUtils.makeNJElement("input", "Textfield", "component");
230 el.elementModel.pi = "TextfieldPi"; 317 el.elementModel.pi = "TextfieldPi";
231 el.setAttribute("type", "text"); 318 el.setAttribute("type", "text");
232 break; 319 break;
233 } 320 case "textarea":
321 el = NJUtils.makeNJElement("textarea", "TextArea", "component");
322 el.elementModel.pi = "TextAreaPi";
323 break;
324 case "toggleButton":
325 el = NJUtils.makeNJElement("button", "Toggle Button", "component");
326 el.elementModel.pi = "ToggleButtonPi";
327 el.innerHTML = "Off";
328 break;
234 } 329 }
235 330
236 return el; 331 return el;