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

Author: Andriy Skuratov <[email protected]>
Date:   Thu Aug 20 14:46:07 2009 +0300

gmap:Handle the case when link connects to non-existing locations.

---

 uifx/src/modules/gmap/data/LinksData.as   |   22 ++++++++++++++++------
 uifx/src/modules/gmap/mate/GeneralEM.mxml |    2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/uifx/src/modules/gmap/data/LinksData.as 
b/uifx/src/modules/gmap/data/LinksData.as
index 5facae6..bd01cf3 100644
--- a/uifx/src/modules/gmap/data/LinksData.as
+++ b/uifx/src/modules/gmap/data/LinksData.as
@@ -24,6 +24,8 @@ package modules.gmap.data
        import modules.gmap.domain.Link;
        
        import mx.collections.ArrayCollection;
+       import mx.logging.LogEvent;
+       import mx.logging.LogEventLevel;
 
        public class LinksData extends ArrayCollection
        {
@@ -43,14 +45,23 @@ package modules.gmap.data
                {
                        this.source = data;
 
-                       for each(var link : Link in this)
-                               resolveLink(link);
+                       for (var i:int = length - 1; i >= 0; i--)
+                       {
+                               var link:Link = getItemAt(i) as Link;
+                               if (!resolveLink(link))
+                                       removeItemAt(i);
+                       }
                }
                
-               protected function resolveLink(link:Link):void
+               protected function resolveLink(link:Link):Boolean
                {
                        link.location1 = _locations.getItemById(link.id1);
                        link.location2 = _locations.getItemById(link.id2);
+                               
+                       if(!link.location1 || !link.location2)
+                               return false;
+                       
+                       return true
                }
 
                public function getItemByIds(id1 : String, id2 : String) : Link
@@ -64,13 +75,12 @@ package modules.gmap.data
 
                public function addUpdateItem(item : Link) : void
                {
-                       trace(item.id1);
                        var link : Link = this.getItemByIds(item.id1, item.id2);
 
                        if (link == null)
                        {
-                               resolveLink(item);
-                               this.addItem(item);
+                               if(resolveLink(item))
+                                       addItem(item);
                        }
                        else
                                link.update(item);
diff --git a/uifx/src/modules/gmap/mate/GeneralEM.mxml 
b/uifx/src/modules/gmap/mate/GeneralEM.mxml
index 890c9f9..15a6ddb 100644
--- a/uifx/src/modules/gmap/mate/GeneralEM.mxml
+++ b/uifx/src/modules/gmap/mate/GeneralEM.mxml
@@ -39,7 +39,7 @@
        <EventHandlers type="{UnhandledFaultEvent.FAULT}">
                <InlineInvoker method="Alert.show" 
arguments="{[event.fault.faultString, 'Error']}"/>
        </EventHandlers>
-
+       
        <EventHandlers type="resized">
                <MethodInvoker generator="{MainMD}" method="reconsiderMode"/>
        </EventHandlers>


------------------------------------------------------------------------------
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