incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject svn commit: r1370323 [12/12] - in /incubator/flex/trunk/mustella/tests/itemRenderers: ./ Assets/ Halo/ Halo/DataGrid/ Halo/DataGrid/SWFs/ Halo/DataGrid/SWFs/assets/ Halo/DataGrid/SWFs/comps/ Halo/DataGrid/SWFs/view/ Halo/DataGrid/baselines/ Halo/DataGr...
Date Tue, 07 Aug 2012 15:39:45 GMT
Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyCheckItemRendererUpdated.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyCheckItemRendererUpdated.as?rev=1370323&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyCheckItemRendererUpdated.as
(added)
+++ incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyCheckItemRendererUpdated.as
Tue Aug  7 15:39:33 2012
@@ -0,0 +1,111 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 comps {
+
+    import flash.display.DisplayObject;
+    import flash.xml.*;
+    
+    import mx.controls.CheckBox;
+    import mx.controls.Tree;
+    import mx.controls.listClasses.*;
+    import mx.controls.treeClasses.*;
+    import mx.core.IDataRenderer;
+ 
+
+    public class MyCheckItemRendererUpdated extends TreeItemRenderer
+    {
+
+        protected var myCheckBox:CheckBox;
+        private var listOwner:Tree;
+        private var folderCbX:uint = 32;
+        private var leafCbX:uint = 40;
+        private var margin:uint = 15;
+       
+        override protected function createChildren():void
+        {
+               super.createChildren();
+                
+               myCheckBox = new CheckBox();
+               addChild(myCheckBox);
+   
+        }   
+ 
+        override public function set data(value:Object):void
+        {
+           
+            super.data = value;
+            
+            if(value != null)
+            {
+            	
+                if(TreeListData(super.listData).hasChildren)
+		{
+	            myCheckBox.visible = false;
+                    myCheckBox.includeInLayout = false; 
+                }
+                else
+		{
+		    myCheckBox.visible = true;
+		    myCheckBox.includeInLayout = true; 
+                }
+                if(value.@selected == "true")
+                {
+                    myCheckBox.selected = true;
+                }
+		else
+                {
+                    myCheckBox.selected = false;
+                }                
+            }
+        }
+          
+       override protected function commitProperties():void
+       {
+           super.commitProperties();
+                        
+           if (icon)
+           {
+               if(!TreeListData(listData).hasChildren)
+               {
+                   removeChild(DisplayObject(icon));
+                   icon = null;
+               }
+           }
+                              
+      }
+     
+      override protected function updateDisplayList(unscaledWidth:Number,unscaledHeight:Number):void
+      {       
+            super.updateDisplayList(unscaledWidth, unscaledHeight);
+            
+            label.y = 0;
+            
+            if(super.listData)
+            {
+                myCheckBox.x = (TreeListData(listData).hasChildren) ? folderCbX : leafCbX;
+		myCheckBox.y = 0;
+		myCheckBox.setActualSize(8, myCheckBox.measuredHeight);
+                if(! TreeListData(listData).hasChildren)
+                {
+                    super.label.x = myCheckBox.x + myCheckBox.width + margin;
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyTreeItemRenderer.as
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyTreeItemRenderer.as?rev=1370323&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyTreeItemRenderer.as
(added)
+++ incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/SWFs/comps/MyTreeItemRenderer.as
Tue Aug  7 15:39:33 2012
@@ -0,0 +1,75 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 comps
+{
+
+import mx.controls.treeClasses.*;
+import mx.collections.*;
+
+	public class MyTreeItemRenderer extends TreeItemRenderer
+	{
+		
+        public function MyTreeItemRenderer() 
+		{
+			super();
+
+			// InteractiveObject variables.
+			mouseEnabled = false;
+			
+		}
+		
+		override public function set data(value:Object):void
+		{
+				if(value != null)
+				{ 
+				     super.data = value;
+				     if(TreeListData(super.listData).hasChildren)
+					{
+						setStyle("color", 0xff0000);
+						setStyle("fontWeight", 'bold');
+					}
+					else
+					{
+						setStyle("color", 0x000000);
+						setStyle("fontWeight", 'normal');
+					}
+				}
+			
+	        
+	    }
+	 
+
+	   override protected function updateDisplayList(unscaledWidth:Number,
+														  unscaledHeight:Number):void
+	   {
+				super.updateDisplayList(unscaledWidth, unscaledHeight);
+		        if(super.data)
+		        {
+				    if(TreeListData(super.listData).hasChildren)
+				    {
+				        var tmp:XMLList = new XMLList(TreeListData(super.listData).item);
+				        var myStr:int = tmp[0].children().length();
+				        super.label.text =  TreeListData(super.listData).label + "(" + myStr + ")";
+				    }
+				}
+	    }
+
+	}
+
+}

Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomBranches.png
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomBranches.png?rev=1370323&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomBranches.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodes.png
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodes.png?rev=1370323&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodes.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodesUpdated.png
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodesUpdated.png?rev=1370323&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/baselines/TreeCustomNodesUpdated.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/test_scripts/Tree_customItemRenderers_spark.mxml
URL: http://svn.apache.org/viewvc/incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/test_scripts/Tree_customItemRenderers_spark.mxml?rev=1370323&view=auto
==============================================================================
--- incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/test_scripts/Tree_customItemRenderers_spark.mxml
(added)
+++ incubator/flex/trunk/mustella/tests/itemRenderers/Spark/Tree/test_scripts/Tree_customItemRenderers_spark.mxml
Tue Aug  7 15:39:33 2012
@@ -0,0 +1,79 @@
+<?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.
+
+-->
+<UnitTester testDir="itemRenderers/Spark/Tree/test_scripts/"  xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns="*" testSWF="Tree_customTests_spark.mxml">
+
+    <mx:Script>
+	<![CDATA[
+
+public static function init(o:DisplayObject):void
+		{
+
+		}
+
+	]]>
+	</mx:Script>
+
+	<mx:Metadata>
+	<![CDATA[
+		[Mixin]
+	]]>
+	</mx:Metadata>
+
+	<testCases>
+    <!--custom parent renderers-->
+        <TestCase testID="CheckBoxRenderer_TreeBranches" description="This tests the visual
appearance of a custom itemRenderer for Tree Branches that uses a CheckBox" keywords="[Tree,
itemRenderers]">
+			<body>
+			    <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="treeCustomBranches"
/>
+			    <DispatchKeyEvent keys="[DOWN]" waitEvent="change" waitTarget="treeCustomBranches"
/>
+			    <DispatchKeyEvent keys="[RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomBranches"
/>
+			    <DispatchKeyEvent keys="[DOWN]" waitEvent="change" waitTarget="treeCustomBranches"
/>
+			    <DispatchKeyEvent keys="[RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomBranches"
/>
+				<CompareBitmap url="../baselines/TreeCustomBranches.png" target="treeCustomBranches"
/>
+			</body>
+		</TestCase>
+    <!--custom child renderers-->
+        <TestCase testID="CheckBoxRenderer_TreeNodes" description="This tests the visual
appearance of a custom itemRenderer for Tree Nodes that uses a CheckBox" keywords="[CheckBox,
Tree, itemRenderers]">
+			<body>
+			    <DispatchKeyEvent keys="[TAB]" waitEvent="focusIn" waitTarget="treeCustomNodes"
/>
+			    <DispatchKeyEvent keys="[DOWN]" waitEvent="change" waitTarget="treeCustomNodes"
/>
+			    <DispatchKeyEvent keys="[RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes"
/>
+			    <DispatchKeyEvent keys="[DOWN]" waitEvent="change" waitTarget="treeCustomNodes"
/>
+			    <DispatchKeyEvent keys="[RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes"
/>
+				<CompareBitmap url="../baselines/TreeCustomNodes.png" target="treeCustomNodes" />
+			</body>
+		</TestCase>
+    <!--custom child renderers-->
+        <TestCase testID="UpdatedCheckBoxRenderer_TreeNodes" description="This tests the
visual appearance of a custom itemRenderer for Tree Nodes that uses a CheckBox" keywords="[CheckBox,
Tree, itemRenderers]">
+			<body>
+			    <DispatchKeyEvent keys="[TAB,TAB,TAB,TAB]" waitEvent="focusIn" waitTarget="treeCustomNodes1"
/>
+			    <DispatchKeyEvent keys="[DOWN,RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes1"
/>
+			    <DispatchKeyEvent keys="[DOWN,RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes1"
/>
+			    <WaitForEffectsToEnd/>
+			    <DispatchKeyEvent keys="[DOWN,DOWN,RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes1"
/>
+			    <WaitForEffectsToEnd/>
+			    <DispatchKeyEvent keys="[DOWN,DOWN,DOWN,DOWN,RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes1"
/>
+			    <DispatchKeyEvent keys="[DOWN,RIGHT]" waitEvent="itemOpen" waitTarget="treeCustomNodes1"
/>
+			    <WaitForEffectsToEnd/>
+
+			    <CompareBitmap url="../baselines/TreeCustomNodesUpdated.png" target="treeCustomNodes1"
/>
+			</body>
+		</TestCase>
+	</testCases>
+</UnitTester>



Mime
View raw message