Changeset 238 for ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as
- Timestamp:
- 03/17/10 13:03:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as
r224 r238 1 1 package clarin.cmdi.componentregistry.services { 2 2 import com.adobe.net.URI; 3 3 4 4 import flash.events.ErrorEvent; 5 5 import flash.events.EventDispatcher; 6 6 7 7 import mx.controls.Alert; 8 8 import mx.managers.CursorManager; 9 9 import mx.utils.StringUtil; 10 10 11 11 import org.httpclient.HttpClient; 12 12 import org.httpclient.events.HttpDataEvent; … … 25 25 26 26 public function IsocatService() { 27 service = new HttpClient();28 service.listener.onComplete = handleResult;29 service.listener.onError = handleError;30 service.listener.onData = handleData;31 27 } 32 28 33 29 public function load(keyword:String):void { 34 30 if (keyword) { 31 createClient(); 35 32 CursorManager.setBusyCursor(); 36 33 var uri:URI = new URI(Config.instance.isocatSearchUrl); … … 44 41 } 45 42 46 public function handleData(event:HttpDataEvent):void { 43 public function close():void { 44 if (service) { 45 service.close(); 46 } 47 CursorManager.removeBusyCursor(); 48 } 49 50 private function createClient():void { 51 service = new HttpClient(); 52 service.listener.onComplete = handleResult; 53 service.listener.onError = handleError; 54 service.listener.onData = handleData; 55 } 56 57 private function handleData(event:HttpDataEvent):void { 47 58 var data:XML = new XML(event.bytes); 48 59 searchResults = data.dcif::dataCategory; … … 58 69 } 59 70 60 p ublicfunction handleError(faultEvent:ErrorEvent):void {71 private function handleError(faultEvent:ErrorEvent):void { 61 72 CursorManager.removeBusyCursor(); 62 73 var errorMessage:String = StringUtil.substitute("Error in {0}: {1}", this, faultEvent.text); 63 74 Alert.show(errorMessage); 64 75 } 65 76
Note: See TracChangeset
for help on using the changeset viewer.