<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software | |
distributed under the License is distributed on an "AS IS" BASIS, | |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
See the License for the specific language governing permissions and | |
limitations under the License. | |
--> | |
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" | |
xmlns:s="library://ns.adobe.com/flex/spark" | |
xmlns:mx="library://ns.adobe.com/flex/mx" | |
xmlns:parsley="http://www.spicefactory.org/parsley" | |
xmlns:settings="org.apache.flex.utilities.developerToolSuite.presentation.graphic.settings.*" | |
title="{resourceManager.getString('Application', 'SETTINGS')}" | |
width="100%" height="500" | |
addedToStage="addedToStageHandler(event)" | |
removedFromStage="removedFromStageHandler(event)" | |
close="closeWindow()"> | |
<fx:Declarations> | |
<parsley:Configure/> | |
</fx:Declarations> | |
<fx:Metadata> | |
[Event(name="opened", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")] | |
[Event(name="closed", type="org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent")] | |
[ManagedEvents("opened,closed")] | |
</fx:Metadata> | |
<s:layout> | |
<s:VerticalLayout/> | |
</s:layout> | |
<s:TabBar dataProvider="{settingsViewStack}"/> | |
<mx:ViewStack id="settingsViewStack" height="100%" width="100%"> | |
<s:NavigatorContent id="generalSettingsContent" label="{resourceManager.getString('SettingsWindow', 'GENERAL')}"> | |
<settings:GeneralSettings/> | |
</s:NavigatorContent> | |
</mx:ViewStack> | |
<s:Group width="100%"> | |
<s:layout> | |
<s:HorizontalLayout horizontalAlign="center" paddingBottom="16"/> | |
</s:layout> | |
<s:Button label="{resourceManager.getString('SettingsWindow', 'CLOSE')}" | |
click="closeWindow()"/> | |
</s:Group> | |
<fx:Script><![CDATA[ | |
import mx.core.FlexGlobals; | |
import mx.events.ResizeEvent; | |
import mx.managers.PopUpManager; | |
import org.apache.flex.utilities.developerToolSuite.infrastructure.event.SettingsWindowEvent; | |
import org.spicefactory.parsley.core.context.Context; | |
private static var __window:SettingsWindow; | |
public static function show(context:Context, modal:Boolean = true):SettingsWindow { | |
if (__window) { | |
return __window; | |
} | |
__window = new SettingsWindow(); | |
context.viewManager.addViewRoot(__window); | |
PopUpManager.addPopUp(__window, FlexGlobals.topLevelApplication as DisplayObject, modal); | |
PopUpManager.centerPopUp(__window); | |
return __window; | |
} | |
[Inject] | |
public var context:Context; | |
[Init] | |
public function init():void { | |
dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.OPENED)); | |
} | |
private function addedToStageHandler(event:Event):void { | |
FlexGlobals.topLevelApplication.addEventListener(ResizeEvent.RESIZE, resizeHandler); | |
} | |
private function removedFromStageHandler(event:Event):void { | |
FlexGlobals.topLevelApplication.removeEventListener(ResizeEvent.RESIZE, resizeHandler); | |
} | |
private function resizeHandler(event:ResizeEvent):void { | |
PopUpManager.centerPopUp(this); | |
} | |
private function closeWindow():void { | |
PopUpManager.removePopUp(this); | |
dispatchEvent(new SettingsWindowEvent(SettingsWindowEvent.CLOSED)); | |
__window = null; | |
} | |
]]></fx:Script> | |
</s:TitleWindow> |