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

Author: Andriy Skuratov <[email protected]>
Date:   Thu Aug 13 15:30:36 2009 +0300

Prepared to save/load location action.

---

 uifx/src/modules/gmap/domain/Location.as       |   15 ++++++
 uifx/src/modules/gmap/view/DialogLocation.mxml |   56 ++++++++++++++++++++++--
 2 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/uifx/src/modules/gmap/domain/Location.as 
b/uifx/src/modules/gmap/domain/Location.as
index 8edbccf..7e2eb19 100644
--- a/uifx/src/modules/gmap/domain/Location.as
+++ b/uifx/src/modules/gmap/domain/Location.as
@@ -40,6 +40,7 @@ package modules.gmap.domain
                private var _description : String;
                private var _object : Object;
                private var _state : Number;
+               private var _action : String;
 
                public function get id() : String
                {
@@ -138,6 +139,20 @@ package modules.gmap.domain
                                dispatchEvent(new LocationEvent('change', 
this));
                        }
                }
+               
+               public function get action():String
+               {
+                       return _action;
+               }
+               
+               public function set action(value:String):void
+               {
+                       if(_action !== value)
+                       {
+                               _action = value;
+                               dispatchEvent(new LocationEvent('change', 
this));       
+                       }
+               }
 
                public function update(value : Location) : void
                {
diff --git a/uifx/src/modules/gmap/view/DialogLocation.mxml 
b/uifx/src/modules/gmap/view/DialogLocation.mxml
index 5bc90d3..9d2167c 100644
--- a/uifx/src/modules/gmap/view/DialogLocation.mxml
+++ b/uifx/src/modules/gmap/view/DialogLocation.mxml
@@ -111,6 +111,34 @@
                                                        
locNObjectType.selectedIndex = 0;
                                                        onObjectTypeChange();
                                                }
+                                               
+                                               if(location.action && 
location.action.length > 0)
+                                               {
+                                                       var slices:Array = 
location.action.split(':', 2);
+                                                       switch(slices[0])
+                                                       {
+                                                               case 'nagios':
+                                                                       
locAction.selectedIndex = 1;
+                                                                       break;
+                                                               case 'nagvis':
+                                                                       
locAction.selectedIndex = 2;
+                                                                       
locActionMaps.text = slices[1];
+                                                                       break;
+                                                               case 'http':
+                                                               case 'https':
+                                                                       
locAction.selectedIndex = 3;
+                                                                       
locActionURL.text = location.action;
+                                                                       break;
+                                                               default:
+                                                                       
locAction.selectedIndex = 0;
+                                                       }
+                                                       onActionChanges();
+                                               }
+                                               else
+                                               {
+                                                       locAction.selectedIndex 
= 0;
+                                                       onActionChanges();      
                                                
+                                               }
                                        }
                                        else
                                        {
@@ -121,6 +149,8 @@
                                                locDescription.text = "";
                                                locNObjectType.selectedIndex = 
0;
                                                onObjectTypeChange();
+                                               locAction.selectedIndex = 0;
+                                               onActionChanges();
                                        }
                                }
                        }
@@ -136,6 +166,21 @@
                                ul.description = locDescription.text;
                                ul.object = locNObject.selectedItem;
                                
+                               switch(locAction.selectedIndex)
+                               {
+                                       case 1:
+                                               ul.action = 'nagios:';
+                                               break;
+                                       case 2:
+                                               ul.action = 'nagvis:' + 
locActionMaps.text;
+                                               break;
+                                       case 3:
+                                               ul.action = locActionURL.text;
+                                               break;
+                                       default:
+                                               ul.action = null;
+                               }
+                               
                                return ul;                              
                        }
 
@@ -235,15 +280,18 @@
                        {                       
                                switch(locAction.selectedIndex)
                                {
-                                       case 3:
+                                       case 2:
+                                               locAction.setStyle('top', 30);
                                                locActionMaps.visible = true; 
                                                locActionURL.visible = false;
                                                break;
-                                       case 4:
+                                       case 3:
+                                               locAction.setStyle('top', 30);
                                                locActionMaps.visible = false; 
                                                locActionURL.visible = true;
                                                break;
                                        default:
+                                               locAction.setStyle('top', 50);
                                                locActionMaps.visible = 
locActionURL.visible = false;
                                }
                        }               
@@ -384,10 +432,10 @@
                        <mx:Canvas label="Actions" width="100%" height="100%" 
horizontalScrollPolicy="off">
                                <mx:Canvas left="5" right="0" top="10" 
bottom="0" borderStyle="solid" cornerRadius="4" borderColor="#000000">
                                        <mx:ComboBox id="locAction" 
change="onActionChanges()"
-                                               left="5" right="5" top="30"
+                                               left="5" right="5" top="50"
                                        >
                                                <mx:ArrayCollection>
-                                                       <mx:String>do 
nothing</mx:String>
+                                                       <mx:String>default 
action</mx:String>
                                                        <mx:String>open Nagios 
details page</mx:String>
                                                        <mx:String>open NagVis 
map</mx:String>
                                                        <mx:String>go to 
URL</mx:String>


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