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:49 UTC
[1/2] git commit: [flex-asjs] [refs/heads/develop] - added change
event to TextInput to be dispatched when textChange fires. This need revision
since is not working as expected.
Repository: flex-asjs
Updated Branches:
refs/heads/develop c7547b689 -> b45e0a373
added change event to TextInput to be dispatched when textChange fires. This need revision since is not working as expected.
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/dc2d8364
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/dc2d8364
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/dc2d8364
Branch: refs/heads/develop
Commit: dc2d8364393aa29df8c38f3fb91082bfab4f6036
Parents: c7547b6
Author: Carlos Rovira <ca...@apache.org>
Authored: Sat Mar 1 11:44:47 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Sat Mar 1 11:44:47 2014 +0100
----------------------------------------------------------------------
.../flex/html/staticControls/TextInput.as | 44 ++++++++++++++++++++
1 file changed, 44 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/dc2d8364/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/TextInput.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/TextInput.as b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/TextInput.as
index 66ae3c7..7b3ff90 100644
--- a/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/TextInput.as
+++ b/frameworks/as/projects/FlexJSUI/src/org/apache/flex/html/staticControls/TextInput.as
@@ -19,7 +19,19 @@ package org.apache.flex.html.staticControls
{
import org.apache.flex.core.ITextModel;
import org.apache.flex.core.UIBase;
+ import org.apache.flex.core.IStrand;
+ import org.apache.flex.events.Event;
+ /**
+ * Dispatched when the user changes the text.
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ [Event(name="change", type="org.apache.flex.events.Event")]
+
/**
* The TextInput class implements the basic control for
* single-line text input.
@@ -86,5 +98,37 @@ package org.apache.flex.html.staticControls
ITextModel(model).html = value;
}
+ private var _strand:IStrand;
+
+ /**
+ * @copy org.apache.flex.core.IBead#strand
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function set strand(value:IStrand):void
+ {
+ _strand = value;
+
+ // this is not working as expected
+ model = UIBase(_strand).model as ITextModel;
+ model.addEventListener("textChange", textChangeHandler);
+ }
+
+ /**
+ * @dispatch change event in response to a textChange event
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion FlexJS 0.0
+ */
+ public function textChangeHandler(event:Event):void
+ {
+ // this is not working as expected
+ dispatchEvent(new Event("change"));
+ }
}
}
\ No newline at end of file
[2/2] git commit: [flex-asjs] [refs/heads/develop] - update buttons
to SVG versions and prepare its methods
Posted by ca...@apache.org.
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>