flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yish...@apache.org
Subject [24/27] git commit: [flex-asjs] [refs/heads/refactor-sprite] - Updated MobileStocks example with better resize handling.
Date Thu, 13 Oct 2016 07:40:25 GMT
Updated MobileStocks example with better resize handling.


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

Branch: refs/heads/refactor-sprite
Commit: 805838652cb668143361ce74cbd58f02c2850c33
Parents: 5df884a
Author: Peter Ent <pent@apache.org>
Authored: Tue Oct 11 16:49:21 2016 -0400
Committer: Peter Ent <pent@apache.org>
Committed: Tue Oct 11 16:49:21 2016 -0400

----------------------------------------------------------------------
 .../src/StockDataJSONItemConverter.as           | 11 ++--
 .../MobileStocks/src/models/ProductsModel.as    |  1 +
 .../MobileStocks/src/views/LaunchView.mxml      | 68 +++++++++++++-------
 .../MobileStocks/src/views/WatchListView.mxml   | 41 ++++--------
 4 files changed, 63 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80583865/examples/flexjs/MobileStocks/src/StockDataJSONItemConverter.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileStocks/src/StockDataJSONItemConverter.as b/examples/flexjs/MobileStocks/src/StockDataJSONItemConverter.as
index 5c21c26..92a75dc 100755
--- a/examples/flexjs/MobileStocks/src/StockDataJSONItemConverter.as
+++ b/examples/flexjs/MobileStocks/src/StockDataJSONItemConverter.as
@@ -17,24 +17,25 @@
 //
 ////////////////////////////////////////////////////////////////////////////////
 package
