flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aha...@apache.org
Subject [01/14] git commit: [flex-utilities] [refs/heads/develop] - added Available task
Date Mon, 09 Dec 2013 23:30:03 GMT
Updated Branches:
  refs/heads/develop 2cc92bf16 -> 1d9886ddb


added Available task


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

Branch: refs/heads/develop
Commit: 26b6f4ca61cff6edcbe04f6437aceb627466d772
Parents: c2f4d93
Author: Alex Harui <aharui@apache.org>
Authored: Sat Dec 7 21:49:08 2013 -0800
Committer: Alex Harui <aharui@apache.org>
Committed: Sat Dec 7 21:50:43 2013 -0800

----------------------------------------------------------------------
 .../src/org/apache/flex/ant/tags/Available.as   | 83 ++++++++++++++++++++
 1 file changed, 83 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-utilities/blob/26b6f4ca/ant_on_air/src/org/apache/flex/ant/tags/Available.as
----------------------------------------------------------------------
diff --git a/ant_on_air/src/org/apache/flex/ant/tags/Available.as b/ant_on_air/src/org/apache/flex/ant/tags/Available.as
new file mode 100644
index 0000000..e3abf87
--- /dev/null
+++ b/ant_on_air/src/org/apache/flex/ant/tags/Available.as
@@ -0,0 +1,83 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.ant.tags
+{
+    import flash.filesystem.File;
+    
+    import mx.core.IFlexModuleFactory;
+    
+    import org.apache.flex.ant.Ant;
+    import org.apache.flex.ant.tags.supportClasses.IValueTagHandler;
+    import org.apache.flex.ant.tags.supportClasses.TaskHandler;
+    
+    [Mixin]
+    public class Available extends TaskHandler implements IValueTagHandler
+    {
+        public static function init(mf:IFlexModuleFactory):void
+        {
+            Ant.antTagProcessors["available"] = Available;
+        }
+
+        public function Available()
+        {
+            super();
+        }
+        
+        private var _file:String;
+        private var _type:String;
+        private var _property:String;
+        private var _value:String;
+        
+        public function get value():Object
+        {
+            if (_file == null) return false;
+            
+            var file:File = new File(_file);
+            if (!file.exists)
+                return false;
+            
+            if (_type == "dir" && !file.isDirectory)
+                return false;
+            
+            return true;
+        }
+
+        override public function execute():Boolean
+        {
+            super.execute();
+            if (value)
+                if (!context.hasOwnProperty(_property))
+                    context[_property] = _value;
+            return true;
+        }
+        
+        override protected function processAttribute(name:String, value:String):void
+        {
+            if (name == "file")
+                _file = value;
+            else if (name == "type")
+                _type = value;
+            if (name == "property")
+                _property = value;
+            if (name == "value")
+                _value = value;
+        }
+        
+    }
+}
\ No newline at end of file


Mime
View raw message