flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [1/3] git commit: [flex-asjs] [refs/heads/core_js_to_as] - have ViewBase also implement IStatesObject
Date Sat, 12 Dec 2015 07:31:23 GMT
Repository: flex-asjs
Updated Branches:
  refs/heads/core_js_to_as 8a3755f29 -> 20e764d25


have ViewBase also implement IStatesObject


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

Branch: refs/heads/core_js_to_as
Commit: 018ff46d42722be0cd0a952a1bb204b4e997db05
Parents: 8a3755f
Author: Alex Harui <aharui@apache.org>
Authored: Fri Dec 11 23:26:16 2015 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Fri Dec 11 23:26:16 2015 -0800

----------------------------------------------------------------------
 .../org/apache/flex/core/IApplicationView.as    |   2 +-
 .../src/org/apache/flex/core/IStatesObject.as   |   5 +
 .../org/apache/flex/createjs/core/ViewBase.as   | 121 +++++++++++++++++++
 3 files changed, 127 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/018ff46d/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as
index b011cd1..c4eab58 100755
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IApplicationView.as
@@ -27,7 +27,7 @@ package org.apache.flex.core
      *  @playerversion AIR 2.6
      *  @productversion FlexJS 0.0
      */
-    public interface IApplicationView extends IUIBase
+    public interface IApplicationView extends IUIBase, IStatesObject
 	{
         /**
          *  The application model.

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/018ff46d/frameworks/projects/Core/as/src/org/apache/flex/core/IStatesObject.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/Core/as/src/org/apache/flex/core/IStatesObject.as b/frameworks/projects/Core/as/src/org/apache/flex/core/IStatesObject.as
index 2088e7b..52bcdb6 100644
--- a/frameworks/projects/Core/as/src/org/apache/flex/core/IStatesObject.as
+++ b/frameworks/projects/Core/as/src/org/apache/flex/core/IStatesObject.as
@@ -51,6 +51,11 @@ package org.apache.flex.core
          *  @productversion FlexJS 0.0
          */
         function get currentState():String;
+        
+        /**
+         *  @private
+         */
+        function set currentState(value:String):void;
 
         /**
          *  The array of view state transitions. 

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/018ff46d/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as
b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as
index b210559..9fb19e8 100644
--- a/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as
+++ b/frameworks/projects/CreateJS/as/src/org/apache/flex/createjs/core/ViewBase.as
@@ -29,6 +29,15 @@ package org.apache.flex.createjs.core
     import org.apache.flex.core.IUIBase;
     import org.apache.flex.events.Event;
     import org.apache.flex.utils.MXMLDataInterpreter;
+    
+    COMPILE::JS
+    {
+        import org.apache.flex.core.IBead;
+        import org.apache.flex.core.IStatesImpl;
+        import org.apache.flex.core.ValuesManager;
+        import org.apache.flex.events.ValueChangeEvent;
+        import org.apache.flex.states.State;
+    }
 	
     COMPILE::AS3
     public class ViewBase extends org.apache.flex.core.ViewBase
@@ -81,5 +90,117 @@ package org.apache.flex.createjs.core
             dispatchEvent(new Event("modelChanged"));
         }
 
+        private var _states:Array;
+        
+        /**
+         *  The array of view states. These should
+         *  be instances of org.apache.flex.states.State.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get states():Array
+        {
+            return _states;
+        }
+        
+        /**
+         *  @private
+         *  @flexjsignorecoercion Class
+         *  @flexjsignorecoercion org.apache.flex.core.IBead
+         */
+        public function set states(value:Array):void
+        {
+            _states = value;
+            _currentState = _states[0].name;
+            
+            try{
+                if (getBeadByType(IStatesImpl) == null)
+                {
+                    var c:Class = ValuesManager.valuesImpl.getValue(this, "iStatesImpl")
as Class;
+                    var b:Object = new c();
+                    addBead(b as IBead);
+                }
+            }
+            //TODO:  Need to handle this case more gracefully
+            catch(e:Error)
+            {
+            }
+            
+        }
+        
+        /**
+         *  <code>true</code> if the array of states
+         *  contains a state with this name.
+         * 
+         *  @param state The state namem.
+         *  @return True if state in state array
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function hasState(state:String):Boolean
+        {
+            for each (var s:State in _states)
+            {
+                if (s.name == state)
+                    return true;
+            }
+            return false;
+        }
+        
+        private var _currentState:String;
+        
+        [Bindable("currentStateChange")]
+        /**
+         *  The name of the current state.
+         * 
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get currentState():String
+        {
+            return _currentState;   
+        }
+        
+        /**
+         *  @private
+         */
+        public function set currentState(value:String):void
+        {
+            var event:ValueChangeEvent = new ValueChangeEvent("currentStateChange", false,
false, _currentState, value)
+            _currentState = value;
+            dispatchEvent(event);
+        }
+        
+        private var _transitions:Array;
+        
+        /**
+         *  The array of transitions.
+         *  
+         *  @langversion 3.0
+         *  @playerversion Flash 10.2
+         *  @playerversion AIR 2.6
+         *  @productversion FlexJS 0.0
+         */
+        public function get transitions():Array
+        {
+            return _transitions;   
+        }
+        
+        /**
+         *  @private
+         */
+        public function set transitions(value:Array):void
+        {
+            _transitions = value;   
+        }
+        
 	}
 }


Mime
View raw message