Last change
on this file since 224 was
224,
checked in by patdui, 14 years ago
|
- reimplemented my drag and drop editor
- created search functionality for isocat conceptLinks.
- added some flexUnit tests and cleanup error handling
|
File size:
1.2 KB
|
Line | |
---|
1 | package clarin.cmdi.componentregistry.services { |
---|
2 | import clarin.cmdi.componentregistry.common.ItemDescription; |
---|
3 | |
---|
4 | import mx.collections.ArrayCollection; |
---|
5 | import mx.rpc.events.ResultEvent; |
---|
6 | |
---|
7 | public class ComponentListService extends BrowserService { |
---|
8 | |
---|
9 | |
---|
10 | private static var _instance:ComponentListService = new ComponentListService(); |
---|
11 | |
---|
12 | public function ComponentListService() { |
---|
13 | super(Config.instance.componentListUrl); |
---|
14 | } |
---|
15 | |
---|
16 | override protected function result(resultEvent:ResultEvent):void { |
---|
17 | var resultXml:XML = resultEvent.result as XML; |
---|
18 | var nodes:XMLList = resultXml.componentDescription; |
---|
19 | |
---|
20 | var tempArray:Array = new Array(); |
---|
21 | for each (var node:XML in nodes) { |
---|
22 | var item:ItemDescription = new ItemDescription(); |
---|
23 | item.createComponent(node); |
---|
24 | tempArray[tempArray.length] = item; |
---|
25 | } |
---|
26 | setItemDescriptions(new ArrayCollection(tempArray)); |
---|
27 | } |
---|
28 | |
---|
29 | public static function get instance():ComponentListService { |
---|
30 | return _instance; |
---|
31 | } |
---|
32 | |
---|
33 | /** |
---|
34 | * Looks up itemDescription, returns null if not found. |
---|
35 | */ |
---|
36 | public function lookUpDescription(componentId:String):ItemDescription { |
---|
37 | for each (var item:ItemDescription in unFilteredItemDescriptions) { |
---|
38 | if (item.id == componentId) { |
---|
39 | return item; |
---|
40 | } |
---|
41 | } |
---|
42 | return null; |
---|
43 | } |
---|
44 | } |
---|
45 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.