- Timestamp:
- 07/01/08 14:17:22 (5 months ago)
- Location:
- trunk/flexbook/chapter9/chapter9_flex
- Files:
-
- 5 modified
-
.actionScriptProperties (modified) (1 diff)
-
src/printpage/PrintFooter.mxml (modified) (2 diffs)
-
src/printpage/PrintHeader.mxml (modified) (1 diff)
-
src/printpage/PrintPage.mxml (modified) (1 diff)
-
src/sample11.mxml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/flexbook/chapter9/chapter9_flex/.actionScriptProperties
r214 r215 10 10 </compiler> 11 11 <applications> 12 <application path="sample3.mxml"/> 13 <application path="sample6.mxml"/> 12 14 <application path="sample2.mxml"/> 15 <application path="sample4.mxml"/> 16 <application path="sample1.mxml"/> 17 <application path="sample5.mxml"/> 18 <application path="sample7.mxml"/> 13 19 <application path="sample8.mxml"/> 14 20 <application path="sample9.mxml"/> 15 <application path="sample7.mxml"/> 16 <application path="sample6.mxml"/> 17 <application path="sample1.mxml"/> 21 <application path="sample11.mxml"/> 18 22 <application path="sample10.mxml"/> 19 <application path="sample3.mxml"/>20 <application path="sample5.mxml"/>21 <application path="sample4.mxml"/>22 <application path="sample11.mxml"/>23 23 </applications> 24 24 <modules/> -
trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintFooter.mxml
r214 r215 1 1 <?xml version="1.0"?> 2 <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 3 width="60%" 2 <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" 4 3 horizontalAlign="right"> 5 6 <!-- Declare and initialize the product total variable. -->7 4 <mx:Script> 8 5 <![CDATA[ … … 11 8 ]]> 12 9 </mx:Script> 13 14 10 <mx:Label text="Product Total: {pTotal}"/> 15 11 </mx:VBox> -
trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintHeader.mxml
r214 r215 2 2 <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" 3 3 width="60%" horizontalAlign="right" > 4 <mx:Label text=" This is a placeholder for first page contents"/>4 <mx:Label text="坐标点数据列表打印"/> 5 5 </mx:VBox> -
trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintPage.mxml
r214 r215 10 10 import mx.core.* 11 11 12 // Declare and initialize the variables used in the component. 13 // The application sets the actual prodTotal value. 12 //当前页数 14 13 [Bindable] 15 14 public var pageNumber:Number = 1; 15 //记录总条数 16 16 [Bindable] 17 17 public var prodTotal:Number = 0; 18 18 19 // Control the page contents by selectively hiding the header and 20 // footer based on the page type. 19 // 根据页面所处位置调整页面显示状态 21 20 public function showPage(pageType:String):void { 22 21 if(pageType == "first" || pageType == "middle") { 23 // Hide the footer.22 // 隐藏页脚 24 23 footer.includeInLayout=false; 25 24 footer.visible = false; 26 25 } 27 26 if(pageType == "middle" || pageType == "last") { 28 // The header won't be used again; hide it.27 // 隐藏页头,不显示页标题 29 28 header.includeInLayout=false; 30 29 header.visible = false; 31 30 } 32 31 if(pageType == "last") { 33 // Show the footer.32 // 显示页脚,总记录条数 34 33 footer.includeInLayout=true; 35 34 footer.visible = true; 36 35 } 37 // Update the DataGrid layout to reflect the results.36 //调整玩显示状态后进行刷新 38 37 validateNow(); 39 38 } 40 39 ]]> 41 </mx:Script> 42 43 <!-- The template for the printed page, 44 with the contents for all pages. --> 45 <mx:VBox width="80%" horizontalAlign="left"> 46 <mx:Label text="Page {pageNumber}"/> 47 </mx:VBox> 48 <MyComp:PrintHeader id="header"/> 49 <!-- The sizeToPage property is true by default, so the last 50 page has only as many grid rows as are needed for the data. --> 51 <mx:PrintDataGrid id="myDataGrid" width="60%" height="100%"> 52 <!-- Specify the columns to ensure that their order is correct. --> 40 </mx:Script> 41 <MyComp:PrintHeader id="header"/> 42 <mx:PrintDataGrid id="myDataGrid" width="100%" height="100%"> 53 43 <mx:columns> 54 <mx:DataGridColumndataField="name"/>55 <mx:DataGridColumndataField="lng"/>56 <mx:DataGridColumndataField="lat"/>44 <mx:DataGridColumn headerText="名称" dataField="name"/> 45 <mx:DataGridColumn headerText="经度" dataField="lng"/> 46 <mx:DataGridColumn headerText="纬度" dataField="lat"/> 57 47 </mx:columns> 58 48 </mx:PrintDataGrid> 59 60 <!-- Create a FormPrintFooter control 61 and set its prodTotal variable. --> 49 <mx:VBox width="80%" horizontalAlign="left"> 50 <mx:Label text="页数: {pageNumber}"/> 51 </mx:VBox> 52 <!-- 打印页脚 --> 62 53 <MyComp:PrintFooter id="footer" pTotal="{prodTotal}"/> 63 54 </mx:VBox> -
trunk/flexbook/chapter9/chapter9_flex/src/sample11.mxml
r214 r215 24 24 var point:Object = {}; 25 25 point.lat = (90-Math.random()*180); 26 point.lat = int(10000*point.lat)/10000; 26 27 point.lng = (180-Math.random()*360); 28 point.lng = int(10000*point.lng)/10000; 27 29 point.name = "Point_"+(z+1); 28 30 dgProvider.addItem(point); … … 97 99 <!-- The form that appears on the user's system.--> 98 100 <mx:Form id="myForm" width="80%"> 99 <mx:FormHeading label=" Product Information"/>101 <mx:FormHeading label="经纬度坐标列表"/> 100 102 <mx:DataGrid id="myDataGrid" dataProvider="{dgProvider}"> 101 103 <mx:columns> 102 <mx:DataGridColumn dataField="name"/>103 <mx:DataGridColumn dataField="lng"/>104 <mx:DataGridColumn dataField="lat"/>104 <mx:DataGridColumn headerText="名称" dataField="name"/> 105 <mx:DataGridColumn headerText="经度" dataField="lng"/> 106 <mx:DataGridColumn headerText="纬度" dataField="lat"/> 105 107 </mx:columns> 106 108 </mx:DataGrid> 107 <mx:Text width="100%" 108 text="Specify the number of lines and click Fill Grid first. 109 Then you can click Print."/> 110 <mx:TextInput id="dataItems" text="35" /> 109 <mx:Text width="100%" text="输入随机点数量:"/> 110 <mx:TextInput id="dataItems" text="50" /> 111 111 <mx:HBox> 112 <mx:Button id="setDP" 113 label="Fill Grid" 114 click="setdgProvider(int(dataItems.text));"/> 115 <mx:Button id="printDG" 116 label="Print" 117 click="doPrint();"/> 112 <mx:Button id="setDP" label="生成数据" click="setdgProvider(int(dataItems.text));"/> 113 <mx:Button id="printDG" label="打印" click="doPrint();"/> 118 114 </mx:HBox> 119 115 </mx:Form>
