You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flex.apache.org by ah...@apache.org on 2014/10/02 21:58:58 UTC

[2/8] git commit: [flex-asjs] [refs/heads/develop] - more beads needed by FlexJSStore

more beads needed by FlexJSStore


Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/c1bd651d
Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/c1bd651d
Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/c1bd651d

Branch: refs/heads/develop
Commit: c1bd651d7f776e28b3c25449c4f1e1279fe365e0
Parents: e5b1ae7
Author: Alex Harui <ah...@apache.org>
Authored: Thu Oct 2 12:40:45 2014 -0700
Committer: Alex Harui <ah...@apache.org>
Committed: Thu Oct 2 12:58:44 2014 -0700

----------------------------------------------------------------------
 .../as/projects/FlexJSJX/basic-manifest.xml     |   2 +
 .../as/projects/FlexJSJX/src/FlexJSJXClasses.as |   1 +
 .../org/apache/flex/core/ParentDocumentBead.as  | 121 ++++++++++++
 .../src/org/apache/flex/effects/Resize.as       | 191 +++++++++++++++++++
 4 files changed, 315 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1bd651d/frameworks/as/projects/FlexJSJX/basic-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/basic-manifest.xml b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
index eebea31..ae2109e 100644
--- a/frameworks/as/projects/FlexJSJX/basic-manifest.xml
+++ b/frameworks/as/projects/FlexJSJX/basic-manifest.xml
@@ -54,6 +54,7 @@
 
     <component id="Fade" class="org.apache.flex.effects.Fade"/>
     <component id="Move" class="org.apache.flex.effects.Move"/>
+    <component id="Resize" class="org.apache.flex.effects.Resize"/>
     <component id="Wipe" class="org.apache.flex.effects.Wipe"/>
     <component id="Sequence" class="org.apache.flex.effects.Sequence"/>
     <component id="Parallel" class="org.apache.flex.effects.Parallel"/>
@@ -66,5 +67,6 @@
     <component id="MXMLBeadViewBaseDataBinding" class="org.apache.flex.core.MXMLBeadViewBaseDataBinding"/>
     <component id="LayoutChangeNotifier" class="org.apache.flex.html.beads.layouts.LayoutChangeNotifier"/>
     <component id="ImageButton" class="org.apache.flex.html.ImageButton"/>
+    <component id="ParentDocumentBead" class="org.apache.flex.core.ParentDocumentBead"/>
 
 </componentPackage>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1bd651d/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
index d103772..5e10ded 100644
--- a/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
+++ b/frameworks/as/projects/FlexJSJX/src/FlexJSJXClasses.as
@@ -72,6 +72,7 @@ internal class FlexJSJXClasses
     import org.apache.flex.html.beads.TitleBarView; TitleBarView;
     import org.apache.flex.html.beads.TitleBarMeasurementBead; TitleBarMeasurementBead;
 
