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

Author: Roman Kyrylych <[email protected]>
Date:   Wed Aug 12 16:42:02 2009 +0300

gmap: Made location states visible immediately after load

Signed-off-by: Roman Kyrylych <[email protected]>

---

 .../modules/gmap/view/controls/LocationMarker.as   |   57 ++++++++++----------
 1 files changed, 28 insertions(+), 29 deletions(-)

diff --git a/uifx/src/modules/gmap/view/controls/LocationMarker.as 
b/uifx/src/modules/gmap/view/controls/LocationMarker.as
index e3643c8..a0085c3 100644
--- a/uifx/src/modules/gmap/view/controls/LocationMarker.as
+++ b/uifx/src/modules/gmap/view/controls/LocationMarker.as
@@ -5,25 +5,27 @@ package modules.gmap.view.controls
        import com.google.maps.overlays.Marker;

        import com.google.maps.overlays.MarkerOptions;

        

+       import flash.display.DisplayObject;

+       

        import modules.gmap.domain.Location;

        import modules.gmap.events.LocationEvent;

 

        public class LocationMarker extends Marker

        {

                [Embed(source="modules/gmap/img/std_small_ok.png")]

-               protected var okIcon : Class;

+               protected static var okIcon : Class;

                

                [Embed(source="modules/gmap/img/std_small_warning.png")]

-               protected var warningIcon : Class;

+               protected static var warningIcon : Class;

                

                [Embed(source="modules/gmap/img/std_small_error.png")]

-               protected var errorIcon : Class;

+               protected static var errorIcon : Class;

                

                [Embed(source="modules/gmap/img/std_small_critical.png")]

-               protected var criticalIcon : Class;

+               protected static var criticalIcon : Class;

                

                [Embed(source="modules/gmap/img/std_small_unknown.png")]

-               protected var unknownIcon : Class;                              

+               protected static var unknownIcon : Class;                       
        

                                

                private var _location : Location;

                

@@ -36,7 +38,7 @@ package modules.gmap.view.controls
                        if(location.id && location.id.length > 0)

                        {

                                options = new MarkerOptions();

-                               options.icon = new okIcon();

+                               options.icon = chooseIcon(location.state);

                                options.iconAlignment = 
MarkerOptions.ALIGN_HORIZONTAL_CENTER | MarkerOptions.ALIGN_VERTICAL_CENTER;

                                options.hasShadow = false;

                        }

@@ -55,36 +57,33 @@ package modules.gmap.view.controls
                                new LocationEvent(LocationEvent.SELECTED, 
_location, true)

                        );

                }

-               

-               protected function onChange(event : *):void

+

+               private static function chooseIcon(state : Number) : 
DisplayObject

                {

-                       if(location.id && location.id.length > 0)

+                       switch (state)

                        {

-                               var options : MarkerOptions = this.getOptions();

-                               

-                               switch (_location.state)

-                               {

-                                       case Location.STATE_OK:

-                                               options.icon = new okIcon();

-                                               break;

+                               case Location.STATE_OK:

+                                       return new okIcon();

 

-                                       case Location.STATE_WARNING:

-                                               options.icon = new 
warningIcon();

-                                               break;

+                               case Location.STATE_WARNING:

+                                       return new warningIcon();

 

-                                       case Location.STATE_ERROR:

-                                               options.icon = new errorIcon();

-                                               break;

+                               case Location.STATE_ERROR:

+                                       return new errorIcon();

 

-                                       case Location.STATE_UNKNOWN:

-                                       default:

-                                               options.icon = new 
unknownIcon();

-                               }

-                               

-                               this.setOptions(options);

+                               case Location.STATE_UNKNOWN:

+                               default:

+                                       return new unknownIcon();

                        }

                }

-

+               

+               protected function onChange(event : *):void

+               {

+                       var options : MarkerOptions = this.getOptions();

+                       options.icon = chooseIcon(_location.state);

+                       this.setOptions(options);

+               }

+               

                public function get location():Location

                {

                        return _location;



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