http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8LibraryAssets/src/assets/icons/tools/Zoom24.png ---------------------------------------------------------------------- diff --git a/Radii8LibraryAssets/src/assets/icons/tools/Zoom24.png b/Radii8LibraryAssets/src/assets/icons/tools/Zoom24.png new file mode 100644 index 0000000..c49677f Binary files /dev/null and b/Radii8LibraryAssets/src/assets/icons/tools/Zoom24.png differ
http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8LibraryAssets/src/assets/icons/tools/ZoomDisabled.png ---------------------------------------------------------------------- diff --git a/Radii8LibraryAssets/src/assets/icons/tools/ZoomDisabled.png b/Radii8LibraryAssets/src/assets/icons/tools/ZoomDisabled.png new file mode 100644 index 0000000..4f70b5c Binary files /dev/null and b/Radii8LibraryAssets/src/assets/icons/tools/ZoomDisabled.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8LibraryAssets/src/assets/icons/tools/ZoomIn.png ---------------------------------------------------------------------- diff --git a/Radii8LibraryAssets/src/assets/icons/tools/ZoomIn.png b/Radii8LibraryAssets/src/assets/icons/tools/ZoomIn.png new file mode 100644 index 0000000..4f70b5c Binary files /dev/null and b/Radii8LibraryAssets/src/assets/icons/tools/ZoomIn.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8LibraryAssets/src/assets/icons/tools/ZoomOut.png ---------------------------------------------------------------------- diff --git a/Radii8LibraryAssets/src/assets/icons/tools/ZoomOut.png b/Radii8LibraryAssets/src/assets/icons/tools/ZoomOut.png new file mode 100644 index 0000000..4f70b5c Binary files /dev/null and b/Radii8LibraryAssets/src/assets/icons/tools/ZoomOut.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8LibraryAssets/src/assets/icons/tools/dragStripIcon.png ---------------------------------------------------------------------- diff --git a/Radii8LibraryAssets/src/assets/icons/tools/dragStripIcon.png b/Radii8LibraryAssets/src/assets/icons/tools/dragStripIcon.png new file mode 100644 index 0000000..a41854b Binary files /dev/null and b/Radii8LibraryAssets/src/assets/icons/tools/dragStripIcon.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/.actionScriptProperties ---------------------------------------------------------------------- diff --git a/Radii8Remote/.actionScriptProperties b/Radii8Remote/.actionScriptProperties new file mode 100644 index 0000000..5c3a3e7 --- /dev/null +++ b/Radii8Remote/.actionScriptProperties @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + +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. + +--> +<actionScriptProperties analytics="false" mainApplicationPath="Radii8Remote.mxml" projectUUID="13a56b92-38a6-4a48-a772-efccfe7b6f49" version="10"> + <compiler additionalCompilerArguments="-locale en_US" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="false" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" verifyDigests="true" warn="true"> + <compilerSourcePath/> + <libraryPath defaultLinkType="0"> + <libraryPathEntry kind="4" path=""> + <excludedEntries> + <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/flex.swc" useDefaultLinkType="false"/> + <libraryPathEntry kind="3" linkType="1" path="${PROJECT_FRAMEWORKS}/libs/core.swc" useDefaultLinkType="false"/> + </excludedEntries> + </libraryPathEntry> + <libraryPathEntry kind="1" linkType="1" path="libs"/> + <libraryPathEntry kind="3" linkType="1" path="/Radii8Library/bin/Radii8Library.swc" useDefaultLinkType="false"/> + <libraryPathEntry kind="3" linkType="1" path="/MyLibrary/bin/MyLibrary.swc" useDefaultLinkType="false"/> + <libraryPathEntry kind="3" linkType="1" path="/Radii8LibraryAssets/bin/Radii8LibraryAssets.swc" useDefaultLinkType="false"/> + <libraryPathEntry kind="3" linkType="1" path="/FCLibrary/bin/FCLibrary.swc" useDefaultLinkType="false"/> + </libraryPath> + <sourceAttachmentPath/> + </compiler> + <applications> + <application path="Radii8Remote.mxml"/> + </applications> + <modules> + <module application="src/Radii8Remote.mxml" destPath="modules/PropertiesExample.swf" optimize="true" sourcePath="src/modules/PropertiesExample.mxml"/> + <module application="src/Radii8Remote.mxml" destPath="modules/Layers.swf" optimize="true" sourcePath="src/modules/Layers.mxml"/> + <module destPath="modules/Tools.swf" optimize="false" sourcePath="src/modules/Tools.mxml"/> + <module destPath="modules/InspectorContainer.swf" optimize="false" sourcePath="src/modules/InspectorContainer.mxml"/> + </modules> + <buildCSSFiles/> + <flashCatalyst validateFlashCatalystCompatibility="false"/> +</actionScriptProperties> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/.flexProperties ---------------------------------------------------------------------- diff --git a/Radii8Remote/.flexProperties b/Radii8Remote/.flexProperties new file mode 100644 index 0000000..f5fd3f3 --- /dev/null +++ b/Radii8Remote/.flexProperties @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + + 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. + +--> +<flexProperties enableServiceManager="false" flexServerFeatures="0" flexServerType="0" fmlDataModelLocation=".model/Radii8Remote.fml" toolCompile="true" useServerFlexSDK="false" version="2"/> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/.fxpProperties ---------------------------------------------------------------------- diff --git a/Radii8Remote/.fxpProperties b/Radii8Remote/.fxpProperties new file mode 100644 index 0000000..1ed787e --- /dev/null +++ b/Radii8Remote/.fxpProperties @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- + + 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. + +--> +<fxpProperties abbreviated="false" authoringTool="Flex Builder" compiles="true" parentProject="13a56b92-38a6-4a48-a772-efccfe7b6f49" projectUUID="13a56b92-38a6-4a48-a772-efccfe7b6f49" pureCatalystProject="false" sdkVersion="4.6.0" uuid="6bfbcfa7-54cb-44ca-9308-54ccc57cb09b" version="15"> + <projects/> + <src/> + <swc> + <linked location="sdkPlaceHolder" path="sdkPlaceHolder" position="0" uuid="6bfbcfa7-54cb-44ca-9308-54ccc57cb09b"/> + <linked location="/libs" path="\libs" position="1" uuid="6bfbcfa7-54cb-44ca-9308-54ccc57cb09b"/> + </swc> + <misc/> + <theme/> + <mxmlFormattingPrefs groupAttributesByState="true" maxLineWidth="100" mxmlAlignAttributes="true" mxmlAttributeOrder="id,userLabel,includeIn,excludeFrom,visible,x,y,z,left,right,top,bottom,width,height,minWidth,minHeight,maxWidth,maxHeight,label" mxmlKeepAttributeValuesOrganized="true"/> +</fxpProperties> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/.project ---------------------------------------------------------------------- diff --git a/Radii8Remote/.project b/Radii8Remote/.project new file mode 100644 index 0000000..332c608 --- /dev/null +++ b/Radii8Remote/.project @@ -0,0 +1,36 @@ +<?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. + +--> +<projectDescription> + <name>Radii8Remote</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>com.adobe.flexbuilder.project.flexbuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>com.adobe.flexbuilder.project.flexnature</nature> + <nature>com.adobe.flexbuilder.project.actionscriptnature</nature> + </natures> +</projectDescription> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/.settings/org.eclipse.core.resources.prefs ---------------------------------------------------------------------- diff --git a/Radii8Remote/.settings/org.eclipse.core.resources.prefs b/Radii8Remote/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..b7671b3 --- /dev/null +++ b/Radii8Remote/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Sat Aug 04 02:21:31 CDT 2012 +eclipse.preferences.version=1 +encoding/<project>=utf-8 http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/html-template/swfobject.js ---------------------------------------------------------------------- diff --git a/Radii8Remote/html-template/swfobject.js b/Radii8Remote/html-template/swfobject.js new file mode 100644 index 0000000..7a9d26f --- /dev/null +++ b/Radii8Remote/html-template/swfobject.js @@ -0,0 +1,777 @@ +/*! SWFObject v2.2 <http://code.google.com/p/swfobject/> + is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> +*/ + +var swfobject = function() { + + var UNDEF = "undefined", + OBJECT = "object", + SHOCKWAVE_FLASH = "Shockwave Flash", + SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash", + FLASH_MIME_TYPE = "application/x-shockwave-flash", + EXPRESS_INSTALL_ID = "SWFObjectExprInst", + ON_READY_STATE_CHANGE = "onreadystatechange", + + win = window, + doc = document, + nav = navigator, + + plugin = false, + domLoadFnArr = [main], + regObjArr = [], + objIdArr = [], + listenersArr = [], + storedAltContent, + storedAltContentId, + storedCallbackFn, + storedCallbackObj, + isDomLoaded = false, + isExpressInstallActive = false, + dynamicStylesheet, + dynamicStylesheetMedia, + autoHideShow = true, + + /* Centralized function for browser feature detection + - User agent string detection is only used when no good alternative is possible + - Is executed directly for optimal performance + */ + ua = function() { + var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF, + u = nav.userAgent.toLowerCase(), + p = nav.platform.toLowerCase(), + windows = p ? /win/.test(p) : /win/.test(u), + mac = p ? /mac/.test(p) : /mac/.test(u), + webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, // returns either the webkit version or false if not webkit + ie = !+"\v1", // feature detection based on Andrea Giammarchi's solution: http://webreflection.blogspot.com/2009/01/32-bytes-to-know-if-your-browser-is-ie.html + playerVersion = [0,0,0], + d = null; + if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) { + d = nav.plugins[SHOCKWAVE_FLASH].description; + if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) { // navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin indicates whether plug-ins are enabled or disabled in Safari 3+ + plugin = true; + ie = false; // cascaded feature detection for Internet Explorer + d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); + playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); + playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); + playerVersion[2] = /[a-zA-Z]/.test(d) ? parseInt(d.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0; + } + } + else if (typeof win.ActiveXObject != UNDEF) { + try { + var a = new ActiveXObject(SHOCKWAVE_FLASH_AX); + if (a) { // a will return null when ActiveX is disabled + d = a.GetVariable("$version"); + if (d) { + ie = true; // cascaded feature detection for Internet Explorer + d = d.split(" ")[1].split(","); + playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + } + catch(e) {} + } + return { w3:w3cdom, pv:playerVersion, wk:webkit, ie:ie, win:windows, mac:mac }; + }(), + + /* Cross-browser onDomLoad + - Will fire an event as soon as the DOM of a web page is loaded + - Internet Explorer workaround based on Diego Perini's solution: http://javascript.nwbox.com/IEContentLoaded/ + - Regular onload serves as fallback + */ + onDomLoad = function() { + if (!ua.w3) { return; } + if ((typeof doc.readyState != UNDEF && doc.readyState == "complete") || (typeof doc.readyState == UNDEF && (doc.getElementsByTagName("body")[0] || doc.body))) { // function is fired after onload, e.g. when script is inserted dynamically + callDomLoadFunctions(); + } + if (!isDomLoaded) { + if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("DOMContentLoaded", callDomLoadFunctions, false); + } + if (ua.ie && ua.win) { + doc.attachEvent(ON_READY_STATE_CHANGE, function() { + if (doc.readyState == "complete") { + doc.detachEvent(ON_READY_STATE_CHANGE, arguments.callee); + callDomLoadFunctions(); + } + }); + if (win == top) { // if not inside an iframe + (function(){ + if (isDomLoaded) { return; } + try { + doc.documentElement.doScroll("left"); + } + catch(e) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + } + if (ua.wk) { + (function(){ + if (isDomLoaded) { return; } + if (!/loaded|complete/.test(doc.readyState)) { + setTimeout(arguments.callee, 0); + return; + } + callDomLoadFunctions(); + })(); + } + addLoadEvent(callDomLoadFunctions); + } + }(); + + function callDomLoadFunctions() { + if (isDomLoaded) { return; } + try { // test if we can really add/remove elements to/from the DOM; we don't want to fire it too early + var t = doc.getElementsByTagName("body")[0].appendChild(createElement("span")); + t.parentNode.removeChild(t); + } + catch (e) { return; } + isDomLoaded = true; + var dl = domLoadFnArr.length; + for (var i = 0; i < dl; i++) { + domLoadFnArr[i](); + } + } + + function addDomLoadEvent(fn) { + if (isDomLoaded) { + fn(); + } + else { + domLoadFnArr[domLoadFnArr.length] = fn; // Array.push() is only available in IE5.5+ + } + } + + /* Cross-browser onload + - Based on James Edwards' solution: http://brothercake.com/site/resources/scripts/onload/ + - Will fire an event as soon as a web page including all of its assets are loaded + */ + function addLoadEvent(fn) { + if (typeof win.addEventListener != UNDEF) { + win.addEventListener("load", fn, false); + } + else if (typeof doc.addEventListener != UNDEF) { + doc.addEventListener("load", fn, false); + } + else if (typeof win.attachEvent != UNDEF) { + addListener(win, "onload", fn); + } + else if (typeof win.onload == "function") { + var fnOld = win.onload; + win.onload = function() { + fnOld(); + fn(); + }; + } + else { + win.onload = fn; + } + } + + /* Main function + - Will preferably execute onDomLoad, otherwise onload (as a fallback) + */ + function main() { + if (plugin) { + testPlayerVersion(); + } + else { + matchVersions(); + } + } + + /* Detect the Flash Player version for non-Internet Explorer browsers + - Detecting the plug-in version via the object element is more precise than using the plugins collection item's description: + a. Both release and build numbers can be detected + b. Avoid wrong descriptions by corrupt installers provided by Adobe + c. Avoid wrong descriptions by multiple Flash Player entries in the plugin Array, caused by incorrect browser imports + - Disadvantage of this method is that it depends on the availability of the DOM, while the plugins collection is immediately available + */ + function testPlayerVersion() { + var b = doc.getElementsByTagName("body")[0]; + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + var t = b.appendChild(o); + if (t) { + var counter = 0; + (function(){ + if (typeof t.GetVariable != UNDEF) { + var d = t.GetVariable("$version"); + if (d) { + d = d.split(" ")[1].split(","); + ua.pv = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]; + } + } + else if (counter < 10) { + counter++; + setTimeout(arguments.callee, 10); + return; + } + b.removeChild(o); + t = null; + matchVersions(); + })(); + } + else { + matchVersions(); + } + } + + /* Perform Flash Player and SWF version matching; static publishing only + */ + function matchVersions() { + var rl = regObjArr.length; + if (rl > 0) { + for (var i = 0; i < rl; i++) { // for each registered object element + var id = regObjArr[i].id; + var cb = regObjArr[i].callbackFn; + var cbObj = {success:false, id:id}; + if (ua.pv[0] > 0) { + var obj = getElementById(id); + if (obj) { + if (hasPlayerVersion(regObjArr[i].swfVersion) && !(ua.wk && ua.wk < 312)) { // Flash Player version >= published SWF version: Houston, we have a match! + setVisibility(id, true); + if (cb) { + cbObj.success = true; + cbObj.ref = getObjectById(id); + cb(cbObj); + } + } + else if (regObjArr[i].expressInstall && canExpressInstall()) { // show the Adobe Express Install dialog if set by the web page author and if supported + var att = {}; + att.data = regObjArr[i].expressInstall; + att.width = obj.getAttribute("width") || "0"; + att.height = obj.getAttribute("height") || "0"; + if (obj.getAttribute("class")) { att.styleclass = obj.getAttribute("class"); } + if (obj.getAttribute("align")) { att.align = obj.getAttribute("align"); } + // parse HTML object param element's name-value pairs + var par = {}; + var p = obj.getElementsByTagName("param"); + var pl = p.length; + for (var j = 0; j < pl; j++) { + if (p[j].getAttribute("name").toLowerCase() != "movie") { + par[p[j].getAttribute("name")] = p[j].getAttribute("value"); + } + } + showExpressInstall(att, par, id, cb); + } + else { // Flash Player and SWF version mismatch or an older Webkit engine that ignores the HTML object element's nested param elements: display alternative content instead of SWF + displayAltContent(obj); + if (cb) { cb(cbObj); } + } + } + } + else { // if no Flash Player is installed or the fp version cannot be detected we let the HTML object element do its job (either show a SWF or alternative content) + setVisibility(id, true); + if (cb) { + var o = getObjectById(id); // test whether there is an HTML object element or not + if (o && typeof o.SetVariable != UNDEF) { + cbObj.success = true; + cbObj.ref = o; + } + cb(cbObj); + } + } + } + } + } + + function getObjectById(objectIdStr) { + var r = null; + var o = getElementById(objectIdStr); + if (o && o.nodeName == "OBJECT") { + if (typeof o.SetVariable != UNDEF) { + r = o; + } + else { + var n = o.getElementsByTagName(OBJECT)[0]; + if (n) { + r = n; + } + } + } + return r; + } + + /* Requirements for Adobe Express Install + - only one instance can be active at a time + - fp 6.0.65 or higher + - Win/Mac OS only + - no Webkit engines older than version 312 + */ + function canExpressInstall() { + return !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac) && !(ua.wk && ua.wk < 312); + } + + /* Show the Adobe Express Install dialog + - Reference: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=6a253b75 + */ + function showExpressInstall(att, par, replaceElemIdStr, callbackFn) { + isExpressInstallActive = true; + storedCallbackFn = callbackFn || null; + storedCallbackObj = {success:false, id:replaceElemIdStr}; + var obj = getElementById(replaceElemIdStr); + if (obj) { + if (obj.nodeName == "OBJECT") { // static publishing + storedAltContent = abstractAltContent(obj); + storedAltContentId = null; + } + else { // dynamic publishing + storedAltContent = obj; + storedAltContentId = replaceElemIdStr; + } + att.id = EXPRESS_INSTALL_ID; + if (typeof att.width == UNDEF || (!/%$/.test(att.width) && parseInt(att.width, 10) < 310)) { att.width = "310"; } + if (typeof att.height == UNDEF || (!/%$/.test(att.height) && parseInt(att.height, 10) < 137)) { att.height = "137"; } + doc.title = doc.title.slice(0, 47) + " - Flash Player Installation"; + var pt = ua.ie && ua.win ? "ActiveX" : "PlugIn", + fv = "MMredirectURL=" + encodeURI(window.location).toString().replace(/&/g,"%26") + "&MMplayerType=" + pt + "&MMdoctitle=" + doc.title; + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + fv; + } + else { + par.flashvars = fv; + } + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + if (ua.ie && ua.win && obj.readyState != 4) { + var newObj = createElement("div"); + replaceElemIdStr += "SWFObjectNew"; + newObj.setAttribute("id", replaceElemIdStr); + obj.parentNode.insertBefore(newObj, obj); // insert placeholder div that will be replaced by the object element that loads expressinstall.swf + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + createSWF(att, par, replaceElemIdStr); + } + } + + /* Functions to abstract and display alternative content + */ + function displayAltContent(obj) { + if (ua.ie && ua.win && obj.readyState != 4) { + // IE only: when a SWF is loading (AND: not available in cache) wait for the readyState of the object element to become 4 before removing it, + // because you cannot properly cancel a loading SWF file without breaking browser load references, also obj.onreadystatechange doesn't work + var el = createElement("div"); + obj.parentNode.insertBefore(el, obj); // insert placeholder div that will be replaced by the alternative content + el.parentNode.replaceChild(abstractAltContent(obj), el); + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + obj.parentNode.removeChild(obj); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.replaceChild(abstractAltContent(obj), obj); + } + } + + function abstractAltContent(obj) { + var ac = createElement("div"); + if (ua.win && ua.ie) { + ac.innerHTML = obj.innerHTML; + } + else { + var nestedObj = obj.getElementsByTagName(OBJECT)[0]; + if (nestedObj) { + var c = nestedObj.childNodes; + if (c) { + var cl = c.length; + for (var i = 0; i < cl; i++) { + if (!(c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) { + ac.appendChild(c[i].cloneNode(true)); + } + } + } + } + } + return ac; + } + + /* Cross-browser dynamic SWF creation + */ + function createSWF(attObj, parObj, id) { + var r, el = getElementById(id); + if (ua.wk && ua.wk < 312) { return r; } + if (el) { + if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content + attObj.id = id; + } + if (ua.ie && ua.win) { // Internet Explorer + the HTML object element + W3C DOM methods do not combine: fall back to outerHTML + var att = ""; + for (var i in attObj) { + if (attObj[i] != Object.prototype[i]) { // filter out prototype additions from other potential libraries + if (i.toLowerCase() == "data") { + parObj.movie = attObj[i]; + } + else if (i.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + att += ' class="' + attObj[i] + '"'; + } + else if (i.toLowerCase() != "classid") { + att += ' ' + i + '="' + attObj[i] + '"'; + } + } + } + var par = ""; + for (var j in parObj) { + if (parObj[j] != Object.prototype[j]) { // filter out prototype additions from other potential libraries + par += '<param name="' + j + '" value="' + parObj[j] + '" />'; + } + } + el.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + '>' + par + '</object>'; + objIdArr[objIdArr.length] = attObj.id; // stored to fix object 'leaks' on unload (dynamic publishing only) + r = getElementById(attObj.id); + } + else { // well-behaving browsers + var o = createElement(OBJECT); + o.setAttribute("type", FLASH_MIME_TYPE); + for (var m in attObj) { + if (attObj[m] != Object.prototype[m]) { // filter out prototype additions from other potential libraries + if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword + o.setAttribute("class", attObj[m]); + } + else if (m.toLowerCase() != "classid") { // filter out IE specific attribute + o.setAttribute(m, attObj[m]); + } + } + } + for (var n in parObj) { + if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") { // filter out prototype additions from other potential libraries and IE specific param element + createObjParam(o, n, parObj[n]); + } + } + el.parentNode.replaceChild(o, el); + r = o; + } + } + return r; + } + + function createObjParam(el, pName, pValue) { + var p = createElement("param"); + p.setAttribute("name", pName); + p.setAttribute("value", pValue); + el.appendChild(p); + } + + /* Cross-browser SWF removal + - Especially needed to safely and completely remove a SWF in Internet Explorer + */ + function removeSWF(id) { + var obj = getElementById(id); + if (obj && obj.nodeName == "OBJECT") { + if (ua.ie && ua.win) { + obj.style.display = "none"; + (function(){ + if (obj.readyState == 4) { + removeObjectInIE(id); + } + else { + setTimeout(arguments.callee, 10); + } + })(); + } + else { + obj.parentNode.removeChild(obj); + } + } + } + + function removeObjectInIE(id) { + var obj = getElementById(id); + if (obj) { + for (var i in obj) { + if (typeof obj[i] == "function") { + obj[i] = null; + } + } + obj.parentNode.removeChild(obj); + } + } + + /* Functions to optimize JavaScript compression + */ + function getElementById(id) { + var el = null; + try { + el = doc.getElementById(id); + } + catch (e) {} + return el; + } + + function createElement(el) { + return doc.createElement(el); + } + + /* Updated attachEvent function for Internet Explorer + - Stores attachEvent information in an Array, so on unload the detachEvent functions can be called to avoid memory leaks + */ + function addListener(target, eventType, fn) { + target.attachEvent(eventType, fn); + listenersArr[listenersArr.length] = [target, eventType, fn]; + } + + /* Flash Player and SWF content version matching + */ + function hasPlayerVersion(rv) { + var pv = ua.pv, v = rv.split("."); + v[0] = parseInt(v[0], 10); + v[1] = parseInt(v[1], 10) || 0; // supports short notation, e.g. "9" instead of "9.0.0" + v[2] = parseInt(v[2], 10) || 0; + return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true : false; + } + + /* Cross-browser dynamic CSS creation + - Based on Bobby van der Sluis' solution: http://www.bobbyvandersluis.com/articles/dynamicCSS.php + */ + function createCSS(sel, decl, media, newStyle) { + if (ua.ie && ua.mac) { return; } + var h = doc.getElementsByTagName("head")[0]; + if (!h) { return; } // to also support badly authored HTML pages that lack a head element + var m = (media && typeof media == "string") ? media : "screen"; + if (newStyle) { + dynamicStylesheet = null; + dynamicStylesheetMedia = null; + } + if (!dynamicStylesheet || dynamicStylesheetMedia != m) { + // create dynamic stylesheet + get a global reference to it + var s = createElement("style"); + s.setAttribute("type", "text/css"); + s.setAttribute("media", m); + dynamicStylesheet = h.appendChild(s); + if (ua.ie && ua.win && typeof doc.styleSheets != UNDEF && doc.styleSheets.length > 0) { + dynamicStylesheet = doc.styleSheets[doc.styleSheets.length - 1]; + } + dynamicStylesheetMedia = m; + } + // add style rule + if (ua.ie && ua.win) { + if (dynamicStylesheet && typeof dynamicStylesheet.addRule == OBJECT) { + dynamicStylesheet.addRule(sel, decl); + } + } + else { + if (dynamicStylesheet && typeof doc.createTextNode != UNDEF) { + dynamicStylesheet.appendChild(doc.createTextNode(sel + " {" + decl + "}")); + } + } + } + + function setVisibility(id, isVisible) { + if (!autoHideShow) { return; } + var v = isVisible ? "visible" : "hidden"; + if (isDomLoaded && getElementById(id)) { + getElementById(id).style.visibility = v; + } + else { + createCSS("#" + id, "visibility:" + v); + } + } + + /* Filter to avoid XSS attacks + */ + function urlEncodeIfNecessary(s) { + var regex = /[\\\"<>\.;]/; + var hasBadChars = regex.exec(s) != null; + return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s; + } + + /* Release memory to avoid memory leaks caused by closures, fix hanging audio/video threads and force open sockets/NetConnections to disconnect (Internet Explorer only) + */ + var cleanup = function() { + if (ua.ie && ua.win) { + window.attachEvent("onunload", function() { + // remove listeners to avoid memory leaks + var ll = listenersArr.length; + for (var i = 0; i < ll; i++) { + listenersArr[i][0].detachEvent(listenersArr[i][1], listenersArr[i][2]); + } + // cleanup dynamically embedded objects to fix audio/video threads and force open sockets and NetConnections to disconnect + var il = objIdArr.length; + for (var j = 0; j < il; j++) { + removeSWF(objIdArr[j]); + } + // cleanup library's main closures to avoid memory leaks + for (var k in ua) { + ua[k] = null; + } + ua = null; + for (var l in swfobject) { + swfobject[l] = null; + } + swfobject = null; + }); + } + }(); + + return { + /* Public API + - Reference: http://code.google.com/p/swfobject/wiki/documentation + */ + registerObject: function(objectIdStr, swfVersionStr, xiSwfUrlStr, callbackFn) { + if (ua.w3 && objectIdStr && swfVersionStr) { + var regObj = {}; + regObj.id = objectIdStr; + regObj.swfVersion = swfVersionStr; + regObj.expressInstall = xiSwfUrlStr; + regObj.callbackFn = callbackFn; + regObjArr[regObjArr.length] = regObj; + setVisibility(objectIdStr, false); + } + else if (callbackFn) { + callbackFn({success:false, id:objectIdStr}); + } + }, + + getObjectById: function(objectIdStr) { + if (ua.w3) { + return getObjectById(objectIdStr); + } + }, + + embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj, callbackFn) { + var callbackObj = {success:false, id:replaceElemIdStr}; + if (ua.w3 && !(ua.wk && ua.wk < 312) && swfUrlStr && replaceElemIdStr && widthStr && heightStr && swfVersionStr) { + setVisibility(replaceElemIdStr, false); + addDomLoadEvent(function() { + widthStr += ""; // auto-convert to string + heightStr += ""; + var att = {}; + if (attObj && typeof attObj === OBJECT) { + for (var i in attObj) { // copy object to avoid the use of references, because web authors often reuse attObj for multiple SWFs + att[i] = attObj[i]; + } + } + att.data = swfUrlStr; + att.width = widthStr; + att.height = heightStr; + var par = {}; + if (parObj && typeof parObj === OBJECT) { + for (var j in parObj) { // copy object to avoid the use of references, because web authors often reuse parObj for multiple SWFs + par[j] = parObj[j]; + } + } + if (flashvarsObj && typeof flashvarsObj === OBJECT) { + for (var k in flashvarsObj) { // copy object to avoid the use of references, because web authors often reuse flashvarsObj for multiple SWFs + if (typeof par.flashvars != UNDEF) { + par.flashvars += "&" + k + "=" + flashvarsObj[k]; + } + else { + par.flashvars = k + "=" + flashvarsObj[k]; + } + } + } + if (hasPlayerVersion(swfVersionStr)) { // create SWF + var obj = createSWF(att, par, replaceElemIdStr); + if (att.id == replaceElemIdStr) { + setVisibility(replaceElemIdStr, true); + } + callbackObj.success = true; + callbackObj.ref = obj; + } + else if (xiSwfUrlStr && canExpressInstall()) { // show Adobe Express Install + att.data = xiSwfUrlStr; + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + return; + } + else { // show alternative content + setVisibility(replaceElemIdStr, true); + } + if (callbackFn) { callbackFn(callbackObj); } + }); + } + else if (callbackFn) { callbackFn(callbackObj); } + }, + + switchOffAutoHideShow: function() { + autoHideShow = false; + }, + + ua: ua, + + getFlashPlayerVersion: function() { + return { major:ua.pv[0], minor:ua.pv[1], release:ua.pv[2] }; + }, + + hasFlashPlayerVersion: hasPlayerVersion, + + createSWF: function(attObj, parObj, replaceElemIdStr) { + if (ua.w3) { + return createSWF(attObj, parObj, replaceElemIdStr); + } + else { + return undefined; + } + }, + + showExpressInstall: function(att, par, replaceElemIdStr, callbackFn) { + if (ua.w3 && canExpressInstall()) { + showExpressInstall(att, par, replaceElemIdStr, callbackFn); + } + }, + + removeSWF: function(objElemIdStr) { + if (ua.w3) { + removeSWF(objElemIdStr); + } + }, + + createCSS: function(selStr, declStr, mediaStr, newStyleBoolean) { + if (ua.w3) { + createCSS(selStr, declStr, mediaStr, newStyleBoolean); + } + }, + + addDomLoadEvent: addDomLoadEvent, + + addLoadEvent: addLoadEvent, + + getQueryParamValue: function(param) { + var q = doc.location.search || doc.location.hash; + if (q) { + if (/\?/.test(q)) { q = q.split("?")[1]; } // strip question mark + if (param == null) { + return urlEncodeIfNecessary(q); + } + var pairs = q.split("&"); + for (var i = 0; i < pairs.length; i++) { + if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) { + return urlEncodeIfNecessary(pairs[i].substring((pairs[i].indexOf("=") + 1))); + } + } + } + return ""; + }, + + // For internal usage only + expressInstallCallback: function() { + if (isExpressInstallActive) { + var obj = getElementById(EXPRESS_INSTALL_ID); + if (obj && storedAltContent) { + obj.parentNode.replaceChild(storedAltContent, obj); + if (storedAltContentId) { + setVisibility(storedAltContentId, true); + if (ua.ie && ua.win) { storedAltContent.style.display = "block"; } + } + if (storedCallbackFn) { storedCallbackFn(storedCallbackObj); } + } + isExpressInstallActive = false; + } + } + }; +}(); http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/Radii8Remote.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/Radii8Remote.mxml b/Radii8Remote/src/Radii8Remote.mxml new file mode 100644 index 0000000..4ca4c10 --- /dev/null +++ b/Radii8Remote/src/Radii8Remote.mxml @@ -0,0 +1,80 @@ +<?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:Application 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:modules="modules.*" + minWidth="955" minHeight="600" + applicationComplete="application1_applicationCompleteHandler(event)" xmlns:utils="com.flexcapacitor.utils.*"> + + <!-- + TODO: + + - Add Add new perspective + - Add switch perspective + - Add delete perspective + - Add start docked + - Add Mini Inspector cmd click + - Add selector + + --> + + + <fx:Script> + <![CDATA[ + import mx.events.FlexEvent; + import mx.managers.PopUpManager; + + import spark.components.Group; + import spark.components.TitleContainer; + import spark.components.TitleWindow;PopUpManager; + + + public static const FLOATING_TEXT:String = "Floating"; + public static const DOCKED_TEXT:String = "Docked"; + + public var popup:Group; + public var titleWindow:TitleWindow; + public var dropRectangle:Group; + + protected function button1_clickHandler(event:MouseEvent):void { + var newTitleContainer:TitleContainer = new TitleContainer(); + newTitleContainer.showInspector(); + } + + protected function application1_applicationCompleteHandler(event:FlexEvent):void { + var newTitleContainer:TitleContainer = new TitleContainer(); + newTitleContainer.showInspector(); + + //showInspector(); + newTitleContainer.setDocked(true); + } + ]]> + </fx:Script> + + + <fx:Declarations> + <modules:InspectorContainer clearSharedObject="false"/> + <utils:MiniInspector /> + </fx:Declarations> + + <s:Button left="50" top="50" label="Get Thing" click="button1_clickHandler(event)"/> + +</s:Application> http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/assets/icons/down_disclosure.png ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/assets/icons/down_disclosure.png b/Radii8Remote/src/assets/icons/down_disclosure.png new file mode 100644 index 0000000..5e7a2c9 Binary files /dev/null and b/Radii8Remote/src/assets/icons/down_disclosure.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/assets/icons/down_disclosure2.png ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/assets/icons/down_disclosure2.png b/Radii8Remote/src/assets/icons/down_disclosure2.png new file mode 100644 index 0000000..9f24498 Binary files /dev/null and b/Radii8Remote/src/assets/icons/down_disclosure2.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/assets/icons/more.png ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/assets/icons/more.png b/Radii8Remote/src/assets/icons/more.png new file mode 100644 index 0000000..0506c3e Binary files /dev/null and b/Radii8Remote/src/assets/icons/more.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/assets/icons/more2.png ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/assets/icons/more2.png b/Radii8Remote/src/assets/icons/more2.png new file mode 100644 index 0000000..354ca4d Binary files /dev/null and b/Radii8Remote/src/assets/icons/more2.png differ http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/data/Item.as ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/data/Item.as b/Radii8Remote/src/data/Item.as new file mode 100644 index 0000000..d04eed7 --- /dev/null +++ b/Radii8Remote/src/data/Item.as @@ -0,0 +1,74 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 data { + + [Bindable] + [RemoteClass] + /** + * Describes the remote module to load + * */ + public class Item { + + public function Item(data:XML=null) { + if (data) { + unmarshall(data); + } + } + + public function unmarshall(value:XML):void { + name = String(value.@name); + url = String(value.@url); + type = String(value.@type); + description = String(value.content); + isDefault = Boolean(value.isDefault); + } + + /** + * Name of module + * */ + public var name:String; + + /** + * Description of module + * */ + public var description:String; + + /** + * URL to module swf + * */ + public var url:String; + + /** + * Type of module. Usually this is the fully qualified class name + * */ + public var type:String; + + /** + * Enabled. May not be applicable when using perspectives. IE some perspectives + * may have this enabled and others may not. + * */ + public var enabled:Boolean; + + /** + * Indicates if item is enabled by default + */ + public var isDefault:Boolean; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/data/Perspective.as ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/data/Perspective.as b/Radii8Remote/src/data/Perspective.as new file mode 100644 index 0000000..aeb9afc --- /dev/null +++ b/Radii8Remote/src/data/Perspective.as @@ -0,0 +1,136 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 data { + + /** + * Layout of views and rules. + * The items contains the list of views or child perspectives. + * Tab stops is the location of + * */ + [Bindable] + [RemoteClass] + public class Perspective { + + public static const VERTICAL:String = "vertical"; + public static const HORIZONTAL:String = "horizontal"; + public static const LEFT:String = "left"; + public static const RIGHT:String = "right"; + public static const TOP:String = "top"; + public static const BOTTOM:String = "bottom"; + + /** + * @constructor + * */ + public function Perspective() { + + } + + /** + * Name of perspective + * */ + public var name:String; + + /** + * Enabled + * */ + public var enabled:Boolean = true; + + /** + * horizontal or vertical + * */ + public var direction:String = VERTICAL; + + private var _items:Array = []; + + /** + * Items or perspectives + * */ + public function get items():Array { + return _items; + } + + /** + * @private + */ + public function set items(value:Array):void { + _items = value; + } + + + private var _visibleItems:Array; + + /** + * Items or perspectives + * */ + public function get visibleItems():Array { + + return _visibleItems; + } + + /** + * @private + */ + public function set visibleItems(value:Array):void { + _visibleItems = value; + } + + private var _types:Array = []; + /** + * List of types + * */ + public function get types():Array { + return _types; + } + /** + * List of types + * */ + public function set types(value:Array):void { + _types = value; + + } + + + /** + * List of column or row positions for each item. + * */ + public var tabStops:Array; + + /** + * Width in percent or number + * */ + public var width:Object; + + /** + * Height in percent or number + * */ + public var height:Object; + + /** + * If docked + * */ + public var docked:Boolean; + + /** + * Docked position + * */ + public var dockedPosition:String = LEFT; + + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/data/Preferences.as ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/data/Preferences.as b/Radii8Remote/src/data/Preferences.as new file mode 100644 index 0000000..e2706dc --- /dev/null +++ b/Radii8Remote/src/data/Preferences.as @@ -0,0 +1,67 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 data { + + [Bindable] + [RemoteClass] + public class Preferences { + + public function Preferences(data:XML=null) { + if (data) { + unmarshall(data); + } + } + + public function unmarshall(value:XML):void { + name = String(value.@name); + url = String(value.@url); + } + + /** + * + */ + public var name:String; + + /** + * Location of views, tools and shortcut items XML + **/ + public var url:String; + + /** + * Not applicable + * */ + public var type:Class; + + /** + * Default perspective + * */ + public var defaultPerspective:Perspective; + + /** + * Selected perspective + * */ + public var selectedPerspective:Perspective; + + /** + * List of perspectives + */ + public var perspectives:Array = []; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/managers/RemoteManager.as ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/managers/RemoteManager.as b/Radii8Remote/src/managers/RemoteManager.as new file mode 100644 index 0000000..a0afc95 --- /dev/null +++ b/Radii8Remote/src/managers/RemoteManager.as @@ -0,0 +1,545 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 managers { + import com.flexcapacitor.controller.Radiate; + + import flash.events.Event; + import flash.events.EventDispatcher; + import flash.events.IEventDispatcher; + import flash.events.IOErrorEvent; + import flash.events.SecurityErrorEvent; + import flash.net.SharedObject; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.registerClassAlias; + + import mx.binding.utils.BindingUtils; + import mx.collections.ArrayCollection; + import mx.collections.ArrayList; + import mx.events.FlexEvent; + import mx.utils.ObjectUtil; + + import data.Item; + import data.Perspective; + import data.Preferences; + + /** + * + * */ + public class RemoteManager extends EventDispatcher { + + + public static const SHARED_OBJECT_NAME:String = "save"; + public static const ITEMS_UPDATED:String = "itemsUpdated"; + public static const ITEMS_UPDATE_FAULT:String = "itemsUpdateFault"; + public static const SETTINGS_CHANGE:String = "settingChange"; + + public function RemoteManager(s:SINGLEDOUBLE) { + + //super(target as IEventDispatcher); + + // listen to changes to settings and save + addEventListener(SETTINGS_CHANGE, settingChangeHandler); + addEventListener(ITEMS_UPDATED, itemsUpdatedHandler); + } + + ///////////////////////////////////////////////////////// + /// Variables + ///////////////////////////////////////////////////////// + + /** + * + * */ + public static var clearSharedObject:Boolean; + + /** + * Indicates if getting list of items from the server + * */ + [Bindable] + public static var retrievingData:Boolean; + + /** + * Items received successfully + * */ + [Bindable] + public static var itemsReceived:Boolean; + + /** + * + * */ + public static var modulesArray:Array; + + /** + * + * */ + public static var menubarXML:XML; + + /** + * + * */ + public static var preferencesXML:XML; + + /** + * + * */ + public static var loader:URLLoader; + + /** + * URL of preferences file + * Default will be "http://www.radii8.com/panels/preferences.xml" + * */ + public static var preferencesURL:String = "preferences.xml"; + + /** + * Default types + * */ + public static var defaultTypes:Array = ["com.radii8.views.properties", "com.radii8.tools.selector"]; + + /** + * + * */ + [Bindable] + public static var preferences:Preferences; + + /** + * + * */ + [Bindable] + public static var perspectives:Array = []; + + /** + * + * */ + [Bindable] + public static var selectedPerspective:Perspective; + + /** + * + * */ + [Bindable] + public static var defaultPerspective:Perspective; + + /** + * List of XML item nodes from the server + * */ + [Bindable] + public static var itemsXMLList:XMLList; + + /** + * List of items from the server + * */ + [Bindable] + public static var remoteItemsList:ArrayCollection = new ArrayCollection(); + + /** + * + * */ + [Bindable] + public static var preferencesList:ArrayList = new ArrayList(); + + /** + * + * */ + [Bindable] + public static var perspectivesList:ArrayList = new ArrayList(); + + /** + * Must be declared before modules are loaded for singleton + * */ + public static var radiate:Radiate = Radiate.getInstance(); + + /** + * Loading status text message + * */ + [Bindable] + public static var loadingStatusText:String; + + + /** + * Adds an item to the selected perspective + * */ + public static function updatePerspectiveItem(perspective:Perspective, item:Item, add:Boolean):void { + var types:Array = perspective.types; + var count:int = types ? types.length : 0; + var exists:Boolean; + var i:int; + + // add item + if (add) { + for (i;i<count;i++) { + + // check if item is already added + if (types[i]==item.type) { + exists = true; + break; + } + } + + if (!exists) { + types.push(item.type); + } + } + else { + for (i;i<count;i++) { + + // check if item is in perspective + if (types[i]==item.type) { + types.splice(i, 1); + break; + } + } + } + } + + /** + * Register classes for saving settings + * */ + public static function init(clearCache:Boolean = false):void { + var saveData:SharedObject = SharedObject.getLocal(SHARED_OBJECT_NAME); + clearSharedObject = clearCache; + + registerClassAlias("Item", Item); + registerClassAlias("Preferences", Preferences); + registerClassAlias("Perspective", Perspective); + + // clear the saved data + if (clearSharedObject) { + saveData.clear(); + } + + createInitialPreferences(); + getSettings(); + //getRemoteItems(); + } + + + /** + * Creates settings if they don't exist + * */ + public static function createInitialPreferences():void { + var saveData:SharedObject = SharedObject.getLocal(SHARED_OBJECT_NAME); + preferences = saveData.data.preferences; + + // create default settings + if (!preferences) { + createDefaultPreferences(); + saveSettings(); + } + else { + + defaultPerspective = preferences.defaultPerspective; + selectedPerspective = preferences.selectedPerspective; + perspectives = preferences.perspectives; + perspectivesList.source = perspectives; + } + + } + + /** + * Create default preferences locally. + * Sets default perspective and selected perspective + * */ + public static function createDefaultPreferences():void { + var newPerspective:Perspective; + var newPreferences:Preferences; + + newPreferences = new Preferences(); + newPreferences.name = "Default Preferences"; + newPreferences.url = preferencesURL; + + newPerspective = new Perspective(); + newPerspective.name = "Default Perspective"; + newPerspective.types = defaultTypes; + + defaultPerspective = newPerspective; + selectedPerspective = newPerspective; + + newPreferences.perspectives = perspectives; + + perspectives.push(newPerspective); + + preferences = newPreferences; + } + + /** + * Create perspective + * */ + public function createPerspective(name:String = ""):Perspective { + var newPerspective:Perspective; + + newPerspective = new Perspective(); + newPerspective.name = name!="" ? name : "Perspective " + (perspectives.length + 1); + newPerspective.types = defaultTypes.slice(); + + selectedPerspective = newPerspective; + + perspectives.push(newPerspective); + + return newPerspective; + } + + /** + * Gets settings from disk + * */ + public static function getSettings():void { + var saveData:SharedObject = SharedObject.getLocal(SHARED_OBJECT_NAME); + var savedPreferences:Preferences = saveData.data.preferences; + + + // set selected perspective + if (savedPreferences) { + if (savedPreferences.selectedPerspective) { + preferences.selectedPerspective = savedPreferences.defaultPerspective; + } + if (savedPreferences.perspectives) { + preferences.perspectives = savedPreferences.perspectives; + } + } + + trace("Getting Settings:\n" + ObjectUtil.toString(saveData.data.preferences)); + + } + + /** + * Saves changes to settings when dispatched from modules + * */ + public static function settingChangeHandler(event:Event):void { + saveSettings(); + } + + /** + * Saves settings to disk + * */ + public static function saveSettings():void { + var saveData:SharedObject = SharedObject.getLocal(SHARED_OBJECT_NAME); + + preferences.defaultPerspective = defaultPerspective; + preferences.selectedPerspective = selectedPerspective; + preferences.perspectives = perspectives; + + saveData.data.preferences = preferences; + + saveData.flush(); + + //trace("Saving Settings:" + saveData.data.preferences); + } + + /** + * Get Remote Items + * */ + public function getRemoteItems():void { + retrievingData = true; + itemsReceived = false; + + // if there are no items then get remote list of items + addEventListener(ITEMS_UPDATED, itemsUpdatedHandler); + addEventListener(ITEMS_UPDATE_FAULT, itemsUpdateFaultHandler); + + retrieveRemoteItems(); + + + loadingStatusText = "Getting Remote Items..."; + + + } + + /** + * + * */ + protected function itemsUpdatedHandler(event:Event):void { + trace("received items"); + } + + /** + * Parses list of views available on the server + * */ + public function getRemoteItemsHandler(event:Event):void { + var data:String = loader.data as String; + retrievingData = false; + + try { + var xml:XML = new XML(data); + itemsXMLList = xml.items.item; + + loadingStatusText += "\nData received..."; + + addRemoteItemsList(); + + loadingStatusText += "\nParsed data items..."; + loadingStatusText += "\nLoading Complete..."; + loadingStatusText += "\nFound " + remoteItemsList.length + " views..."; + loadingStatusText += "\nClick Continue..."; + + itemsReceived = true; + + updatedPerspectivesHandler(); + + dispatchEvent(new Event(ITEMS_UPDATED)); + } + catch (error:Error) { + + itemsReceived = false; + + loadingStatusText += "\nError in data: " + error.message; + + } + + } + + /** + * Offline + * */ + public function ioErrorHandler(event:IOErrorEvent):void { + var error:String; + retrievingData = false; + dispatchEvent(new Event(ITEMS_UPDATE_FAULT)); + itemsReceived = false; + + loadingStatusText += "\n" + event.text; + } + + /** + * Offline + * */ + public function securityErrorHandler(event:SecurityErrorEvent):void { + var error:String; + retrievingData = false; + itemsReceived = false; + + dispatchEvent(new Event(ITEMS_UPDATE_FAULT)); + + loadingStatusText += "\n" + event.text; + } + + + + /** + * Converts items to objects + * */ + public static function addRemoteItemsList():void { + var count:int = itemsXMLList.length(); + remoteItemsList.removeAll(); + + for (var i:int;i<count;i++) { + var item:Item = new Item(itemsXMLList[i]); + remoteItemsList.addItem(item); + } + + } + + /** + * Loads the available remote items from the preferences URL + * */ + public function retrieveRemoteItems():void { + var request:URLRequest = new URLRequest(preferencesURL); + + loader = new URLLoader(request); + loader.addEventListener(Event.COMPLETE, getRemoteItemsHandler); + loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); + loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + + } + + /** + * Updates the items in the + * */ + public function updateSelectedItemsHandler(event:Event):void { + + //updateDefaultItems(); + //saveSettings(); + + //removeEventListener(ITEMS_UPDATED, updateSelectedItemsHandler); + //removeEventListener(ITEMS_UPDATE_FAULT, itemsUpdateFaultHandler); + } + + + /** + * + * */ + public function itemsUpdateFaultHandler(event:Event):void { + //removeEventListener(ITEMS_UPDATED, updateSelectedItemsHandler); + //removeEventListener(ITEMS_UPDATE_FAULT, itemsUpdateFaultHandler); + } + + /** + * Updates and adds remote items to all perspectives + * */ + public function updatedPerspectivesHandler():void { + var perspectiveCount:int = perspectives.length; + var currentPerspective:Perspective; + var remoteItemsCount:int = remoteItemsList.length; + var types:Array; + var items:Array; + var item:Item; + + for (var j:int;j<perspectiveCount;j++) { + currentPerspective = perspectives[j]; + types = currentPerspective.types; + currentPerspective.items = []; + + for (var i:int;i<remoteItemsCount;i++) { + item = remoteItemsList.getItemAt(i) as Item; + + if (currentPerspective.types.indexOf(item.type)!=-1) { + updatePerspectiveItem(currentPerspective, item, true); + } + } + } + } + + /** + * finds perspective by name + * */ + public function findPerspectiveByName(name:String):Perspective { + var perspectiveCount:int = perspectives.length; + var currentPerspective:Perspective; + + for (var j:int;j<perspectiveCount;j++) { + currentPerspective = perspectives[j]; + + if (currentPerspective.name==name) { + return currentPerspective; + } + } + + return null; + } + + //---------------------------------- + // instance + //---------------------------------- + private static var _instance:RemoteManager; + + public static function get instance():RemoteManager + { + if (!_instance) { + _instance = new RemoteManager(new SINGLEDOUBLE()); + } + return _instance; + } + + public static function getInstance():RemoteManager { + return instance; + } + } +} + + +class SINGLEDOUBLE{} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/flex-radii8/blob/f370bfcf/Radii8Remote/src/modules/Components.mxml ---------------------------------------------------------------------- diff --git a/Radii8Remote/src/modules/Components.mxml b/Radii8Remote/src/modules/Components.mxml new file mode 100644 index 0000000..485a2be --- /dev/null +++ b/Radii8Remote/src/modules/Components.mxml @@ -0,0 +1,44 @@ +<?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:Module 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:views="com.flexcapacitor.views.*" + width="100%" height="100%" + minHeight="300" + minWidth="200"> + + + <s:Rect width="100%" height="100%"> + <s:fill> + <s:SolidColor color="#0000ff" alpha=".05"/> + </s:fill> + <s:stroke> + <s:SolidColorStroke color="#000000" weight="1" alpha=".1"/> + </s:stroke> + </s:Rect> + + + <views:Components width="100%" height="100%" + bottom="0" top="0" + contentBackgroundAlpha="0" + /> + +</s:Module>