+    import org.apache.flex.core.ParentDocumentBead; ParentDocumentBead;
 }
 
 }

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1bd651d/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ParentDocumentBead.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ParentDocumentBead.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ParentDocumentBead.as
new file mode 100644
index 0000000..8fb623e
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/core/ParentDocumentBead.as
@@ -0,0 +1,121 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.core
+{
+    import org.apache.flex.core.IBead;
+    import org.apache.flex.core.IChild;
+    import org.apache.flex.core.IMXMLDocument;
+    import org.apache.flex.core.IStrand;
+    import org.apache.flex.events.Event;
+    import org.apache.flex.events.EventDispatcher;
+    
+    /**
+     *  The ParentDocumentBead class looks up the parent
+     *  chain to find a parent that was written in MXML.
+     *  Because it is usually rare for an application
+     *  to need to know this information, an optional bead
+     *  is used to compute it, instead of baking in the
+     *  overhead of a recursive infrastucture to store
+     *  this information.  It is intended to be used
+     *  as a bead in the top-level tag of an MXML document.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion FlexJS 0.0
+     */
+	public class ParentDocumentBead extends EventDispatcher implements IBead
+	{
+        /**
+         *  Constructor.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+		public function ParentDocumentBead()
+		{
+			super();
+		}
+        
+        private var _strand:IStrand;
+        
+        /**
+         *  @copy org.apache.flex.core.IBead#strand
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function set strand(value:IStrand):void
+        {
+            _strand = value;
+            
+            //TODO (aharui) watch for re-parenting
+        }    
+
+        private var _id:String;
+        
+        /**
+         *  An id property for MXML documents.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get id():String
+        {
+            return _id;
+        }
+        
+        /**
+         *  @private
+         */
+        public function set id(value:String):void
+        {
+            if (_id != value)
+            {
+                _id = value;
+                dispatchEvent(new org.apache.flex.events.Event("idChanged"));
+            }
+        }
+        
+        [Bindable("parentDocumentChange")]
+        public function get parentDocument():Object
+        {
+            var child:IChild = _strand as IChild;
+            child = child.parent as IChild;
+            while (child)
+            {
+                if (child is IMXMLDocument)
+                {
+                    var doc:IMXMLDocument = child as IMXMLDocument;
+                    if (doc.MXMLDescriptor != null)
+                        return doc;
+                }
+                child = child.parent as IChild;
+            }
+            return null;
+        }
+        
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/c1bd651d/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
----------------------------------------------------------------------
diff --git a/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
new file mode 100644
index 0000000..298dc39
--- /dev/null
+++ b/frameworks/as/projects/FlexJSJX/src/org/apache/flex/effects/Resize.as
@@ -0,0 +1,191 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.effects
+{
+
+import org.apache.flex.core.IDocument;
+import org.apache.flex.core.IUIBase;
+
+/**
+ *  The Resize effect animates a UI component's width or height.
+ * 
+ *  @langversion 3.0
+ *  @playerversion Flash 10.2
+ *  @playerversion AIR 2.6
+ *  @productversion FlexJS 0.0
+ */
+public class Resize extends Tween implements IDocument
+{
+
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  @param target Object ID or reference to an object that will
+	 *  have its x and/or y property animated.
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function Resize(target:IUIBase = null)
+    {
+        super();
+
+		this.target = target;
+		startValue = 0;
+		endValue = 1;
+		
+		listener = this;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    //  Variables
+    //
+    //--------------------------------------------------------------------------
+
+	/**
+	 *  @private
+	 *  The document.
+	 */
+	private var document:Object;
+
+	/**
+	 *  @private
+	 *  The target.
+	 */
+	private var target:IUIBase;
+    
+	/**
+	 *  The change in width.
+	 */
+	public var widthBy:Number;
+	
+	/**
+	 *  The change in height.
+	 */
+	public var heightBy:Number;
+	
+	/**
+	 *  @private
+	 *  The starting width.
+	 */
+	private var widthStart:Number;
+	
+	/**
+	 *  @private
+	 *  The starting height.
+	 */
+	private var heightStart:Number;
+
+	/**
+	 *  Starting width value.  If NaN, the current width value is used
+     */
+    public var widthFrom:Number;
+    
+	/**
+	 *  Starting height value.  If NaN, the current height value is used
+	 */
+	public var heightFrom:Number;
+		
+    /**
+     *  Ending width value.
+     */
+    public var widthTo:Number;
+    
+    /**
+     *  Ending height value.
+     */
+    public var heightTo:Number;
+    
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Properties
+    //
+    //--------------------------------------------------------------------------
+
+    
+    //--------------------------------------------------------------------------
+    //
+    //  Methods
+    //
+    //--------------------------------------------------------------------------
+
+	public function setDocument(document:Object, id:String = null):void
+	{
+		this.document = document;	
+	}
+	
+	/**
+	 *  @private
+	 */
+	override public function play():void
+	{
+		if (target is String)
+			target = document[target];
+		
+		if (isNaN(widthFrom))
+			widthStart = target.width;
+        if (isNaN(widthBy))
+        {
+    		if (isNaN(widthTo))
+                widthBy = 0;
+    		else
+                widthBy = widthTo - widthStart;
+        }
+        
+		if (isNaN(heightFrom))
+			heightStart = target.height;
+        if (isNaN(heightBy))
+        {
+    		if (isNaN(heightTo))
+                heightBy = 0;
+    		else
+                heightBy = heightTo - heightStart;
+        }			
+		super.play();
+	}
+
+	public function onTweenUpdate(value:Number):void
+	{
+		if (widthBy)
+			target.width = widthStart + value * widthBy;
+		if (heightBy)
+			target.height = heightStart + value * heightBy;
+	}
+	
+	public function onTweenEnd(value:Number):void
+	{
+		if (widthBy)
+			target.width = widthStart + widthBy;
+		if (heightBy)
+			target.height = heightStart + heightBy;
+	}
+}
+
+}