Repository: flex-utilities Updated Branches: refs/heads/InstallerRefactor [created] 56e3bd07d
http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/cb68cb55/installer/src/org/apache/flex/packageflexsdk/model/AvailableFlexVersion.as ---------------------------------------------------------------------- diff --git a/installer/src/org/apache/flex/packageflexsdk/model/AvailableFlexVersion.as b/installer/src/org/apache/flex/packageflexsdk/model/AvailableFlexVersion.as new file mode 100644 index 0000000..04db1ef --- /dev/null +++ b/installer/src/org/apache/flex/packageflexsdk/model/AvailableFlexVersion.as @@ -0,0 +1,44 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +package org.apache.flex.packageflexsdk.model +{ + public class AvailableFlexVersion + { + + public var shortName:String; + public var fileName:String; + public var label:String; + public var version:String; + public var path:String; + public var overlay:Boolean; + public var prefix:String; + public var legacy:Boolean; + public var nocache:Boolean; + public var needsAIR:Boolean; + public var needsFlash:Boolean; + public var devBuild:Boolean; + public var icon:String; + + public function AvailableFlexVersion() + { + } + + } +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/cb68cb55/installer/src/org/apache/flex/packageflexsdk/model/FlexVersions.as ---------------------------------------------------------------------- diff --git a/installer/src/org/apache/flex/packageflexsdk/model/FlexVersions.as b/installer/src/org/apache/flex/packageflexsdk/model/FlexVersions.as new file mode 100644 index 0000000..16be550 --- /dev/null +++ b/installer/src/org/apache/flex/packageflexsdk/model/FlexVersions.as @@ -0,0 +1,84 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +package org.apache.flex.packageflexsdk.model +{ + import mx.collections.ArrayCollection; + + import org.apache.flex.utilities.common.Constants; + + public class FlexVersions extends ArrayCollection + { + public var defaultVersion:int = -1; + private var _os:OS = new OS(); + + public function FlexVersions() + { + + } + + public function showDevBuilds():void + { + this.filterFunction = null; + this.refresh(); + } + + public function hideDevBuilds():void + { + this.filterFunction = devBuildFilterFunction; + this.refresh(); + } + + public function processXML(flexData:XMLList):void + { + for each (var productData:XML in flexData) + { + var productVersionList:XMLList = productData.versions.children(); + + for each (var productVersion:XML in productVersionList) + { + var newFlexVersion:AvailableFlexVersion = new AvailableFlexVersion(); + newFlexVersion.shortName = [email protected](); + newFlexVersion.fileName = newFlexVersion.shortName + (_os.isWindows() ? Constants.ARCHIVE_EXTENSION_WIN : Constants.ARCHIVE_EXTENSION_MAC); + newFlexVersion.version = newFlexVersion.fileName.substr([email protected]().length).split("-")[0]; + newFlexVersion.label = [email protected]() + " " + [email protected](); + newFlexVersion.path = [email protected](); + newFlexVersion.devBuild = [email protected]() == "true"; + newFlexVersion.legacy = [email protected]() == "true"; + newFlexVersion.nocache = [email protected]() == "true"; + newFlexVersion.overlay = [email protected]() == "true"; + newFlexVersion.needsAIR = [email protected]() != "false"; + newFlexVersion.needsFlash = [email protected]() != "false"; + newFlexVersion.icon = [email protected](); + if (productVersion["@default"].length() == 1) + { + defaultVersion = this.length; + } + this.addItem(newFlexVersion); + } + } + + } + + private function devBuildFilterFunction(o:Object):Boolean + { + return !o.devBuild; + } + } +} http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/cb68cb55/installer/src/org/apache/flex/packageflexsdk/view/components/CacheDialog.mxml ---------------------------------------------------------------------- diff --git a/installer/src/org/apache/flex/packageflexsdk/view/components/CacheDialog.mxml b/installer/src/org/apache/flex/packageflexsdk/view/components/CacheDialog.mxml new file mode 100644 index 0000000..9485e89 --- /dev/null +++ b/installer/src/org/apache/flex/packageflexsdk/view/components/CacheDialog.mxml @@ -0,0 +1,74 @@ +<?xml version="1.0"?> +<!-- + +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" + backgroundColor="0xDDDDDD" close="closeUp()" + title="Download Cache Configuration" + width="400" + height="130"> + + <fx:Script> + <![CDATA[ + import mx.managers.PopUpManager; + + private function browseFolders():void + { + var file:File; + if (folder.text.length > 0) + file = File.applicationStorageDirectory.resolvePath(folder.text); + else + file = File.applicationStorageDirectory; + file.browseForDirectory("Download Cache Folder"); + file.addEventListener(Event.SELECT, folderSelected); + } + + private function folderSelected(event:Event):void + { + folder.text = event.target.nativePath; + } + + private function closeUp():void + { + PopUpManager.removePopUp(this); + } + + private function updateCache():void + { + dispatchEvent(new Event(Event.COMPLETE)); + closeUp(); + } + ]]> + </fx:Script> + + <s:VGroup left="10" top="10" right="10"> + <s:CheckBox id="cb" label="Cache Downloaded Files" /> + <s:HGroup width="100%" verticalAlign="baseline"> + <s:Label text="Cache Folder: " /> + <s:TextInput id="folder" width="100%" enabled="{cb.selected}"/> + <s:Button label="Browse..." click="browseFolders()" styleName="genericBtnStyle" enabled="{cb.selected}"/> + </s:HGroup> + <s:HGroup horizontalAlign="center" width="100%" > + <s:Button label="OK" click="updateCache()" enabled="{cb.selected == false || folder.text.length > 0}" styleName="genericBtnStyle" /> + <s:Button label="Cancel" click="closeUp()" styleName="genericBtnStyle" /> + </s:HGroup> + </s:VGroup> + +</s:TitleWindow>
