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

Author: Andriy Skuratov <[email protected]>
Date:   Tue Aug 25 18:46:05 2009 +0300

gmap:After location is removed also remove related links.

---

 uifx/src/modules/gmap/mate/LocationsEM.mxml |    6 +++++-
 uifx/src/modules/gmap/mediator/MainMD.as    |   16 +++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/uifx/src/modules/gmap/mate/LocationsEM.mxml 
b/uifx/src/modules/gmap/mate/LocationsEM.mxml
index 9353fe1..c9a2550 100644
--- a/uifx/src/modules/gmap/mate/LocationsEM.mxml
+++ b/uifx/src/modules/gmap/mate/LocationsEM.mxml
@@ -23,12 +23,13 @@
 >
        <mx:Script>
                <![CDATA[
-                       import modules.gmap.data.SettingsData;
                        import mx.controls.Alert;
 
                        import modules.gmap.data.CurrentLocation;
                        import modules.gmap.data.LocationsData;
                        import modules.gmap.data.LocationsExtData;
+                       import modules.gmap.data.LinksData;
+                       import modules.gmap.data.SettingsData;
 
                        import modules.gmap.events.AddressEvent;
                        import modules.gmap.events.LocationEvent;
@@ -80,6 +81,9 @@
                        <resultHandlers>
                                <MethodInvoker generator="{LocationsData}" 
method="removeItemById" arguments="{resultObject}"/>
                                <EventAnnouncer generator="{LocationEvent}" 
constructorArguments="{LocationEvent.SELECTED}" />
+                               
+                               <DataCopier destination="data" 
destinationKey="links" source="{LinksData}"/>
+                               <MethodInvoker generator="{MainMD}" 
method="removeRelatedLinks" arguments="{[resultObject, data.links]}"/>
                        </resultHandlers>
                </RemoteObjectInvoker>
        </EventHandlers>
diff --git a/uifx/src/modules/gmap/mediator/MainMD.as 
b/uifx/src/modules/gmap/mediator/MainMD.as
index eadb668..f32e791 100644
--- a/uifx/src/modules/gmap/mediator/MainMD.as
+++ b/uifx/src/modules/gmap/mediator/MainMD.as
@@ -24,7 +24,8 @@ package modules.gmap.mediator
        import flash.events.IEventDispatcher;
        import flash.external.ExternalInterface;
        import flash.system.Security;
-
+       
+       import modules.gmap.data.LinksData;
        import modules.gmap.domain.Link;
        import modules.gmap.domain.Location;
        import modules.gmap.domain.Settings;
@@ -32,6 +33,7 @@ package modules.gmap.mediator
        import modules.gmap.domain.nagios.HostGroup;
        import modules.gmap.domain.nagios.Service;
        import modules.gmap.domain.nagios.ServiceGroup;
+       import modules.gmap.events.LinkEvent;
        import modules.gmap.events.ModeEvent;
        import modules.gmap.view.MainView;
 
@@ -128,6 +130,18 @@ package modules.gmap.mediator
                        else
                                
ExternalInterface.call('window.location.assign("' + url + '")');
                }
+               
+               public function removeRelatedLinks(locationID:String, 
links:LinksData):void
+               {
+                       for(var i:int = links.length - 1; i >=0; --i)
+                       {
+                               var link:Link = links.getItemAt(i) as Link;
+                               if(link.id1 == locationID || link.id2 == 
locationID)
+                                       _dispatcher.dispatchEvent(
+                                               new LinkEvent(LinkEvent.DELETE, 
link)
+                                       );
+                       }
+               }
 
                public function activate(element : Object, settings : Settings) 
: 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