Hi Yishay,

I'm wondering whether it is possible to have it bead instead class ? What
do you think ?

Thanks, Piotr

2017-07-10 18:30 GMT+02:00 <yish...@apache.org>:

> Repository: flex-asjs
> Updated Branches:
>   refs/heads/develop c6a24011b -> 54d00a044
>
>
> Add FileUploaderWithResponseData
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/54d00a04
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/54d00a04
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/54d00a04
>
> Branch: refs/heads/develop
> Commit: 54d00a044196ec62e81840b3134f9f17f26f4cb1
> Parents: c6a2401
> Author: DESKTOP-RH4S838\Yishay <yishayj...@hotmail.com>
> Authored: Mon Jul 10 19:30:12 2017 +0300
> Committer: DESKTOP-RH4S838\Yishay <yishayj...@hotmail.com>
> Committed: Mon Jul 10 19:30:12 2017 +0300
>
> ----------------------------------------------------------------------
>  .../main/flex/org/apache/flex/file/FileProxy.as |  9 ++++
>  .../flex/file/beads/FileLoaderAndUploader.as    |  2 +-
>  .../org/apache/flex/file/beads/FileUploader.as  | 18 ++++++++
>  .../file/beads/FileUploaderWithResponseData.as  | 43 ++++++++++++++++++++
>  .../src/main/resources/basic-manifest.xml       |  1 +
>  5 files changed, 72 insertions(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 54d00a04/frameworks/projects/Network/src/main/flex/org/
> apache/flex/file/FileProxy.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/Network/src/main/flex/org/apache/flex/file/FileProxy.as
> b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/FileProxy.as
> index 738cf55..38c2fe8 100644
> --- a/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/FileProxy.as
> +++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/FileProxy.as
> @@ -23,6 +23,15 @@ package org.apache.flex.file
>         import org.apache.flex.file.beads.FileModel;
>
>         /**
> +        *  Indicates that the model has changed
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.9
> +        */
> +       [Event(name="modelChanged", type="org.apache.flex.events.Event")]
> +       /**
>          *  The FileProxy class is where beads regarding file operations
> are added.
>          *  Information about operations can be queried in the file model,
> or by
>          *  listenening to events dispatched by beads.
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 54d00a04/frameworks/projects/Network/src/main/flex/org/
> apache/flex/file/beads/FileLoaderAndUploader.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileLoaderAndUploader.as b/frameworks/projects/Network/
> src/main/flex/org/apache/flex/file/beads/FileLoaderAndUploader.as
> index 77ba96c..2b66552 100644
> --- a/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileLoaderAndUploader.as
> +++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileLoaderAndUploader.as
> @@ -21,7 +21,7 @@ package org.apache.flex.file.beads
>         import org.apache.flex.events.Event;
>
>         /**
> -        *  The FileLoaderUploader is a compound bead that allows you
> +        *  The FileLoaderAndUploader is a compound bead that allows you
>          *  to load a file and upload it in one operation.
>          *
>          *
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 54d00a04/frameworks/projects/Network/src/main/flex/org/
> apache/flex/file/beads/FileUploader.as
> ----------------------------------------------------------------------
> diff --git 
> a/frameworks/projects/Network/src/main/flex/org/apache/flex/file/beads/FileUploader.as
> b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileUploader.as
> index 0cf4d5f..470eb28 100644
> --- a/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileUploader.as
> +++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileUploader.as
> @@ -19,6 +19,8 @@ package org.apache.flex.file.beads
>  {
>         import org.apache.flex.core.IBead;
>         import org.apache.flex.core.IStrand;
> +       import org.apache.flex.events.Event;
> +       import org.apache.flex.events.IEventDispatcher;
>         import org.apache.flex.file.FileProxy;
>         import org.apache.flex.net.URLBinaryLoader;
>         import org.apache.flex.net.URLRequest;
> @@ -37,6 +39,15 @@ package org.apache.flex.file.beads
>         }
>
>         /**
> +        *  Indicates that the upload operation is complete
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.9
> +        */
> +       [Event(name="complete", type="org.apache.flex.events.Event")]
> +       /**
>          *  The FileUploader class is a bead which adds to FileProxy
>          *  the ability to upload files.
>          *
> @@ -70,9 +81,16 @@ package org.apache.flex.file.beads
>                         var binaryUploader:URLBinaryLoader = new
> URLBinaryLoader();
>                         var req:URLRequest = new URLRequest();
>                         req.data = (host.model as FileModel).blob;
> +                       binaryUploader.addEventListener(Event.COMPLETE,
> completeHandler);
>                         binaryUploader.load(req);
>                 }
>
> +               protected function completeHandler(event:Event):void
> +               {
> +                       (event.target as IEventDispatcher).
> removeEventListener(Event.COMPLETE, completeHandler);
> +                       (host as IEventDispatcher).dispatchEvent(event);
> +               }
> +
>                 /**
>                  *  @copy org.apache.flex.core.IBead#strand
>                  *
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 54d00a04/frameworks/projects/Network/src/main/flex/org/
> apache/flex/file/beads/FileUploaderWithResponseData.as
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileUploaderWithResponseData.as b/frameworks/projects/Network/
> src/main/flex/org/apache/flex/file/beads/FileUploaderWithResponseData.as
> new file mode 100644
> index 0000000..99d0b03
> --- /dev/null
> +++ b/frameworks/projects/Network/src/main/flex/org/apache/flex/
> file/beads/FileUploaderWithResponseData.as
> @@ -0,0 +1,43 @@
> +//
> +//  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.file.beads
> +{
> +       import org.apache.flex.events.Event;
> +       import org.apache.flex.net.URLBinaryLoader;
> +
> +       /**
> +        *  FileUploaderWithResponseData records responseData before
> dispatching the complete event
> +        *
> +        *
> +        *  @toplevel
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.9
> +        */
> +       public class FileUploaderWithResponseData extends FileUploader
> +       {
> +               public var responseData:Object;
> +
> +               override protected function completeHandler(event:Event):
> void
> +               {
> +                       responseData = (event.target as
> URLBinaryLoader).data;
> +                       super.completeHandler(event);
> +               }
> +       }
> +}
> \ No newline at end of file
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/
> 54d00a04/frameworks/projects/Network/src/main/resources/basic-manifest.xml
> ----------------------------------------------------------------------
> diff --git a/frameworks/projects/Network/src/main/resources/basic-manifest.xml
> b/frameworks/projects/Network/src/main/resources/basic-manifest.xml
> index eabda27..4a55df4 100644
> --- a/frameworks/projects/Network/src/main/resources/basic-manifest.xml
> +++ b/frameworks/projects/Network/src/main/resources/basic-manifest.xml
> @@ -27,5 +27,6 @@
>      <component id="FileBrowser" class="org.apache.flex.file.
> beads.FileBrowser"/>
>      <component id="FileLoader" class="org.apache.flex.file.
> beads.FileLoader"/>
>      <component id="FileUploader" class="org.apache.flex.file.
> beads.FileUploader"/>
> +    <component id="FileUploaderWithResponseData"
> class="org.apache.flex.file.beads.FileUploaderWithResponseData"/>
>      <component id="FileLoaderAndUploader" class="org.apache.flex.file.
> beads.FileLoaderAndUploader"/>
>  </componentPackage>
>
>

Reply via email to