You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by jm...@apache.org on 2014/09/21 04:22:45 UTC

svn commit: r1626510 - in /flex/site/trunk/content/tourdeflex: SourceTab.mxml SourceTab.swf explorer.mxml explorer.swf viewsource.mxml

Author: jmclean
Date: Sun Sep 21 02:22:45 2014
New Revision: 1626510

URL: http://svn.apache.org/r1626510
Log:
New TourDEflex 1.1 viewer

Modified:
    flex/site/trunk/content/tourdeflex/SourceTab.mxml
    flex/site/trunk/content/tourdeflex/SourceTab.swf
    flex/site/trunk/content/tourdeflex/explorer.mxml
    flex/site/trunk/content/tourdeflex/explorer.swf
    flex/site/trunk/content/tourdeflex/viewsource.mxml

Modified: flex/site/trunk/content/tourdeflex/SourceTab.mxml
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/tourdeflex/SourceTab.mxml?rev=1626510&r1=1626509&r2=1626510&view=diff
==============================================================================
--- flex/site/trunk/content/tourdeflex/SourceTab.mxml (original)
+++ flex/site/trunk/content/tourdeflex/SourceTab.mxml Sun Sep 21 02:22:45 2014
@@ -26,6 +26,8 @@
         import mx.rpc.events.FaultEvent;
         import mx.controls.Alert;
 
+		public var app:String;
+			
         public function set source(file:String):void
         {
             label = file.substring(file.lastIndexOf("/")+1);
@@ -46,6 +48,25 @@
         {
             Alert.show("Error loading source file");
         }
+			
+		private function copyCode():void
+        {
+        	System.setClipboard(ta.text);
+        }
+		
+		private function copyLink():void
+        {
+			var linkText:String = "http://flex.apache.org/tourdeflex/?app=" + app;
+			
+        	System.setClipboard(linkText);
+        }
+			
+		private function viewInGitHub():void
+		{
+			var gitHubLink:String = "https://github.com/apache/flex-utilities/tree/master/TourDeFlex/TourDeFlex3/src/" + srv.url;
+			var urlRequest:URLRequest = new URLRequest(gitHubLink);
+			navigateToURL(urlRequest, "_blank");
+		}
 
         ]]>
     </fx:Script>
@@ -54,6 +75,11 @@
     	<mx:HTTPService id="srv" useProxy="false" resultFormat="text" result="resultHandler(event)" fault="faultHandler(event)"/>
 	</fx:Declarations>
 	
-    <mx:TextArea id= "ta" color="#0000A0" fontFamily="Courier" editable="false" wordWrap="false" width="100%" height="100%"/>
-
+    <mx:TextArea id="ta" color="#0000A0" fontFamily="Courier" editable="false" wordWrap="false" width="100%" height="100%"/>
+	<mx:HBox width="100%">
+		<mx:Spacer width="100%" />
+		<mx:Button label="Copy" click="copyCode()" />
+		<mx:Button label="Copy Link" click="copyLink()" />
+		<mx:Button label="GitHub" click="viewInGitHub()" />
+	</mx:HBox>
 </mx:VBox>
\ No newline at end of file

Modified: flex/site/trunk/content/tourdeflex/SourceTab.swf
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/tourdeflex/SourceTab.swf?rev=1626510&r1=1626509&r2=1626510&view=diff
==============================================================================
Binary files - no diff available.

Modified: flex/site/trunk/content/tourdeflex/explorer.mxml
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/tourdeflex/explorer.mxml?rev=1626510&r1=1626509&r2=1626510&view=diff
==============================================================================
--- flex/site/trunk/content/tourdeflex/explorer.mxml (original)
+++ flex/site/trunk/content/tourdeflex/explorer.mxml Sun Sep 21 02:22:45 2014
@@ -18,46 +18,109 @@
 
 <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:explorer="*"
     width="100%" height="100%" pageTitle="{TITLE}"
