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/02/26 18:59:23 UTC
git commit: [flex-asjs] [refs/heads/develop] - Todo List FlexJS
sample app initial commit
Repository: flex-asjs
Updated Branches:
refs/heads/develop 71948bc82 -> 5c53ff889
Todo List FlexJS sample app initial commit
Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/5c53ff88
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/5c53ff88
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/5c53ff88
Branch: refs/heads/develop
Commit: 5c53ff8896a0d6788b1c891abccf76e4a377ab84
Parents: 71948bc
Author: Carlos Rovira <ca...@apache.org>
Authored: Wed Feb 26 18:59:10 2014 +0100
Committer: Carlos Rovira <ca...@apache.org>
Committed: Wed Feb 26 18:59:10 2014 +0100
----------------------------------------------------------------------
examples/TodoListSampleApp/build.xml | 47 ++++++++++++++
.../src/TodoListSampleApp.mxml | 43 +++++++++++++
.../src/controller/TodoListController.as | 45 ++++++++++++++
.../src/model/TodoListModel.as | 40 ++++++++++++
.../src/renderer/TodoItemRenderer.as | 61 ++++++++++++++++++
.../src/view/TodoListView.mxml | 65 ++++++++++++++++++++
6 files changed, 301 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5c53ff88/examples/TodoListSampleApp/build.xml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/build.xml b/examples/TodoListSampleApp/build.xml
new file mode 100644
index 0000000..64bcb1d
--- /dev/null
+++ b/examples/TodoListSampleApp/build.xml
@@ -0,0 +1,47 @@
+<?xml version="1.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.
+
+-->
+<project name="todoListSampleApp" default="main" basedir=".">
+ <property name="FLEXJS_HOME" location="../.."/>
+ <property name="example" value="TodoListSampleApp" />
+
+ <property file="${FLEXJS_HOME}/env.properties"/>
+ <property environment="env"/>
+ <property file="${FLEXJS_HOME}/build.properties"/>
+ <property name="FLEX_HOME" value="${FLEXJS_HOME}"/>
+ <property name="FALCON_HOME" value="${env.FALCON_HOME}"/>
+ <property name="FALCONJX_HOME" value="${env.FALCONJX_HOME}"/>
+ <property name="GOOG_HOME" value="${env.GOOG_HOME}"/>
+
+ <include file="${basedir}/../build_example.xml" />
+
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+ <!-- Uncomment to reproduce cross-compilation error in compilejs step
+ <target name="main" depends="clean,build_example.compile,build_example.compilejs" description="Clean build of ${example}">
+ </target>
+ -->
+
+ <target name="clean">
+ <delete dir="${basedir}/bin" failonerror="false" />
+ <delete dir="${basedir}/bin-debug" failonerror="false" />
+ <delete dir="${basedir}/bin-release" failonerror="false" />
+ </target>
+</project>
+
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5c53ff88/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/TodoListSampleApp.mxml b/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
new file mode 100644
index 0000000..bae26da
--- /dev/null
+++ b/examples/TodoListSampleApp/src/TodoListSampleApp.mxml
@@ -0,0 +1,43 @@
+<?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: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>
+
+</basic:Application>
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5c53ff88/examples/TodoListSampleApp/src/controller/TodoListController.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/controller/TodoListController.as b/examples/TodoListSampleApp/src/controller/TodoListController.as
new file mode 100644
index 0000000..a8550fc
--- /dev/null
+++ b/examples/TodoListSampleApp/src/controller/TodoListController.as
@@ -0,0 +1,45 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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 org.apache.flex.core.Application;
+ import org.apache.flex.core.IDocument;
+ import org.apache.flex.events.Event;
+
+ import model.TodoListModel;
+
+ public class TodoListController implements IDocument {
+ private var app:TodoListSampleApp;
+ private var model:TodoListModel;
+
+ public function TodoListController(app:Application = null) {
+ if (app != null) {
+ app = app as TodoListSampleApp;
+ }
+ }
+
+ /**
+ *
+ */
+ public function setDocument(document:Object, id:String = null):void {
+ this.app = document as TodoListSampleApp;
+ }
+
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5c53ff88/examples/TodoListSampleApp/src/model/TodoListModel.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/model/TodoListModel.as b/examples/TodoListSampleApp/src/model/TodoListModel.as
new file mode 100644
index 0000000..1b78a5e
--- /dev/null
+++ b/examples/TodoListSampleApp/src/model/TodoListModel.as
@@ -0,0 +1,40 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Event;
+ 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}
+ ];
+ 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/5c53ff88/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as b/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
new file mode 100644
index 0000000..82a0bfb
--- /dev/null
+++ b/examples/TodoListSampleApp/src/renderer/TodoItemRenderer.as
@@ -0,0 +1,61 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+// 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.Label;
+ import org.apache.flex.html.staticControls.CheckBox;
+ 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;
+
+ override public function addedToParent():void {
+ super.addedToParent();
+
+ checkbox = new CheckBox();
+ addElement(checkbox);
+
+ title = new Label();
+ addElement(title);
+ }
+
+ 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;
+
+ updateRenderer();
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/5c53ff88/examples/TodoListSampleApp/src/view/TodoListView.mxml
----------------------------------------------------------------------
diff --git a/examples/TodoListSampleApp/src/view/TodoListView.mxml b/examples/TodoListSampleApp/src/view/TodoListView.mxml
new file mode 100644
index 0000000..e68c233
--- /dev/null
+++ b/examples/TodoListSampleApp/src/view/TodoListView.mxml
@@ -0,0 +1,65 @@
+<?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" >
+ <fx:Script>
+ <![CDATA[
+
+ ]]>
+ </fx:Script>
+
+ <basic:Panel title="FlexJS TODO List" width="600">
+ <basic:beads>
+ <basic:NonVirtualVerticalLayout />
+ </basic:beads>
+
+ <basic:TextInput width="300"/>
+
+ <basic:List id="todoList"
+ itemRenderer="renderer.TodoItemRenderer"
+ width="300" height="400">
+ <basic:beads>
+ <basic:ConstantBinding sourceID="applicationModel"
+ sourcePropertyName="todos"
+ destinationPropertyName="dataProvider"/>
+ </basic:beads>
+ </basic:List>
+
+ </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>