You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by pu...@apache.org on 2021/09/21 14:23:06 UTC

[royale-asjs] branch develop updated: Added FileReferenceList.as in MXRoyale

This is an automated email from the ASF dual-hosted git repository.

pushminakazi pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new ffb15c8  Added FileReferenceList.as in MXRoyale
ffb15c8 is described below

commit ffb15c8b1ea645b05317472f180d9449d80b9e28
Author: pashminakazi <pa...@gmail.com>
AuthorDate: Tue Sep 21 07:22:36 2021 -0700

    Added FileReferenceList.as in MXRoyale
---
 .../MXRoyale/src/main/royale/MXRoyaleClasses.as    |   1 +
 .../src/main/royale/mx/net/FileReferenceList.as    | 107 +++++++++++++++++++++
 2 files changed, 108 insertions(+)

diff --git a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
index f1ea508..46780be 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/MXRoyaleClasses.as
@@ -425,6 +425,7 @@ internal class MXRoyaleClasses
 	import mx.controls.dataGridClasses.DataGridHeader; DataGridHeader;
 	import mx.printing.PrintJob; PrintJob;
 	import mx.containers.accordionClasses.AccordionHeader; AccordionHeader;
+	import mx.net.FileReferenceList; FileReferenceList;
 }
 
 }
diff --git a/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReferenceList.as b/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReferenceList.as
new file mode 100644
index 0000000..866df19
--- /dev/null
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReferenceList.as
@@ -0,0 +1,107 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  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.net
+{
+   import org.apache.royale.events.EventDispatcher;
+   import org.apache.royale.file.beads.FileBrowserWithFilter;
+   
+	/**
+	 *  Dispatched when the component has finished its construction
+	 *  and has all initialization properties set.
+	 *
+	 *  <p>After the initialization phase, properties are processed, the component
+	 *  is measured, laid out, and drawn, after which the
+	 *  <code>creationComplete</code> event is dispatched.</p>
+	 * 
+	 *  @eventType = org.apache.royale.events.Event.CANCEL
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	[Event(name="cancel", type="org.apache.royale.events.Event")]
+	
+	/**
+	 *  Dispatched when the component has finished its construction
+	 *  and has all initialization properties set.
+	 *
+	 *  <p>After the initialization phase, properties are processed, the component
+	 *  is measured, laid out, and drawn, after which the
+	 *  <code>creationComplete</code> event is dispatched.</p>
+	 * 
+	 *  @eventType = org.apache.royale.events.Event.SELECT
+	 *  
+	 *  @langversion 3.0
+	 *  @playerversion Flash 9
+	 *  @playerversion AIR 1.1
+	 *  @productversion Flex 3
+	 */
+	[Event(name="select", type="org.apache.royale.events.Event")]
+
+   public class FileReferenceList extends EventDispatcher
+   {
+		
+	  private var _browser:FileBrowserWithFilter;
+	  private var _fileList:Array;
+
+      public function FileReferenceList()
+      {
+		  super();
+		  _browser = new FileBrowserWithFilter();
+	
+	  }
+	  
+	 public function get fileList():Array {
+		return _fileList;
+	 }
+	
+     public function browse(typeFilter:Array = null):Boolean
+      {
+         var allFilters:Array = [];
+         if (typeFilter)
+		 {
+			for (var i:int = 0; i < typeFilter.length; i++)
+			{
+				var fileFilter:FileFilter = typeFilter[i] as FileFilter;
+				var filters:Array = fileFilter.extension.split(";");
+				for (var j:int = 0; j < filters.length; j++)
+				{
+					var filter:String = filters[j];
+					if (filter.charAt(0) == '*')
+					{
+						filter = filter.substring(1);
+						filters[j] = filter;
+					}
+				}
+				allFilters = allFilters.concat(filters);
+			}
+			_browser.filter = allFilters.join(",");
+		 }
+		 _browser.browse();
+         return true;
+      }
+      
+
+   }
+
+            
+
+}