Changeset 5795 for ComponentRegistry
- Timestamp:
- 11/11/14 16:13:39 (10 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/SpaceSwitch.mxml
r5699 r5795 1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 <mx:ComboBox xmlns:mx="http://www.adobe.com/2006/mxml" 3 dataProvider="{spaces}" 4 width="110" 5 close="registrySpaceCloseHandler(event)" 6 initialize="init()" 7 change="onSelectionChanged(event)" 8 > 3 width="110" change="selectionChangedHandler(event)" 4 dataProvider="{spaces}" initialize="init()"> 9 5 10 6 <mx:Script> … … 19 15 import mx.collections.ArrayCollection; 20 16 import mx.controls.Alert; 17 import mx.events.ListEvent; 21 18 22 19 private static const PRIVATE_SPACE_LABEL:String = "Private space"; … … 29 26 spaces = new ArrayCollection([{label: PUBLIC_SPACE_LABEL, space: Config.SPACE_PUBLISHED, groupId:null}, {label: PRIVATE_SPACE_LABEL, space: Config.SPACE_PRIVATE, groupId:null}]); 30 27 } 31 32 private function onSelectionChanged(event:Event):void{33 var space:String = ComboBox(event.target).selectedItem.space;34 var groupId:String = ComboBox(event.target).selectedItem.groupId;35 if ((groupId != null) && (groupId != "")) {36 space = Config.SPACE_GROUP;37 }38 Config.instance.registrySpace = new RegistrySpace(space, groupId);39 }40 41 42 28 43 29 public function init():void{ 44 30 Config.instance.getListUserGroupsMembershipService().addEventListener(ListUserGroupsMembershipService.GROUPS_LOADED, onGroupsLoaded); 45 31 Config.instance.getListUserGroupsMembershipService().loadGroupsForUser(); // triggers the event ListUserGroupsMembershipService.GROUPS_LOADED 32 } 33 34 private function selectionChangedHandler(event:ListEvent):void { 35 if (Credentials.instance.isLoggedIn()) { 36 var space:String = ComboBox(event.target).selectedItem.space; 37 var groupId:String = ComboBox(event.target).selectedItem.groupId; 38 if ((groupId != null) && (groupId != "")) { 39 space = Config.SPACE_GROUP; 40 } 41 Config.instance.registrySpace = new RegistrySpace(space, groupId); 42 } else { 43 event.stopPropagation(); 44 new Login().show(this.parent.parent, Config.VIEW_BROWSE, Config.instance.registrySpace.space, null); 45 selectedIndex = 0; 46 46 } 47 48 47 } 49 48 50 49 public function onGroupsLoaded(event:Event):void{ … … 55 54 setSelectedIndex(); 56 55 } 57 58 private function registrySpaceCloseHandler(event:Event):void {59 if (Credentials.instance.isLoggedIn()) {60 } else {61 if (Config.instance.registrySpace.space != Config.SPACE_PUBLISHED) {62 new Login().show(this.parent.parent, Config.VIEW_BROWSE, Config.instance.registrySpace.space, null);63 //setSelectedIndex();64 }65 66 }67 }68 56 57 /** 58 * sets the index according to the current registry space 59 */ 69 60 public function setSelectedIndex():void{ 70 61 … … 73 64 return; 74 65 } 75 if (Config.instance.registrySpace.space==Config.SPACE_PRIVATE) {76 this.selectedIndex = 1;77 return;78 }79 66 80 var index:int; 81 if (Config.instance.registrySpace.space==Config.SPACE_GROUP) { 82 for (index=2;index<spaces.length; index++) { 83 if (spaces[index].groupId==Config.instance.registrySpace.groupId){ 84 trace("indeces:" + index+" " +Config.instance.registrySpace.groupId +" " +spaces[index].groupId); 85 this.selectedIndex = index; 86 return; 67 if(Credentials.instance.isLoggedIn()) { 68 if (Config.instance.registrySpace.space==Config.SPACE_PRIVATE) { 69 this.selectedIndex = 1; 70 return; 71 } 72 73 var index:int; 74 if (Config.instance.registrySpace.space==Config.SPACE_GROUP) { 75 for (index=2;index<spaces.length; index++) { 76 if (spaces[index].groupId==Config.instance.registrySpace.groupId){ 77 trace("indeces:" + index+" " +Config.instance.registrySpace.groupId +" " +spaces[index].groupId); 78 this.selectedIndex = index; 79 return; 80 } 87 81 } 88 82 } 83 84 // in case of #$%^-up: 85 var spacesDump:String= spaces[0].space + "; "+spaces[1].space; 86 for (index=2;index<spaces.length; index++) { 87 spacesDump=spacesDump+"; "+spaces[index].space + " " +spaces[index].groupId; 88 } 89 90 throw "Cannot identify the selection index for registry-space combobox. space = "+Config.instance.registrySpace.space+ " group "+Config.instance.registrySpace.groupId + spacesDump; 89 91 } 90 91 // in case of #$%^-up:92 var spacesDump:String= spaces[0].space + "; "+spaces[1].space;93 for (index=2;index<spaces.length; index++) {94 spacesDump=spacesDump+"; "+spaces[index].space + " " +spaces[index].groupId;95 }96 97 throw "Cannot indetify the selection index for registry-space combobox. space = "+Config.instance.registrySpace.space+ " group "+Config.instance.registrySpace.groupId + spacesDump;98 92 } 99 93 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentRegistryService.as
r5699 r5795 31 31 throw "Registry space is lost." 32 32 } 33 trace("Dispatching request to " + url.toDisplayString()) 33 34 super.dispatchRequest(url); 34 35 }
Note: See TracChangeset
for help on using the changeset viewer.