-{    
+{
     import org.apache.flex.collections.converters.JSONItemConverter;
-    
+
     public class StockDataJSONItemConverter extends JSONItemConverter
     {
         public function StockDataJSONItemConverter()
         {
             super();
         }
-        
+
         override public function convertItem(data:String):Object
         {
             var obj:Object = super.convertItem(data);
+            if (obj["query"] == null) return "No Data";
 			if (obj["query"]["count"] == 0)
 				return "No Data";
-			
+
 			obj = obj["query"]["results"]["quote"];
 			return obj;
         }
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80583865/examples/flexjs/MobileStocks/src/models/ProductsModel.as
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileStocks/src/models/ProductsModel.as b/examples/flexjs/MobileStocks/src/models/ProductsModel.as
index 91bc792..b807e19 100755
--- a/examples/flexjs/MobileStocks/src/models/ProductsModel.as
+++ b/examples/flexjs/MobileStocks/src/models/ProductsModel.as
@@ -232,6 +232,7 @@ package models
 		private function completeHandler(event:Event):void
 		{
 			var responseData:Object = collection.getItemAt(0);
+			if ((responseData is String) && (responseData == "No Data")) return;
 			var sym:String = responseData["Symbol"];
 
 			var queueNext:Stock = null;

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80583865/examples/flexjs/MobileStocks/src/views/LaunchView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileStocks/src/views/LaunchView.mxml b/examples/flexjs/MobileStocks/src/views/LaunchView.mxml
index 5d14065..094da51 100644
--- a/examples/flexjs/MobileStocks/src/views/LaunchView.mxml
+++ b/examples/flexjs/MobileStocks/src/views/LaunchView.mxml
@@ -80,6 +80,22 @@ limitations under the License.
 			padding-bottom: 2px;
 			padding-right: 10px;
 		}
+		
+		.Outer1 {
+			background-color: #FFFFCC;
+		}
+		
+		.Outer2 {
+			background-color: #FF0000;
+		}
+		
+		.LaunchGrid {
+			background-color: #0000FF;
+		}
+		
+		.DataGridListArea {
+			background-color: #CCFFFF;
+		}
 	</fx:Style>
 	
 	<fx:Metadata>
@@ -94,7 +110,10 @@ limitations under the License.
 		<models:AssetsModel />
 	</js:model>
 
-	<js:HContainer height="10%">
+	<js:Container height="40" width="100%" className="Outer1">
+	  <js:beads>
+	  	<js:OneFlexibleChildHorizontalLayout flexibleChild="spacer1" maxWidth="400" maxHeight="20"
/>
+	  </js:beads>
 		<js:Label text="Symbol:" />
 		<js:TextInput id="symbolInput" width="50" />
 		<js:Spacer width="10" />
@@ -102,37 +121,40 @@ limitations under the License.
 		<js:TextInput id="sharesInput" width="50" />
 		<js:Spacer width="10" />
 		<js:TextButton id="addButton" text="Add" width="80" click="addSymbol()" />
-		<js:Spacer width="30" />
+		<js:Spacer id="spacer1" width="1" />
 		<js:TextButton id="removeButton" text="Remove" width="80" click="removeSymbol()" />
-	</js:HContainer>
+	</js:Container>
 	
-	<js:DataGrid id="assetGrid" height="45%" width="510" rowHeight="25" change="gridSelected()">
-		<js:beads>
-			<js:SimpleBinding
-				eventName="update"
-				sourceID="dataModel"
-				sourcePropertyName="assetList"
-				destinationPropertyName="dataProvider" />
-			<js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" 
-										   destinationPropertyName="dataProvider" changeEventName="dataProviderChanged"
/>
-		</js:beads>
-		<js:columns>
-			<js:DataGridColumn columnWidth="250" label="Company (SYMB)" dataField="name" itemRenderer="renderers.CompanyNameRenderer"
/>
-			<js:DataGridColumn columnWidth="80" label="Shares" dataField="shares" />
-			<js:DataGridColumn columnWidth="80" label="Last" dataField="last" />
-			<js:DataGridColumn columnWidth="100" label="Total $" dataField="shares" itemRenderer="renderers.SharesTotalRenderer"
/>
-		</js:columns>
-	</js:DataGrid>
+	<js:Container height="45%" width="100%" className="Outer2">
+		<js:DataGrid id="assetGrid" height="100%" width="100%" rowHeight="25" change="gridSelected()"
className="LaunchGrid">
+			<js:beads>
+				<js:DataGridPercentageLayout />
+				<js:SimpleBinding
+					eventName="update"
+					sourceID="dataModel"
+					sourcePropertyName="assetList"
+					destinationPropertyName="dataProvider" />
+				<js:DataProviderChangeNotifier sourceID="dataModel" propertyName="assetList" 
+											   destinationPropertyName="dataProvider" changeEventName="dataProviderChanged"
/>
+			</js:beads>
+			<js:columns>
+				<js:DataGridColumn columnWidth="36" label="Company (SYMB)" dataField="name" itemRenderer="renderers.CompanyNameRenderer"
/>
+				<js:DataGridColumn columnWidth="20" label="Shares" dataField="shares" />
+				<js:DataGridColumn columnWidth="20" label="Last" dataField="last" />
+				<js:DataGridColumn columnWidth="24" label="Total $" dataField="shares" itemRenderer="renderers.SharesTotalRenderer"
/>
+			</js:columns>
+		</js:DataGrid>
+	</js:Container>
 	
 	<js:Spacer height="3%" />
 		
-	<js:StackedBarChart id="barChart" width="510" height="40%" className="AllCharts">
+	<js:BarChart id="barChart" width="100%" height="40%" className="AllCharts">
 		<js:model>
 			<js:ChartArrayListSelectionModel />
 		</js:model>
 		<js:beads>
 			<js:DataItemRendererFactoryForSeriesArrayListData />
-			<js:StackedBarChartLayoutForArrayList />
+			<js:BarChartLayoutForArrayList />
 			<js:SimpleBinding
 				eventName="update"
 				sourceID="dataModel"
@@ -156,6 +178,6 @@ limitations under the License.
 				</js:itemRenderer>
 			</js:BarSeries>
 		</js:series>
-	</js:StackedBarChart>
+	</js:BarChart>
 
 </js:TitleView>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/80583865/examples/flexjs/MobileStocks/src/views/WatchListView.mxml
----------------------------------------------------------------------
diff --git a/examples/flexjs/MobileStocks/src/views/WatchListView.mxml b/examples/flexjs/MobileStocks/src/views/WatchListView.mxml
index f4dcd94..1c317fe 100755
--- a/examples/flexjs/MobileStocks/src/views/WatchListView.mxml
+++ b/examples/flexjs/MobileStocks/src/views/WatchListView.mxml
@@ -107,6 +107,7 @@ limitations under the License.
 		
 	<js:DataGrid id="dataGrid" width="100%" height="85%" change="selectRow()" className="WatchListDataGrid">
 		<js:beads>
+			<js:DataGridPercentageLayout />
 			<js:SimpleBinding
 				eventName="update"
 				sourceID="dataModel"
@@ -116,38 +117,18 @@ limitations under the License.
 										   destinationPropertyName="dataProvider" changeEventName="dataProviderChanged"
/>
 		</js:beads>
 		<js:columns>
-			<js:DataGridColumn label="Company (SYMB)" dataField="symbol" 
+			<js:DataGridColumn label="Company (SYMB)" dataField="symbol" columnWidth="45"
 			                   itemRenderer="renderers.CompanyNameRenderer" />
-			<js:DataGridColumn label="Open" dataField="open"
+			<js:DataGridColumn label="Open" dataField="open" columnWidth="11"
+			                   itemRenderer="renderers.StockRenderer" />
+			<js:DataGridColumn label="Last" dataField="last"columnWidth="11"
+			                   itemRenderer="renderers.StockRenderer" />
+			<js:DataGridColumn label="Change" dataField="change"columnWidth="11"
+			                   itemRenderer="renderers.StockRenderer" />
+			<js:DataGridColumn label="High" dataField="high"columnWidth="11"
+			                   itemRenderer="renderers.StockRenderer" />
+			<js:DataGridColumn label="Low" dataField="low" columnWidth="11"
 			                   itemRenderer="renderers.StockRenderer" />
-			<js:DataGridColumn label="Last" dataField="last" >
-				<js:itemRenderer>
-					<fx:Component>
-						<renderers:StockRenderer />
-					</fx:Component>
-				</js:itemRenderer>
-			</js:DataGridColumn>
-			<js:DataGridColumn label="Change" dataField="change">
-				<js:itemRenderer>
-					<fx:Component>
-						<renderers:StockRenderer />
-					</fx:Component>
-				</js:itemRenderer>
-			</js:DataGridColumn>
-			<js:DataGridColumn label="High" dataField="high" >
-				<js:itemRenderer>
-					<fx:Component>
-						<renderers:StockRenderer />
-					</fx:Component>
-				</js:itemRenderer>
-			</js:DataGridColumn>
-			<js:DataGridColumn label="Low" dataField="low" >
-				<js:itemRenderer>
-					<fx:Component>
-						<renderers:StockRenderer />
-					</fx:Component>
-				</js:itemRenderer>
-			</js:DataGridColumn>
 		</js:columns>
 	</js:DataGrid>
 	


Mime
View raw message