xml version="1.0" encoding="utf-8"
<mxApplication xmlnsmx="http://www.adobe.com/2006/mxml"
xmlns="*"
layout="vertical"
creationComplete="onCreationComplete()"
>
<mxScript>
<![CDATA[
import mx.events.DragEvent;
import mx.controls.Alert;
import mx.events.CollectionEvent;
import mx.rpc.AsyncToken;
import mx.collections.XMLListCollection;
import mx.utils.ObjectUtil;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
[Bindable]
public var xlcDragMove0:XMLListCollection;
[Bindable]
public var xlcDragMove1:XMLListCollection;
[Bindable]
public var xlcDragMove2:XMLListCollection;
private function onCreationComplete():void{
// HTTPServiceで「data1.xml」の取得をキックする
getXML(srv, "./data1.xml", "e4x");
}
// HTTPServiceを使用してHTTPリクエスト(GET)を行う
private function getXML(httpSrv:HTTPService, targetURL:String, dataFormat:String):void
{
// リクエストするURLをセット
httpSrv.url = targetURL;
// レスポンス結果のデータフォーマットを指定する(デフォルトはObject)
httpSrv.resultFormat = dataFormat;
// デフォルトでGETですがサンプルとして明示する意味で書きました
httpSrv.method = "GET";
// リクエストを実行
var at:AsyncToken = httpSrv.send();
// 投げたリクエストと非同期で発生するレスポンスを対応付けるために情報を持たせる
at.url = targetURL.toLowerCase();
}
// HTTPServiceが成功
private function resultHandler(e:ResultEvent):void
{
// ドラッグ&ドロップ移動用に XMLListCollection を作成
xlcDragMove0 = new XMLListCollection(e.result.Person as XMLList);
xlcDragMove1 = new XMLListCollection();
xlcDragMove2 = new XMLListCollection();
}
// HTTPServiceでエラーが発生した
private function faultHandler(e:FaultEvent):void
{
Alert.show("HTTPService失敗\n\n理由 : " + e.fault.message);
}
]]>
</mxScript>
<mxHTTPService id="srv" showBusyCursor="true"
result="resultHandler(event)" fault="faultHandler(event)" />
<AdvanceTabNavigator id="tab1" width="600" height="300" historyManagementEnabled="true">
<mxCanvas id="cv0" label="0000">
<mxVBox id="vb0" x="0" y="0" height="100%" width="100%">
<mxText text="0" />
<mxDataGrid id="dg0"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
width="100%" height="100%"
dataProvider="{xlcDragMove0}">
<mxcolumns>
<mxDataGridColumn headerText="苗字" dataField="LastName" width="60"/>
<mxDataGridColumn headerText="名前" dataField="FirstName" width="60"/>
<mxDataGridColumn headerText="性別" dataField="Gender" width="40"/>
<mxDataGridColumn headerText="生年月日" dataField="BirthDay" width="90"/>
<mxDataGridColumn headerText="年齢" dataField="Age" width="40"/>
<mxDataGridColumn headerText="郵便番号" dataField="ZipCode" width="80"/>
<mxDataGridColumn headerText="都道府県" dataField="Prefecture" width="60"/>
<mxDataGridColumn headerText="住所" dataField="Address" width="200"/>
</mxcolumns>
</mxDataGrid>
</mxVBox>
</mxCanvas>
<mxCanvas id="cv1" label="1111">
<mxVBox id="vb1" x="0" y="0" height="100%" width="100%">
<mxText text="1" />
<mxDataGrid id="dg1"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
dataProvider="{xlcDragMove1}"
width="100%" height="100%">
<mxcolumns>
<mxDataGridColumn headerText="苗字" dataField="LastName" width="60"/>
<mxDataGridColumn headerText="名前" dataField="FirstName" width="60"/>
<mxDataGridColumn headerText="性別" dataField="Gender" width="40"/>
<mxDataGridColumn headerText="生年月日" dataField="BirthDay" width="90"/>
<mxDataGridColumn headerText="年齢" dataField="Age" width="40"/>
<mxDataGridColumn headerText="郵便番号" dataField="ZipCode" width="80"/>
<mxDataGridColumn headerText="都道府県" dataField="Prefecture" width="60"/>
<mxDataGridColumn headerText="住所" dataField="Address" width="200"/>
</mxcolumns>
</mxDataGrid>
</mxVBox>
</mxCanvas>
<mxCanvas id="cv2" label="2222">
<mxVBox id="vb2" x="0" y="0" height="100%" width="100%">
<mxText text="2" />
<mxDataGrid id="dg2"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
dataProvider="{xlcDragMove2}"
width="100%" height="100%">
<mxcolumns>
<mxDataGridColumn headerText="苗字" dataField="LastName" width="60"/>
<mxDataGridColumn headerText="名前" dataField="FirstName" width="60"/>
<mxDataGridColumn headerText="性別" dataField="Gender" width="40"/>
<mxDataGridColumn headerText="生年月日" dataField="BirthDay" width="90"/>
<mxDataGridColumn headerText="年齢" dataField="Age" width="40"/>
<mxDataGridColumn headerText="郵便番号" dataField="ZipCode" width="80"/>
<mxDataGridColumn headerText="都道府県" dataField="Prefecture" width="60"/>
<mxDataGridColumn headerText="住所" dataField="Address" width="200"/>
</mxcolumns>
</mxDataGrid>
</mxVBox>
</mxCanvas>
</AdvanceTabNavigator>
<mxButton id="b2" label="drag" click="tab1.tabDragEnable = (!tab1.tabDragEnable);
b2.label='drag: ' + tab1.tabDragEnable" />
<mxDataGrid id="dg4"
dragEnabled="true"
dropEnabled="true"
dragMoveEnabled="true"
width="100%" height="100%">
<mxcolumns>
<mxDataGridColumn headerText="苗字" dataField="LastName" width="60"/>
<mxDataGridColumn headerText="名前" dataField="FirstName" width="60"/>
<mxDataGridColumn headerText="性別" dataField="Gender" width="40"/>
<mxDataGridColumn headerText="生年月日" dataField="BirthDay" width="90"/>
<mxDataGridColumn headerText="年齢" dataField="Age" width="40"/>
<mxDataGridColumn headerText="郵便番号" dataField="ZipCode" width="80"/>
<mxDataGridColumn headerText="都道府県" dataField="Prefecture" width="60"/>
<mxDataGridColumn headerText="住所" dataField="Address" width="200"/>
</mxcolumns>
</mxDataGrid>
</mxApplication>