1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" |
---|
3 | xmlns:local="clarin.cmdi.componentregistry.services.*" |
---|
4 | xmlns:browser="clarin.cmdi.componentregistry.browser.*" |
---|
5 | initialize="init()" |
---|
6 | creationComplete="refresh()" |
---|
7 | width="100%" |
---|
8 | height="100%" |
---|
9 | label="Browse..."> |
---|
10 | |
---|
11 | <mx:Script> |
---|
12 | <![CDATA[ |
---|
13 | import clarin.cmdi.componentregistry.common.components.RegistryViewStack; |
---|
14 | import clarin.cmdi.componentregistry.common.components.BrowseContextMenu; |
---|
15 | import clarin.cmdi.componentregistry.services.DeleteService; |
---|
16 | import clarin.cmdi.componentregistry.services.ComponentListService; |
---|
17 | import clarin.cmdi.componentregistry.common.ItemDescription; |
---|
18 | import mx.controls.Alert; |
---|
19 | import clarin.cmdi.componentregistry.browser.BrowserSelectionEvent; |
---|
20 | import clarin.cmdi.componentregistry.common.Profile; |
---|
21 | |
---|
22 | [Bindable] |
---|
23 | private var componentsSrv:ComponentListService = ComponentListService.instance; |
---|
24 | private var deleteSrv:DeleteService = new DeleteService(); |
---|
25 | [Bindable] |
---|
26 | private var browseMenu:BrowseContextMenu |
---|
27 | |
---|
28 | public function init():void { |
---|
29 | browseMenu = new BrowseContextMenu(); |
---|
30 | browseMenu.viewStack = this.parent as RegistryViewStack; |
---|
31 | browseMenu.deleteService = deleteSrv; |
---|
32 | deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted); |
---|
33 | } |
---|
34 | |
---|
35 | public function refresh():void { |
---|
36 | profilesSrv.load(); |
---|
37 | componentsSrv.load(); |
---|
38 | } |
---|
39 | |
---|
40 | private function loadProfileInfoPage(event:BrowserSelectionEvent):void { |
---|
41 | profileSrv.load(event.itemDescription); |
---|
42 | } |
---|
43 | |
---|
44 | private function loadComponentInfoPage(event:BrowserSelectionEvent):void { |
---|
45 | componentSrv.load(event.itemDescription); |
---|
46 | } |
---|
47 | |
---|
48 | public function setSelectedDescription(desc:ItemDescription):void { |
---|
49 | if (desc.isProfile) { |
---|
50 | tabnav.selectedIndex = 0; |
---|
51 | } else { |
---|
52 | tabnav.selectedIndex = 1; |
---|
53 | } |
---|
54 | //Need to select the correct item, can't get it to highlight at the mo |
---|
55 | //profilesOverview.dataGrid.selectedIndex=2; |
---|
56 | //profilesOverview.dataGrid.validateNow(); |
---|
57 | //profilesOverview.dataGrid.scrollToIndex(2); |
---|
58 | } |
---|
59 | |
---|
60 | private function handleItemDeleted(event:Event):void { |
---|
61 | refresh(); |
---|
62 | } |
---|
63 | ]]> |
---|
64 | </mx:Script> |
---|
65 | |
---|
66 | <local:ProfileListService id="profilesSrv"/> |
---|
67 | <local:ProfileInfoService id="profileSrv"/> |
---|
68 | <local:ComponentInfoService id="componentSrv"/> |
---|
69 | <browser:BrowserColumns id="browserColumns"/> |
---|
70 | |
---|
71 | |
---|
72 | <mx:VBox borderStyle="none" |
---|
73 | horizontalAlign="center" |
---|
74 | height="100%" |
---|
75 | width="100%"> |
---|
76 | |
---|
77 | <mx:TabNavigator id="tabnav" |
---|
78 | width="100%" |
---|
79 | height="100%" |
---|
80 | color="0x323232" |
---|
81 | y="59" |
---|
82 | borderStyle="outset"> |
---|
83 | <mx:VDividedBox label="Profiles" |
---|
84 | width="100%"> |
---|
85 | <browser:BrowserOverviewList id="profilesOverview" |
---|
86 | browserDataProvider="{profilesSrv.itemDescriptions}" |
---|
87 | browserItemSelected="{loadProfileInfoPage(event)}" |
---|
88 | browserColumns="{browserColumns.getProfileColumns()}" |
---|
89 | width="100%" |
---|
90 | height="70%" |
---|
91 | browseMenu="{browseMenu}"/> |
---|
92 | <browser:ProfileInfoPage id="profileInfoPage" |
---|
93 | profile="{profileSrv.profile}" |
---|
94 | width="100%" |
---|
95 | height="50%"/> |
---|
96 | </mx:VDividedBox> |
---|
97 | |
---|
98 | <mx:VDividedBox label="Components" |
---|
99 | width="100%"> |
---|
100 | <browser:BrowserOverviewList id="componentsOverview" |
---|
101 | browserDataProvider="{componentsSrv.itemDescriptions}" |
---|
102 | browserItemSelected="{loadComponentInfoPage(event)}" |
---|
103 | browserColumns="{browserColumns.getComponentColumns()}" |
---|
104 | width="100%" |
---|
105 | height="50%" |
---|
106 | browseMenu="{browseMenu}"/> |
---|
107 | <browser:ComponentInfoPage id="componentInfoPage" |
---|
108 | component="{componentSrv.component}" |
---|
109 | width="100%" |
---|
110 | height="50%"/> |
---|
111 | |
---|
112 | </mx:VDividedBox> |
---|
113 | </mx:TabNavigator> |
---|
114 | </mx:VBox> |
---|
115 | </mx:Canvas> |
---|