Module: nagvis
Branch: master
Commit: 56c4144170f466f93a89e02398bbb3c1c33a082e
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=56c4144170f466f93a89e02398bbb3c1c33a082e

Author: Roman Kyrylych <[email protected]>
Date:   Tue Aug 18 18:22:12 2009 +0300

gmap: Handle link removal and remove the corresponding line immediately

Signed-off-by: Roman Kyrylych <[email protected]>

---

 uifx/src/modules/gmap/mate/LinksEM.mxml            |    2 +-
 .../modules/gmap/view/controls/GMapLinksControl.as |   31 +++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/uifx/src/modules/gmap/mate/LinksEM.mxml 
b/uifx/src/modules/gmap/mate/LinksEM.mxml
index 0f2410d..c788ba8 100644
--- a/uifx/src/modules/gmap/mate/LinksEM.mxml
+++ b/uifx/src/modules/gmap/mate/LinksEM.mxml
@@ -64,7 +64,7 @@
        <EventHandlers type="{LinkEvent.DELETE}">
                <RemoteObjectInvoker instance="{LinksService}" method="remove" 
arguments="{[event.link.id1, event.link.id2]}">
                        <resultHandlers>
-                               <MethodInvoker generator="{LinksData}" 
method="removeItemById" arguments="{resultObject}"/>
+                               <MethodInvoker generator="{LinksData}" 
method="removeItemByIds" arguments="{[event.link.id1, event.link.id2]}"/>
                        </resultHandlers>
                </RemoteObjectInvoker>
        </EventHandlers>
diff --git a/uifx/src/modules/gmap/view/controls/GMapLinksControl.as 
b/uifx/src/modules/gmap/view/controls/GMapLinksControl.as
index 8a0eaff..7b85e2f 100644
--- a/uifx/src/modules/gmap/view/controls/GMapLinksControl.as
+++ b/uifx/src/modules/gmap/view/controls/GMapLinksControl.as
@@ -31,6 +31,7 @@ package modules.gmap.view.controls
 
        import mx.core.UIComponent;
        import mx.events.CollectionEvent;
+       import mx.events.CollectionEventKind;
 
        public class GMapLinksControl extends UIComponent
        {
@@ -81,7 +82,35 @@ package modules.gmap.view.controls
 
                protected function onDataProviderChanged(event : 
CollectionEvent) : void
                {
-                       //TODO: do something
+                       if (event.kind == CollectionEventKind.RESET)
+                               reinitLines();
+
+                       if (event.kind == CollectionEventKind.ADD)
+                       {
+                               for each (var added : Link in event.items)
+                                       createLine(added);
+                       }
+
+                       if (event.kind == CollectionEventKind.REMOVE)
+                       {
+                               for each (var removed : Link in event.items)
+                               {
+                                       var marked : LinkLine;
+                                       for (var i : int = _lines.length - 1; i 
>= 0; i--)
+                                       {
+                                               marked = _lines.shift();
+
+                                               if (marked.link.id1 === 
removed.id1 && marked.link.id2 === removed.id2)
+                                               {
+                                                       if (visible && _map)
+                                                               
_map.removeOverlay(marked);
+                                                       break;
+                                               }
+
+                                               _lines.push(marked);
+                                       }
+                               }
+                       }
                }
 
                public override function set visible(value : Boolean) : void


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to