Author: erikdebruin
Date: Fri Jan 25 13:51:50 2013
New Revision: 1438517

URL: http://svn.apache.org/viewvc?rev=1438517&view=rev
Log:
- updated VanillaSDK framework and POC project

Added:
    flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/
    flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js   
(with props)
Modified:
    flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Example.as
    flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Main.mxml
    
flex/asjs/branches/develop/frameworks/js/VanillaSDK/flash/events/MouseEvent.js
    
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Button.js
    
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Group.js
    
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Label.js

Modified: flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Example.as
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Example.as?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Example.as (original)
+++ flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Example.as Fri Jan 
25 13:51:50 2013
@@ -9,12 +9,15 @@ import spark.components.Label;
 
 public class Example extends Group
 {
-       private static const BYEBYE:String = "Bye Bye";
-       private static const HELLOWORLD:String = "Hello World";
+       private const BYEBYE:String = "Bye Bye";
+       private const HELLOWORLD:String = "Hello World";
        
-       private static var counter:int = 100;
+       private var _counter:int = 100;
 
-       public function Example() {}
+       public function Example() 
+       {
+               init();
+       }
        
        private var _btn1:Button;
        private var _btn2:Button;
@@ -27,56 +30,51 @@ public class Example extends Group
                _lbl1 = new Label();
                _lbl1.x = 100;
                _lbl1.y = 25;
-               _lbl1.text = Example.HELLOWORLD;
-               
+               _lbl1.text = HELLOWORLD;
                addElement(_lbl1);
                
                _lbl2 = new Label();
                _lbl2.x = 200;
                _lbl2.y = 25;
-               _lbl2.text = Example.counter + "";
-               
+               _lbl2.text = _counter + "";
                addElement(_lbl2);
                
                _btn1 = new Button();
                _btn1.x = 100;
                _btn1.y = 50;
                _btn1.label = "Click me";
-               _btn1.addEventListener(MouseEvent.CLICK, 
this.btn1_clickHandler);
-               
                addElement(_btn1);
+               _btn1.addEventListener(MouseEvent.CLICK, btn1clickHandler);
 
                _btn2 = new Button();
                _btn2.x = 200;
                _btn2.y = 50;
                _btn2.label = "Add it";
-               _btn2.addEventListener(MouseEvent.CLICK, 
this.btn2_clickHandler);
-               
                addElement(_btn2);
+               _btn2.addEventListener(MouseEvent.CLICK, btn2clickHandler);
                
                _btn3 = new Button();
                _btn3.x = 300;
                _btn3.y = 50;
                _btn3.label = "Move it";
-               _btn3.addEventListener(MouseEvent.CLICK, 
this.btn3_clickHandler);
-               
                addElement(_btn3);
+               _btn3.addEventListener(MouseEvent.CLICK, btn3clickHandler);
        }
        
-       protected function btn1_clickHandler(event:MouseEvent):void
+       protected function btn1clickHandler(event:MouseEvent):void
        {
-               if (_lbl1.text == Example.HELLOWORLD)
-                       _lbl1.text = Example.BYEBYE;
+               if (_lbl1.text == HELLOWORLD)
+                       _lbl1.text = BYEBYE;
                else
-                       _lbl1.text = Example.HELLOWORLD;
+                       _lbl1.text = HELLOWORLD;
        }
        
-       protected function btn2_clickHandler(event:MouseEvent):void
+       protected function btn2clickHandler(event:MouseEvent):void
        {
-               _lbl2.text = --Example.counter + "";
+               _lbl2.text = --_counter + "";
        }
        
-       protected function btn3_clickHandler(event:MouseEvent):void
+       protected function btn3clickHandler(event:MouseEvent):void
        {
                _btn3.x += 10;
        }

Modified: flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Main.mxml
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Main.mxml?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Main.mxml (original)
+++ flex/asjs/branches/develop/examples/VanillaSDK_POC/src/Main.mxml Fri Jan 25 
13:51:50 2013
@@ -13,8 +13,6 @@
                        var main:Example = new Example();
                        
                        this.addElement(main);
-                       
-                       main.init();
                }
                
        ]]></fx:Script>

Modified: 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/flash/events/MouseEvent.js
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/VanillaSDK/flash/events/MouseEvent.js?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/flash/events/MouseEvent.js 
(original)
+++ 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/flash/events/MouseEvent.js 
Fri Jan 25 13:51:50 2013
@@ -5,3 +5,10 @@ goog.provide('flash.events.MouseEvent');
  */
 flash.events.MouseEvent = function() {
 }
+
+/**
+ * @const
+ * @static
+ * @type {string}
+ */
+flash.events.MouseEvent.CLICK = "click";