-    initialize="sdk.send()" layout="vertical">
+    initialize="init()" creationComplete="checkParameters()" layout="vertical">
 
     <fx:Script>
         <![CDATA[
-			
-		static protected const VERSION:String = "1.0";	
+		import mx.core.FlexGlobals;
+
+		static protected const VERSION:String = "1.1";	
 		static protected const TITLE:String = "Tour De Flex Component Explorer";
-		static protected const FULL_TITLE:String = "Apache Flex™ Tour De Flex Component Explorer " + VERSION;
+		static protected const FULL_TITLE:String = "Apache Flex® Tour De Flex Component Explorer " + VERSION;
+
+		[Embed(source="explorer.xml", mimeType="application/octet-stream")]
+		private var XMLData:Class;
+			
+		[Bindable]
+		protected var noExamples:int = 0;
+			
+		private function init():void
+		{
+			var data:XML = XML(new XMLData());
+			
+            explorerTree = XML(data.node);
+            compLibTree.dataProvider = explorerTree;
+			
+			noExamples = (explorerTree..node.(hasOwnProperty("@app") && @app.length() > 0)).length();
+		}
+		
+		protected function checkParameters():void
+		{		
+			var parameters:Object = FlexGlobals.topLevelApplication.parameters;
+			
+			if (parameters.hasOwnProperty("app")) {
+				var application:String = parameters.app;
+				var source:String = explorerTree..node.(hasOwnProperty("@app") && @app == application).@src;
+				loadApp(application, source);
+				openNode(application);
+			}			
+		}
 
         private function treeChanged(event:Event):void
         {
             var nodeApp:String = compLibTree.selectedItem.@app;
+			
             if (nodeApp != null && nodeApp != "")
             {
-                swfLoader.loadApp(nodeApp + ".swf");
-                vs.loadSource(nodeApp, compLibTree.selectedItem.@src);
+				loadApp(nodeApp, compLibTree.selectedItem.@src);
             }
             else
             {
                 compLibTree.expandItem(compLibTree.selectedItem, true, true);
             }
         }
-
-        private function xmlLoaded():void
-        {
-            explorerTree = XML(sdk.lastResult.node);
-            compLibTree.dataProvider = explorerTree;
-        }
-        ]]>
+			
+		private function loadApp(application:String, source:String):void
+		{
+			swfLoader.loadApp(application + ".swf");
+            vs.loadSource(application, source);
+		}
+			
+		private function gotoHome(event:Event):void
+		{
+			var urlRequest:URLRequest = new URLRequest("http://flex.apache.org/download-tourdeflex.html");
+			navigateToURL(urlRequest);
+		}	
+		
+		private function openNode(application:String):void
+		{
+			var node:XML = explorerTree..node.(hasOwnProperty("@app") && @app == application)[0];
+			var parent:XML;
+			var nodes:Array = [];
+			 
+			if (!node) {
+				return;
+			}
+			
+			parent = node.parent();
+			 
+			while (parent != null) {
+			    if (!compLibTree.isItemOpen(parent)) {
+			        nodes.push(parent);
+			    }
+			    parent = parent.parent();
+			}
+			 
+			for each (var expand:XML in nodes) {
+			    compLibTree.expandItem(expand, true);
+			}
+			 
+			compLibTree.selectedIndex = compLibTree.getItemIndex(node);
+			compLibTree.scrollToIndex(explorerTree.selectedIndex);
+		}
+	
+		]]>
     </fx:Script>
 
 	<fx:Declarations>
     	<fx:XML id="explorerTree"/>
-
-   		<mx:HTTPService id="sdk" url="explorer.xml" resultFormat="e4x" result="xmlLoaded()" />
 	</fx:Declarations>
 	
 	<mx:HBox width="100%">
-		<mx:Image source="./mx/controls/assets/ApacheFlexIcon.png" />
+		<mx:Image source="./mx/controls/assets/ApacheFlexIcon.png" useHandCursor="true" buttonMode="true" click="gotoHome(event)" />
 		<mx:Label text="{FULL_TITLE}" fontSize="20" fontWeight="bold" />
+		<mx:Spacer width="100%" />
+		<mx:Label text="{noExamples} examples" />
 	</mx:HBox>
     <mx:HDividedBox width="100%" height="100%">
         <mx:Panel width="30%" height="100%" title="{TITLE}" dropShadowVisible="false">
@@ -74,4 +137,4 @@
 	<mx:HBox width="100%">
 		<mx:Label fontSize="9" width="100%" text="Copyright © 2014 The Apache Software Foundation, Licensed under the Apache License, Version 2.0. Apache Flex is trademark of The Apache Software Foundation." />
 	</mx:HBox>
-</mx:Application>
+</mx:Application>
\ No newline at end of file

Modified: flex/site/trunk/content/tourdeflex/explorer.swf
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/tourdeflex/explorer.swf?rev=1626510&r1=1626509&r2=1626510&view=diff
==============================================================================
Binary files - no diff available.

Modified: flex/site/trunk/content/tourdeflex/viewsource.mxml
URL: http://svn.apache.org/viewvc/flex/site/trunk/content/tourdeflex/viewsource.mxml?rev=1626510&r1=1626509&r2=1626510&view=diff
==============================================================================
--- flex/site/trunk/content/tourdeflex/viewsource.mxml (original)
+++ flex/site/trunk/content/tourdeflex/viewsource.mxml Sun Sep 21 02:22:45 2014
@@ -46,6 +46,7 @@
 						tabs[i] = new SourceTab();
 						tn.addChild(tabs[i]);
 						tabs[i].source = files[i];
+						tabs[i].app = appUrl;
     	    		}
 				}
 			}