Changeset 215 for trunk

Show
Ignore:
Timestamp:
07/01/08 14:17:22 (5 months ago)
Author:
silver
Message:
 
Location:
trunk/flexbook/chapter9/chapter9_flex
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/flexbook/chapter9/chapter9_flex/.actionScriptProperties

    r214 r215  
    1010  </compiler> 
    1111  <applications> 
     12    <application path="sample3.mxml"/> 
     13    <application path="sample6.mxml"/> 
    1214    <application path="sample2.mxml"/> 
     15    <application path="sample4.mxml"/> 
     16    <application path="sample1.mxml"/> 
     17    <application path="sample5.mxml"/> 
     18    <application path="sample7.mxml"/> 
    1319    <application path="sample8.mxml"/> 
    1420    <application path="sample9.mxml"/> 
    15     <application path="sample7.mxml"/> 
    16     <application path="sample6.mxml"/> 
    17     <application path="sample1.mxml"/> 
     21    <application path="sample11.mxml"/> 
    1822    <application path="sample10.mxml"/> 
    19     <application path="sample3.mxml"/> 
    20     <application path="sample5.mxml"/> 
    21     <application path="sample4.mxml"/> 
    22     <application path="sample11.mxml"/> 
    2323  </applications> 
    2424  <modules/> 
  • trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintFooter.mxml

    r214 r215  
    11<?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%" 
    43    horizontalAlign="right"> 
    5      
    6     <!-- Declare and initialize the product total variable. --> 
    74    <mx:Script> 
    85        <![CDATA[ 
     
    118        ]]> 
    129        </mx:Script> 
    13  
    1410    <mx:Label text="Product Total: {pTotal}"/> 
    1511</mx:VBox> 
  • trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintHeader.mxml

    r214 r215  
    22<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml"  
    33    width="60%" horizontalAlign="right" > 
    4     <mx:Label text="This is a placeholder for first page contents"/> 
     4    <mx:Label text="坐标点数据列表打印"/> 
    55</mx:VBox> 
  • trunk/flexbook/chapter9/chapter9_flex/src/printpage/PrintPage.mxml

    r214 r215  
    1010            import mx.core.* 
    1111             
    12             // Declare and initialize the variables used in the component. 
    13             // The application sets the actual prodTotal value. 
     12            //当前页数 
    1413            [Bindable] 
    1514            public var pageNumber:Number = 1; 
     15            //记录总条数 
    1616            [Bindable] 
    1717            public var prodTotal:Number = 0; 
    1818 
    19             // Control the page contents by selectively hiding the header and 
    20             // footer based on the page type. 
     19            // 根据页面所处位置调整页面显示状态 
    2120            public function showPage(pageType:String):void { 
    2221                if(pageType == "first" || pageType == "middle") { 
    23                     // Hide the footer. 
     22                    // 隐藏页脚 
    2423                    footer.includeInLayout=false; 
    2524                    footer.visible = false; 
    2625                } 
    2726                if(pageType == "middle" || pageType == "last") { 
    28                     // The header won't be used again; hide it. 
     27                    // 隐藏页头,不显示页标题 
    2928                    header.includeInLayout=false; 
    3029                    header.visible = false; 
    3130                } 
    3231                if(pageType == "last") { 
    33                     // Show the footer. 
     32                    // 显示页脚,总记录条数 
    3433                    footer.includeInLayout=true; 
    3534                    footer.visible = true; 
    3635                } 
    37                 //Update the DataGrid layout to reflect the results. 
     36                //调整玩显示状态后进行刷新 
    3837                validateNow(); 
    3938            } 
    4039        ]]> 
    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%">     
    5343        <mx:columns> 
    54              <mx:DataGridColumn dataField="name"/> 
    55              <mx:DataGridColumn dataField="lng"/> 
    56              <mx:DataGridColumn dataField="lat"/> 
     44            <mx:DataGridColumn headerText="名称" dataField="name"/> 
     45            <mx:DataGridColumn headerText="经度" dataField="lng"/> 
     46            <mx:DataGridColumn headerText="纬度" dataField="lat"/> 
    5747        </mx:columns> 
    5848    </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    <!-- 打印页脚 --> 
    6253    <MyComp:PrintFooter id="footer" pTotal="{prodTotal}"/> 
    6354</mx:VBox> 
  • trunk/flexbook/chapter9/chapter9_flex/src/sample11.mxml

    r214 r215  
    2424                var point:Object = {}; 
    2525                point.lat = (90-Math.random()*180); 
     26                point.lat = int(10000*point.lat)/10000; 
    2627                point.lng = (180-Math.random()*360); 
     28                point.lng = int(10000*point.lng)/10000; 
    2729                point.name = "Point_"+(z+1); 
    2830                dgProvider.addItem(point);                
     
    9799    <!-- The form that appears on the user's system.--> 
    98100    <mx:Form id="myForm" width="80%"> 
    99         <mx:FormHeading label="Product Information"/>        
     101        <mx:FormHeading label="经纬度坐标列表"/>        
    100102        <mx:DataGrid id="myDataGrid" dataProvider="{dgProvider}"> 
    101103             <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"/> 
    105107             </mx:columns> 
    106108         </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" /> 
    111111        <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();"/> 
    118114        </mx:HBox> 
    119115    </mx:Form>