flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [08/37] git commit: [flex-asjs] [refs/heads/spark] - copy of many flex-sdk classes, modified to try to compile on top of the FlexJS base classes. A COMPILE::LATER flag is used to comment out features like multi-swf support and a few other features that
Date Sat, 13 Feb 2016 00:14:15 GMT
http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as b/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
new file mode 100644
index 0000000..34369e1
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/utils/UIDUtil.as
@@ -0,0 +1,424 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.utils
+{
+
+import flash.utils.ByteArray;
+import flash.utils.Dictionary;
+
+import mx.core.IPropertyChangeNotifier;
+import mx.core.IUIComponent;
+import mx.core.IUID;
+import mx.core.mx_internal;
+
+use namespace mx_internal;
+
+/**
+ *  The UIDUtil class is an all-static class
+ *  with methods for working with UIDs (unique identifiers) within Flex.
+ *  You do not create instances of UIDUtil;
+ *  instead you simply call static methods such as the
+ *  <code>UIDUtil.createUID()</code> method.
+ * 
+ *  <p><b>Note</b>: If you have a dynamic object that has no [Bindable]
properties 
+ *  (which force the object to implement the IUID interface), Flex  adds an 
+ *  <code>mx_internal_uid</code> property that contains a UID to the object.

+ *  To avoid having this field 
+ *  in your dynamic object, make it [Bindable], implement the IUID interface
+ *  in the object class, or set a <coded>uid</coded> property with a value.</p>
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class UIDUtil
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class constants
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  Char codes for 0123456789ABCDEF
+     */
+	private static const ALPHA_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 
+		55, 56, 57, 65, 66, 67, 68, 69, 70];
+
+    private static const DASH:int = 45;       // dash ascii
+    private static const UIDBuffer:ByteArray = new ByteArray();       // static ByteArray
used for UID generation to save memory allocation cost
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class variables
+    //
+    //--------------------------------------------------------------------------
+
+    /** 
+     *  This Dictionary records all generated uids for all existing items.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    private static var uidDictionary:Dictionary = new Dictionary(true);
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Generates a UID (unique identifier) based on ActionScript's
+     *  pseudo-random number generator and the current time.
+     *
+     *  <p>The UID has the form
+     *  <code>"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"</code>
+     *  where X is a hexadecimal digit (0-9, A-F).</p>
+     *
+     *  <p>This UID will not be truly globally unique; but it is the best
+     *  we can do without player support for UID generation.</p>
+     *
+     *  @return The newly-generated UID.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+	public static function createUID():String
+    {
+        UIDBuffer.position = 0;
+
+        var i:int;
+        var j:int;
+
+        for (i = 0; i < 8; i++)
+        {
+            UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+        }
+
+        for (i = 0; i < 3; i++)
+        {
+            UIDBuffer.writeByte(DASH);
+            for (j = 0; j < 4; j++)
+            {
+                UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+            }
+        }
+
+        UIDBuffer.writeByte(DASH);
+
+        var time:uint = new Date().getTime(); // extract last 8 digits
+        var timeString:String = time.toString(16).toUpperCase();
+        // 0xFFFFFFFF milliseconds ~= 3 days, so timeString may have between 1 and 8 digits,
hence we need to pad with 0s to 8 digits
+        for (i = 8; i > timeString.length; i--)
+            UIDBuffer.writeByte(48);
+        UIDBuffer.writeUTFBytes(timeString);
+
+        for (i = 0; i < 4; i++)
+        {
+            UIDBuffer.writeByte(ALPHA_CHAR_CODES[int(Math.random() * 16)]);
+        }
+
+        return UIDBuffer.toString();
+    }
+
+    /**
+     * Converts a 128-bit UID encoded as a ByteArray to a String representation.
+     * The format matches that generated by createUID. If a suitable ByteArray
+     * is not provided, null is returned.
+     * 
+     * @param ba ByteArray 16 bytes in length representing a 128-bit UID.
+     * 
+     * @return String representation of the UID, or null if an invalid
+     * ByteArray is provided.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static function fromByteArray(ba:ByteArray):String
+    {
+        if (ba != null && ba.length >= 16 && ba.bytesAvailable >= 16)
+        {
+            UIDBuffer.position = 0;
+            var index:uint = 0;
+            for (var i:uint = 0; i < 16; i++)
+            {
+                if (i == 4 || i == 6 || i == 8 || i == 10)
+                    UIDBuffer.writeByte(DASH); // Hyphen char code
+
+                var b:int = ba.readByte();
+                UIDBuffer.writeByte(ALPHA_CHAR_CODES[(b & 0xF0) >>> 4]);
+                UIDBuffer.writeByte(ALPHA_CHAR_CODES[(b & 0x0F)]);
+            }
+            return UIDBuffer.toString();
+        }
+
+        return null;
+    }
+
+    /**
+     * A utility method to check whether a String value represents a 
+     * correctly formatted UID value. UID values are expected to be 
+     * in the format generated by createUID(), implying that only
+     * capitalized A-F characters in addition to 0-9 digits are
+     * supported.
+     * 
+     * @param uid The value to test whether it is formatted as a UID.
+     * 
+     * @return Returns true if the value is formatted as a UID.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static function isUID(uid:String):Boolean
+    {
+        if (uid != null && uid.length == 36)
+        {
+            for (var i:uint = 0; i < 36; i++)
+            {
+                var c:Number = uid.charCodeAt(i);
+
+                // Check for correctly placed hyphens
+                if (i == 8 || i == 13 || i == 18 || i == 23)
+                {
+                    if (c != DASH)
+                    {
+                        return false;
+                    }
+                }
+                // We allow capital alpha-numeric hex digits only
+                else if (c < 48 || c > 70 || (c > 57 && c < 65))
+                {
+                    return false;
+                }
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Converts a UID formatted String to a ByteArray. The UID must be in the
+     * format generated by createUID, otherwise null is returned.
+     * 
+     * @param String representing a 128-bit UID
+     * 
+     * @return ByteArray 16 bytes in length representing the 128-bits of the
+     * UID or null if the uid could not be converted.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static function toByteArray(uid:String):ByteArray
+    {
+        if (isUID(uid))
+        {
+            var result:ByteArray = new ByteArray();
+
+            for (var i:uint = 0; i < uid.length; i++)
+            {
+                var c:String = uid.charAt(i);
+                if (c == "-")
+                    continue;
+                var h1:uint = getDigit(c);
+                i++;
+                var h2:uint = getDigit(uid.charAt(i));
+                result.writeByte(((h1 << 4) | h2) & 0xFF);
+            }
+            result.position = 0;
+            return result;
+        }
+
+        return null;
+    }
+
+    /**
+     *  Returns the UID (unique identifier) for the specified object.
+     *  If the specified object doesn't have an UID
+     *  then the method assigns one to it.
+     *  If a map is specified this method will use the map
+     *  to construct the UID.
+     *  As a special case, if the item passed in is null,
+     *  this method returns a null UID.
+     *  
+     *  @param item Object that we need to find the UID for.
+     *
+     *  @return The UID that was either found or generated.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static function getUID(item:Object):String
+    {
+        var result:String = null;
+
+        if (item == null)
+            return result;
+
+        if (item is IUID)
+        {
+            result = IUID(item).uid;
+            if (result == null || result.length == 0)
+            {
+                result = createUID();
+                IUID(item).uid = result;
+            }
+        }
+        else if ((item is IPropertyChangeNotifier) &&
+                 !(item is IUIComponent))
+        {
+            result = IPropertyChangeNotifier(item).uid;
+            if (result == null || result.length == 0)
+            {
+                result = createUID();
+                IPropertyChangeNotifier(item).uid = result;
+            }
+        }
+        else if (item is String)
+        {
+            return item as String;
+        }
+        else
+        {
+            try
+            {
+                // We don't create uids for XMLLists, but if
+                // there's only a single XML node, we'll extract it.
+                if (item is XMLList && item.length == 1)
+                    item = item[0];
+
+                if (item is XML)
+                {
+                    // XML nodes carry their UID on the
+                    // function-that-is-a-hashtable they can carry around.
+                    // To decorate an XML node with a UID,
+                    // we need to first initialize it for notification.
+                    // There is a potential performance issue here,
+                    // since notification does have a cost, 
+                    // but most use cases for needing a UID on an XML node also
+                    // require listening for change notifications on the node.
+                    var xitem:XML = XML(item);
+                    var nodeKind:String = xitem.nodeKind();
+                    if (nodeKind == "text" || nodeKind == "attribute")
+                        return xitem.toString();
+
+                    COMPILE::AS3
+                    {
+                        var notificationFunction:Function = xitem.notification();
+                        if (!(notificationFunction is Function))
+                        {
+                            // The xml node hasn't already been initialized
+                            // for notification, so do so now.
+                            notificationFunction =
+                                XMLNotifier.initializeXMLForNotification(); 
+                            xitem.setNotification(notificationFunction);
+                        }
+                    }
+                    
+                    // Generate a new uid for the node if necessary.
+                    if (notificationFunction["uid"] == undefined)
+                        result = notificationFunction["uid"] = createUID();
+
+                    result = notificationFunction["uid"];
+                }
+                else
+                {
+                    if ("mx_internal_uid" in item)
+                        return item.mx_internal_uid;
+
+                    if ("uid" in item)
+                        return item.uid;
+
+                    result = uidDictionary[item];
+
+                    if (!result)
+                    {
+                        result = createUID();
+                        try 
+                        {
+                            item.mx_internal_uid = result;
+                        }
+                        catch(e:Error)
+                        {
+                            uidDictionary[item] = result;
+                        }
+                    }
+                }
+            }
+            catch(e:Error)
+            {
+                result = item.toString();
+            }
+        }
+
+        return result;
+    }
+
+    /**
+     * Returns the decimal representation of a hex digit.
+     * @private
+     */
+    private static function getDigit(hex:String):uint
+    {
+        switch (hex) 
+        {
+            case "A": 
+            case "a":           
+                return 10;
+            case "B":
+            case "b":
+                return 11;
+            case "C":
+            case "c":
+                return 12;
+            case "D":
+            case "d":
+                return 13;
+            case "E":
+            case "e":
+                return 14;                
+            case "F":
+            case "f":
+                return 15;
+            default:
+                return new uint(hex);
+        }    
+    }
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/utils/XMLNotifier.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/XMLNotifier.as b/frameworks/projects/MX/src/main/flex/mx/utils/XMLNotifier.as
new file mode 100644
index 0000000..2505a64
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/utils/XMLNotifier.as
@@ -0,0 +1,264 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.utils
+{
+
+import flash.utils.Dictionary;
+import mx.core.mx_internal;
+import mx.utils.IXMLNotifiable;
+
+use namespace mx_internal;
+
+/**
+ *  Used for watching changes to XML and XMLList objects.
+ *  Those objects are not EventDispatchers, so if multiple elements
+ *  want to watch for changes they need to go through this mechanism.
+ *  Call <code>watchXML()</code>, passing in the same notification
+ *  function that you would pass to XML.notification.
+ *  Use <code>unwatchXML()</code> to remove that notification.
+ *  
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class XMLNotifier
+{
+    include "../core/Version.as";
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class variables
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  @private
+     *  XMLNotifier is a singleton.
+     */
+    private static var instance:XMLNotifier;
+
+    //--------------------------------------------------------------------------
+    //
+    //  Class methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Get the singleton instance of the XMLNotifier.
+     *
+     *  @return The XMLNotifier object.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public static function getInstance():XMLNotifier
+    {
+        if (!instance)
+            instance = new XMLNotifier(new XMLNotifierSingleton());
+
+        return instance;
+    }
+
+    /**
+     *  @private
+     *  Decorates an XML node with a notification function
+     *  that can fan out to multiple targets.
+     */
+    mx_internal static function initializeXMLForNotification():Function
+    {
+        var notificationFunction:Function = function(currentTarget:Object,
+                                                     ty:String,
+                                                     tar:Object,
+                                                     value:Object,
+                                                     detail:Object):void
+        {
+            var xmlWatchers:Dictionary = arguments.callee.watched;
+            if (xmlWatchers != null)
+            {
+                for (var notifiable:Object in xmlWatchers)
+                {
+                    IXMLNotifiable(notifiable).xmlNotification(currentTarget, ty, tar, value,
detail);
+                }
+            }
+        }
+
+        return notificationFunction;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *
+     *  XMLNotifier is a singleton class, so you do not use
+     *  the <code>new</code> operator to create multiple instances of it.
+     *  Instead, call the static method <code>XMLNotifider.getInstance()</code>
+     *  to get the sole instance of this class.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function XMLNotifier(x:XMLNotifierSingleton)
+    {
+        super();
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Methods
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Given an XML or XMLList, add the notification function
+     *  to watch for changes.
+     *
+     *  @param xml XML/XMLList object to watch.
+     *  @param notification Function that needs to be called.
+     *  @param optional UID for object
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function watchXML(xml:Object, notifiable:IXMLNotifiable, uid:String = null):void
+    {
+        if ((xml is XMLList) && xml.length() > 1)
+        {
+            for each(var item:Object in xml)
+            {
+                watchXML(item, notifiable, uid);
+            }
+        }
+        else
+        {
+            // An XMLList object behaves like XML when it contains one
+            // XML object.  Casting to an XML object is necessary to
+            // access the notification() function.
+            var xmlItem:XML = XML(xml);
+
+            // First make sure the xml node has a notification function.
+            var watcherFunction:Object = xmlItem.notification();
+
+            if (!(watcherFunction is Function))
+            {
+                watcherFunction = initializeXMLForNotification();
+                xmlItem.setNotification(watcherFunction as Function);
+                if (uid && watcherFunction["uid"] == null)
+                    watcherFunction["uid"] = uid;
+            }
+
+            // Watch lists are maintained on the notification function.
+            var xmlWatchers:Dictionary;
+            if (watcherFunction["watched"] == undefined)
+                watcherFunction["watched"] = xmlWatchers = new Dictionary(true);
+            else
+                xmlWatchers = watcherFunction["watched"];
+            
+            xmlWatchers[notifiable] = true;
+        }
+    }
+
+    /**
+     *  Given an XML or XMLList, remove the specified notification function.
+     *
+     *  @param xml XML/XMLList object to un-watch.
+     *  @param notification Function notification function.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function unwatchXML(xml:Object, notifiable:IXMLNotifiable):void
+    {
+        if ((xml is XMLList) && xml.length() > 1)
+        {
+            for each(var item:Object in xml)
+            {
+                unwatchXML(item, notifiable);
+            }
+        }
+        else
+        {
+            // An XMLList object behaves like XML when it contains one
+            // XML object.  Casting to an XML object is necessary to
+            // access the notification() function.
+            var xmlItem:XML = XML(xml);
+
+            var watcherFunction:Object = xmlItem.notification();
+
+            if (!(watcherFunction is Function))
+                return;
+
+            var xmlWatchers:Dictionary;
+
+            if (watcherFunction["watched"] != undefined)
+            {
+                xmlWatchers = watcherFunction["watched"];
+                delete xmlWatchers[notifiable];
+            }           
+        }
+    }
+}
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Helper class: XMLNotifierSingleton
+//
+////////////////////////////////////////////////////////////////////////////////
+
+/**
+ *  @private
+ */
+class XMLNotifierSingleton
+{
+    //--------------------------------------------------------------------------
+    //
+    //  Constructor
+    //
+    //--------------------------------------------------------------------------
+
+    /**
+     *  Constructor.
+     *  
+     *  @langversion 3.0
+     *  @playerversion Flash 9
+     *  @playerversion AIR 1.1
+     *  @productversion Flex 3
+     */
+    public function XMLNotifierSingleton()
+    {
+        super();
+    }
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/utils/object_proxy.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/utils/object_proxy.as b/frameworks/projects/MX/src/main/flex/mx/utils/object_proxy.as
new file mode 100644
index 0000000..5aea911
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/utils/object_proxy.as
@@ -0,0 +1,34 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.utils
+{
+
+/**
+ *  Documentation is not currently available.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public namespace object_proxy =
+	"http://www.adobe.com/2006/actionscript/flash/objectproxy";
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/validators/IValidatorListener.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/validators/IValidatorListener.as b/frameworks/projects/MX/src/main/flex/mx/validators/IValidatorListener.as
new file mode 100644
index 0000000..aa19bc8
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/validators/IValidatorListener.as
@@ -0,0 +1,132 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.validators
+{
+
+import mx.events.ValidationResultEvent;
+
+/**
+ *  The interface that components implement to support
+ *  the Flex data validation mechanism. 
+ *  The UIComponent class implements this interface.
+ *  Therefore, any subclass of UIComponent also implements it.
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public interface IValidatorListener
+{
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  errorString
+	//----------------------------------
+
+	/**
+     *  The text that will be displayed by a component's error tip when a
+     *  component is monitored by a Validator and validation fails.
+     *
+     *  <p>You can use the <code>errorString</code> property to show a

+     *  validation error for a component, without actually using
+	 *  a validator class. 
+     *  When you write a String value to the <code>errorString</code> property,

+     *  Flex draws a red border around the component to indicate
+	 *  the validation error, and the String appears in a tooltip
+	 *  as the validation error message when you move  the mouse over
+	 *  the component, just as if a validator detected a validation error.</p>
+     *
+     *  <p>To clear the validation error, write an empty String, "", 
+     *  to the <code>errorString</code> property.</p>
+     *
+     *  <p>Note that writing a value to the <code>errorString</code> property

+     *  does not trigger the valid or invalid events; it only changes the 
+     *  border color and displays the validation error message.</p>
+ 	 *  
+ 	 *  @langversion 3.0
+ 	 *  @playerversion Flash 9
+ 	 *  @playerversion AIR 1.1
+ 	 *  @productversion Flex 3
+ 	 */
+	function get errorString():String;
+
+	/**
+	 *  @private
+	 */
+	function set errorString(value:String):void;
+
+	//----------------------------------
+	//  validationSubField
+	//----------------------------------
+
+	/**
+	 *  Used by a validator to assign a subfield.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	function get validationSubField():String;
+
+	/**
+	 *  @private
+	 */
+	function set validationSubField(value:String):void;
+
+	//--------------------------------------------------------------------------
+	//
+	//  Event handlers
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Handles both the <code>valid</code> and <code>invalid</code>
events
+	 *  from a  validator assigned to this component.  
+	 *
+	 *  <p>You typically handle the <code>valid</code> and <code>invalid</code>
+	 *  events dispatched by a validator by assigning event listeners
+	 *  to the validators. 
+	 *  If you want to handle validation events directly in the component
+	 *  that is being validated, you can override this method
+	 *  to handle the <code>valid</code> and <code>invalid</code> events.
+	 *  From within your implementation, you can use the
+	 *  <code>dispatchEvent()</code> method to dispatch the 
+	 *  <code>valid</code> and <code>invalid</code> events
+	 *  in the case where a validator is also listening for them.</p>
+	 *
+	 *  @param event The event object for the validation.
+     *
+     *  @see mx.events.ValidationResultEvent
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	function validationResultHandler(event:ValidationResultEvent):void;
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/flex/mx/validators/ValidationResult.as
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/flex/mx/validators/ValidationResult.as b/frameworks/projects/MX/src/main/flex/mx/validators/ValidationResult.as
new file mode 100644
index 0000000..4845e73
--- /dev/null
+++ b/frameworks/projects/MX/src/main/flex/mx/validators/ValidationResult.as
@@ -0,0 +1,147 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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 mx.validators
+{
+
+/**
+ *  The ValidationResult class contains the results of a validation. 
+ *
+ *  <p>The ValidationResultEvent class defines the event object
+ *  that is passed to event listeners for the <code>valid</code>
+ *  and <code>invalid</code> validator events. 
+ *  The class also defines the <code>results</code> property,
+ *  which contains an Array of ValidationResult objects,
+ *  one for each field examined by the validator.
+ *  This lets you access the ValidationResult objects
+ *  from within an event listener.</p>
+ *
+ *  @see mx.events.ValidationResultEvent
+ *  
+ *  @langversion 3.0
+ *  @playerversion Flash 9
+ *  @playerversion AIR 1.1
+ *  @productversion Flex 3
+ */
+public class ValidationResult
+{
+	include "../core/Version.as";
+
+	//--------------------------------------------------------------------------
+	//
+	//  Constructor
+	//
+	//--------------------------------------------------------------------------
+
+	/**
+	 *  Constructor
+	 *
+     *  @param isError Pass <code>true</code> if there was a validation error.
+     *
+     *  @param subField Name of the subfield of the validated Object.
+     *
+     *  @param errorCode  Validation error code.
+     *
+     *  @param errorMessage Validation error message.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public function ValidationResult(isError:Boolean, subField:String = "",
+									 errorCode:String = "",
+									 errorMessage:String = "")
+	{
+		super();
+
+		this.isError = isError;
+		this.subField = subField;
+		this.errorMessage = errorMessage;
+		this.errorCode = errorCode;
+	}
+
+	//--------------------------------------------------------------------------
+	//
+	//  Properties
+	//
+	//--------------------------------------------------------------------------
+
+	//----------------------------------
+	//  errorCode
+	//----------------------------------
+
+	/**
+	 *  The validation error code
+	 *  if the value of the <code>isError</code> property is <code>true</code>.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var errorCode:String;
+
+	//----------------------------------
+	//  errorMessage
+	//----------------------------------
+
+	/**
+	 *  The validation error message
+	 *  if the value of the <code>isError</code> property is <code>true</code>.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var errorMessage:String;
+	
+	//----------------------------------
+	//  isError
+	//----------------------------------
+
+	/**
+	 *  Contains <code>true</code> if the field generated a validation failure.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var isError:Boolean;
+	
+	//----------------------------------
+	//  subField
+	//----------------------------------
+
+	/**
+	 *  The name of the subfield that the result is associated with.
+	 *  Some validators, such as CreditCardValidator and DateValidator,
+	 *  validate multiple subfields at the same time.
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	public var subField:String;
+}
+
+}

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/resources/compile-asjs-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/resources/compile-asjs-config.xml b/frameworks/projects/MX/src/main/resources/compile-asjs-config.xml
new file mode 100644
index 0000000..57a36d3
--- /dev/null
+++ b/frameworks/projects/MX/src/main/resources/compile-asjs-config.xml
@@ -0,0 +1,85 @@
+<!--
+
+  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.
+
+-->
+<flex-config>
+
+    <compiler>
+        <accessible>false</accessible>
+        
+        <external-library-path>
+        </external-library-path>
+        
+		<mxml>
+			<children-as-data>true</children-as-data>
+		</mxml>
+		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+        <keep-as3-metadata>
+          <name>Bindable</name>
+          <name>Managed</name>
+          <name>ChangeEvent</name>
+          <name>NonCommittingChangeEvent</name>
+          <name>Transient</name>
+        </keep-as3-metadata>
+	  
+        <locale/>
+        
+        <library-path>
+            <!-- asjscompc won't 'link' these classes in, but will list their requires
+                 if these swcs are on the external-library-path then their requires
+                 will not be listed -->
+            <path-element>../../../../../externs/Binding.swc</path-element>
+            <path-element>../../../../../externs/Core.swc</path-element>
+            <path-element>../../../../../externs/Graphics.swc</path-element>
+            <path-element>../../../../../externs/Collections.swc</path-element>
+        </library-path>
+        
+        <namespaces>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/mx</uri>
+                <manifest>mx-manifest.xml</manifest>
+            </namespace>
+        </namespaces>
+        
+        <source-path>
+            <path-element>../flex</path-element>
+        </source-path>
+        
+        <warn-no-constructor>false</warn-no-constructor>
+    </compiler>
+    
+    <include-file>
+    </include-file>
+
+    <include-sources>
+    </include-sources>
+    
+    <include-classes>
+        <class>MXClasses</class>
+    </include-classes>
+    
+    <include-namespaces>
+        <uri>library://ns.apache.org/flexjs/mx</uri>
+    </include-namespaces>
+        
+    <target-player>${playerglobal.version}</target-player>
+	
+
+</flex-config>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/resources/compile-config.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/resources/compile-config.xml b/frameworks/projects/MX/src/main/resources/compile-config.xml
new file mode 100644
index 0000000..57a36d3
--- /dev/null
+++ b/frameworks/projects/MX/src/main/resources/compile-config.xml
@@ -0,0 +1,85 @@
+<!--
+
+  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.
+
+-->
+<flex-config>
+
+    <compiler>
+        <accessible>false</accessible>
+        
+        <external-library-path>
+        </external-library-path>
+        
+		<mxml>
+			<children-as-data>true</children-as-data>
+		</mxml>
+		<binding-value-change-event>org.apache.flex.events.ValueChangeEvent</binding-value-change-event>
+		<binding-value-change-event-kind>org.apache.flex.events.ValueChangeEvent</binding-value-change-event-kind>
+		<binding-value-change-event-type>valueChange</binding-value-change-event-type>
+
+        <keep-as3-metadata>
+          <name>Bindable</name>
+          <name>Managed</name>
+          <name>ChangeEvent</name>
+          <name>NonCommittingChangeEvent</name>
+          <name>Transient</name>
+        </keep-as3-metadata>
+	  
+        <locale/>
+        
+        <library-path>
+            <!-- asjscompc won't 'link' these classes in, but will list their requires
+                 if these swcs are on the external-library-path then their requires
+                 will not be listed -->
+            <path-element>../../../../../externs/Binding.swc</path-element>
+            <path-element>../../../../../externs/Core.swc</path-element>
+            <path-element>../../../../../externs/Graphics.swc</path-element>
+            <path-element>../../../../../externs/Collections.swc</path-element>
+        </library-path>
+        
+        <namespaces>
+            <namespace>
+                <uri>library://ns.apache.org/flexjs/mx</uri>
+                <manifest>mx-manifest.xml</manifest>
+            </namespace>
+        </namespaces>
+        
+        <source-path>
+            <path-element>../flex</path-element>
+        </source-path>
+        
+        <warn-no-constructor>false</warn-no-constructor>
+    </compiler>
+    
+    <include-file>
+    </include-file>
+
+    <include-sources>
+    </include-sources>
+    
+    <include-classes>
+        <class>MXClasses</class>
+    </include-classes>
+    
+    <include-namespaces>
+        <uri>library://ns.apache.org/flexjs/mx</uri>
+    </include-namespaces>
+        
+    <target-player>${playerglobal.version}</target-player>
+	
+
+</flex-config>

http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/1f6418c4/frameworks/projects/MX/src/main/resources/mx-manifest.xml
----------------------------------------------------------------------
diff --git a/frameworks/projects/MX/src/main/resources/mx-manifest.xml b/frameworks/projects/MX/src/main/resources/mx-manifest.xml
new file mode 100644
index 0000000..a1c9fd5
--- /dev/null
+++ b/frameworks/projects/MX/src/main/resources/mx-manifest.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+
+  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.
+
+-->
+
+
+<componentPackage>
+
+    <!--<component id="Button" class="org.apache.flex.html.Button"/>-->
+    
+</componentPackage>


Mime
View raw message