source: ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/main.mxml @ 2126

Last change on this file since 2126 was 2126, checked in by twagoo, 12 years ago

Merged changes from 1.12.0 branch that fix #217 and #218 + CHANGES file for that release

File size: 3.7 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
3                                xmlns:common="clarin.cmdi.componentregistry.common.components.*"
4                                layout="absolute"
5                                preinitialize="init();"
6                                applicationComplete="appComplete();"
7                                backgroundColor="#DDE3EF">
8        <mx:Style source="/assets/css/main.css"/>
9        <mx:Script>
10                <![CDATA[
11                        import clarin.cmdi.componentregistry.common.AboutPopup;
12                        import clarin.cmdi.componentregistry.common.Credentials;
13                        import clarin.cmdi.componentregistry.services.Config;
14                        import clarin.cmdi.componentregistry.services.PingSessionService;
15                       
16                        import com.flexspy.FlexSpy;
17                       
18                        import flash.utils.getTimer;
19                       
20                        import mx.containers.Box;
21                        import mx.controls.Alert;
22                        import mx.controls.Button;
23                        import mx.core.UIComponent;
24                        import mx.core.mx_internal;
25                        import mx.events.FlexEvent;
26                        import mx.managers.PopUpManager;
27                       
28                        import org.hasseg.externalMouseWheel.ExternalMouseWheelSupport;
29
30                        private var sessionPinger:PingSessionService;
31                        [Bindable]
32                        private var aboutMenu:ContextMenu;
33                       
34                       
35                        private function init():void{
36                                this.contextMenu = createMenu();
37                                initializeInstances();
38                        }
39                       
40                        private function initializeInstances():void {
41                                Credentials.create(Application.application.parameters);
42                                Config.create(Application.application.parameters);                             
43                        }
44                       
45                        private function createMenu():ContextMenu{
46                                var menu:ContextMenu = new ContextMenu();
47                                var item:ContextMenuItem = new ContextMenuItem("About Clarin Component Registry");
48                                item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, showAbout);
49                                menu.customItems = [item];
50                                menu.hideBuiltInItems();
51                                return menu;
52                        }
53                       
54                        private function showAbout(event:ContextMenuEvent):void{
55                                var aboutBox:AboutPopup = new AboutPopup();
56                                aboutBox.x = appPanel.width/2 - aboutBox.width/2;
57                                aboutBox.y = appPanel.height/2 - aboutBox.height/2;
58                                PopUpManager.addPopUp(aboutBox, event.mouseTarget);
59                        }
60
61                        private function appComplete():void {
62                                ExternalMouseWheelSupport.getInstance(stage);
63                                sessionPinger = PingSessionService.INSTANCE
64                                sessionPinger.startPinging();
65                                if (Credentials.instance.isLoggedIn() && (Config.instance.space == Config.SPACE_USER)) {
66                                        Config.instance.userSpace = true;
67                                }
68                                viewStack.loadStartup();
69                               
70                                if(Config.instance.debug){
71                                        var flexSpyButton:Button = new Button();
72                                        flexSpyButton.label="FlexSpy";
73                                        flexSpyButton.addEventListener(MouseEvent.CLICK,showFlexSpy);
74                                        flexSpyButton.setStyle("right","0");
75                                        flexSpyButton.setStyle("top","0");
76                                        addChild(flexSpyButton);
77                                }
78                        }
79                       
80                        private function showFlexSpy(event:Event):void{
81                                FlexSpy.show();
82                        }
83
84                ]]>
85        </mx:Script>
86
87        <mx:Panel id="appPanel" width="100%"
88                          height="100%"
89                          layout="absolute"
90                          title="Clarin Component Registry"
91                          x="0"
92                          y="0">                         
93               
94                <mx:VBox height="100%" width="100%">                   
95                       
96                        <mx:HBox width="100%" id="topBar" styleName="topBar" verticalAlign="middle">
97                                <mx:Label width="20%" styleName="sectionTitle" paddingLeft="5" text="{viewStack.selectedChild.label}" />
98                       
99                                <mx:HBox width="80%" horizontalAlign="right" paddingRight="5">                                 
100                                        <mx:Label text="User: {Credentials.instance.userName}"/>
101                                        <common:LoginLabelButton id="login" includeInLayout="{!Credentials.instance.isLoggedIn()}" visible="{!Credentials.instance.isLoggedIn()}" />
102                                        <common:UserSettingsLabelButton id="userSettings" includeInLayout="{Credentials.instance.isLoggedIn()}" visible="{Credentials.instance.isLoggedIn()}"/>
103                                </mx:HBox>
104                        </mx:HBox>
105                       
106                        <common:RegistryViewStack id="viewStack"
107                                                                          borderStyle="none"
108                                                                          height="100%"
109                                                                          width="100%"/>
110                </mx:VBox>
111        </mx:Panel>
112               
113</mx:Application>
Note: See TracBrowser for help on using the repository browser.