You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by yi...@apache.org on 2019/07/18 10:18:30 UTC
[royale-asjs] 01/01: Add blob and fileContent to IFileModel
This is an automated email from the ASF dual-hosted git repository.
yishayw pushed a commit to branch file_proxy_refactor
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
commit a7ecd32ea7cc35a65f21d7dd91ae4ea9b964bfaf
Author: DESKTOP-RH4S838\Yishay <yi...@hotmail.com>
AuthorDate: Thu Jul 18 13:18:06 2019 +0300
Add blob and fileContent to IFileModel
---
.../royale/org/apache/royale/file/FileProxy.as | 24 ++++++++++++++++++----
.../royale/org/apache/royale/file/IFileModel.as | 21 +++++++++++++++++++
.../org/apache/royale/file/beads/FileLoader.as | 4 ++--
.../org/apache/royale/file/beads/FileModel.as | 6 +++---
4 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
index 00912ab..a9b74f8 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/FileProxy.as
@@ -20,7 +20,7 @@ package org.apache.royale.file
import org.apache.royale.core.IBead;
import org.apache.royale.core.IDocument;
import org.apache.royale.core.Strand;
- import org.apache.royale.file.beads.FileModel;
+ import org.apache.royale.utils.BinaryData;
/**
* Indicates that the model has changed
@@ -68,7 +68,7 @@ package org.apache.royale.file
*/
public function get lastModified():uint
{
- return (model as FileModel).lastModified;
+ return (model as IFileModel).lastModified;
}
/**
@@ -76,7 +76,7 @@ package org.apache.royale.file
*/
public function get name():String
{
- return (model as FileModel).name;
+ return (model as IFileModel).name;
}
/**
@@ -84,7 +84,23 @@ package org.apache.royale.file
*/
public function get type():String
{
- return (model as FileModel).type;
+ return (model as IFileModel).type;
+ }
+
+ /**
+ * @copy org.apache.royale.file.IFileModel#blob
+ */
+ public function get blob():Object
+ {
+ return (model as IFileModel).blob;
+ }
+
+ /**
+ * @copy org.apache.royale.file.IFileModel#fileContent
+ */
+ public function set fileContent(value:BinaryData):void
+ {
+ (model as IFileModel).fileContent = value;
}
}
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/IFileModel.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/IFileModel.as
index 9c9a124..365e20f 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/IFileModel.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/IFileModel.as
@@ -18,6 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.file
{
+ import org.apache.royale.utils.BinaryData;
+
public interface IFileModel
{
/**
@@ -50,6 +52,25 @@ package org.apache.royale.file
*/
function get name():String;
+ /**
+ * A representation of the file model in binary format
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.6
+ */
+ function get blob():Object;
+ /**
+ * The file content
+ *
+ * @langversion 3.0
+ * @playerversion Flash 10.2
+ * @playerversion AIR 2.6
+ * @productversion Royale 0.9.6
+ */
+ function set fileContent(value:BinaryData):void;
+
}
}
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileLoader.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileLoader.as
index 3fa893d..9f819af 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileLoader.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileLoader.as
@@ -75,13 +75,13 @@ package org.apache.royale.file.beads
protected function fileLoadHandler(event:flash.events.Event):void
{
fileModel.fileReference.removeEventListener(Event.COMPLETE, fileLoadHandler);
- fileModel.blob = new BinaryData(fileModel.fileReference.data);
+ fileModel.fileContent = new BinaryData(fileModel.fileReference.data);
}
COMPILE::JS
protected function fileLoadHandler(event:Event):void
{
- fileModel.blob = new BinaryData(event.target.result);
+ fileModel.fileContent = new BinaryData(event.target.result);
}
/**
diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileModel.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileModel.as
index c4e4116..4238f68 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileModel.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/file/beads/FileModel.as
@@ -150,14 +150,14 @@ package org.apache.royale.file.beads
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
- * @productversion Royale 0.9
+ * @productversion Royale 0.9.6
*/
- public function get blob():BinaryData
+ public function get blob():Object
{
return _blob;
}
- public function set blob(value:BinaryData):void
+ public function set fileContent(value:BinaryData):void
{
_blob = value;
dispatchEvent(new Event("blobChanged"));