| <?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. |
| |
| --> |
| <windows:AnimatedPanelWindow 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:handlers="com.flexcapacitor.handlers.*" |
| xmlns:fc="com.flexcapacitor.effects.popup.*" |
| xmlns:views="com.flexcapacitor.views.*" |
| xmlns:panels="com.flexcapacitor.views.panels.*" |
| xmlns:windows="com.flexcapacitor.views.windows.*" |
| |
| title="Save As..." |
| creationComplete="panel1_creationCompleteHandler(event)" |
| > |
| |
| <fx:Script> |
| <![CDATA[ |
| import com.flexcapacitor.controller.Radiate; |
| import com.flexcapacitor.events.RadiateEvent; |
| |
| import mx.events.EffectEvent; |
| import mx.events.FlexEvent; |
| |
| public static const NEW_DOCUMENT:String = "newDocument"; |
| public static const CURRENT_DOCUMENT:String = "currentDocument"; |
| public static const CURRENT_SELECTION:String = "currentSelection"; |
| |
| |
| protected function panel1_creationCompleteHandler(event:FlexEvent):void {
|
| codeInspector.exportWindow = true;
|
| codeInspector.activate();
|
| } |
| |
| protected function eventhandler1_effectEndHandler(event:EffectEvent):void {
|
| codeInspector.deactivate();
|
| } |
| |
| protected function saveButton_clickHandler(event:MouseEvent):void {
|
| var radiate:Radiate = Radiate.getInstance(); |
| var codeType:String = codeInspector.codeType.selectedItem as String; |
| var extension:String = (codeType==CodeInspector.HTML) ? "html" : (codeType==CodeInspector.MXML) ? "mxml" : "xml"; |
| |
| radiate.saveFileAs(codeInspector.sourceCode, radiate.selectedDocument.name, extension); |
| radiate.addEventListener(RadiateEvent.DOCUMENT_SAVE_COMPLETE, completeHandler, false, 0, true);
|
| radiate.addEventListener(RadiateEvent.DOCUMENT_SAVE_AS_CANCEL, cancelHandler, false, 0, true);
|
| } |
| |
| protected function completeHandler(event:Event):void { |
| codeInspector.deactivate();
|
| closePopUp.startDelay = closePanelDelay; |
| closePopUp.play();
|
| } |
|
|
| protected function cancelHandler(event:Event):void { |
| //Radiate.log.info("Canceled Save");
|
| } |
| |
| ]]> |
| </fx:Script> |
| |
| <fx:Declarations> |
| |
| <!--- hide about popup --> |
| <handlers:EventHandler targets="{cancelButton}" eventName="click" > |
| <s:SetAction property="action" target="{this}" value="cancel"/> |
| <fc:ClosePopUp id="closePopUp" popUp="{this}" effectEnd="eventhandler1_effectEndHandler(event)"/> |
| </handlers:EventHandler> |
| |
| <!--- hide about popup --> |
| <!--<handlers:EventHandler targets="{saveButton}" eventName="click" > |
| <s:SetAction property="action" target="{this}" value="save"/> |
| </handlers:EventHandler>--> |
| |
| <fx:String id="action"></fx:String> |
| |
| <s:RadioButtonGroup id="exportLocation" /> |
| </fx:Declarations> |
| |
| |
| <s:VGroup left="15" |
| top="20" |
| right="20" |
| bottom="20"> |
| |
| <!--<s:Label x="15" y="65" text="Paste in the MXML code below:" fontWeight="bold"/>--> |
| |
| <panels:CodeInspector id="codeInspector" |
| width="100%" height="300" |
| /> |
| |
| <!--<s:HGroup x="14" y="31" width="100%" horizontalAlign="right" verticalAlign="baseline"> |
| <s:Label x="15" y="15" text="Export:" fontWeight="bold"/> |
| <s:Spacer width="100%"/> |
| <s:RadioButton x="190" |
| y="130" |
| label="Current Document" |
| group="{exportLocation}" |
| value="{CURRENT_DOCUMENT}" |
| /> |
| <s:RadioButton x="190" |
| y="130" |
| label="Selected Component" |
| group="{exportLocation}" |
| value="{CURRENT_SELECTION}" |
| /> |
| </s:HGroup>--> |
| |
| <s:Label id="warningLabel_Ha" |
| x="15" y="15" |
| text="Warning: XML is invalid" |
| fontWeight="bold" |
| color="red" |
| includeInLayout="false" |
| visible="false" |
| width="100%"/> |
| |
| <s:HGroup width="100%" right="10" bottom="10" verticalAlign="baseline"> |
| <s:Spacer width="100%"/> |
| <s:Button id="cancelButton" label="Cancel" /> |
| <s:Button id="saveButton" label="Save" click="saveButton_clickHandler(event)"/> |
| </s:HGroup> |
| </s:VGroup> |
| |
| </windows:AnimatedPanelWindow> |