Changeset 1473
- Timestamp:
- 07/27/11 09:45:44 (13 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml
r1086 r1473 43 43 <mx:VBox styleName="borderStyles" 44 44 width="100%"> 45 <mx:Label text="Drag existing components onto edit canvas"/>45 <mx:Label text="Drag TESTTEST existing components onto edit canvas"/> 46 46 <browser:BrowserOverviewList id="componentsPaletteOverview" 47 47 width="100%" -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as
r1086 r1473 9 9 import clarin.cmdi.componentregistry.services.ComponentInfoService; 10 10 import clarin.cmdi.componentregistry.services.ComponentListService; 11 import clarin.cmdi.componentregistry.services.ComponentUsageCheckEvent; 12 import clarin.cmdi.componentregistry.services.ComponentUsageService; 11 13 import clarin.cmdi.componentregistry.services.Config; 12 14 import clarin.cmdi.componentregistry.services.ProfileInfoService; … … 88 90 89 91 private function saveSpec(inUserSpace:Boolean, uploadAction:int):void { 90 // Alert.show(xmlEditor.cmdSpec.toXml());92 // Alert.show(xmlEditor.cmdSpec.toXml()); 91 93 if (xmlEditor.validate()) { 92 94 var item:ItemDescription = new ItemDescription(); … … 100 102 item.id = xmlEditor.cmdSpec.headerId; 101 103 } 102 uploadService.upload(uploadAction, item, xmlEditor.cmdSpec.toXml()); 104 105 // Private components that are in updated require usage check call. If in use, the user can choose whether or not to save the changes . 106 if(inUserSpace && uploadAction == UploadService.UPDATE && !item.isProfile){ 107 checkUsage(item); 108 }else{ 109 doUpload(uploadAction,item); 110 } 103 111 } else { 104 112 errorMessageField.text = "Validation errors: red colored fields are invalid."; 105 113 } 114 } 115 116 /** 117 * Calls usage check for the specified component. If in use, asks user whether to proceed; if positive, initiates update. 118 */ 119 private function checkUsage(item:ItemDescription, uploadAction:int = UploadService.UPDATE):void{ 120 var componentUsageService:ComponentUsageService = new ComponentUsageService(item); 121 componentUsageService.addEventListener(ComponentUsageCheckEvent.COMPONENT_IN_USE, 122 function (event:ComponentUsageCheckEvent):void{ 123 if(event.isComponentInUse){ 124 Alert.show("Component is used by other components and/or profiles. Changes in this component will affect these. Do you want to proceed?","Component is used", Alert.YES|Alert.NO,null, 125 function (eventObj:CloseEvent):void{ 126 if(eventObj.detail == Alert.YES){ 127 doUpload(uploadAction, item); 128 } 129 }); 130 } else { 131 doUpload(uploadAction,item); 132 } 133 }); 134 componentUsageService.checkUsage(); 135 } 136 137 private function doUpload(uploadAction:int, item:ItemDescription):void{ 138 uploadService.upload(uploadAction, item, xmlEditor.cmdSpec.toXml()); 106 139 } 107 140 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/Config.as
r1232 r1473 28 28 private static const COMPONENT_LIST_URL:String = "/rest/registry/components"; 29 29 private static const PROFILE_LIST_URL:String = "/rest/registry/profiles"; 30 private static const COMPONENT_USAGE_URL:String = "/rest/registry/components/usage/"; 30 31 private static const UPLOAD_PROFILE_SERVICE_URL:String = "/rest/registry/profiles"; 31 32 private static const UPLOAD_COMPONENT_SERVICE_URL:String = "/rest/registry/components"; … … 87 88 public function get componentListUrl():String { 88 89 return _serviceRootUrl + COMPONENT_LIST_URL; 90 } 91 92 public function get componentUsageUrl():String { 93 return _serviceRootUrl + COMPONENT_USAGE_URL; 89 94 } 90 95
Note: See TracChangeset
for help on using the changeset viewer.