Module: nagvis
Branch: master
Commit: 6a8e6bb2ced8d2b5f5f57852c5eee3cc87c9063d
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=6a8e6bb2ced8d2b5f5f57852c5eee3cc87c9063d

Author: Andriy Skuratov <[email protected]>
Date:   Tue Mar 16 16:29:38 2010 +0200

Support for initial setup via flashvars. Select host on map.

---

 uifx/src/modules/gmap/events/SetupEvent.as |   39 ++++++++++++++++++++++++++++
 uifx/src/modules/gmap/mate/StartupEM.mxml  |   15 ++++++++++-
 uifx/src/modules/gmap/mediator/MainMD.as   |   16 +++++++++++
 3 files changed, 69 insertions(+), 1 deletions(-)

diff --git a/uifx/src/modules/gmap/events/SetupEvent.as 
b/uifx/src/modules/gmap/events/SetupEvent.as
new file mode 100644
index 0000000..6081b12
--- /dev/null
+++ b/uifx/src/modules/gmap/events/SetupEvent.as
@@ -0,0 +1,39 @@
+/*****************************************************************************

+ *

+ * Copyright (C) 2009 NagVis Project

+ *

+ * License:

+ *

+ * This program is free software; you can redistribute it and/or modify

+ * it under the terms of the GNU General Public License version 2 as

+ * published by the Free Software Foundation.

+ *

+ * This program is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU General Public License for more details.

+ *

+ * You should have received a copy of the GNU General Public License

+ * along with this program; if not, write to the Free Software

+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

+ *

+ *****************************************************************************/

+

+package modules.gmap.events

+{

+       import flash.events.Event;

+

+       public class SetupEvent extends Event

+       {

+               public static const MARK_HOST : String = "MarkHost";

+               

+               public var value : String;

+               

+               public function SetupEvent(type:String, value:String, 
bubbles:Boolean=true, cancelable:Boolean=false)

+               {

+                       super(type, bubbles, cancelable);

+                       this.value = value; 

+               }

+               

+       }

+}
\ No newline at end of file
diff --git a/uifx/src/modules/gmap/mate/StartupEM.mxml 
b/uifx/src/modules/gmap/mate/StartupEM.mxml
index 3b83de5..462134d 100644
--- a/uifx/src/modules/gmap/mate/StartupEM.mxml
+++ b/uifx/src/modules/gmap/mate/StartupEM.mxml
@@ -23,7 +23,6 @@
 >
        <mx:Script>
                <![CDATA[
-                       import modules.gmap.data.NagVisMapsData;
                        import mx.controls.Alert;
 
                        import modules.gmap.view.controls.GMapControl;
@@ -32,10 +31,14 @@
                        import modules.gmap.mediator.MapMD;
                        import modules.gmap.mediator.Poller;
 
+                       import modules.gmap.data.NagVisMapsData;
                        import modules.gmap.data.ViewpointsData;
                        import modules.gmap.data.LocationsData;
                        import modules.gmap.data.LinksData;
                        import modules.gmap.data.SettingsData;
+
+                       import modules.gmap.events.SetupEvent;
+                       import modules.gmap.events.LocationEvent;
                ]]>
        </mx:Script>
 
@@ -88,6 +91,16 @@
 
        <EventHandlers type="{GMapControl.MAP_READY}" debug="true">
                <MethodInvoker generator="{MapMD}" method="initMap"/>
+               <MethodInvoker generator="{MainMD}" method="doSetup"/>
+       </EventHandlers>
+
+       <EventHandlers type="{SetupEvent.MARK_HOST}" debug="true">
+               <RemoteObjectInvoker destination="zend" 
source="LocationService" method="findByHostName" arguments="{event.value}">
+                       <resultHandlers>
+                               <MethodInvoker generator="{LocationsData}" 
method="getItemById" arguments="{resultObject.id}"/>
+                               <EventAnnouncer generator="{LocationEvent}" 
constructorArguments="{[LocationEvent.SELECTED, lastReturn]}"/>
+                       </resultHandlers>
+               </RemoteObjectInvoker>
        </EventHandlers>
 
 </EventMap>
diff --git a/uifx/src/modules/gmap/mediator/MainMD.as 
b/uifx/src/modules/gmap/mediator/MainMD.as
index d95fb4e..ab751c1 100644
--- a/uifx/src/modules/gmap/mediator/MainMD.as
+++ b/uifx/src/modules/gmap/mediator/MainMD.as
@@ -26,6 +26,7 @@ package modules.gmap.mediator
        import flash.system.Security;
        
        import modules.gmap.data.LinksData;
+       import modules.gmap.data.LocationsData;
        import modules.gmap.domain.Link;
        import modules.gmap.domain.Location;
        import modules.gmap.domain.Settings;
@@ -35,8 +36,11 @@ package modules.gmap.mediator
        import modules.gmap.domain.nagios.ServiceGroup;
        import modules.gmap.events.LinkEvent;
        import modules.gmap.events.ModeEvent;
+       import modules.gmap.events.SetupEvent;
        import modules.gmap.view.MainView;
 
+       import mx.core.Application;
+
        public class MainMD
        {
                public static const MODE_DEFAULT : int = 0;
@@ -205,5 +209,17 @@ package modules.gmap.mediator
                                        return;
                        }
                }
+
+               public function doSetup():void
+               {
+                       for(var option:String in 
Application.application.parameters)
+                       {
+                               var value:String = 
Application.application.parameters[option];
+
+                               _dispatcher.dispatchEvent(
+                                       new SetupEvent(option, value)
+                               );
+                       }
+               }
        }
 }


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to