Changeset 5803 for ComponentRegistry


Ignore:
Timestamp:
11/12/14 14:16:50 (10 years ago)
Author:
Twan Goosen
Message:

Added permanent instances for the public component and profile list services to the 'config' object; in the Expanding Component Label check the public space if the current space has no matching component ID
Fixes #670

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

Legend:

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

    r5699 r5803  
    3737                       
    3838                        [Bindable]
    39                         private var componentsSrv:ComponentListService = Config.instance.getComponentsSrv();
    40                         [Bindable]
    41                         private var profilesSrv:ProfileListService = Config.instance.getProfilesSrv();
     39                        private var componentsSrv:ComponentListService = Config.instance.getCurrentComponentsSrv();
     40                        [Bindable]
     41                        private var profilesSrv:ProfileListService = Config.instance.getCurrentProfilesSrv();
    4242                       
    4343                        [Bindable]
     
    8282                       
    8383                        private function toggleRegistrySpace(event:Event):void {
    84                                 componentsSrv = Config.instance.getComponentsSrv();
    85                                 profilesSrv = Config.instance.getProfilesSrv();
     84                                componentsSrv = Config.instance.getCurrentComponentsSrv();
     85                                profilesSrv = Config.instance.getCurrentProfilesSrv();
    8686                                refresh();                             
    8787                                registrySpaceComboBox.setSelectedIndex();
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/ExpandingComponentLabel.as

    r5699 r5803  
    4141                        this.editable = editable;
    4242                        this.componentId = componentId;                 
    43                         this.item = Config.instance.getComponentsSrv().findDescription(componentId);                   
     43                        this.item = Config.instance.getCurrentComponentsSrv().findDescription(componentId);
     44                        // item not from current space? try public...
     45                        if (this.item==null) {
     46                                this.item = Config.instance.getPublicComponentsSrv().findDescription(componentId);
     47                        }
    4448                        styleName = StyleConstants.EXPANDING_COMPONENT;
    4549                        if (item && item.isPrivate) {
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentSummary.mxml

    r5699 r5803  
    2929                                 >                     
    3030                        <mx:Label text="ComponentId: " fontWeight="bold"/>
    31                         <mx:Label text="{Config.instance.getComponentsSrv().findDescription(component.componentId).name}" />
     31                        <mx:Label text="{Config.instance.getCurrentComponentsSrv().findDescription(component.componentId).name}" />
    3232                </mx:HBox>
    3333               
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as

    r5729 r5803  
    3030
    3131[Bindable]
    32 private var componentsSrv:ComponentListService = Config.instance.getComponentsSrv();
    33 
    34 [Bindable]
    35 private var profilesSrv:ProfileListService = Config.instance.getProfilesSrv();
     32private var componentsSrv:ComponentListService = Config.instance.getCurrentComponentsSrv();
     33
     34[Bindable]
     35private var profilesSrv:ProfileListService = Config.instance.getCurrentProfilesSrv();
    3636
    3737[Bindable]
     
    7070
    7171private function toggleRegistrySpace(event:Event):void {
    72         componentsSrv = Config.instance.getComponentsSrv();
    73         profilesSrv = Config.instance.getProfilesSrv();
     72        componentsSrv = Config.instance.getCurrentComponentsSrv();
     73        profilesSrv = Config.instance.getCurrentProfilesSrv();
    7474}
    7575
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as

    r5699 r5803  
    4646                }
    4747               
    48                 public function findDescription(id:String):ItemDescription {                   
     48                /**
     49                 * finds a component inside the currently loaded space
     50                 */
     51                public function findDescription(id:String):ItemDescription {
     52                        //look in the current space
    4953                        for each (var item:ItemDescription in itemDescriptions) {
    5054                                if (item.id == id) {
     
    5256                                }
    5357                        }
     58                        //item not in current space
     59                        //TODO: request description from server
    5460                        return null;
    5561                }
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as

    r5699 r5803  
    7979               
    8080                private var componentsSrv:ComponentListService;
     81                private var publicComponentsSrv:ComponentListService;
    8182                private var profilesSrv:ProfileListService;
     83                private var publicProfilesSrv:ProfileListService;
    8284                private var listUserGroupsMembershipService:ListUserGroupsMembershipService;
    8385                private var listGroupsOfItemService:ListGroupsOfItemService;
     
    131133                        };
    132134                       
    133                         registrySpace = new RegistrySpace(space_, groupId_);
    134                        
    135135                        var debug_:int = applicationParameters.debug;
    136136                        if(debug_) {
    137137                                _debug = Boolean(debug_);                               
    138138                        }
    139                        
     139                                                                       
    140140                        listUserGroupsMembershipService = new ListUserGroupsMembershipService();
    141                         listGroupsOfItemService = new ListGroupsOfItemService();                       
    142                        
     141                        listGroupsOfItemService = new ListGroupsOfItemService();
     142
     143                        publicProfilesSrv = new ProfileListService(new RegistrySpace(SPACE_PUBLISHED, ""));
     144                        publicComponentsSrv = new ComponentListService(new RegistrySpace(SPACE_PUBLISHED, ""))
     145                       
     146                        registrySpace = new RegistrySpace(space_, groupId_);
    143147                }
    144148               
     
    146150                        return listUserGroupsMembershipService;
    147151                }
    148 
    149                 public function getProfilesSrv():ProfileListService{
    150                                 return profilesSrv;             
    151                 }
    152                
    153                 public function getComponentsSrv():ComponentListService{               
    154                                 return componentsSrv;
     152               
     153                public function getCurrentProfilesSrv():ProfileListService{
     154                        return profilesSrv;             
     155                }
     156               
     157                public function getPublicProfilesSrv():ProfileListService{
     158                        return publicProfilesSrv;               
     159                }
     160               
     161                public function getCurrentComponentsSrv():ComponentListService{         
     162                        return componentsSrv;
     163                }
     164               
     165                public function getPublicComponentsSrv():ComponentListService{
     166                        return publicComponentsSrv;
    155167                }
    156168               
     
    230242                public function set registrySpace(registrySpace:RegistrySpace):void {
    231243                        _registrySpace = registrySpace;
    232                         profilesSrv = new ProfileListService(registrySpace);                   
    233                         componentsSrv = new ComponentListService(registrySpace);
     244                       
     245                        if(registrySpace.space == SPACE_PUBLISHED) {
     246                                profilesSrv = publicProfilesSrv;
     247                                componentsSrv = publicComponentsSrv;
     248                        } else {
     249                                profilesSrv = new ProfileListService(registrySpace);                   
     250                                componentsSrv = new ComponentListService(registrySpace);
     251                        }
    234252                       
    235253                        // everything is ready to open new componentBrowser instance
Note: See TracChangeset for help on using the changeset viewer.