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

Author: Andriy Skuratov <[email protected]>
Date:   Wed Aug 19 14:49:09 2009 +0300

gmap: Now user can select links' edge point by clicking locations on the map.

---

 uifx/src/modules/gmap/mediator/MainMD.as   |   36 ++++++++++++++++-----------
 uifx/src/modules/gmap/view/DialogLink.mxml |    6 ++++
 2 files changed, 27 insertions(+), 15 deletions(-)

diff --git a/uifx/src/modules/gmap/mediator/MainMD.as 
b/uifx/src/modules/gmap/mediator/MainMD.as
index 887df5f..230f4de 100644
--- a/uifx/src/modules/gmap/mediator/MainMD.as
+++ b/uifx/src/modules/gmap/mediator/MainMD.as
@@ -40,6 +40,7 @@ package modules.gmap.mediator
                public static const MODE_DEFAULT : int = 0;
                public static const MODE_LOCATION_EDIT : int = 1;
                public static const MODE_LOCATION_SEARCH : int = 2;
+               public static const MODE_LINK_EDIT : int = 3;
 
                private var _mode:int = 0;
 
@@ -84,6 +85,9 @@ package modules.gmap.mediator
                                case _view.searchBox:
                                        mode = MODE_LOCATION_SEARCH;
                                        break;
+                               case _view.linksBox:
+                                       mode = MODE_LINK_EDIT;
+                                       break;
                                default:
                                        mode = MODE_DEFAULT;
                        }
@@ -91,27 +95,29 @@ package modules.gmap.mediator
 
                public function selectLocation(location : Location) : void
                {
-                       switch (_mode)
+                       if (_mode == MODE_LOCATION_SEARCH)
                        {
-                               case MODE_DEFAULT:
-                                       //Alert.show(location.label);
-                                       break;
-                               case MODE_LOCATION_EDIT:
-                                       //_view.locationBox.update(location);
-                                       break;
-                               case MODE_LOCATION_SEARCH:
-                                       if (location.id && location.id.length > 
0)
-                                               break;
-                                       //_view.locationBox.update(location);
-                                       
_view.locationBox.setCurrentState('right-expanded');
-                                       break;
+                               //no location selected - do nothing
+                               if (!location) 
+                                       return;
+                               
+                               //selected existing location - do nothing
+                               if (location.id && location.id.length > 0)
+                                       return;
+                                       
+                               //selected the new location - open location 
dialog to add it
+                               
_view.locationBox.setCurrentState('right-expanded');
+                               return;
+                       }
+                       
+                       if (_mode == MODE_LINK_EDIT)
+                       {
+                               _view.linksBox.pushLocation(location);
                        }
                }
 
                public function selectLink(link : Link) : void
                {
-                       if (link)
-                               
_view.linksBox.setCurrentState('right-expanded');
                }
 
                public function gotoURL(url : String, newWindow : Boolean) : 
void
diff --git a/uifx/src/modules/gmap/view/DialogLink.mxml 
b/uifx/src/modules/gmap/view/DialogLink.mxml
index 75fc09c..29de6d0 100644
--- a/uifx/src/modules/gmap/view/DialogLink.mxml
+++ b/uifx/src/modules/gmap/view/DialogLink.mxml
@@ -184,6 +184,12 @@
                                return ul;
                        }
 
+                       public function pushLocation(location:Location):void
+                       {
+                               lnkLocation1.selectedItem = 
lnkLocation2.selectedItem;
+                               lnkLocation2.selectedItem = location;
+                       }
+
                        private function onAddClicked() : void
                        {
                                dispatchEvent(new LinkEvent(LinkEvent.ADD, 
getUpdatedLink()));


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