Changeset 3363
- Timestamp:
- 08/12/13 12:34:39 (11 years ago)
- Location:
- ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/pom.xml
r2616 r3363 124 124 </plugin> 125 125 </plugins> 126 <pluginManagement> 127 <plugins> 128 <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> 129 <plugin> 130 <groupId>org.eclipse.m2e</groupId> 131 <artifactId>lifecycle-mapping</artifactId> 132 <version>1.0.0</version> 133 <configuration> 134 <lifecycleMappingMetadata> 135 <pluginExecutions> 136 <pluginExecution> 137 <pluginExecutionFilter> 138 <groupId> 139 org.sonatype.flexmojos 140 </groupId> 141 <artifactId> 142 flexmojos-maven-plugin 143 </artifactId> 144 <versionRange> 145 [3.9,) 146 </versionRange> 147 <goals> 148 <goal>compile-swf</goal> 149 <goal>test-compile</goal> 150 </goals> 151 </pluginExecutionFilter> 152 <action> 153 <ignore></ignore> 154 </action> 155 </pluginExecution> 156 </pluginExecutions> 157 </lifecycleMappingMetadata> 158 </configuration> 159 </plugin> 160 </plugins> 161 </pluginManagement> 126 162 </build> 127 163 -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BrowserService.as
r3131 r3363 1 1 package clarin.cmdi.componentregistry.services { 2 import c larin.cmdi.componentregistry.common.ItemDescription;2 import com.adobe.net.URI; 3 3 4 import com.adobe.net.URI;5 import mx.collections.ArrayCollection;6 import mx.rpc.events.ResultEvent;4 import mx.collections.ArrayCollection; 5 6 import clarin.cmdi.componentregistry.common.ItemDescription; 7 7 8 8 public class BrowserService extends ComponentRegistryService { … … 15 15 public var itemDescriptions:ArrayCollection; 16 16 17 // Not bindable needed for lookups over the whole collections of itemDescriptions 18 protected var userSpace:Boolean; 19 20 public function BrowserService(restUrl:String, userSpace:Boolean) { 21 super(restUrl); 17 public function BrowserService(successEvent:String, restUrl:URI, userSpace:Boolean) { 18 super(successEvent, restUrl); 22 19 this.userSpace = userSpace; 23 20 } 24 21 25 override protected function initServiceUrl(url:URI):void{22 override protected function dispatchRequest(url:URI):void { 26 23 if (userSpace) { 27 24 url.setQueryValue(Config.PARAM_USERSPACE, "true"); 28 25 } 26 super.dispatchRequest(url); 29 27 } 30 28 31 /**32 * Override in concrete subclasses33 */34 override protected function result(resultEvent:ResultEvent):void {35 }36 37 38 39 29 public function findDescription(id:String):ItemDescription { 40 30 for each (var item:ItemDescription in itemDescriptions) { -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/CommentListService.as
r1896 r3363 1 1 package clarin.cmdi.componentregistry.services { 2 import clarin.cmdi.componentregistry.common.Comment;3 import clarin.cmdi.componentregistry.common.ItemDescription;4 5 2 import com.adobe.net.URI; 6 3 7 4 import mx.collections.ArrayCollection; 8 import mx.rpc.events.ResultEvent; 5 6 import clarin.cmdi.componentregistry.common.Comment; 7 import clarin.cmdi.componentregistry.common.ItemDescription; 9 8 10 9 [Event(name="CommentsLoaded", type="flash.events.Event")] 11 10 public class CommentListService extends ComponentRegistryService { 12 11 public static const COMMENTS_LOADED:String = "CommentsLoaded"; 13 ;14 private var userSpace:Boolean;15 12 private var itemDescription:ItemDescription; 16 13 … … 29 26 url = Config.instance.getComponentCommentsPath(itemDescription.id); 30 27 } 31 super( url);28 super(COMMENTS_LOADED, new URI(url)); 32 29 33 30 this.itemDescription = itemDescription; … … 35 32 } 36 33 37 override protected function initServiceUrl(url:URI):void{ 38 if (userSpace) { 39 url.setQueryValue(Config.PARAM_USERSPACE, "true"); 40 } 41 } 42 43 override protected function result(resultEvent:ResultEvent):void { 44 var resultXml:XML = resultEvent.result as XML; 34 override protected function handleXmlResult(resultXml:XML):void{ 45 35 var nodes:XMLList = resultXml.comment; 46 36 … … 52 42 } 53 43 comments.refresh(); 54 dispatchEvent(new Event(COMMENTS_LOADED));55 44 } 56 45 } -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentInfoService.as
r1375 r3363 1 1 package clarin.cmdi.componentregistry.services { 2 2 3 import com.adobe.net.URI; 4 3 5 import clarin.cmdi.componentregistry.common.Component; 4 6 import clarin.cmdi.componentregistry.common.ComponentMD; 5 7 import clarin.cmdi.componentregistry.common.ItemDescription; 6 8 7 import com.adobe.net.URI;8 9 9 import flash.events.Event;10 import flash.events.EventDispatcher;11 12 import mx.controls.Alert;13 import mx.messaging.messages.HTTPRequestMessage;14 import mx.rpc.AsyncToken;15 import mx.rpc.Responder;16 import mx.rpc.events.FaultEvent;17 import mx.rpc.events.ResultEvent;18 import mx.rpc.http.HTTPService;19 import mx.utils.StringUtil;20 21 10 [Event(name="ComponentLoaded", type="flash.events.Event")] 22 public class ComponentInfoService extends EventDispatcher{ 23 public static const COMPONENT_LOADED:String = "ComponentLoaded"; 24 25 private var service:HTTPService; 11 public class ComponentInfoService extends BaseRemoteService{ 12 13 public static const COMPONENT_LOADED:String="ComponentLoaded"; 26 14 27 15 [Bindable] 28 16 public var component:Component; 29 17 30 31 18 public function ComponentInfoService() { 32 this.service = new HTTPService(); 33 this.service.method = HTTPRequestMessage.GET_METHOD; 34 this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X; 19 super(COMPONENT_LOADED); 35 20 } 36 21 … … 42 27 url.setQueryValue(Config.PARAM_USERSPACE, "true"); 43 28 } 44 service.url = url.toString(); 45 var token:AsyncToken = this.service.send(); 46 token.addResponder(new Responder(result, fault)); 29 dispatchRequest(url); 47 30 } 48 31 49 private function result(resultEvent:ResultEvent):void { 50 var resultXml:XML = resultEvent.result as XML; 32 override protected function handleXmlResult(resultXml:XML):void { 51 33 var metaData:ComponentMD = new ComponentMD(); 52 34 metaData.name = resultXml.CMD_Component.@name; 53 35 metaData.xml = resultXml; 54 36 component.componentMD = metaData; 55 dispatchEvent(new Event(COMPONENT_LOADED));56 37 } 57 38 58 public function fault(faultEvent:FaultEvent):void {59 var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);60 Alert.show(errorMessage);61 }62 39 } 63 40 } -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentListService.as
r3131 r3363 1 1 package clarin.cmdi.componentregistry.services { 2 import com.adobe.net.URI; 3 4 import flash.events.Event; 5 6 import mx.collections.ArrayCollection; 7 2 8 import clarin.cmdi.componentregistry.browser.BrowserColumns; 3 9 import clarin.cmdi.componentregistry.common.ItemDescription; 4 5 import mx.collections.ArrayCollection;6 import mx.rpc.events.ResultEvent;7 import flash.events.Event;8 10 9 11 public class ComponentListService extends BrowserService { … … 12 14 13 15 public function ComponentListService(userSpace:Boolean = false) { 14 super(C onfig.instance.componentListUrl, userSpace);16 super(COMPONENTS_LOADED, new URI(Config.instance.componentListUrl), userSpace); 15 17 } 16 18 17 override protected function result(resultEvent:ResultEvent):void { 18 var resultXml:XML = resultEvent.result as XML; 19 override protected function handleXmlResult(resultXml:XML):void{ 19 20 var nodes:XMLList = resultXml.componentDescription; 20 21 -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentRegistryService.as
r2525 r3363 3 3 import com.adobe.net.URI; 4 4 5 import flash.events.Event; 6 import flash.events.EventDispatcher; 7 8 import mx.controls.Alert; 9 import mx.messaging.messages.HTTPRequestMessage; 10 import mx.rpc.AsyncToken; 11 import mx.rpc.Responder; 12 import mx.rpc.events.FaultEvent; 13 import mx.rpc.events.ResultEvent; 14 import mx.rpc.http.HTTPService; 15 import mx.utils.StringUtil; 16 17 public class ComponentRegistryService extends EventDispatcher { 18 private var service:HTTPService; 5 public class ComponentRegistryService extends BaseRemoteService { 19 6 20 private var serviceUrl:String; 7 protected var serviceUrl:URI; 8 protected var userSpace:Boolean; 21 9 22 public function ComponentRegistryService(restUrl:String) { 23 this.serviceUrl = restUrl; 24 service = new HTTPService(); 25 service.method = HTTPRequestMessage.GET_METHOD; 26 service.resultFormat = HTTPService.RESULT_FORMAT_E4X; 10 public function ComponentRegistryService(successEvent:String, serviceUrl:URI) { 11 super(successEvent); 12 this.serviceUrl = serviceUrl; 27 13 } 28 14 29 private function initService():void { 30 var url:URI = new URI(serviceUrl); 15 override protected function dispatchRequest(url:URI):void { 31 16 url.setQueryValue("unique", new Date().getTime().toString()); 32 initServiceUrl(url); 33 service.url = url.toString(); 17 if (userSpace) { 18 url.setQueryValue(Config.PARAM_USERSPACE, "true"); 19 } else 20 url.setQueryValue(Config.PARAM_USERSPACE, null); 21 super.dispatchRequest(url); 34 22 } 35 23 36 24 public function load():void { 37 initService(); 38 var token:AsyncToken = this.service.send(); 39 token.addResponder(new Responder(result, fault)); 25 dispatchRequest(serviceUrl); 40 26 } 41 27 42 /**43 * Override in concrete subclasses44 */45 protected function result(resultEvent:ResultEvent):void {46 }47 48 public function fault(faultEvent:FaultEvent):void {49 var errorMessage:String = StringUtil.substitute("Error in {0}: \n Fault: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);50 trace(errorMessage);51 Alert.show("Internal Server error cannot process the data, try reloading the application.");52 }53 54 protected function initServiceUrl(url:URI):void{55 };56 28 } 57 29 } -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ElementTypesListService.as
r2535 r3363 1 1 package clarin.cmdi.componentregistry.services //trunk 2 2 { 3 import flash.events.Event;4 import flash.events.MouseEvent;3 4 import com.adobe.net.URI; 5 5 6 6 import mx.collections.ArrayCollection; 7 import mx.rpc.events.ResultEvent;8 7 9 8 public class ElementTypesListService extends ComponentRegistryService … … 16 15 public function ElementTypesListService() 17 16 { 18 super( Config.getUriAllowedElementTypes());17 super(ALLOWED_TYPES_LOADED, new URI(Config.getUriAllowedElementTypes())); 19 18 } 20 19 21 20 22 // called by load() 23 override protected function result(resultEvent:ResultEvent):void { 24 var resultXml:XML = resultEvent.result as XML; 21 override protected function handleXmlResult(resultXml:XML):void{ 25 22 allowedTypes= new ArrayCollection(); 26 23 var currentValue:String; … … 29 26 allowedTypes.addItem({label: currentValue, data: currentValue}); 30 27 } 31 dispatchEvent(new Event(ALLOWED_TYPES_LOADED));32 28 } 33 29 -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/PingSessionService.as
r2515 r3363 1 1 package clarin.cmdi.componentregistry.services { 2 2 3 import c larin.cmdi.componentregistry.common.Credentials;3 import com.adobe.net.URI; 4 4 5 5 import flash.events.TimerEvent; … … 14 14 import mx.rpc.http.HTTPService; 15 15 import mx.utils.StringUtil; 16 17 import clarin.cmdi.componentregistry.common.Credentials; 16 18 17 19 18 public class PingSessionService {20 public class PingSessionService extends BaseRemoteService{ 19 21 20 22 [Bindable] … … 24 26 private static const PING_INTERVAL:int = 1000 * 60 * 5; //5 minutes 25 27 private var timer:Timer = new Timer(PING_INTERVAL, 0); 26 private var service:HTTPService;27 28 28 29 /** … … 30 31 */ 31 32 function PingSessionService() { 32 this.service = new HTTPService(); 33 this.service.method = HTTPRequestMessage.GET_METHOD; 34 this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X; 33 super("PingOk"); 35 34 } 36 35 … … 46 45 private function pingSession():void { 47 46 if (Credentials.instance.isLoggedIn()) { 48 service.url = Config.instance.pingSessionUrl; 49 var token:AsyncToken = service.send(); 50 token.addResponder(new Responder(result, fault)); 47 dispatchRequest(new URI(Config.instance.pingSessionUrl)); 51 48 } 52 49 } 53 50 54 private function result(resultEvent:ResultEvent):void{55 stillActive = result Event.result.@stillActive == "true";51 override protected function handleXmlResult(resultXml:XML):void{ 52 stillActive = resultXml.@stillActive == "true"; 56 53 if (!stillActive) { 57 54 Alert.show("Your session has expired, please reload the application to refresh the session."); … … 60 57 } 61 58 62 public function fault(faultEvent:FaultEvent):void {59 override protected function requestCallbackFailed(faultEvent:FaultEvent):void { 63 60 timer.stop(); // We stop to bother the user with more errors. Somethings is wrong user needs probably to reload which will start the timer again. 64 var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail); 65 Alert.show(errorMessage); 61 super.requestCallbackFailed(faultEvent); 66 62 } 67 63 } -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileInfoService.as
r856 r3363 6 6 import com.adobe.net.URI; 7 7 8 import flash.events.Event;9 import flash.events.EventDispatcher;10 11 8 import mx.collections.ArrayCollection; 12 import mx.controls.Alert;13 import mx.messaging.messages.HTTPRequestMessage;14 import mx.rpc.AsyncToken;15 import mx.rpc.Responder;16 import mx.rpc.events.FaultEvent;17 import mx.rpc.events.ResultEvent;18 import mx.rpc.http.HTTPService;19 import mx.utils.StringUtil;20 9 21 10 [Event(name="ProfileLoaded", type="flash.events.Event")] 22 public class ProfileInfoService extends EventDispatcher{11 public class ProfileInfoService extends BaseRemoteService { 23 12 public static const PROFILE_LOADED:String = "ProfileLoaded"; 24 25 private var service:HTTPService;26 13 27 14 [Bindable] 28 15 public var profile:Profile; 29 16 30 31 17 public function ProfileInfoService() { 32 this.service = new HTTPService(); 33 this.service.method = HTTPRequestMessage.GET_METHOD; 34 this.service.resultFormat = HTTPService.RESULT_FORMAT_E4X; 18 super(PROFILE_LOADED); 35 19 } 36 20 … … 42 26 url.setQueryValue(Config.PARAM_USERSPACE, "true"); 43 27 } 44 service.url = url.toString(); 45 var token:AsyncToken = this.service.send(); 46 token.addResponder(new Responder(result, fault)); 28 super.dispatchRequest(url); 47 29 } 48 49 private function result(resultEvent:ResultEvent):void { 50 var resultXml:XML = resultEvent.result as XML; 30 31 override protected function handleXmlResult(resultXml:XML):void{ 51 32 var nodes:XMLList = resultXml.CMD_Component; 52 33 53 34 profile.nrOfComponents = nodes.length(); 54 35 profile.profileSource = resultXml; … … 61 42 } 62 43 this.profile.components = new ArrayCollection(tempArray); 63 dispatchEvent(new Event(PROFILE_LOADED));64 }65 66 public function fault(faultEvent:FaultEvent):void {67 var errorMessage:String = StringUtil.substitute("Error in {0}: {1} - {2}", this, faultEvent.fault.faultString, faultEvent.fault.faultDetail);68 Alert.show(errorMessage);69 44 } 70 45 } -
ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileListService.as
r3131 r3363 4 4 5 5 import mx.collections.ArrayCollection; 6 import mx.rpc.events.ResultEvent; 7 import flash.events.Event; 6 import com.adobe.net.URI; 8 7 9 8 … … 13 12 14 13 public function ProfileListService(userSpace:Boolean=false) { 15 super( Config.instance.profileListUrl, userSpace);14 super(PROFILES_LOADED, new URI(Config.instance.profileListUrl), userSpace); 16 15 } 17 16 18 override protected function result(resultEvent:ResultEvent):void { 19 var resultXml:XML = resultEvent.result as XML; 17 override protected function handleXmlResult(resultXml:XML):void{ 20 18 var nodes:XMLList = resultXml.profileDescription; 21 19 var tempArray:ArrayCollection = new ArrayCollection(); … … 28 26 tempArray.refresh(); 29 27 itemDescriptions = new ArrayCollection(tempArray.toArray()); 30 trace(itemDescriptions.length);31 dispatchEvent(new Event(this.PROFILES_LOADED));32 28 } 33 29 }
Note: See TracChangeset
for help on using the changeset viewer.