Added: flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js?rev=1438517&view=auto
==============================================================================
--- flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js 
(added)
+++ flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js 
Fri Jan 25 13:51:50 2013
@@ -0,0 +1,61 @@
+goog.provide('other.ViewElement');
+
+goog.require('goog.events.EventTarget');
+
+/**
+ * @constructor
+ * @extends {goog.events.EventTarget}
+ */
+other.ViewElement = function() {
+       var self = this;
+       goog.base(this);
+}
+goog.inherits(other.ViewElement, goog.events.EventTarget);
+
+/**
+ * @type {Object}
+ */
+other.ViewElement.prototype.element;
+
+/**
+ * @type {Object}
+ */
+other.ViewElement.prototype.owner;
+
+/**
+ * @type {number}
+ */
+other.ViewElement.prototype.x;
+Object.defineProperty(
+       other.ViewElement.prototype, 
+       'x', 
+       {
+               get:function() {
+                       var self = this;
+                       return self.element.offsetLeft;
+               }, 
+               set:function(value) {
+                       var self = this;
+                       self.element.style.left = value + "px";
+               }
+       }
+);
+
+/**
+ * @type {number}
+ */
+other.ViewElement.prototype.y;
+Object.defineProperty(
+       other.ViewElement.prototype, 
+       'y', 
+       {
+               get:function() {
+                       var self = this;
+                       return self.element.offsetTop;
+               }, 
+               set:function(value) {
+                       var self = this;
+                       self.element.style.top = value + "px";
+               }
+       }
+);

Propchange: 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/other/ViewElement.js
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Button.js
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Button.js?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Button.js 
(original)
+++ 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Button.js 
Fri Jan 25 13:51:50 2013
@@ -2,42 +2,48 @@ goog.provide('spark.components.Button');
 
 goog.require("goog.dom");
 goog.require("goog.events");
-goog.require("goog.events.EventType");
 
-goog.require("mx.core.UIComponent");
+goog.require("other.ViewElement");
 
 /**
  * @constructor
- * @extends {mx.core.UIComponent}
+ * @extends {other.ViewElement}
  */
 spark.components.Button = function() {
+       var self = this;
        goog.base(this);
        
-       this.element = goog.dom.createDom('button', {'id':'button'});
+       self.element = goog.dom.createDom('button');
 }
-goog.inherits(spark.components.Button, mx.core.UIComponent);
+goog.inherits(spark.components.Button, other.ViewElement);
 
-spark.components.Button.prototype.addEventListener = function(type, handler) {
-       goog.events.listen(this.element, goog.events.EventType.CLICK, handler, 
false, this);
+/**
+ * @this {goog.events.EventTarget}
+ * @param {string} type
+ * @param {Object} listener
+ * @param {boolean=} captureOnly
+ * @param {Object=} handler
+ */
+spark.components.Button.prototype.addEventListener = function(type, listener, 
captureOnly, handler) {
+       var self = this;
+       goog.events.listen(self.element, type, listener, false, self.owner);
 };
 
 /**
  * @type {string}
  */
 spark.components.Button.prototype.label;
-
-Object.defineProperty(
-       spark.components.Button.prototype, 
-       'label', 
-       {get:function() {
-               return this.element.innerHTML;
-       }, configurable:true}
-);
-
 Object.defineProperty(
        spark.components.Button.prototype, 
        'label', 
-       {set:function(value) {
-               this.element.innerHTML = value;
-       }, configurable:true}
+       {
+               get:function() {
+                       var self = this;
+                       return self.element.innerHTML;
+               }, 
+               set:function(value) {
+                       var self = this;
+                       self.element.innerHTML = value;
+               }
+       }
 );

Modified: 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Group.js
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Group.js?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Group.js 
(original)
+++ 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Group.js 
Fri Jan 25 13:51:50 2013
@@ -15,4 +15,6 @@ spark.components.Group.prototype.addElem
        object.element.style.position = "absolute";
        
        goog.dom.appendChild(document.body, object.element);
-};
\ No newline at end of file
+       
+       object.owner = this;
+};

Modified: 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Label.js
URL: 
http://svn.apache.org/viewvc/flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Label.js?rev=1438517&r1=1438516&r2=1438517&view=diff
==============================================================================
--- 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Label.js 
(original)
+++ 
flex/asjs/branches/develop/frameworks/js/VanillaSDK/spark/components/Label.js 
Fri Jan 25 13:51:50 2013
@@ -1,35 +1,34 @@
 goog.provide('spark.components.Label');
 
-goog.require("mx.core.UIComponent");
+goog.require("other.ViewElement");
 
 /**
  * @constructor
- * @extends {mx.core.UIComponent}
+ * @extends {other.ViewElement}
  */
 spark.components.Label = function() {
+       var self = this;
        goog.base(this);
        
-       this.element = goog.dom.createDom('div', null, 'Boo!');
+       self.element = goog.dom.createDom('div', null, 'Boo!');
 }
-goog.inherits(spark.components.Label, mx.core.UIComponent);
+goog.inherits(spark.components.Label, other.ViewElement);
 
 /**
  * @type {string}
  */
 spark.components.Label.prototype.text;
-
 Object.defineProperty(
        spark.components.Label.prototype, 
        'text', 
-       {get:function() {
-               return this.element.innerHTML;
-       }, configurable:true}
+       {
+               get:function() {
+                       var self = this;
+                       return self.element.innerHTML;
+               },
+               set:function(value) {
+                       var self = this;
+                       self.element.innerHTML = value;
+               }
+       }
 );
-
-Object.defineProperty(
-       spark.components.Label.prototype, 
-       'text', 
-       {set:function(value) {
-               this.element.innerHTML = value;
-       }, configurable:true}
-);
\ No newline at end of file


Reply via email to