You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pi...@apache.org on 2017/11/19 23:38:53 UTC

[royale-asjs] branch develop updated: Fix binding warnings in ToDoListSampleApp example (closes #45)

This is an automated email from the ASF dual-hosted git repository.

piotrz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new 695bfa3  Fix binding warnings in ToDoListSampleApp example (closes #45)
695bfa3 is described below

commit 695bfa31ce735f03fa2dfcc3e0b6efd0f0c86c78
Author: Piotr Zarzycki <pi...@gmail.com>
AuthorDate: Mon Nov 20 00:38:29 2017 +0100

    Fix binding warnings in ToDoListSampleApp example (closes #45)
---
 .../royale/sample/todo/models/TodoListModel.as     |  7 +++--
 .../sample/todo/renderers/TodoItemRenderer.mxml    | 12 ++++++--
 .../src/main/royale/sample/todo/vo/ToDoVO.as       | 33 ++++++++++++++++++++++
 3 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/models/TodoListModel.as b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/models/TodoListModel.as
index 0b0f823..3e87618 100644
--- a/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/models/TodoListModel.as
+++ b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/models/TodoListModel.as
@@ -19,6 +19,7 @@
 package sample.todo.models {
     import org.apache.royale.events.Event;
     import org.apache.royale.events.EventDispatcher;
+    import sample.todo.vo.ToDoVO;
 
     public class TodoListModel extends EventDispatcher {
         public function TodoListModel() {
@@ -26,9 +27,9 @@ package sample.todo.models {
 			_filterFunction();
         }
 
-        private var _todos:Array = [{title:"Get something", selected:true},
-			{title:"Do this", selected:true},
-			{title:"Do that", selected:false}];
+        private var _todos:Array = [new ToDoVO("Get something", true),
+			new ToDoVO("Do this", true),
+			new ToDoVO("Do that", false)];
 		
 		private var _filteredList:Array = [];
 		private var _filterFunction:Function = showAllTodos;
diff --git a/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/renderers/TodoItemRenderer.mxml b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/renderers/TodoItemRenderer.mxml
index 75f8873..7c4817f 100644
--- a/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/renderers/TodoItemRenderer.mxml
+++ b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/renderers/TodoItemRenderer.mxml
@@ -25,9 +25,15 @@ limitations under the License.
 
 	<fx:Script>
 		<![CDATA[
-		
 			import org.apache.royale.events.Event;
 			import org.apache.royale.events.MouseEvent;
+			import sample.todo.vo.ToDoVO;
+			
+			[Bindable("dataChange")]
+            public function get todo():ToDoVO
+            {
+                return data as ToDoVO;
+            }
 			
 			private function checkBoxChange():void
 			{
@@ -46,8 +52,8 @@ limitations under the License.
 		<js:ItemRendererDataBinding />
 	</js:beads>
 
-	<js:CheckBox text="{data.title}" 
-	             selected="{data.selected}" 
+	<js:CheckBox text="{todo.title}" 
+	             selected="{todo.selected}" 
 	             className="RendererText"
 	             change="checkBoxChange()"
 				 />
diff --git a/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/vo/ToDoVO.as b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/vo/ToDoVO.as
new file mode 100644
index 0000000..18ef81b
--- /dev/null
+++ b/examples/royale/TodoListSampleApp/src/main/royale/sample/todo/vo/ToDoVO.as
@@ -0,0 +1,33 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package sample.todo.vo
+{
+	[Bindable]
+	public class ToDoVO
+	{
+		public var title:String;
+		public var selected:Boolean;
+		
+		public function ToDoVO(title:String, selected:Boolean):void
+		{
+			this.title = title;
+			this.selected = selected;
+		}
+	}
+}
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
['"commits@royale.apache.org" <co...@royale.apache.org>'].