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/06 16:31:43 UTC
[2/2] git commit: [flex-asjs] [refs/heads/develop] - refactor TODO
sample to package "sample.todo"
refactor TODO sample to package "sample.todo"
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/496c0e62
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/496c0e62
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/496c0e62
Branch: refs/heads/develop
Commit: 496c0e62b0493aa02107985e509dc6f2ad987c98
Parents: 85b6150
Author: Carlos Rovira <ca...@apache.org>
Authored: Thu Mar 6 15:58:26 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Thu Mar 6 16:31:26 2014 +0100
----------------------------------------------------------------------
.../src/TodoListSampleApp.mxml | 42 +++----
.../src/controller/TodoListController.as | 63 -----------
.../src/event/TodoListEvent.as | 35 ------
.../src/model/TodoListModel.as | 42 -------
.../src/renderer/TodoItemRenderer.as | 69 ------------
.../todo/controllers/TodoListController.as | 62 +++++++++++
.../src/sample/todo/events/TodoListEvent.as | 35 ++++++
.../src/sample/todo/models/TodoListModel.as | 42 +++++++
.../sample/todo/renderers/TodoItemRenderer.as | 69 ++++++++++++
.../src/sample/todo/views/TodoListView.mxml | 109 +++++++++++++++++++
.../src/view/TodoListView.mxml | 109 -------------------
11 files changed, 338 insertions(+), 339 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/TodoListSampleApp.mxml b/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
index bae26da..727c5c0 100644
--- a/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
+++ b/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
@@ -19,25 +19,25 @@
////////////////////////////////////////////////////////////////////////////////
-->
<basic:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:controller="controller.*"
- xmlns:model="model.*"
- xmlns:view="view.*">
-
- <basic:valuesImpl>
- <basic:SimpleCSSValuesImpl/>
- </basic:valuesImpl>
-
- <basic:controller>
- <controller:TodoListController/>
- </basic:controller>
-
- <basic:model>
- <model:TodoListModel/>
- </basic:model>
-
- <basic:initialView>
- <view:TodoListView/>
- </basic:initialView>
-
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:controller="sample.todo.controllers.*"
+ xmlns:model="sample.todo.models.*"
+ xmlns:views="sample.todo.views.*">
+
+ <basic:valuesImpl>
+ <basic:SimpleCSSValuesImpl/>
+ </basic:valuesImpl>
+
+ <basic:controller>
+ <controller:TodoListController/>
+ </basic:controller>
+
+ <basic:model>
+ <model:TodoListModel/>
+ </basic:model>
+
+ <basic:initialView>
+ <views:TodoListView/>
+ </basic:initialView>
+
</basic:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/controller/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/controller/TodoListController.as b/examples/TodoListSampleApp/src/controller/TodoListController.as
deleted file mode 100644
index bc70e3e..0000000
--- a/examples/TodoListSampleApp/src/controller/TodoListController.as
+++ /dev/null
@@ -1,63 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 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;
-
- 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/496c0e62/examples/TodoListSampleApp/src/event/TodoListEvent.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/event/TodoListEvent.as b/examples/TodoListSampleApp/src/event/TodoListEvent.as
deleted file mode 100644
index 4d3cdc7..0000000
--- a/examples/TodoListSampleApp/src/event/TodoListEvent.as
+++ /dev/null
@@ -1,35 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 event {
- import org.apache.flex.events.Event;
-
- public class TodoListEvent extends Event {
-
- public static const LOG_TODO:String = "logTodoEvent";
-
- /**
- * the todo to log
- */
- public var todo:String = null;
-
- public function TodoListEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) {
- super(type, bubbles, cancelable);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/model/TodoListModel.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/model/TodoListModel.as b/examples/TodoListSampleApp/src/model/TodoListModel.as
deleted file mode 100644
index 265424a..0000000
--- a/examples/TodoListSampleApp/src/model/TodoListModel.as
+++ /dev/null
@@ -1,42 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 model {
- import org.apache.flex.events.EventDispatcher;
-
- public class TodoListModel extends EventDispatcher {
- public function TodoListModel() {
- super();
- }
-
- private var _todos:Array = [
- {title: "Get something", selected: true},
- {title: "Do this", selected: true},
- {title: "Do that", selected: false}
- ];
-
- [Bindable]
- public function get todos():Array {
- return _todos;
- }
-
- public function set todos(value:Array):void {
- _todos = value;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as b/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
deleted file mode 100644
index 1f27aa6..0000000
--- a/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
+++ /dev/null
@@ -1,69 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-//
-// 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 renderer {
- import org.apache.flex.html.staticControls.Button;
- import org.apache.flex.html.staticControls.CheckBox;
- import org.apache.flex.html.staticControls.Label;
- import org.apache.flex.html.staticControls.supportClasses.DataItemRenderer;
-
- public class TodoItemRenderer extends DataItemRenderer {
- public function TodoItemRenderer() {
- super();
- }
-
- private var checkbox:CheckBox;
- private var title:Label;
- private var removeButton:Button;
-
- override public function addedToParent():void {
- super.addedToParent();
-
- checkbox = new CheckBox();
- addElement(checkbox);
-
- title = new Label();
- addElement(title);
-
- removeButton = new Button();
- addElement(removeButton);
- }
-
- override public function set data(value:Object):void {
- super.data = value;
-
- checkbox.selected = data.selected;
- title.text = data.title;
- }
-
- override public function adjustSize():void {
- var cy:Number = this.height / 2;
-
- checkbox.x = 10;
- checkbox.y = cy;
-
- title.x = 60;
- title.y = cy;
-
- removeButton.x = 300;
- removeButton.y = cy;
-
- updateRenderer();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as b/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
new file mode 100644
index 0000000..cbc4b1e
--- /dev/null
+++ b/examples/TodoListSampleApp/src/sample/todo/controllers/TodoListController.as
@@ -0,0 +1,62 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.controllers {
+ import sample.todo.events.TodoListEvent;
+ import sample.todo.models.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/496c0e62/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as b/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
new file mode 100644
index 0000000..c4d5fd1
--- /dev/null
+++ b/examples/TodoListSampleApp/src/sample/todo/events/TodoListEvent.as
@@ -0,0 +1,35 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.events {
+ import org.apache.flex.events.Event;
+
+ public class TodoListEvent extends Event {
+
+ public static const LOG_TODO:String = "logTodoEvent";
+
+ /**
+ * the todo to log
+ */
+ public var todo:String = null;
+
+ public function TodoListEvent(type:String, bubbles:Boolean = false, cancelable:Boolean = false) {
+ super(type, bubbles, cancelable);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as b/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
new file mode 100644
index 0000000..e4d06b1
--- /dev/null
+++ b/examples/TodoListSampleApp/src/sample/todo/models/TodoListModel.as
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.models {
+ import org.apache.flex.events.EventDispatcher;
+
+ public class TodoListModel extends EventDispatcher {
+ public function TodoListModel() {
+ super();
+ }
+
+ private var _todos:Array = [
+ {title: "Get something", selected: true},
+ {title: "Do this", selected: true},
+ {title: "Do that", selected: false}
+ ];
+
+ [Bindable]
+ public function get todos():Array {
+ return _todos;
+ }
+
+ public function set todos(value:Array):void {
+ _todos = value;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as b/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
new file mode 100644
index 0000000..0158513
--- /dev/null
+++ b/examples/TodoListSampleApp/src/sample/todo/renderers/TodoItemRenderer.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.renderers {
+ import org.apache.flex.html.staticControls.Button;
+ import org.apache.flex.html.staticControls.CheckBox;
+ import org.apache.flex.html.staticControls.Label;
+ import org.apache.flex.html.staticControls.supportClasses.DataItemRenderer;
+
+ public class TodoItemRenderer extends DataItemRenderer {
+ public function TodoItemRenderer() {
+ super();
+ }
+
+ private var checkbox:CheckBox;
+ private var title:Label;
+ private var removeButton:Button;
+
+ override public function addedToParent():void {
+ super.addedToParent();
+
+ checkbox = new CheckBox();
+ addElement(checkbox);
+
+ title = new Label();
+ addElement(title);
+
+ removeButton = new Button();
+ addElement(removeButton);
+ }
+
+ override public function set data(value:Object):void {
+ super.data = value;
+
+ checkbox.selected = data.selected;
+ title.text = data.title;
+ }
+
+ override public function adjustSize():void {
+ var cy:Number = this.height / 2;
+
+ checkbox.x = 10;
+ checkbox.y = cy;
+
+ title.x = 60;
+ title.y = cy;
+
+ removeButton.x = 300;
+ removeButton.y = cy;
+
+ updateRenderer();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml b/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
new file mode 100644
index 0000000..2c5ac10
--- /dev/null
+++ b/examples/TodoListSampleApp/src/sample/todo/views/TodoListView.mxml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+
+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.
+
+-->
+<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
+ xmlns:basic="library://ns.apache.org/flexjs/basic"
+ xmlns:svg="library://ns.apache.org/flexjs/svg">
+
+ <fx:Script>
+ <![CDATA[
+ import sample.todo.events.TodoListEvent;
+
+ /**
+ * add to the list the text entered by the user, in the text box,
+ * as a new todo list item
+ */
+ public function logTodo():void {
+ var logEvent:TodoListEvent = new TodoListEvent(TodoListEvent.LOG_TODO);
+ logEvent.todo = todoInput.text;
+ dispatchEvent(logEvent);
+
+ //todoList.width = Math.random() * 200; // to show changes vía ENTER key
+ }
+
+ /**
+ * show all todos
+ */
+ private function showAll():void {
+ }
+
+ /**
+ * show active todos
+ */
+ private function showActive():void {
+ }
+
+ /**
+ * show completed todos
+ */
+ private function showCompleted():void {
+ }
+ ]]>
+ </fx:Script>
+
+ <basic:Panel title="FlexJS TODO List" width="600">
+ <basic:beads>
+ <basic:NonVirtualVerticalLayout/>
+ </basic:beads>
+
+ <basic:TextInput id="todoInput"
+ width="300"
+ change="logTodo()"/>
+
+ <basic:List id="todoList"
+ itemRenderer="sample.todo.renderers.TodoItemRenderer"
+ width="300" height="400">
+ <!-- dataProvider="{TodoListModel(applicationModel).todos}" -->
+ <basic:beads>
+ <basic:ConstantBinding sourceID="applicationModel"
+ sourcePropertyName="todos"
+ destinationPropertyName="dataProvider"/>
+ </basic:beads>
+ </basic:List>
+
+ <basic:Container>
+ <basic:beads>
+ <basic:NonVirtualHorizontalLayout/>
+ </basic:beads>
+ <basic:Label id="statusLabel" text="N items left"/>
+ <svg:TextButton text="All" width="100" height="30" click="showAll()" />
+ <svg:TextButton text="Active" width="100" height="30" click="showActive()" />
+ <svg:TextButton text="Completed" width="100" height="30" click="showCompleted()" />
+ </basic:Container>
+ </basic:Panel>
+
+ <fx:Style>
+ @namespace basic "library://ns.apache.org/flexjs/basic";
+ @namespace renderer "renderer.*";
+
+ /* use className="todoList" on the List element in place of itemRenderer if you want to specify
+ * the itemRenderer in a style definition along with other settings.
+ */
+ .todoList {
+ IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData");
+ IItemRenderer: ClassReference("sample.todo.renderers.TodoItemRenderer");
+ }
+
+ renderer|TodoItemRenderer {
+ height: 40;
+ IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.ItemRendererMouseController");
+ }
+ </fx:Style>
+
+</basic:ViewBase>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/496c0e62/examples/TodoListSampleApp/src/view/TodoListView.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/view/TodoListView.mxml b/examples/TodoListSampleApp/src/view/TodoListView.mxml
deleted file mode 100644
index 5bde70a..0000000
--- a/examples/TodoListSampleApp/src/view/TodoListView.mxml
+++ /dev/null
@@ -1,109 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-
-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.
-
--->
-<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="library://ns.apache.org/flexjs/basic"
- xmlns:svg="library://ns.apache.org/flexjs/svg">
-
- <fx:Script>
- <![CDATA[
- import event.TodoListEvent;
-
- /**
- * add to the list the text entered by the user, in the text box,
- * as a new todo list item
- */
- public function logTodo():void {
- var logEvent:TodoListEvent = new TodoListEvent(TodoListEvent.LOG_TODO);
- logEvent.todo = todoInput.text;
- dispatchEvent(logEvent);
-
- //todoList.width = Math.random() * 200; // to show changes vía ENTER key
- }
-
- /**
- * show all todos
- */
- private function showAll():void {
- }
-
- /**
- * show active todos
- */
- private function showActive():void {
- }
-
- /**
- * show completed todos
- */
- private function showCompleted():void {
- }
- ]]>
- </fx:Script>
-
- <basic:Panel title="FlexJS TODO List" width="600">
- <basic:beads>
- <basic:NonVirtualVerticalLayout/>
- </basic:beads>
-
- <basic:TextInput id="todoInput"
- width="300"
- change="logTodo()"/>
-
- <basic:List id="todoList"
- itemRenderer="renderer.TodoItemRenderer"
- width="300" height="400">
- <!-- dataProvider="{TodoListModel(applicationModel).todos}" -->
- <basic:beads>
- <basic:ConstantBinding sourceID="applicationModel"
- sourcePropertyName="todos"
- destinationPropertyName="dataProvider"/>
- </basic:beads>
- </basic:List>
-
- <basic:Container>
- <basic:beads>
- <basic:NonVirtualHorizontalLayout/>
- </basic:beads>
- <basic:Label id="statusLabel" text="N items left"/>
- <svg:TextButton text="All" width="100" height="30" click="showAll()" />
- <svg:TextButton text="Active" width="100" height="30" click="showActive()" />
- <svg:TextButton text="Completed" width="100" height="30" click="showCompleted()" />
- </basic:Container>
- </basic:Panel>
-
- <fx:Style>
- @namespace basic "library://ns.apache.org/flexjs/basic";
- @namespace renderer "renderer.*";
-
- /* use className="todoList" on the List element in place of itemRenderer if you want to specify
- * the itemRenderer in a style definition along with other settings.
- */
- .todoList {
- IDataProviderItemRendererMapper: ClassReference("org.apache.flex.html.staticControls.beads.DataItemRendererFactoryForArrayData");
- IItemRenderer: ClassReference("renderer.TodoItemRenderer");
- }
-
- renderer|TodoItemRenderer {
- height: 40;
- IBeadController: ClassReference("org.apache.flex.html.staticControls.beads.controllers.ItemRendererMouseController");
- }
- </fx:Style>
-
-</basic:ViewBase>