flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject git commit: [flex-asjs] [refs/heads/develop] - DataGrid example.
Date Tue, 05 Nov 2013 20:11:17 GMT
Updated Branches:
  refs/heads/develop 07d4e7b73 -> bbba578de


DataGrid example.


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/bbba578d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/bbba578d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/bbba578d

Branch: refs/heads/develop
Commit: bbba578de3de5820713a810a5608ecbd16a17647
Parents: 07d4e7b
Author: Peter Ent <pent@apache.org>
Authored: Tue Nov 5 15:11:02 2013 -0500
Committer: Peter Ent <pent@apache.org>
Committed: Tue Nov 5 15:11:02 2013 -0500

----------------------------------------------------------------------
 .../DataGridExample/src/DataGridExample.mxml    | 36 ++++++++++++++
 examples/DataGridExample/src/MyInitialView.mxml | 51 ++++++++++++++++++++
 .../src/models/MyGridPresentation.as            | 32 ++++++++++++
 .../DataGridExample/src/models/ProductsModel.as | 49 +++++++++++++++++++
 .../DataGridExample/src/products/Product.as     | 41 ++++++++++++++++
 5 files changed, 209 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bbba578d/examples/DataGridExample/src/DataGridExample.mxml
----------------------------------------------------------------------
diff --git a/examples/DataGridExample/src/DataGridExample.mxml b/examples/DataGridExample/src/DataGridExample.mxml
new file mode 100644
index 0000000..cc9a43c
--- /dev/null
+++ b/examples/DataGridExample/src/DataGridExample.mxml
@@ -0,0 +1,36 @@
+<?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:local="*"
+				   xmlns:models="models.*"
+				   xmlns:basic="library://ns.apache.org/flexjs/basic" 
+				   >
+	
+	<basic:valuesImpl>
+		<basic:SimpleCSSValuesImpl />
+	</basic:valuesImpl>
+	<basic:model>
+		<models:ProductsModel />
+	</basic:model>
+	<basic:initialView>
+		<local:MyInitialView />
+	</basic:initialView>
+</basic:Application>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bbba578d/examples/DataGridExample/src/MyInitialView.mxml
----------------------------------------------------------------------
diff --git a/examples/DataGridExample/src/MyInitialView.mxml b/examples/DataGridExample/src/MyInitialView.mxml
new file mode 100644
index 0000000..16a2813
--- /dev/null
+++ b/examples/DataGridExample/src/MyInitialView.mxml
@@ -0,0 +1,51 @@
+<?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:local="*" 
+				xmlns:models="models.*">
+    <fx:Script>
+        <![CDATA[
+			
+			private function dataGridChange() : void
+			{
+				output.text = "Clicked on row "+dataGrid.selectedIndex;
+				trace("Click on row "+dataGrid.selectedIndex);
+			}
+		]]>
+    </fx:Script>
+	
+	<basic:Label id="output" x="450" y="30" width="100" />
+	
+	<basic:DataGrid id="dataGrid" x="20" y="30" width="400" height="300" change="dataGridChange()"
>
+		<basic:beads>
+			<models:MyGridPresentation rowHeight="50" />
+			<basic:ConstantBinding
+				sourceID="applicationModel"
+				sourcePropertyName="productList"
+				destinationPropertyName="dataProvider" />
+			<basic:ConstantBinding
+				sourceID="applicationModel"
+				sourcePropertyName="labelFields"
+				destinationPropertyName="labelFields" />
+		</basic:beads>
+	</basic:DataGrid>
+
+</basic:ViewBase>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bbba578d/examples/DataGridExample/src/models/MyGridPresentation.as
----------------------------------------------------------------------
diff --git a/examples/DataGridExample/src/models/MyGridPresentation.as b/examples/DataGridExample/src/models/MyGridPresentation.as
new file mode 100644
index 0000000..3434348
--- /dev/null
+++ b/examples/DataGridExample/src/models/MyGridPresentation.as
@@ -0,0 +1,32 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 models
+{
+	import org.apache.flex.html.staticControls.beads.models.DataGridPresentationModel;
+	
+	public class MyGridPresentation extends DataGridPresentationModel
+	{
+		public function MyGridPresentation()
+		{
+			super();
+			
+			this.columnLabels = ["ID","Title","Inventory"];
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bbba578d/examples/DataGridExample/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/DataGridExample/src/models/ProductsModel.as b/examples/DataGridExample/src/models/ProductsModel.as
new file mode 100644
index 0000000..5b452b8
--- /dev/null
+++ b/examples/DataGridExample/src/models/ProductsModel.as
@@ -0,0 +1,49 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 models
+{
+	import org.apache.flex.events.EventDispatcher;
+	
+	import products.Product;
+	
+	public class ProductsModel extends EventDispatcher
+	{
+		public function ProductsModel()
+		{
+		}
+
+		private var _productList:Array = [
+			new Product("ps100","Widgets","44","smallbluerect.jpg"),
+			new Product("tx200","Thingys","out of stock","smallgreenrect.jpg"),
+			new Product("rz300","Sprockets","8,000","smallyellowrect.jpg"),
+			new Product("dh440","Doohickies","out of stock","smallredrect.jpg"),
+			new Product("ps220","Weejets","235","smallorangerect.jpg")
+			];
+		public function get productList():Array
+		{
+			return _productList;
+		}
+
+		private var _labelFields:Array = [ "id", "title", "detail" ];
+		public function get labelFields():Array
+		{
+			return _labelFields;
+		}
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/bbba578d/examples/DataGridExample/src/products/Product.as
----------------------------------------------------------------------
diff --git a/examples/DataGridExample/src/products/Product.as b/examples/DataGridExample/src/products/Product.as
new file mode 100644
index 0000000..34abf6b
--- /dev/null
+++ b/examples/DataGridExample/src/products/Product.as
@@ -0,0 +1,41 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 products
+{
+	public class Product
+	{
+		public function Product(id:String,title:String,detail:String,image:String)
+		{
+			this.id = id;
+			this.title = title;
+			this.detail = detail;
+			this.image = image;
+		}
+		
+		public var id:String;
+		public var title:String;
+		public var detail:String;
+		public var image:String;
+		
+		public function toString():String
+		{
+			return title;
+		}
+	}
+}
\ No newline at end of file


Mime
View raw message