From d26a13de2aca25c36cb35f85604de1ac2b9befbb Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Wed, 1 Feb 2012 14:37:30 -0800 Subject: Simple button native widget test. Added a controller, pi and panel code. Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 458e6b46..7a8acb3a 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -9,4 +9,27 @@ var Montage = require("montage/core/core").Montage, exports.ComponentController = Montage.create(ElementController, { + getProperty: { + value: function(el, prop) { + switch(prop) { + case "label": + return this.application.ninja.currentDocument.getComponentFromElement(el).label; + break; + default: + return ElementController.getProperty(el, prop); + } + } + }, + + setProperty: { + value: function(el, p, value) { + switch(p) { + case "label": + this.application.ninja.currentDocument.getComponentFromElement(el).label = value; + break; + default: + ElementController.setProperty(el, p, value); + } + } + } }); -- cgit v1.2.3 From dbd3a60478db35b0b12baa2ca54a0712d880951f Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 3 Feb 2012 15:50:35 -0800 Subject: button component using json data Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'js/controllers') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 7a8acb3a..1b0591be 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -15,8 +15,11 @@ exports.ComponentController = Montage.create(ElementController, { case "label": return this.application.ninja.currentDocument.getComponentFromElement(el).label; break; + case "enabled": + return this.application.ninja.currentDocument.getComponentFromElement(el).enabled; + break; default: - return ElementController.getProperty(el, prop); + return ElementController.getProperty(el, prop, true); } } }, @@ -27,6 +30,9 @@ exports.ComponentController = Montage.create(ElementController, { case "label": this.application.ninja.currentDocument.getComponentFromElement(el).label = value; break; + case "enabled": + this.application.ninja.currentDocument.getComponentFromElement(el).enabled = value; + break; default: ElementController.setProperty(el, p, value); } -- cgit v1.2.3 From 47df0aff81c25334b129047bb227ea5015357eda Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Thu, 9 Feb 2012 16:22:03 -0800 Subject: Setting defaults and more cleanup Signed-off-by: Valerio Virgillito --- js/controllers/elements/component-controller.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'js/controllers') diff --git a/js/controllers/elements/component-controller.js b/js/controllers/elements/component-controller.js index 1b0591be..33b9b79a 100644 --- a/js/controllers/elements/component-controller.js +++ b/js/controllers/elements/component-controller.js @@ -18,6 +18,12 @@ exports.ComponentController = Montage.create(ElementController, { 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: return ElementController.getProperty(el, prop, true); } @@ -33,6 +39,12 @@ exports.ComponentController = Montage.create(ElementController, { 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; + break; default: ElementController.setProperty(el, p, value); } -- cgit v1.2.3