aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/elements/component-controller.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-14 23:47:33 -0800
committerValerio Virgillito2012-02-14 23:47:33 -0800
commit68f8788c80d7f8d7815aca65ffabaa40b9434705 (patch)
tree5e37f4ad67b01fe66d4529d00f53b39310657f74 /js/controllers/elements/component-controller.js
parentf2f6ed48634ee4d74dd780c66e58c6b1e00234dd (diff)
downloadninja-68f8788c80d7f8d7815aca65ffabaa40b9434705.tar.gz
fixing the controller to handle all properties
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers/elements/component-controller.js')
-rw-r--r--js/controllers/elements/component-controller.js43
1 files changed, 18 insertions, 25 deletions
diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js
index 33b9b79a..7fa62d1e 100644
--- a/js/controllers/elements/component-controller.js
+++ b/js/controllers/elements/component-controller.js
@@ -12,20 +12,15 @@ exports.ComponentController = Montage.create(ElementController, {
12 getProperty: { 12 getProperty: {
13 value: function(el, prop) { 13 value: function(el, prop) {
14 switch(prop) { 14 switch(prop) {
15 case "label": 15 case "id":
16 return this.application.ninja.currentDocument.getComponentFromElement(el).label; 16 case "class":
17 break; 17 case "left":
18 case "enabled": 18 case "top":
19 return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; 19 case "width":
20 break; 20 case "height":
21 case "disabled":
22 return this.application.ninja.currentDocument.getComponentFromElement(el).disabled;
23 break;
24 case "value":
25 return this.application.ninja.currentDocument.getComponentFromElement(el).value;
26 break;
27 default:
28 return ElementController.getProperty(el, prop, true); 21 return ElementController.getProperty(el, prop, true);
22 default:
23 return this.application.ninja.currentDocument.getComponentFromElement(el)[prop];
29 } 24 }
30 } 25 }
31 }, 26 },
@@ -33,20 +28,18 @@ exports.ComponentController = Montage.create(ElementController, {
33 setProperty: { 28 setProperty: {
34 value: function(el, p, value) { 29 value: function(el, p, value) {
35 switch(p) { 30 switch(p) {
36 case "label": 31 case "id":
37 this.application.ninja.currentDocument.getComponentFromElement(el).label = value; 32 case "class":
38 break; 33 case "left":
39 case "enabled": 34 case "top":
40 this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; 35 case "width":
41 break; 36 case "height":
42 case "disabled": 37 ElementController.setProperty(el, p, value);
43 this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value;
44 break;
45 case "value":
46 this.application.ninja.currentDocument.getComponentFromElement(el).value = value;
47 break; 38 break;
48 default: 39 default:
49 ElementController.setProperty(el, p, value); 40 this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value;
41 break;
42
50 } 43 }
51 } 44 }
52 } 45 }