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/01 11:47:50 UTC
[2/2] git commit: [flex-asjs] [refs/heads/develop] - update buttons
to SVG versions and prepare its methods
update buttons to SVG versions and prepare its methods
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/b45e0a37
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/b45e0a37
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/b45e0a37
Branch: refs/heads/develop
Commit: b45e0a3733127a397ba5b792f1f00ac5a3a41768
Parents: dc2d836
Author: Carlos Rovira <ca...@apache.org>
Authored: Sat Mar 1 11:47:39 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Sat Mar 1 11:47:39 2014 +0100
----------------------------------------------------------------------
.../src/controller/TodoListController.as | 20 +++++++++
.../src/view/TodoListView.mxml | 46 +++++++++++++++++---
2 files changed, 60 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b45e0a37/examples/TodoListSampleApp/src/controller/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/controller/TodoListController.as b/examples/TodoListSampleApp/src/controller/TodoListController.as
index 9065224..069866a 100644
--- a/examples/TodoListSampleApp/src/controller/TodoListController.as
+++ b/examples/TodoListSampleApp/src/controller/TodoListController.as
@@ -17,10 +17,13 @@
//
////////////////////////////////////////////////////////////////////////////////
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;
@@ -37,6 +40,23 @@ package controller {
*/
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};
}
}
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/b45e0a37/examples/TodoListSampleApp/src/view/TodoListView.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/view/TodoListView.mxml b/examples/TodoListSampleApp/src/view/TodoListView.mxml
index c28b52d..5bde70a 100644
--- a/examples/TodoListSampleApp/src/view/TodoListView.mxml
+++ b/examples/TodoListSampleApp/src/view/TodoListView.mxml
@@ -18,10 +18,42 @@ limitations under the License.
-->
<basic:ViewBase xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:basic="library://ns.apache.org/flexjs/basic">
+ 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>
@@ -30,7 +62,9 @@ limitations under the License.
<basic:NonVirtualVerticalLayout/>
</basic:beads>
- <basic:TextInput width="300"/>
+ <basic:TextInput id="todoInput"
+ width="300"
+ change="logTodo()"/>
<basic:List id="todoList"
itemRenderer="renderer.TodoItemRenderer"
@@ -47,10 +81,10 @@ limitations under the License.
<basic:beads>
<basic:NonVirtualHorizontalLayout/>
</basic:beads>
- <basic:Label text="2 items left"/>
- <basic:TextButton text="all"/>
- <basic:TextButton text="active"/>
- <basic:TextButton text="completed"/>
+ <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>