source: ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml @ 281

Last change on this file since 281 was 281, checked in by patdui, 14 years ago
  • more little bug fixes and layout changes, trying to use shibboleth for authorisation
File size: 4.5 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
3                   xmlns:browser="clarin.cmdi.componentregistry.browser.*"
4                   initialize="init()"
5                   creationComplete="refresh()"
6                   width="100%"
7                   height="100%"
8                   label="Browse...">
9
10        <mx:Script>
11                <![CDATA[
12                    import clarin.cmdi.componentregistry.services.ComponentInfoService;
13                    import clarin.cmdi.componentregistry.services.ProfileInfoService;
14                    import clarin.cmdi.componentregistry.services.ProfileListService;
15                    import mx.events.CollectionEvent;
16                        import mx.collections.ArrayCollection;
17                        import clarin.cmdi.componentregistry.common.components.RegistryViewStack;
18                        import clarin.cmdi.componentregistry.common.components.BrowseContextMenu;
19                        import clarin.cmdi.componentregistry.services.DeleteService;
20                        import clarin.cmdi.componentregistry.services.ComponentListService;
21                        import clarin.cmdi.componentregistry.common.ItemDescription;
22                        import mx.controls.Alert;
23                        import clarin.cmdi.componentregistry.browser.BrowserSelectionEvent;
24                        import clarin.cmdi.componentregistry.common.Profile;
25
26            [Bindable]
27                        private var componentsSrv:ComponentListService = ComponentListService.instance;
28                        [Bindable]
29                        private var profilesSrv:ProfileListService = new ProfileListService();
30                        [Bindable]
31                        private var profileSrv:ProfileInfoService = new ProfileInfoService();
32                        [Bindable]
33                        private var componentSrv:ComponentInfoService = new ComponentInfoService();
34                       
35                        private var deleteSrv:DeleteService = DeleteService.instance;
36                       
37                        [Bindable]
38                        private var profilesMenu:BrowseContextMenu;
39                        [Bindable]
40                        private var componentsMenu:BrowseContextMenu;
41                        [Bindable]
42                        private var selectedProfileItem:ItemDescription;
43                        [Bindable]
44                        private var selectedComponentItem:ItemDescription;
45
46                        public function init():void {
47                                profilesMenu = new BrowseContextMenu();
48                                profilesMenu.viewStack = this.parent as RegistryViewStack;
49                                profilesMenu.deleteService = deleteSrv;
50                                componentsMenu = new BrowseContextMenu();
51                                componentsMenu.viewStack = this.parent as RegistryViewStack;
52                                componentsMenu.deleteService = deleteSrv;
53                                deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted);
54                        }
55
56                        public function refresh():void {
57                                profilesSrv.load();
58                                componentsSrv.load();
59                        }
60
61                        private function loadProfileInfoPage(event:BrowserSelectionEvent):void {
62                                profileSrv.load(event.itemDescription);
63                        }
64
65                        private function loadComponentInfoPage(event:BrowserSelectionEvent):void {
66                                componentSrv.load(event.itemDescription);
67                        }
68
69                        public function setSelectedDescription(desc:ItemDescription):void {
70                                if (desc.isProfile) {
71                                        tabnav.selectedIndex = 0;
72                                        this.selectedProfileItem = desc;
73                                } else {
74                                        tabnav.selectedIndex = 1;
75                                        this.selectedComponentItem = desc;
76                                }
77                        }
78
79                        private function handleItemDeleted(event:Event):void {
80                                refresh();
81                        }
82                ]]>
83        </mx:Script>
84
85
86        <browser:BrowserColumns id="browserColumns"/>
87
88
89        <mx:VBox borderStyle="none"
90                         horizontalAlign="center"
91                         height="100%"
92                         width="100%">
93
94                <mx:TabNavigator id="tabnav"
95                                                 width="100%"
96                                                 height="100%"
97                                                 color="0x323232"
98                                                 y="59"
99                                                 borderStyle="outset">
100                        <mx:VDividedBox label="Profiles"
101                                                        width="100%">
102                                <browser:BrowserOverviewList id="profilesOverview"
103                                                                                         browserDataProvider="{profilesSrv.itemDescriptions}"
104                                                                                         browserItemSelected="{loadProfileInfoPage(event)}"
105                                                                                         browserColumns="{browserColumns.getProfileColumns()}"
106                                                                                         itemToScrollTo="{selectedProfileItem}"
107                                                                                         width="100%"
108                                                                                         height="70%"
109                                                                                         browseMenu="{profilesMenu}"/>
110                                <browser:ProfileInfoPage id="profileInfoPage"
111                                                                                 profile="{profileSrv.profile}"
112                                                                                 width="100%"
113                                                                                 height="50%"
114                                                                                 contextMenu="{profilesMenu.cm}"/>
115                        </mx:VDividedBox>
116
117                        <mx:VDividedBox label="Components"
118                                                        width="100%">
119                                <browser:BrowserOverviewList id="componentsOverview"
120                                                                                         browserDataProvider="{componentsSrv.itemDescriptions}"
121                                                                                         browserItemSelected="{loadComponentInfoPage(event)}"
122                                                                                         browserColumns="{browserColumns.getComponentColumns()}"
123                                                                                         itemToScrollTo="{selectedComponentItem}"
124                                                                                         width="100%"
125                                                                                         height="50%"
126                                                                                         browseMenu="{componentsMenu}"/>
127                                <browser:ComponentInfoPage id="componentInfoPage"
128                                                                                   component="{componentSrv.component}"
129                                                                                   width="100%"
130                                                                                   height="50%"
131                                                                                   contextMenu="{componentsMenu.cm}"/>
132
133                        </mx:VDividedBox>
134                </mx:TabNavigator>
135        </mx:VBox>
136</mx:Canvas>
Note: See TracBrowser for help on using the repository browser.