You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ca...@apache.org on 2014/03/05 01:39:31 UTC

[1/2] git commit: [flex-asjs] [refs/heads/develop] - TextInput in JS now dispatch an internal inputhandler INPUT event with the purpose of dispatch a FlexJS CHANGE event

Repository: flex-asjs
Updated Branches:
  refs/heads/develop 3d7e4f0e0 -> 84952edc9


TextInput in JS now dispatch an internal inputhandler INPUT event with the purpose of dispatch a FlexJS CHANGE event


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/2a20336a
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/2a20336a
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/2a20336a

Branch: refs/heads/develop
Commit: 2a20336a9da709064a3e5fac55009de8c698a47a
Parents: 3d7e4f0
Author: Carlos Rovira <ca...@apache.org>
Authored: Wed Mar 5 00:48:52 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Wed Mar 5 01:37:38 2014 +0100

----------------------------------------------------------------------
 .../js/FlexJS/src/org/apache/flex/events/Event.js    |  9 +++++++++
 .../org/apache/flex/html/staticControls/TextInput.js | 15 +++++++++++++++
 2 files changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2a20336a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
index 32d2297..f530106 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/events/Event.js
@@ -43,6 +43,15 @@ org.apache.flex.events.Event.prototype.FLEXJS_CLASS_INFO =
 
 
 /**
+ * Enum type for the events fired by the FlexJS Event
+ * @enum {string}
+ */
+org.apache.flex.events.Event.EventType = {
+    CHANGE: 'change'
+  };
+
+
+/**
  * @expose
  * @type {string} type The event type.
  */

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/2a20336a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
----------------------------------------------------------------------
diff --git a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
index 694cdce..422b57c 100644
--- a/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
+++ b/frameworks/js/FlexJS/src/org/apache/flex/html/staticControls/TextInput.js
@@ -14,6 +14,7 @@
 
 goog.provide('org.apache.flex.html.staticControls.TextInput');
 
+goog.require('goog.events.InputHandler');
 goog.require('org.apache.flex.core.UIBase');
 
 
@@ -47,6 +48,10 @@ org.apache.flex.html.staticControls.TextInput.prototype.createElement =
   this.element = document.createElement('input');
   this.element.setAttribute('type', 'input');
 
+  //attach input handler to dispatch flexjs change event when user write in textinput
+  var ih = new goog.events.InputHandler(this.element);
+  goog.events.listen(ih, goog.events.InputHandler.EventType.INPUT, goog.bind(this.inputChangeHandler, this));
+
   this.positioner = this.element;
   this.element.flexjs_wrapper = this;
 
@@ -71,3 +76,13 @@ org.apache.flex.html.staticControls.TextInput.prototype.set_text =
     function(value) {
   this.element.value = value;
 };
+
+
+/**
+ * @expose
+ * @param {Object} event The event.
+ */
+org.apache.flex.html.staticControls.TextInput.prototype.inputChangeHandler =
+    function(event) {
+        this.dispatchEvent(new org.apache.flex.events.Event(org.apache.flex.events.Event.EventType.CHANGE));
+      };


[2/2] git commit: [flex-asjs] [refs/heads/develop] - controller logTodo setup event, we need dispatch events when collection changes (add, remove) to let List component react

Posted by ca...@apache.org.
controller logTodo setup event, we need dispatch events when collection changes (add, remove) to let List component react


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/84952edc
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/84952edc
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/84952edc

Branch: refs/heads/develop
Commit: 84952edc9cb10ca40dafdf18b80f4486db5ca456
Parents: 2a20336
Author: Carlos Rovira <ca...@apache.org>
Authored: Wed Mar 5 01:39:19 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Wed Mar 5 01:39:19 2014 +0100

----------------------------------------------------------------------
 .../src/controller/TodoListController.as        | 86 ++++++++++----------
 .../src/renderer/TodoItemRenderer.as            |  2 +-
 2 files changed, 44 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/84952edc/examples/TodoListSampleApp/src/controller/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/controller/TodoListController.as b/examples/TodoListSampleApp/src/controller/TodoListController.as
index 069866a..bc70e3e 100644
--- a/examples/TodoListSampleApp/src/controller/TodoListController.as
+++ b/examples/TodoListSampleApp/src/controller/TodoListController.as
@@ -17,47 +17,47 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 package controller {
-    import event.TodoListEvent;
-
-    import model.TodoListModel;
-
-    import org.apache.flex.core.Application;
-    import org.apache.flex.core.IDocument;
-    import org.apache.flex.events.Event;
-
-    public class TodoListController implements IDocument {
-        private var app:TodoListSampleApp;
-        private var todoListModel:TodoListModel;
-
-        public function TodoListController(app:Application = null) {
-            if (app != null) {
-                app = app as TodoListSampleApp;
-            }
-        }
-
-        /**
-         *
-         */
-        public function setDocument(document:Object, id:String = null):void {
-            app = document as TodoListSampleApp;
-            app.addEventListener("viewChanged", viewChangeHandler);
-        }
-
-        /**
-         *
-         * @param event
-         */
-        private function viewChangeHandler(event:Event):void {
-            app.initialView.addEventListener(TodoListEvent.LOG_TODO, logTodo);
-        }
-
-        /**
-         * log todo
-         * @param event
-         */
-        public function logTodo(evt:TodoListEvent):void {
-            //todoListModel.todos = []; //{title: evt.todo, selected: false};
-        }
-
-    }
+	import event.TodoListEvent;
+
+	import model.TodoListModel;
+
+	import org.apache.flex.core.Application;
+	import org.apache.flex.core.IDocument;
+	import org.apache.flex.events.Event;
+
+	public class TodoListController implements IDocument {
+		private var app:TodoListSampleApp;
+
+		public function TodoListController(app:Application = null) {
+			if (app != null) {
+				app = app as TodoListSampleApp;
+			}
+		}
+
+		/**
+		 *
+		 */
+		public function setDocument(document:Object, id:String = null):void {
+			app = document as TodoListSampleApp;
+			app.addEventListener("viewChanged", viewChangeHandler);
+		}
+
+		/**
+		 *
+		 * @param event
+		 */
+		private function viewChangeHandler(event:Event):void {
+			app.initialView.addEventListener(TodoListEvent.LOG_TODO, logTodo);
+		}
+
+		/**
+		 * log todo
+		 * @param event
+		 */
+		public function logTodo(evt:TodoListEvent):void {
+			// still need to change model a view get the changes
+			var todoModel:TodoListModel = app.model as TodoListModel;
+			//todoModel.todos.push({title: evt.todo, selected: false});
+		}
+	}
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/84952edc/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as b/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
index e60b830..1f27aa6 100644
--- a/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
+++ b/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
@@ -61,7 +61,7 @@ package renderer {
             title.y = cy;
 
             removeButton.x = 300;
-            removeButton.y = cy
+            removeButton.y = cy;
 
             updateRenderer();
         }