From 68f8788c80d7f8d7815aca65ffabaa40b9434705 Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Tue, 14 Feb 2012 23:47:33 -0800 Subject: fixing the controller to handle all properties Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 43 +++++++++++-------------- 1 file changed, 18 insertions(+), 25 deletions(-) (limited to 'js') 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, { getProperty: { value: function(el, prop) { switch(prop) { - case "label": - return this.application.ninja.currentDocument.getComponentFromElement(el).label; - break; - case "enabled": - return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; - break; - case "disabled": - return this.application.ninja.currentDocument.getComponentFromElement(el).disabled; - break; - case "value": - return this.application.ninja.currentDocument.getComponentFromElement(el).value; - break; - default: + case "id": + case "class": + case "left": + case "top": + case "width": + case "height": return ElementController.getProperty(el, prop, true); + default: + return this.application.ninja.currentDocument.getComponentFromElement(el)[prop]; } } }, @@ -33,20 +28,18 @@ exports.ComponentController = Montage.create(ElementController, { setProperty: { value: function(el, p, value) { switch(p) { - case "label": - this.application.ninja.currentDocument.getComponentFromElement(el).label = value; - break; - case "enabled": - this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; - break; - case "disabled": - this.application.ninja.currentDocument.getComponentFromElement(el).disabled = value; - break; - case "value": - this.application.ninja.currentDocument.getComponentFromElement(el).value = value; + case "id": + case "class": + case "left": + case "top": + case "width": + case "height": + ElementController.setProperty(el, p, value); break; default: - ElementController.setProperty(el, p, value); + this.application.ninja.currentDocument.getComponentFromElement(el)[p] = value; + break; + } } } -- cgit v1.2.3