multipolygon fix
[potlatch2.git] / net / systemeD / potlatch2 / TagViewer.mxml
1 <?xml version="1.0" encoding="utf-8"?>
2 <mx:VBox
3         xmlns:mx="http://www.adobe.com/2006/mxml"
4         xmlns:flexlib="flexlib.containers.*"
5     backgroundColor="white"
6     initialize="loadFeatures()">
7
8 <mx:ViewStack id="sidebar" width="100%" height="100%" creationPolicy="all">
9   <mx:VBox id="dndPanel" width="100%" height="100%">
10     <!-- FIXME the panel text is repeated below for mouseOut -->
11     <mx:Text id="dndPanelText" text="Drag and Drop Points of Interest" />
12     <mx:TileList id="poiGrid" dataProvider="{MapFeatures.getInstance().pois}" width="100%" height="100%">
13       <mx:itemRenderer>
14         <mx:Component>
15           <mx:VBox mouseOver="parentDocument.dndPanelText.text = data.name"
16                    mouseOut="parentDocument.dndPanelText.text = 'Drag and Drop Points of Interest'">
17             <mx:Script><![CDATA[
18               import mx.events.DragEvent;
19               import mx.managers.DragManager;
20               import mx.core.DragSource;
21                   
22               private function dragPOI(event:MouseEvent, tags:Array):void {
23                   // Get the drag initiator component from the event object.
24                   var dragInitiator:Image = event.currentTarget as Image;
25                   var dragSource:DragSource = new DragSource();
26                   dragSource.addData(tags, 'tags');
27                   
28                   var dragProxy:Image = new Image();
29                   dragProxy.source = dragInitiator.source;
30                   dragProxy.width = dragInitiator.width;   // must set width and height explicitly
31                   dragProxy.height = dragInitiator.height; // for non-embedded images
32                   DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
33               }
34             ]]></mx:Script>
35             <mx:Image id="foo" source="{data.image}" height="25" width="25" mouseMove="dragPOI(event, data.tags)" toolTip="{data.name}" />
36           </mx:VBox>
37         </mx:Component>
38       </mx:itemRenderer>
39     </mx:TileList>
40   </mx:VBox>
41   
42   <mx:VBox id="tagsPanel" width="100%" height="100%" creationPolicy="auto">
43     <mx:ViewStack id="stack" width="100%" height="100%">
44       <mx:VBox width="100%" height="100%" label="Simple" id="editorContainer" creationComplete="initEditorStackUIs()">
45         <mx:HBox borderStyle="inset" verticalAlign="middle" width="100%" paddingLeft="3" id="iconContainer">
46             <mx:Image id="iconImage"/>
47             <mx:VBox width="100%" verticalGap="1">
48               <mx:PopUpButton id="popupChange" creationComplete="initFeatureBox()" openAlways="true" width="100%"/>
49               <mx:Text condenseWhite="true" width="100%" id="iconText"/>
50             </mx:VBox>
51             <mx:LinkButton label="?" click="openDescription()" id="helpLabel"/>
52         </mx:HBox>
53       </mx:VBox>
54       <mx:VBox width="100%" height="100%" label="Advanced" initialize="checkAdvanced()" verticalGap="1">
55         <mx:Label id="advancedID">
56           <mx:htmlText><![CDATA[<i>No Selection</i>]]></mx:htmlText>
57         </mx:Label>
58
59         <mx:DataGrid editable="true" width="100%" height="75%" id="advancedTagGrid">
60                 <mx:columns>
61                     <mx:DataGridColumn editable="true" dataField="key" headerText="Key"/>
62                     <mx:DataGridColumn editable="true" dataField="value" headerText="Value"/>
63                 </mx:columns>
64         </mx:DataGrid>
65
66         <mx:HBox horizontalAlign="right" width="100%">
67           <mx:LinkButton label="Delete" click="removeTag()" enabled="{advancedTagGrid.selectedItem != null? true : false}"/>
68           <mx:LinkButton label="Add" click="addNewTag()"/>
69         </mx:HBox>
70         
71         <mx:DataGrid editable="true" width="100%" height="25%" id="relationsGrid"
72             doubleClickEnabled="true"
73             itemDoubleClick="editRelation(relationsGrid.selectedItem.id)">
74             <mx:columns>
75                 <mx:DataGridColumn editable="false" dataField="description" headerText="Relation"/>
76                 <mx:DataGridColumn editable="false" dataField="id_idx" headerText="ID"/>
77                 <mx:DataGridColumn editable="true" dataField="role" headerText="Role"/>
78             </mx:columns>
79         </mx:DataGrid>
80
81         <mx:HBox horizontalAlign="right" width="100%">
82           <mx:LinkButton label="Remove from" click="removeFromRelation(relationsGrid.selectedItem.id, relationsGrid.selectedItem.index)" 
83                           enabled="{relationsGrid.selectedItem != null? true : false}"/>
84           <mx:LinkButton label="Add to" click="addToRelation()"/>
85         </mx:HBox>
86
87       </mx:VBox>
88
89       <mx:VBox width="100%" height="100%" label="Members" id="membersVBox" initialize="checkMembers()" verticalGap="1">
90         <mx:Label id="membersText" text="Relation Members"/>
91         <mx:DataGrid editable="true" width="100%" height="100%" id="membersGrid"
92                       dragEnabled="true" dragMoveEnabled="true" dropEnabled="true">
93           <mx:columns>
94             <mx:DataGridColumn editable="false" dataField="type" headerText="Type"/>
95             <mx:DataGridColumn editable="false" dataField="id" headerText="ID"/>
96             <mx:DataGridColumn editable="true" dataField="role" headerText="Role"/>
97           </mx:columns>
98         </mx:DataGrid>
99       </mx:VBox>
100       
101       </mx:ViewStack>
102
103           <mx:HBox width="100%">
104                 <mx:LinkBar dataProvider="{stack}"/>
105                 <mx:Spacer width="100%"/>
106                 <mx:LinkButton 
107                         icon="@Embed('../../../embedded/view_tabbed.png')"
108                         disabledIcon="@Embed('../../../embedded/view_tabbed_disabled.png')"
109                         click="setEditorStackUI(true)" id="tabNavigatorLabel" paddingTop="6" 
110                         enabled="{editorStack is Accordion &amp;&amp; stack.selectedIndex==0}" />
111                 <mx:LinkButton
112                         icon="@Embed('../../../embedded/view_accordion.png')" 
113                         disabledIcon="@Embed('../../../embedded/view_accordion_disabled.png')"
114                         click="setEditorStackUI(false)" id="accordionLabel" paddingTop="6"
115                         enabled="{editorStack is SuperTabNavigator &amp;&amp; stack.selectedIndex==0}" />
116           </mx:HBox>
117   </mx:VBox>
118 </mx:ViewStack>
119
120   <mx:Script><![CDATA[
121       import net.systemeD.halcyon.connection.*;
122       import net.systemeD.potlatch2.mapfeatures.*;
123
124       import mx.collections.*;
125       import mx.containers.*;
126       import mx.events.*;
127       import mx.core.*;
128       import mx.managers.PopUpManager;
129       import flash.geom.Point;
130       import flash.net.*;
131       import mx.events.DragEvent;
132       import mx.managers.DragManager;
133       import mx.core.DragSource;
134       import flexlib.containers.SuperTabNavigator;
135
136       private var editorStackTabNavigator:SuperTabNavigator;
137       private var editorStackAccordion:Accordion;
138       [Bindable] private var editorStack:Container;
139
140       private var mapFeatures:MapFeatures;
141       private var selectedEntity:Entity;
142       private var tagDataProvider:ArrayCollection;
143       private var tw:CategorySelector = null;
144       private var feature:Feature = null;
145
146       public function setEntity(entity:Entity):void {
147           UIComponent.suspendBackgroundProcessing();
148           if ( selectedEntity != entity ) {
149               if ( selectedEntity != null )
150                   selectedEntity.removeEventListener(Connection.TAG_CHANGED, tagChanged);
151               selectedEntity = entity;
152               if ( selectedEntity != null )
153                   selectedEntity.addEventListener(Connection.TAG_CHANGED, tagChanged);
154           }
155
156           if ( advancedID != null )
157               setupAdvanced(entity);
158           if (entity is Relation) {
159               stack.addChild(membersVBox);
160           }
161           refreshFeatureIcon(); 
162           if (selectedEntity == null) {
163             sidebar.selectedChild = dndPanel;
164           } else {
165             initialiseEditors();
166             sidebar.selectedChild = tagsPanel;
167           }
168           UIComponent.resumeBackgroundProcessing();
169       }
170
171       private function refreshFeatureIcon():void {
172           var oldFeature:Feature = feature;
173           feature = selectedEntity == null ? null : mapFeatures.findMatchingFeature(selectedEntity);
174           if ( feature != oldFeature ) {
175               if ( oldFeature != null )
176                   oldFeature.removeEventListener("imageChanged", featureImageChanged);
177               if ( feature != null )
178                   feature.addEventListener("imageChanged", featureImageChanged);
179           }
180
181           if ( feature != null ) {
182               setFeatureIcon(selectedEntity, feature);
183           } else {
184               blankFeatureIcon(selectedEntity);
185           }
186       }
187
188       private function featureImageChanged(event:Event):void {
189           setFeatureIcon(selectedEntity, feature);
190       }
191       
192       private function setFeatureIcon(entity:Entity, feature:Feature):void {
193           //blankFeatureIcon(entity);
194           
195           iconImage.source = feature.image;
196
197           var txt:String = feature.htmlDetails(entity);
198           iconText.htmlText = txt;
199           popupChange.label = feature.name;
200           setLimitTypes(entity);
201           tw.setSelectedFeature(feature);
202           helpLabel.visible = feature.hasHelpURL();
203       }
204       
205       private function setLimitTypes(entity:Entity):void {
206           var type:String = null;
207           if ( entity is Node )
208               type = "point";
209           else if ( entity is Way )
210               type = Way(entity).isArea() ? "area" : "line";
211           else if ( entity is Relation )
212               type = "relation";
213           tw.setLimitTypes(type);
214       }
215
216       private function blankFeatureIcon(entity:Entity):void {
217           iconImage.source = null;
218           popupChange.label = "unknown";
219           setLimitTypes(entity);
220                   if (entity == null) { 
221                         iconText.htmlText = "<i>Nothing selected</i>";
222             tw.setNoSelectedFeature();
223                   } else if (entity.hasTags()) {
224                         iconText.htmlText = "<b>Not recognised</b><br/>Try looking at the tags under the advanced properties";
225             tw.setSelectedFeature(null);
226                   } else {
227                         iconText.htmlText = "<b>No tags set</b><br/>Use the menu above to say what this "+entity.getType()+" is";
228             tw.setSelectedFeature(null);
229           }
230           helpLabel.visible = false;
231       }
232
233       private var tabComponents:Object = {};
234       
235       private function initialiseEditors():void {
236           editorStack.removeAllChildren();
237           if ( selectedEntity == null || feature == null )
238               return;
239           
240           var editorBox:VBox = createEditorBox();
241           editorBox.label = "Basic";
242           editorStack.addChild(editorBox);
243           
244           var tabs:Object = {};
245           tabComponents = {};
246           
247           for each (var factory:EditorFactory in feature.editors) {
248               if ( factory.presence.isEditorPresent(factory, selectedEntity, null) ) {
249                   var editor:DisplayObject = factory.createEditorInstance(selectedEntity);
250                   if ( editor != null )
251                       editorBox.addChild(editor);
252               }
253               var category:String = factory.category;
254               var tab:VBox = tabs[category];
255               if ( tab == null ) {
256                   tab = createEditorBox();
257                   tab.label = category;
258                   editorStack.addChild(tab);
259                   tabs[category] = tab;
260                   tabComponents[tab] = [];
261               }
262               var catEditor:DisplayObject = factory.createEditorInstance(selectedEntity);
263               if ( catEditor != null )
264                   tabComponents[tab].push(catEditor);
265               //    tab.addChild(catEditor);
266           }
267       }
268       
269       private function createEditorBox():VBox {
270           var box:VBox = new VBox();
271           box.percentWidth = 100;
272           box.percentHeight = 100;
273           return box;
274       }
275
276       private function ensureEditorsPopulated(tab:VBox):void {
277           var components:Array = tabComponents[tab];
278           if ( components == null || tab == null || tab.numChildren >= components.length )
279               return;
280           for each (var component:DisplayObject in components ) {
281               tab.addChild(component);
282           }
283       }
284       
285         private function initEditorStackUIs():void {
286                 editorStackTabNavigator = new SuperTabNavigator();
287                 editorStackTabNavigator.allowTabSqueezing=false;
288                 editorStackTabNavigator.minTabWidth=10;
289                 editorStackTabNavigator.closePolicy="close_never";
290                 editorStackTabNavigator.scrollSpeed=20;
291                 editorStackTabNavigator.creationPolicy="auto";
292                 editorStackTabNavigator.percentWidth=100;
293                 editorStackTabNavigator.percentHeight=100;
294
295                 editorStackAccordion = new Accordion();
296                 editorStackAccordion.percentWidth=100;
297                 editorStackAccordion.percentHeight=100;
298                 editorStackAccordion.creationPolicy="auto";
299
300                 setEditorStackUI(true);
301         }
302
303         private function setEditorStackUI(isTabbed:Boolean):void {
304                 var children:Array=[]; var i:uint;
305
306                 if (editorStack) {
307                         // blank existing component
308                         editorStack.removeEventListener("change",editorStackUIChange);
309                         editorStack.removeEventListener("updateComplete",editorStackUIUpdate);
310                         editorStack.removeAllChildren();
311                         editorContainer.removeChildAt(1);
312                 }
313
314                 // replace with new component
315                 editorStack = (isTabbed ? editorStackTabNavigator : editorStackAccordion) as Container;
316                 editorContainer.addChild(editorStack);
317
318                 // re-add children and listeners
319                 initialiseEditors();
320                 editorStack.addEventListener("change",editorStackUIChange);
321                 editorStack.addEventListener("updateComplete",editorStackUIUpdate);
322         }
323         
324         private function editorStackUIChange(event:Event):void {
325                 ensureEditorsPopulated(IndexChangedEvent(event).relatedObject as VBox);
326         }
327
328         private function editorStackUIUpdate(event:Event):void {
329                 if (editorStack is SuperTabNavigator) {
330                         var e:SuperTabNavigator = editorStack as SuperTabNavigator;
331                         if (e.selectedIndex<0) { return; }
332                         for (var i:uint=0; i<e.numChildren; i++) {
333                                 e.getTabAt(i).selected=(i==e.selectedIndex);
334                         }
335                 }
336         }
337
338
339       private function checkAdvanced():void {
340           if ( selectedEntity != null )
341              setupAdvanced(selectedEntity);
342       }
343
344       private var listeningToRelations:Array = [];
345       
346       private function setupAdvanced(entity:Entity):void {
347           if ( tagDataProvider == null ) {
348               tagDataProvider = new ArrayCollection();
349               advancedTagGrid.dataProvider = tagDataProvider;
350           }
351
352           tagDataProvider.removeAll();
353           
354           if ( entity == null ) {
355               advancedID.htmlText = "";
356           } else {
357               var entityText:String = "xx";
358               if ( entity is Node ) entityText = "Node";
359               else if ( entity is Way ) entityText = "Way";
360               else if ( entity is Relation ) entityText = "Relation";
361               advancedID.htmlText = entityText+": <b>"+entity.id+"</b>";
362
363               var tags:Array = entity.getTagArray();
364               tags.sortOn("key");
365               for each(var tag:Tag in tags)
366                   tagDataProvider.addItem(tag);
367           }
368                     
369           removeRelationListeners();
370           if ( selectedEntity != null ) {
371               selectedEntity.removeEventListener(Connection.ADDED_TO_RELATION, addedToRelation);
372               selectedEntity.removeEventListener(Connection.REMOVED_FROM_RELATION, removedFromRelation);
373           }
374           
375           if ( entity == null ) {
376               relationsGrid.dataProvider = null;
377           } else {
378               resetRelationsGrid(entity);
379               entity.addEventListener(Connection.ADDED_TO_RELATION, addedToRelation);
380               entity.addEventListener(Connection.REMOVED_FROM_RELATION, removedFromRelation);
381           }
382       }
383       
384       private function addedToRelation(event:RelationMemberEvent):void {
385          resetRelationsGrid(selectedEntity);
386       }
387
388       private function removedFromRelation(event:RelationMemberEvent):void {
389          resetRelationsGrid(selectedEntity);
390       }
391
392       private function removeRelationListeners():void {
393           for each( var rel:Relation in listeningToRelations ) {
394               rel.removeEventListener(Connection.TAG_CHANGED, relationTagChanged);
395               rel.removeEventListener(Connection.RELATION_MEMBER_ADDED, entityRelationMemberChanged);
396               rel.removeEventListener(Connection.RELATION_MEMBER_REMOVED, entityRelationMemberChanged);
397           }
398           listeningToRelations = [];
399           relationsGrid.removeEventListener(DataGridEvent.ITEM_EDIT_END, relationRoleChanged);
400       }
401             
402       private function resetRelationsGrid(entity:Entity):void {
403           removeRelationListeners();
404           var relations:Array = [];
405           for each( var rel:Relation in entity.parentRelations ) {
406               for each( var memberIndex:int in rel.findEntityMemberIndexes(entity)) {
407                   var props:Object = {};
408                   props["relation"] = rel;
409                   props["id"] = rel.id;
410                   props["index"] = memberIndex;
411                   props["role"] = rel.getMember(memberIndex).role;
412                   props["description"] = rel.getDescription();
413                   props["id_idx"] = rel.id + "/"+memberIndex;
414
415                   relations.push(props);
416               }
417               
418               rel.addEventListener(Connection.TAG_CHANGED, relationTagChanged);
419               rel.addEventListener(Connection.RELATION_MEMBER_ADDED, entityRelationMemberChanged);
420               rel.addEventListener(Connection.RELATION_MEMBER_REMOVED, entityRelationMemberChanged);
421               listeningToRelations.push(rel);
422           }
423           relationsGrid.dataProvider = relations;
424           relationsGrid.addEventListener(DataGridEvent.ITEM_EDIT_END, relationRoleChanged, false, -100);
425       }
426       
427       private function relationRoleChanged(event:DataGridEvent):void {
428                 if (event.dataField != 'role') { return; }      // shouldn't really happen
429
430                 var relations:Array=event.currentTarget.dataProvider.toArray();
431                 var props:Object=relations[event.rowIndex];
432
433                 var relation:Relation=props['relation'];
434                 var index:uint=props['index'];
435                 var newRole:String=event.itemRenderer.data['role'];
436
437                 relation.setMember(index, new RelationMember(selectedEntity,newRole));
438       }
439
440       private function relationTagChanged(event:TagEvent):void {
441           resetRelationsGrid(selectedEntity);
442       }
443
444       private function entityRelationMemberChanged(event:RelationMemberEvent):void {
445           resetRelationsGrid(selectedEntity);
446       }
447       
448       private function checkMembers():void {
449           if (selectedEntity is Relation) {
450             setupMembers(selectedEntity as Relation);
451           }
452       }
453       
454       private function setupMembers(rel:Relation):void {
455           var members:Array = [];
456           for (var i:int=0 ; i<rel.length; i++) {
457             var props:Object = {};
458             var member:RelationMember = rel.getMember(i);
459             props["id"] = member.entity.id;
460             props["type"] = member.entity.getType();
461             props["role"] = member.role;
462             
463             members.push(props);
464           }
465           membersGrid.dataProvider = members;
466           membersGrid.dataProvider.addEventListener('collectionChange', membersChange); 
467       }
468       
469       private function membersChange(event:Event):void {
470           // Dropping all the members and re-adding them isn't exactly optimal
471           // but is at least robust for any kind of change.
472           // Figuring out a better way is someone else's FIXME
473           
474           var conn:Connection = Connection.getConnectionInstance();
475           var rel:Relation = selectedEntity as Relation
476           
477           // drop members
478           trace("Dropping "+rel.length+" members");
479           for (var i:int=rel.length-1 ; i>=0; i--) {
480             rel.removeMemberByIndex(i);
481           }
482           
483           // add members in new order
484           for each(var memberObject:Object in membersGrid.dataProvider) {
485             var e:Entity;
486             var id:Number = memberObject.id;
487             if(memberObject.type == 'node') {
488               e = conn.getNode(id);
489             } else if (memberObject.type == 'way') {
490               e = conn.getWay(id);
491             } else if (memberObject.type == 'relation') {
492               e = conn.getRelation(id);
493             }
494             rel.appendMember(new RelationMember(e, memberObject.role));
495             trace("added member "+memberObject.type+" "+id+" in role "+memberObject.role);
496           }
497           trace("complete: relation "+rel.id+" now has "+rel.length+" members");
498       }
499       
500       private function editRelation(id:Number):void {
501           var panel:RelationEditorPanel = RelationEditorPanel(
502               PopUpManager.createPopUp(Application(Application.application), RelationEditorPanel, true));
503           panel.setRelation(Connection.getConnectionInstance().getRelation(id));
504           PopUpManager.centerPopUp(panel);
505       }
506       
507       private function tagChanged(event:TagEvent):void {
508           refreshFeatureIcon();
509           
510           if ( tagDataProvider != null ) {
511               // check to see if the key is already in our list
512               var exists:Boolean = false;
513               var tag:Tag = null;
514               var i:uint;
515               for ( i = 0; i < tagDataProvider.length && !exists; i++ ) {
516                   tag = Tag(tagDataProvider.getItemAt(i));
517                   exists = tag.key == event.key;
518               }
519               if ( !exists ) {
520                   tag = new Tag(selectedEntity, event.key, event.newValue);
521                   tagDataProvider.addItem(tag);
522                   tagDataProvider.refresh();
523               } else {
524                   if ( event.newValue == null ) {
525                       tagDataProvider.removeItemAt(i-1);
526                       tagDataProvider.refresh();
527                   } else {
528                       tagDataProvider.itemUpdated(tag, "value");
529                   }
530               }
531           }
532       }
533
534       public function loadFeatures():void {
535           mapFeatures = MapFeatures.getInstance();
536           stack.removeChild(membersVBox); // remove by default, will be added if relation
537       }
538
539       public function openDescription():void {
540           trace("open description here");
541           if ( feature != null && feature.hasHelpURL() )
542               navigateToURL(new URLRequest(feature.helpURL), "potlatch_help");
543       }
544
545       public function addNewTag():void {
546           var newKey:String = "(new tag)";
547           var newTag:Tag = new Tag(selectedEntity, newKey, "(new value)");
548           tagDataProvider.addItem(newTag);
549           advancedTagGrid.editedItemPosition = {rowIndex: tagDataProvider.getItemIndex(newTag), columnIndex: 0};
550       }
551
552       public function removeTag():void {
553           var k:String = advancedTagGrid.selectedItem.key;
554           selectedEntity.setTag(k, null, MainUndoStack.getGlobalStack().addAction);
555       }
556       
557       public function addToRelation():void {
558           new RelationSelectPanel().init(selectedEntity,new Object());
559       }
560       
561       public function removeFromRelation(id:Number, index:int):void {
562           Connection.getConnectionInstance().getRelation(id).removeMemberByIndex(index);
563       }
564       
565       public function initFeatureBox():void {
566           tw = new CategorySelector();
567           tw.addEventListener("selectedType", changeFeatureType);
568           popupChange.popUp = tw;
569       }
570       
571       public function changeFeatureType(event:Event):void {
572           if ( selectedEntity == null )
573               return;
574
575           UIComponent.suspendBackgroundProcessing();
576           var newFeature:Feature = tw.selectedType;
577           var undoStack:Function = MainUndoStack.getGlobalStack().addAction;
578           var action:CompositeUndoableAction = new CompositeUndoableAction(
579                   "Set "+selectedEntity.getType()+" "+selectedEntity.id+" to "+newFeature.name);
580                   selectedEntity.suspend();
581
582           // remove tags from the current feature
583           if ( feature != null ) {
584               for each( var oldtag:Object in feature.tags ) {
585                   selectedEntity.setTag(oldtag["k"], null, action.push);
586               }
587           }
588           
589           // set tags for new feature
590           if ( newFeature != null ) {
591               for each( var newtag:Object in newFeature.tags ) {
592                   selectedEntity.setTag(newtag["k"], newtag["v"], action.push);
593               }
594           }
595           
596                   selectedEntity.resume();
597           undoStack(action);
598           popupChange.close();
599           initialiseEditors();
600           UIComponent.resumeBackgroundProcessing();
601       }
602       
603       private function dragPOI(event:MouseEvent, tags:Array):void {
604           // Get the drag initiator component from the event object.
605           var dragInitiator:Image = event.currentTarget as Image;
606           var dragSource:DragSource = new DragSource();
607           dragSource.addData(tags, 'tags');
608           
609           var dragProxy:Image = new Image();
610           dragProxy.source = event.currentTarget.source;
611           
612           DragManager.doDrag(dragInitiator, dragSource, event, dragProxy);
613       }
614   ]]></mx:Script>
615 </mx:VBox>
616