Changeset 3120


Ignore:
Timestamp:
07/08/13 14:27:42 (12 years ago)
Author:
olhsha
Message:

Bug 322 (visible in Opera and 50% f times in Chrome) seems to be fixed by: splitting up BrowserService?.ITEM_LOADED event into ComponentListService?.COMPONENTS_LOADED and ProfilesListService?.PROFILES_LOADED, and running load infor page only AFTER BOTH these events have dispatched.

Location:
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml

    r2985 r3120  
    1717                        import clarin.cmdi.componentregistry.common.components.BrowseContextMenu;
    1818                        import clarin.cmdi.componentregistry.common.components.RegistryViewStack;
    19                         import clarin.cmdi.componentregistry.services.BrowserService;
    2019                        import clarin.cmdi.componentregistry.services.ComponentInfoService;
    2120                        import clarin.cmdi.componentregistry.services.ComponentListService;
     
    2524                        import clarin.cmdi.componentregistry.services.ProfileListService;
    2625                       
     26                        //debug
     27                        import clarin.cmdi.componentregistry.common.Profile;
     28                       
    2729                        public static const START_ITEM_LOADED:String = "startItemLoaded";
    2830                       
     
    9193                                startupItemId = Config.instance.startupItem;
    9294                                startupPanel = Config.instance.browserPanel;
    93                                 if (startupItemId) { //only load this once on startup
    94                                         componentsSrv.addEventListener(BrowserService.ITEMS_LOADED, componentsLoaded);
    95                                         profilesSrv.addEventListener(BrowserService.ITEMS_LOADED, profilesLoaded);
    96                                 }
    97                                
    98                                 refresh();
     95                                if (startupItemId) { //only load this once on startup                                   
     96                                        profilesSrv.addEventListener(ProfileListService.PROFILES_LOADED, profilesLoaded);
     97                                        componentsSrv.addEventListener(ComponentListService.COMPONENTS_LOADED, componentsLoaded);                                       
     98                                        profilesSrv.load();
     99                                }
     100                                else{
     101                                        refresh();
     102                                }
    99103                        }
    100104                       
    101105                        public function refresh():void {
    102106                                componentsSrv.load();
    103                                 profilesSrv.load();
    104                                
     107                                profilesSrv.load();                             
    105108                                selectedComponentSrv = new ComponentInfoService();
    106109                                selectedProfileSrv = new ProfileInfoService();
    107110                        }
    108111                       
    109                         private function profilesLoaded(event:Event):void {
     112                       
     113                       
     114                        private function profilesLoaded(event:Event):void {                             
     115                                profilesSrv.removeEventListener(ProfileListService.PROFILES_LOADED, profilesLoaded);
     116                                componentsSrv.load();   
     117                        }
     118                       
     119                        private function componentsLoaded(event:Event):void {                                   
     120                                componentsSrv.removeEventListener(ComponentListService.COMPONENTS_LOADED, componentsLoaded);
     121                               
    110122                                var item:ItemDescription = ProfileListService.findDescription(startupItemId);
    111                                 loadStartupItem(item);
    112                                 profileInfoPage.infoPanel.setPanel(Config.instance.browserPanel);                               
    113                                 profilesSrv.removeEventListener(BrowserService.ITEMS_LOADED, profilesLoaded);
    114                         }
    115                        
    116                         private function componentsLoaded(event:Event):void {
    117                                 var item:ItemDescription = ComponentListService.findDescription(startupItemId);
    118                                 if(item != null){
     123                                if(item != null){                                       
     124                                        selectedProfileSrv = new ProfileInfoService();
    119125                                        loadStartupItem(item);
    120                                         componentInfoPage.infoPanel.setPanel(Config.instance.browserPanel);                             
    121                                         componentsSrv.removeEventListener(BrowserService.ITEMS_LOADED, componentsLoaded);
     126                                        profileInfoPage.infoPanel.setPanel(Config.instance.browserPanel);       
     127                                }
     128                               
     129                                item = ComponentListService.findDescription(startupItemId);
     130                                if(item != null){                                       
     131                                        selectedComponentSrv = new ComponentInfoService();
     132                                        loadStartupItem(item);
     133                                        componentInfoPage.infoPanel.setPanel(Config.instance.browserPanel);     
    122134                                }
    123135                        }
     
    204216                                        return false;
    205217                                }
     218                        }
     219                       
     220                        private function debugProfile():Profile{
     221                                trace("in mxml: "+selectedProfileSrv.profile.components.length + "components for the given profile");
     222                                return selectedProfileSrv.profile;
    206223                        }
    207224                       
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as

    r2515 r3120  
    99       
    1010       
    11         [Event(name="itemsLoaded", type="flash.events.Event")]
     11        // [Event(name="itemsLoaded", type="flash.events.Event")]
    1212        public class BrowserService extends ComponentRegistryService {
    13         public static const ITEMS_LOADED:String = "itemsLoaded";
     13        // public static const ITEMS_LOADED:String = "itemsLoaded";
    1414
    1515                /**
     
    3939                 */
    4040                override protected function result(resultEvent:ResultEvent):void {
    41                         dispatchEvent(new Event(ITEMS_LOADED));
     41                        //dispatchEvent(new Event(ITEMS_LOADED));
    4242                }
    4343
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentListService.as

    r867 r3120  
    55        import mx.collections.ArrayCollection;
    66        import mx.rpc.events.ResultEvent;
     7        import flash.events.Event;
    78
     9        [Event(name="componentsLoaded", type="flash.events.Event")]
    810        public class ComponentListService extends BrowserService {
    911
     12                public static const COMPONENTS_LOADED:String = "componentsLoaded";
     13               
    1014                private static var _instance:ComponentListService = new ComponentListService();
    1115                private static var _userSpaceInstance:ComponentListService = new ComponentListService(true);
     
    2832                        tempArray.refresh();
    2933            setItemDescriptions(new ArrayCollection(tempArray.toArray()));
    30                     super.result(resultEvent);
     34                        trace(itemDescriptions.length + " components are loaded");
     35                        dispatchEvent(new Event(COMPONENTS_LOADED));
     36                    // super.result(resultEvent);
    3137                }
    3238
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileListService.as

    r867 r3120  
    44       
    55        import mx.collections.ArrayCollection;
    6         import mx.rpc.events.ResultEvent;
    7 
     6        import mx.rpc.events.ResultEvent;       
     7        import flash.events.Event;
     8       
     9       
     10        [Event(name="profilesLoaded", type="flash.events.Event")]
    811        public class ProfileListService extends BrowserService {
    912               
     
    1114                private static var _userSpaceInstance:ProfileListService = new ProfileListService(true);
    1215
     16                public static const PROFILES_LOADED:String = "profilesLoaded";
     17               
    1318                public function ProfileListService(userSpace:Boolean=false) {
    1419                        super(Config.instance.profileListUrl, userSpace);
     
    2631                        tempArray.sort = BrowserColumns.getInitialSortForProfiles();
    2732                        tempArray.refresh();
    28                         setItemDescriptions(new ArrayCollection(tempArray.toArray()));
    29                     super.result(resultEvent);
     33                        setItemDescriptions(new ArrayCollection(tempArray.toArray()));                 
     34                        trace(itemDescriptions.length + " profiles are loaded");
     35                        dispatchEvent(new Event(PROFILES_LOADED));
     36                    //super.result(resultEvent);
    3037                }
    3138
Note: See TracChangeset for help on using the changeset viewer.