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

Author: Andriy Skuratov <[email protected]>
Date:   Wed Aug 26 17:30:56 2009 +0300

gmap:Restrict the empty and dublicate names for viewpoints.

---

 uifx/src/modules/gmap/view/DialogViewpoint.mxml |   28 ++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/uifx/src/modules/gmap/view/DialogViewpoint.mxml 
b/uifx/src/modules/gmap/view/DialogViewpoint.mxml
index 9b52d0f..a633899 100644
--- a/uifx/src/modules/gmap/view/DialogViewpoint.mxml
+++ b/uifx/src/modules/gmap/view/DialogViewpoint.mxml
@@ -30,6 +30,7 @@
     </mx:Metadata>
     <mx:Script>
        <![CDATA[
+               import mx.controls.Alert;
                import modules.gmap.domain.Viewpoint;
                import modules.gmap.events.ViewpointEvent;
                import modules.gmap.data.ViewpointsData;
@@ -41,10 +42,35 @@
                        dispatchEvent(new 
ViewpointEvent(ViewpointEvent.SELECTED, list.selectedItem as Viewpoint));
                }
 
+                       private function trim(str:String):String
+                       {
+                           for(var j:int = str.length-1; str.charCodeAt(j) < 
33; j--);
+                           if(j < 0) return '';
+                           for(var i:int = 0; str.charCodeAt(i) < 33; i++);
+                           return str.substring(i, j+1);
+                       }
+
                public function onSaveButtonClick() : void
                {
+                       var name:String = trim(preName.text);
+                       
+                       if(name.length == 0)
+                       {
+                               Alert.show('Please, select a name for a View 
Point', 'Error');
+                               return; 
+                       }
+                       
+                               for each(var v:Viewpoint in dataProvider)
+                               {
+                                       if(v.label == name)
+                                       {
+                                               Alert.show('View Point named ' 
+ name + ' already exists.', 'Error');
+                                               return;
+                                       }
+                               }
+                                       
                        var vp : Viewpoint = new Viewpoint;
-                       vp.label = preName.text;
+                       vp.label = name;
 
                        dispatchEvent(new ViewpointEvent(ViewpointEvent.CREATE, 
vp));
                }


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