Re: Royale compiler does not work with super

2020-09-15 Thread Greg Dove
That looks like it probably needs a compiler fix.
But it also seems avoidable for now.
Because they are vars and not methods or accessors that are overridden,
can't you just avoid using super?



On Wed, Sep 16, 2020 at 10:20 AM Hugo Ferreira 
wrote:

> Example 1, using super to use the base base variable
>
> public class MyBaseClass
> {
> protected var myProtectedVar:String;
> }
>
> public class MyExtendedClass
> {
> public function MyExtendedClass
> {
> super.myProtecedVar = "Hello World"; // this will throw an JS error
> at runtime
> }
> }
>
> Example 2, using super at an event
>
> call a remote AMF service to a resultHandler event:
>
> private function resultHandler(event:ResultEvent):void
> {
> super.entities = event.data as ArrayList; // this will throw an
> internal JS error that will stop the result event and fire the AMF fault
> event
> }
>


Re: Open ByteArray as file

2020-09-15 Thread Hugo Ferreira
This is for open a file from file system.
My goal is to open a file on the file system from a byte array that exists
on the application, so I download the file and the user needs to press it
(right now not it's the way to go).

However I will also need your feature soon, so thank you.
It will be very ususfull and one less issue to solve.

Maria Jose Esteve  escreveu no dia terça, 15/09/2020
à(s) 10:08:

> Hi Hugo, sorry for the delay.
>
> Here you can see how we work with mx.net.FileReference. (I have adapted
> the code to be able to show it to you in a few lines, there may be omission
> or transcription errors)
>
> import org.apache.royale.events.Event;
> import org.apache.royale.events.IEventDispatcher;
> import mx.net.FileReference;
> import mx.net.FileFilter;
> import mx.events.IOErrorEvent;
> import mx.events.SecurityErrorEvent;
> import mx.utils.ByteArray;
>
> public var allowedExtensions:String =
> '*.jpg;*.jpeg;*.gif;*.png;*.bmp';
> public var maxFileSize:Number = 2;
> public var fileType:String;
> public var fileName:String;
> private var fileData:ByteArray;
>
> public function loadFromFileSystem():void
> {
> fileData = null;
> fileType = "";
> fileName = "";
>
> var file:FileReference = new FileReference();
> file.addEventListener("cancel", cancelHandler);
> file.addEventListener(Event.SELECT, selectHandler);
> file.browse([new FileFilter('Image',allowedExtensions)]);
> }
>
> private function cancelHandler(event:Event):void
> {
> var dispatcher:IEventDispatcher =
> IEventDispatcher(event.target);
> dispatcher.removeEventListener("cancel", cancelHandler);
> dispatcher.removeEventListener(Event.SELECT,
> selectHandler);
> }
>
> private function selectHandler(event:Event):void
> {
> var file:FileReference = FileReference(event.target);
> file.removeEventListener("cancel", cancelHandler);
> file.removeEventListener(Event.SELECT, selectHandler);
>
> var fileTypeIndex:int = file.name.search(new
> RegExp("\.[^\.]+$"));
> var _fileType:String = fileTypeIndex >= 0 ?
> file.name.slice(fileTypeIndex).toLowerCase() : "";
>
> if (allowedExtensions.search(_fileType.toLowerCase()) ==
> -1) {
> Alert.show(String("File type not supported") + "
> (" + allowedExtensions.replace(/\*\./g, "").replace(/;/g,
> ",").toUpperCase() + ")");
> return;
> }
> if (!isNaN(maxFileSize) && file.size > maxFileSize * 1024)
> {
> Alert.show(String("Maximum file size exceeded") +
> " (" + maxFileSize + " KB)");
> return;
> }
>
> file.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
> file.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
> errorHandler);
> file.addEventListener(Event.COMPLETE, completeHandler);
> fileType = _fileType;
> fileName = file.name;
>
> file.load();
> }
>
> private function completeHandler(event:Event):void
> {
> var dispatcher:IEventDispatcher =
> IEventDispatcher(event.target);
> dispatcher.removeEventListener(IOErrorEvent.IO_ERROR,
> errorHandler);
>
> dispatcher.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
> errorHandler);
> dispatcher.removeEventListener(Event.COMPLETE,
> completeHandler);
>
> fileData = Object(dispatcher).data;
> }
>
> private function errorHandler(event:Event):void
> {
> var dispatcher:IEventDispatcher =
> IEventDispatcher(event.target);
> dispatcher.removeEventListener(IOErrorEvent.IO_ERROR,
> errorHandler);
>
> dispatcher.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
> errorHandler);
> dispatcher.removeEventListener(Event.COMPLETE,
> completeHandler);
>
> fileData = null;
> }
>
> In the view, you can have a Jewel BinaryImage that you will assign
> fileData to:
>
> //xmlns:j="library://ns.apache.org/royale/jewel"
>  click="loadFromFileSystem()" />
>
> I don't know if this will help you ... (An example of this type is never
> bad, right?)
>
> Hiedra.
> -Mensaje original-
> De: Carlos Rovira 
> Enviado el: lunes, 14 de septiembre de 2020 10:22
> Para: Apache Royale Development 
> Asunto: Re: Open ByteArray as file
>
> Hi Hugo,
>
> sure, don't worry I'm sure others will take a look soon.
> thanks
>
> El dom., 13 sept. 2020 a las 18:06, Hugo Ferreira ( >)
> escribió:
>
> > OK.
> > For now, I'm using my own implementation.
> > If in a near fu

Re: Fault even on server call without any special reason

2020-09-15 Thread Hugo Ferreira
Solved.

Its' related with this:
http://apache-royale-development.20373.n8.nabble.com/Royale-compiler-does-not-work-with-super-td18264.html


Hugo Ferreira  escreveu no dia terça, 15/09/2020
à(s) 01:23:

> I have a particular server call that falls to fault event with the
> following message: {code: -1006, message: 'Unknown error.', detail:
> 'Cannot read property 'apply' of undefined', data: null}
>
> I have many other server calls that are working without any issue.
>
> Some facts:
> I'm using SimpleRemoting
> This server call works on my counterpart Flex project
> The returns it's exactly the same as other server calls (checked with
> Charles Web Proxy)
> There is no errors on browser console
>
> Any tips ?
>


Royale compiler does not work with super

2020-09-15 Thread Hugo Ferreira
Example 1, using super to use the base base variable

public class MyBaseClass
{
protected var myProtectedVar:String;
}

public class MyExtendedClass
{
public function MyExtendedClass
{
super.myProtecedVar = "Hello World"; // this will throw an JS error
at runtime
}
}

Example 2, using super at an event

call a remote AMF service to a resultHandler event:

private function resultHandler(event:ResultEvent):void
{
super.entities = event.data as ArrayList; // this will throw an
internal JS error that will stop the result event and fire the AMF fault
event
}


Re: Sort Jewel DataGrid by column click

2020-09-15 Thread Hugo Ferreira
And the correct bead sort from Jewel ?

Piotr Zarzycki  escreveu no dia terça,
15/09/2020 à(s) 12:28:

> I have used build from yesterday.
>
> wt., 15 wrz 2020 o 12:05 Hugo Ferreira 
> napisał(a):
>
> > You should test with the most recent nightly build.
> > There is also the mx version for the Flex emulation DataGrid.
> > Ensure that you are using the Royale version.
> >
> > Piotr Zarzycki  escreveu no dia terça,
> > 15/09/2020 à(s) 10:06:
> >
> > > Thanks Hugo. I have added it to one of the DG in TourDeJewel and it
> > doesn't
> > > work.
> > >
> > > wt., 15 wrz 2020 o 10:20 Hugo Ferreira 
> > > napisał(a):
> > >
> > > > Hi Piotr,
> > > >
> > > > Just add the bead to the datagrid:
> > > >
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > >
> > > > I was me that set dataProvider = null to force the DataGrid to
> refresh.
> > > > I saw that on something else on the framework to refresh the
> DataGrid.
> > > >
> > > > Carlos, also is worry about that.
> > > > For sure that is an area to be improved, to find out a better way to
> > > > refresh if possible.
> > > >
> > > > Piotr Zarzycki  escreveu no dia terça,
> > > > 15/09/2020 à(s) 07:17:
> > > >
> > > > > Hi Hugo, Carlos,
> > > > >
> > > > > Could you provide example how to use DataGridSort ?
> > > > >
> > > > > Additionally making dataProvider = null worries me a lot - can any
> of
> > > you
> > > > > look into this and sort it out ? It's completely insufficient if
> you
> > > > > display a lot in DG.
> > > > >
> > > > > Thanks,
> > > > > Piotr
> > > > >
> > > > > sob., 12 wrz 2020 o 16:53 Hugo Ferreira 
> > > > > napisał(a):
> > > > >
> > > > > > That makes sense, not tied only a one kind of component.
> > > > > >
> > > > > > Carlos Rovira  escreveu no dia sábado,
> > > > > 12/09/2020
> > > > > > à(s) 15:48:
> > > > > >
> > > > > > > Just refactored the header to IDataGridHeader as a first step
> to
> > > > allow
> > > > > > > other kind ButtonBars (IconButtonBar or ToggleButtonBar).
> > > > > > > So I think we could have some css for additional DG
> configuration
> > > > that
> > > > > > add
> > > > > > > the sort bead and a toggle button bar with the right icons.
> Still
> > > > have
> > > > > to
> > > > > > > think more about it...
> > > > > > >
> > > > > > > El sáb., 12 sept. 2020 a las 16:16, Hugo Ferreira (<
> > > > > > hferreira...@gmail.com
> > > > > > > >)
> > > > > > > escribió:
> > > > > > >
> > > > > > > > Hi Carlos,
> > > > > > > >
> > > > > > > > Yes, I think that if someone needs to extend this bead, it's
> > more
> > > > > > likely
> > > > > > > to
> > > > > > > > create a complete new one instead of override a mouse click
> > > > function.
> > > > > > > > Just my 2 cents.
> > > > > > > > But it's not a big issue for me.
> > > > > > > >
> > > > > > > > - I miss some icon indicators. That probably could be solved
> > > > changing
> > > > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > > > > Yes. I notice that. Probably the next DataGrid update. Maybe
> I
> > > can
> > > > do
> > > > > > > > myself.
> > > > > > > >
> > > > > > > > Carlos Rovira  escreveu no dia
> > sábado,
> > > > > > > 12/09/2020
> > > > > > > > à(s) 08:24:
> > > > > > > >
> > > > > > > > > Hi Hugo,
> > > > > > > > >
> > > > > > > > > The change from private to protected was thinking on
> > > > extensibility,
> > > > > > > > > although probably in this case since it only implies that
> > > > function
> > > > > > > people
> > > > > > > > > probably will create a completely new bead if they need to
> do
> > > > > > something
> > > > > > > > > more.
> > > > > > > > >
> > > > > > > > > Two more things:
> > > > > > > > >
> > > > > > > > > - The actual way of reassigning the collection completely
> > has 2
> > > > > > > problems:
> > > > > > > > > remove the current selection (if it has some) and reset the
> > > > > > > scrollToIndex
> > > > > > > > > (scrollbar goes to the start). I add here @Greg Dove <
> > > > > > > > greg.d...@gmail.com>
> > > > > > > > > to
> > > > > > > > > notice this.
> > > > > > > > > - I miss some icon indicators. That probably could be
> solved
> > > > > changing
> > > > > > > > > ButtonBar to ToggleButtonBar and setting up the up/down
> icons
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > El vie., 11 sept. 2020 a las 20:14, Hugo Ferreira (<
> > > > > > > > hferreira...@gmail.com
> > > > > > > > > >)
> > > > > > > > > escribió:
> > > > > > > > >
> > > > > > > > > > OK, I saw.
> > > > > > > > > > Thank you.
> > > > > > > > > >
> > > > > > > > > > I have one question:
> > > > > > > > > > Why did you changed "private function mouseClickHandler"
> to
> > > > > > > "protected
> > > > > > > > > > function mouseClickHandler" ?
> > > > > > > > > >
> > > > > > > > > > Carlos Rovira  escreveu no dia
> > > sexta,
> > > > > > > > > 11/09/2020
> > > > > > > > > > à(s) 18:26:
> > > > > > > > > >
> > > > > > > > > > > Hi Hugo,
> > > > > > > > > > > I committed some changes that would like you to check:
> > > > > > > > > > >
>

Re: Sort Jewel DataGrid by column click

2020-09-15 Thread Piotr Zarzycki
I have used build from yesterday.

wt., 15 wrz 2020 o 12:05 Hugo Ferreira  napisał(a):

> You should test with the most recent nightly build.
> There is also the mx version for the Flex emulation DataGrid.
> Ensure that you are using the Royale version.
>
> Piotr Zarzycki  escreveu no dia terça,
> 15/09/2020 à(s) 10:06:
>
> > Thanks Hugo. I have added it to one of the DG in TourDeJewel and it
> doesn't
> > work.
> >
> > wt., 15 wrz 2020 o 10:20 Hugo Ferreira 
> > napisał(a):
> >
> > > Hi Piotr,
> > >
> > > Just add the bead to the datagrid:
> > >
> > > 
> > > 
> > > 
> > > 
> > > 
> > >
> > > I was me that set dataProvider = null to force the DataGrid to refresh.
> > > I saw that on something else on the framework to refresh the DataGrid.
> > >
> > > Carlos, also is worry about that.
> > > For sure that is an area to be improved, to find out a better way to
> > > refresh if possible.
> > >
> > > Piotr Zarzycki  escreveu no dia terça,
> > > 15/09/2020 à(s) 07:17:
> > >
> > > > Hi Hugo, Carlos,
> > > >
> > > > Could you provide example how to use DataGridSort ?
> > > >
> > > > Additionally making dataProvider = null worries me a lot - can any of
> > you
> > > > look into this and sort it out ? It's completely insufficient if you
> > > > display a lot in DG.
> > > >
> > > > Thanks,
> > > > Piotr
> > > >
> > > > sob., 12 wrz 2020 o 16:53 Hugo Ferreira 
> > > > napisał(a):
> > > >
> > > > > That makes sense, not tied only a one kind of component.
> > > > >
> > > > > Carlos Rovira  escreveu no dia sábado,
> > > > 12/09/2020
> > > > > à(s) 15:48:
> > > > >
> > > > > > Just refactored the header to IDataGridHeader as a first step to
> > > allow
> > > > > > other kind ButtonBars (IconButtonBar or ToggleButtonBar).
> > > > > > So I think we could have some css for additional DG configuration
> > > that
> > > > > add
> > > > > > the sort bead and a toggle button bar with the right icons. Still
> > > have
> > > > to
> > > > > > think more about it...
> > > > > >
> > > > > > El sáb., 12 sept. 2020 a las 16:16, Hugo Ferreira (<
> > > > > hferreira...@gmail.com
> > > > > > >)
> > > > > > escribió:
> > > > > >
> > > > > > > Hi Carlos,
> > > > > > >
> > > > > > > Yes, I think that if someone needs to extend this bead, it's
> more
> > > > > likely
> > > > > > to
> > > > > > > create a complete new one instead of override a mouse click
> > > function.
> > > > > > > Just my 2 cents.
> > > > > > > But it's not a big issue for me.
> > > > > > >
> > > > > > > - I miss some icon indicators. That probably could be solved
> > > changing
> > > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > > > Yes. I notice that. Probably the next DataGrid update. Maybe I
> > can
> > > do
> > > > > > > myself.
> > > > > > >
> > > > > > > Carlos Rovira  escreveu no dia
> sábado,
> > > > > > 12/09/2020
> > > > > > > à(s) 08:24:
> > > > > > >
> > > > > > > > Hi Hugo,
> > > > > > > >
> > > > > > > > The change from private to protected was thinking on
> > > extensibility,
> > > > > > > > although probably in this case since it only implies that
> > > function
> > > > > > people
> > > > > > > > probably will create a completely new bead if they need to do
> > > > > something
> > > > > > > > more.
> > > > > > > >
> > > > > > > > Two more things:
> > > > > > > >
> > > > > > > > - The actual way of reassigning the collection completely
> has 2
> > > > > > problems:
> > > > > > > > remove the current selection (if it has some) and reset the
> > > > > > scrollToIndex
> > > > > > > > (scrollbar goes to the start). I add here @Greg Dove <
> > > > > > > greg.d...@gmail.com>
> > > > > > > > to
> > > > > > > > notice this.
> > > > > > > > - I miss some icon indicators. That probably could be solved
> > > > changing
> > > > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > > > >
> > > > > > > >
> > > > > > > > El vie., 11 sept. 2020 a las 20:14, Hugo Ferreira (<
> > > > > > > hferreira...@gmail.com
> > > > > > > > >)
> > > > > > > > escribió:
> > > > > > > >
> > > > > > > > > OK, I saw.
> > > > > > > > > Thank you.
> > > > > > > > >
> > > > > > > > > I have one question:
> > > > > > > > > Why did you changed "private function mouseClickHandler" to
> > > > > > "protected
> > > > > > > > > function mouseClickHandler" ?
> > > > > > > > >
> > > > > > > > > Carlos Rovira  escreveu no dia
> > sexta,
> > > > > > > > 11/09/2020
> > > > > > > > > à(s) 18:26:
> > > > > > > > >
> > > > > > > > > > Hi Hugo,
> > > > > > > > > > I committed some changes that would like you to check:
> > > > > > > > > >
> > > > > > > > > > * docs
> > > > > > > > > > * imports (DataGrid and Event imports was missed so jewel
> > was
> > > > not
> > > > > > > > > > compiling)
> > > > > > > > > >
> > > > > > > > > > also about this lines I was exposing in review comments:
> > > > > > > > > >
> > > > > > > > > > dg.dataProvider = null;
> > > > > > > > > > dg.dataProvider = collection;
> > > > > > > > > >
> > > > > > > > > > I was thinking 

Re: Sort Jewel DataGrid by column click

2020-09-15 Thread Hugo Ferreira
You should test with the most recent nightly build.
There is also the mx version for the Flex emulation DataGrid.
Ensure that you are using the Royale version.

Piotr Zarzycki  escreveu no dia terça,
15/09/2020 à(s) 10:06:

> Thanks Hugo. I have added it to one of the DG in TourDeJewel and it doesn't
> work.
>
> wt., 15 wrz 2020 o 10:20 Hugo Ferreira 
> napisał(a):
>
> > Hi Piotr,
> >
> > Just add the bead to the datagrid:
> >
> > 
> > 
> > 
> > 
> > 
> >
> > I was me that set dataProvider = null to force the DataGrid to refresh.
> > I saw that on something else on the framework to refresh the DataGrid.
> >
> > Carlos, also is worry about that.
> > For sure that is an area to be improved, to find out a better way to
> > refresh if possible.
> >
> > Piotr Zarzycki  escreveu no dia terça,
> > 15/09/2020 à(s) 07:17:
> >
> > > Hi Hugo, Carlos,
> > >
> > > Could you provide example how to use DataGridSort ?
> > >
> > > Additionally making dataProvider = null worries me a lot - can any of
> you
> > > look into this and sort it out ? It's completely insufficient if you
> > > display a lot in DG.
> > >
> > > Thanks,
> > > Piotr
> > >
> > > sob., 12 wrz 2020 o 16:53 Hugo Ferreira 
> > > napisał(a):
> > >
> > > > That makes sense, not tied only a one kind of component.
> > > >
> > > > Carlos Rovira  escreveu no dia sábado,
> > > 12/09/2020
> > > > à(s) 15:48:
> > > >
> > > > > Just refactored the header to IDataGridHeader as a first step to
> > allow
> > > > > other kind ButtonBars (IconButtonBar or ToggleButtonBar).
> > > > > So I think we could have some css for additional DG configuration
> > that
> > > > add
> > > > > the sort bead and a toggle button bar with the right icons. Still
> > have
> > > to
> > > > > think more about it...
> > > > >
> > > > > El sáb., 12 sept. 2020 a las 16:16, Hugo Ferreira (<
> > > > hferreira...@gmail.com
> > > > > >)
> > > > > escribió:
> > > > >
> > > > > > Hi Carlos,
> > > > > >
> > > > > > Yes, I think that if someone needs to extend this bead, it's more
> > > > likely
> > > > > to
> > > > > > create a complete new one instead of override a mouse click
> > function.
> > > > > > Just my 2 cents.
> > > > > > But it's not a big issue for me.
> > > > > >
> > > > > > - I miss some icon indicators. That probably could be solved
> > changing
> > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > > Yes. I notice that. Probably the next DataGrid update. Maybe I
> can
> > do
> > > > > > myself.
> > > > > >
> > > > > > Carlos Rovira  escreveu no dia sábado,
> > > > > 12/09/2020
> > > > > > à(s) 08:24:
> > > > > >
> > > > > > > Hi Hugo,
> > > > > > >
> > > > > > > The change from private to protected was thinking on
> > extensibility,
> > > > > > > although probably in this case since it only implies that
> > function
> > > > > people
> > > > > > > probably will create a completely new bead if they need to do
> > > > something
> > > > > > > more.
> > > > > > >
> > > > > > > Two more things:
> > > > > > >
> > > > > > > - The actual way of reassigning the collection completely has 2
> > > > > problems:
> > > > > > > remove the current selection (if it has some) and reset the
> > > > > scrollToIndex
> > > > > > > (scrollbar goes to the start). I add here @Greg Dove <
> > > > > > greg.d...@gmail.com>
> > > > > > > to
> > > > > > > notice this.
> > > > > > > - I miss some icon indicators. That probably could be solved
> > > changing
> > > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > > >
> > > > > > >
> > > > > > > El vie., 11 sept. 2020 a las 20:14, Hugo Ferreira (<
> > > > > > hferreira...@gmail.com
> > > > > > > >)
> > > > > > > escribió:
> > > > > > >
> > > > > > > > OK, I saw.
> > > > > > > > Thank you.
> > > > > > > >
> > > > > > > > I have one question:
> > > > > > > > Why did you changed "private function mouseClickHandler" to
> > > > > "protected
> > > > > > > > function mouseClickHandler" ?
> > > > > > > >
> > > > > > > > Carlos Rovira  escreveu no dia
> sexta,
> > > > > > > 11/09/2020
> > > > > > > > à(s) 18:26:
> > > > > > > >
> > > > > > > > > Hi Hugo,
> > > > > > > > > I committed some changes that would like you to check:
> > > > > > > > >
> > > > > > > > > * docs
> > > > > > > > > * imports (DataGrid and Event imports was missed so jewel
> was
> > > not
> > > > > > > > > compiling)
> > > > > > > > >
> > > > > > > > > also about this lines I was exposing in review comments:
> > > > > > > > >
> > > > > > > > > dg.dataProvider = null;
> > > > > > > > > dg.dataProvider = collection;
> > > > > > > > >
> > > > > > > > > I was thinking in do instead this:
> > > > > > > > >
> > > > > > > > > dg.model.dispatchEvent(new Event("dataProviderChanged"));
> > > > > > > > >
> > > > > > > > > But this is not working since
> > > > > "ArrayListSelectionModel.dataProvider"
> > > > > > > for
> > > > > > > > > each column List has:
> > > > > > > > >
> > > > > > > > > if (value == _dataProvider) return;
> > > > > > > > >
> > > > > > > > > a

RE: Open ByteArray as file

2020-09-15 Thread Maria Jose Esteve
Hi Hugo, sorry for the delay.

Here you can see how we work with mx.net.FileReference. (I have adapted the 
code to be able to show it to you in a few lines, there may be omission or 
transcription errors)

import org.apache.royale.events.Event;
import org.apache.royale.events.IEventDispatcher;
import mx.net.FileReference;
import mx.net.FileFilter;
import mx.events.IOErrorEvent;
import mx.events.SecurityErrorEvent;
import mx.utils.ByteArray;

public var allowedExtensions:String = '*.jpg;*.jpeg;*.gif;*.png;*.bmp';
public var maxFileSize:Number = 2;  
public var fileType:String;
public var fileName:String;
private var fileData:ByteArray;

public function loadFromFileSystem():void
{
fileData = null;
fileType = "";
fileName = "";

var file:FileReference = new FileReference();
file.addEventListener("cancel", cancelHandler);
file.addEventListener(Event.SELECT, selectHandler);
file.browse([new FileFilter('Image',allowedExtensions)]);
}

private function cancelHandler(event:Event):void
{
var dispatcher:IEventDispatcher = 
IEventDispatcher(event.target);
dispatcher.removeEventListener("cancel", cancelHandler);
dispatcher.removeEventListener(Event.SELECT, selectHandler);
}

private function selectHandler(event:Event):void
{
var file:FileReference = FileReference(event.target);
file.removeEventListener("cancel", cancelHandler);
file.removeEventListener(Event.SELECT, selectHandler);

var fileTypeIndex:int = file.name.search(new 
RegExp("\.[^\.]+$"));  
var _fileType:String = fileTypeIndex >= 0 ? 
file.name.slice(fileTypeIndex).toLowerCase() : "";

if (allowedExtensions.search(_fileType.toLowerCase()) == -1) {
Alert.show(String("File type not supported") + " (" + 
allowedExtensions.replace(/\*\./g, "").replace(/;/g, ",").toUpperCase() + ")");
return;
}
if (!isNaN(maxFileSize) && file.size > maxFileSize * 1024) {
Alert.show(String("Maximum file size exceeded") + " (" 
+ maxFileSize + " KB)");
return;
}

file.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
file.addEventListener(SecurityErrorEvent.SECURITY_ERROR, 
errorHandler);
file.addEventListener(Event.COMPLETE, completeHandler);
fileType = _fileType;
fileName = file.name;

file.load();
}

private function completeHandler(event:Event):void
{
var dispatcher:IEventDispatcher = 
IEventDispatcher(event.target);
dispatcher.removeEventListener(IOErrorEvent.IO_ERROR, 
errorHandler);

dispatcher.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
dispatcher.removeEventListener(Event.COMPLETE, completeHandler);

fileData = Object(dispatcher).data;
}

private function errorHandler(event:Event):void
{
var dispatcher:IEventDispatcher = 
IEventDispatcher(event.target);
dispatcher.removeEventListener(IOErrorEvent.IO_ERROR, 
errorHandler);

dispatcher.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, errorHandler);
dispatcher.removeEventListener(Event.COMPLETE, completeHandler);

fileData = null;
}

In the view, you can have a Jewel BinaryImage that you will assign fileData to:

//xmlns:j="library://ns.apache.org/royale/jewel"


I don't know if this will help you ... (An example of this type is never bad, 
right?)

Hiedra.
-Mensaje original-
De: Carlos Rovira  
Enviado el: lunes, 14 de septiembre de 2020 10:22
Para: Apache Royale Development 
Asunto: Re: Open ByteArray as file

Hi Hugo,

sure, don't worry I'm sure others will take a look soon.
thanks

El dom., 13 sept. 2020 a las 18:06, Hugo Ferreira ()
escribió:

> OK.
> For now, I'm using my own implementation.
> If in a near future my fix is integrated in Royale framework, I will 
> delete my implementation on use directly from Royle.
>
> Carlos Rovira  escreveu no dia domingo,
> 13/09/2020
> à(s) 15:52:
>
> > Hi Hugo,
> > since I don't have much use of that class hope others can review it 
> > thanks
> >
> > El dom., 13 sept. 2020 a las 2:59, Hugo Ferreira (<
> hferreira...@gmail.com
> > >)
> > escribió:
> >
> > > FileReference fixed with a PR.

Re: Sort Jewel DataGrid by column click

2020-09-15 Thread Piotr Zarzycki
Thanks Hugo. I have added it to one of the DG in TourDeJewel and it doesn't
work.

wt., 15 wrz 2020 o 10:20 Hugo Ferreira  napisał(a):

> Hi Piotr,
>
> Just add the bead to the datagrid:
>
> 
> 
> 
> 
> 
>
> I was me that set dataProvider = null to force the DataGrid to refresh.
> I saw that on something else on the framework to refresh the DataGrid.
>
> Carlos, also is worry about that.
> For sure that is an area to be improved, to find out a better way to
> refresh if possible.
>
> Piotr Zarzycki  escreveu no dia terça,
> 15/09/2020 à(s) 07:17:
>
> > Hi Hugo, Carlos,
> >
> > Could you provide example how to use DataGridSort ?
> >
> > Additionally making dataProvider = null worries me a lot - can any of you
> > look into this and sort it out ? It's completely insufficient if you
> > display a lot in DG.
> >
> > Thanks,
> > Piotr
> >
> > sob., 12 wrz 2020 o 16:53 Hugo Ferreira 
> > napisał(a):
> >
> > > That makes sense, not tied only a one kind of component.
> > >
> > > Carlos Rovira  escreveu no dia sábado,
> > 12/09/2020
> > > à(s) 15:48:
> > >
> > > > Just refactored the header to IDataGridHeader as a first step to
> allow
> > > > other kind ButtonBars (IconButtonBar or ToggleButtonBar).
> > > > So I think we could have some css for additional DG configuration
> that
> > > add
> > > > the sort bead and a toggle button bar with the right icons. Still
> have
> > to
> > > > think more about it...
> > > >
> > > > El sáb., 12 sept. 2020 a las 16:16, Hugo Ferreira (<
> > > hferreira...@gmail.com
> > > > >)
> > > > escribió:
> > > >
> > > > > Hi Carlos,
> > > > >
> > > > > Yes, I think that if someone needs to extend this bead, it's more
> > > likely
> > > > to
> > > > > create a complete new one instead of override a mouse click
> function.
> > > > > Just my 2 cents.
> > > > > But it's not a big issue for me.
> > > > >
> > > > > - I miss some icon indicators. That probably could be solved
> changing
> > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > Yes. I notice that. Probably the next DataGrid update. Maybe I can
> do
> > > > > myself.
> > > > >
> > > > > Carlos Rovira  escreveu no dia sábado,
> > > > 12/09/2020
> > > > > à(s) 08:24:
> > > > >
> > > > > > Hi Hugo,
> > > > > >
> > > > > > The change from private to protected was thinking on
> extensibility,
> > > > > > although probably in this case since it only implies that
> function
> > > > people
> > > > > > probably will create a completely new bead if they need to do
> > > something
> > > > > > more.
> > > > > >
> > > > > > Two more things:
> > > > > >
> > > > > > - The actual way of reassigning the collection completely has 2
> > > > problems:
> > > > > > remove the current selection (if it has some) and reset the
> > > > scrollToIndex
> > > > > > (scrollbar goes to the start). I add here @Greg Dove <
> > > > > greg.d...@gmail.com>
> > > > > > to
> > > > > > notice this.
> > > > > > - I miss some icon indicators. That probably could be solved
> > changing
> > > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > > >
> > > > > >
> > > > > > El vie., 11 sept. 2020 a las 20:14, Hugo Ferreira (<
> > > > > hferreira...@gmail.com
> > > > > > >)
> > > > > > escribió:
> > > > > >
> > > > > > > OK, I saw.
> > > > > > > Thank you.
> > > > > > >
> > > > > > > I have one question:
> > > > > > > Why did you changed "private function mouseClickHandler" to
> > > > "protected
> > > > > > > function mouseClickHandler" ?
> > > > > > >
> > > > > > > Carlos Rovira  escreveu no dia sexta,
> > > > > > 11/09/2020
> > > > > > > à(s) 18:26:
> > > > > > >
> > > > > > > > Hi Hugo,
> > > > > > > > I committed some changes that would like you to check:
> > > > > > > >
> > > > > > > > * docs
> > > > > > > > * imports (DataGrid and Event imports was missed so jewel was
> > not
> > > > > > > > compiling)
> > > > > > > >
> > > > > > > > also about this lines I was exposing in review comments:
> > > > > > > >
> > > > > > > > dg.dataProvider = null;
> > > > > > > > dg.dataProvider = collection;
> > > > > > > >
> > > > > > > > I was thinking in do instead this:
> > > > > > > >
> > > > > > > > dg.model.dispatchEvent(new Event("dataProviderChanged"));
> > > > > > > >
> > > > > > > > But this is not working since
> > > > "ArrayListSelectionModel.dataProvider"
> > > > > > for
> > > > > > > > each column List has:
> > > > > > > >
> > > > > > > > if (value == _dataProvider) return;
> > > > > > > >
> > > > > > > > and since the dataProvider is the same (although order
> changed)
> > > it
> > > > > > > returns
> > > > > > > > without refreshing it
> > > > > > > > for that reason you need to do a null and then reassign the
> > > > provider.
> > > > > > > >
> > > > > > > > I'll see what we can do in that kind of cases.
> > > > > > > >
> > > > > > > > @Greg Dove  , what do you think about
> > this?
> > > > > > looking
> > > > > > > > at
> > > > > > > > IArrayListView API talks about calling just refresh() in the
> > > > > collection
> > > > 

Re: Sort Jewel DataGrid by column click

2020-09-15 Thread Hugo Ferreira
Hi Piotr,

Just add the bead to the datagrid:







I was me that set dataProvider = null to force the DataGrid to refresh.
I saw that on something else on the framework to refresh the DataGrid.

Carlos, also is worry about that.
For sure that is an area to be improved, to find out a better way to
refresh if possible.

Piotr Zarzycki  escreveu no dia terça,
15/09/2020 à(s) 07:17:

> Hi Hugo, Carlos,
>
> Could you provide example how to use DataGridSort ?
>
> Additionally making dataProvider = null worries me a lot - can any of you
> look into this and sort it out ? It's completely insufficient if you
> display a lot in DG.
>
> Thanks,
> Piotr
>
> sob., 12 wrz 2020 o 16:53 Hugo Ferreira 
> napisał(a):
>
> > That makes sense, not tied only a one kind of component.
> >
> > Carlos Rovira  escreveu no dia sábado,
> 12/09/2020
> > à(s) 15:48:
> >
> > > Just refactored the header to IDataGridHeader as a first step to allow
> > > other kind ButtonBars (IconButtonBar or ToggleButtonBar).
> > > So I think we could have some css for additional DG configuration that
> > add
> > > the sort bead and a toggle button bar with the right icons. Still have
> to
> > > think more about it...
> > >
> > > El sáb., 12 sept. 2020 a las 16:16, Hugo Ferreira (<
> > hferreira...@gmail.com
> > > >)
> > > escribió:
> > >
> > > > Hi Carlos,
> > > >
> > > > Yes, I think that if someone needs to extend this bead, it's more
> > likely
> > > to
> > > > create a complete new one instead of override a mouse click function.
> > > > Just my 2 cents.
> > > > But it's not a big issue for me.
> > > >
> > > > - I miss some icon indicators. That probably could be solved changing
> > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > Yes. I notice that. Probably the next DataGrid update. Maybe I can do
> > > > myself.
> > > >
> > > > Carlos Rovira  escreveu no dia sábado,
> > > 12/09/2020
> > > > à(s) 08:24:
> > > >
> > > > > Hi Hugo,
> > > > >
> > > > > The change from private to protected was thinking on extensibility,
> > > > > although probably in this case since it only implies that function
> > > people
> > > > > probably will create a completely new bead if they need to do
> > something
> > > > > more.
> > > > >
> > > > > Two more things:
> > > > >
> > > > > - The actual way of reassigning the collection completely has 2
> > > problems:
> > > > > remove the current selection (if it has some) and reset the
> > > scrollToIndex
> > > > > (scrollbar goes to the start). I add here @Greg Dove <
> > > > greg.d...@gmail.com>
> > > > > to
> > > > > notice this.
> > > > > - I miss some icon indicators. That probably could be solved
> changing
> > > > > ButtonBar to ToggleButtonBar and setting up the up/down icons
> > > > >
> > > > >
> > > > > El vie., 11 sept. 2020 a las 20:14, Hugo Ferreira (<
> > > > hferreira...@gmail.com
> > > > > >)
> > > > > escribió:
> > > > >
> > > > > > OK, I saw.
> > > > > > Thank you.
> > > > > >
> > > > > > I have one question:
> > > > > > Why did you changed "private function mouseClickHandler" to
> > > "protected
> > > > > > function mouseClickHandler" ?
> > > > > >
> > > > > > Carlos Rovira  escreveu no dia sexta,
> > > > > 11/09/2020
> > > > > > à(s) 18:26:
> > > > > >
> > > > > > > Hi Hugo,
> > > > > > > I committed some changes that would like you to check:
> > > > > > >
> > > > > > > * docs
> > > > > > > * imports (DataGrid and Event imports was missed so jewel was
> not
> > > > > > > compiling)
> > > > > > >
> > > > > > > also about this lines I was exposing in review comments:
> > > > > > >
> > > > > > > dg.dataProvider = null;
> > > > > > > dg.dataProvider = collection;
> > > > > > >
> > > > > > > I was thinking in do instead this:
> > > > > > >
> > > > > > > dg.model.dispatchEvent(new Event("dataProviderChanged"));
> > > > > > >
> > > > > > > But this is not working since
> > > "ArrayListSelectionModel.dataProvider"
> > > > > for
> > > > > > > each column List has:
> > > > > > >
> > > > > > > if (value == _dataProvider) return;
> > > > > > >
> > > > > > > and since the dataProvider is the same (although order changed)
> > it
> > > > > > returns
> > > > > > > without refreshing it
> > > > > > > for that reason you need to do a null and then reassign the
> > > provider.
> > > > > > >
> > > > > > > I'll see what we can do in that kind of cases.
> > > > > > >
> > > > > > > @Greg Dove  , what do you think about
> this?
> > > > > looking
> > > > > > > at
> > > > > > > IArrayListView API talks about calling just refresh() in the
> > > > collection
> > > > > > > should update the view, but we are not doing this, so making
> > things
> > > > > > > more complicated when using the API.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > El vie., 11 sept. 2020 a las 19:14, Carlos Rovira (<
> > > > > > > carlosrov...@apache.org>)
> > > > > > > escribió:
> > > > > > >
> > > > > > > > Hi Hugo,
> > > > > > > >
> > > > > > > > it's less difficult than you could think. For example in
> Jewel
> > > > List

Re: [DISCUSS] fork/move Apache Flex BlazeDS to Royale?

2020-09-15 Thread Piotr Zarzycki
Definitely Chris! Enjoy your meal ! ;)

wt., 15 wrz 2020 o 09:17 Christofer Dutz 
napisał(a):

> Lol ... good catch .. stupid phone __
>
> Note to myself: Don't write emails on your phone during breakfast ...
>
> That should have been "RoyaleDS" __
>
> Chris
>
> Am 15.09.20, 08:59 schrieb "Piotr Zarzycki" :
>
> Chris,
>
> Why Royales ? Do you suggest to have more than one project there ?
>
> wt., 15 wrz 2020 o 08:52 Christofer Dutz 
> napisał(a):
>
> > Hi all,
> >
> > Well if we want to do this, I would suggest a new git repository.
> For that
> > we should pick a name. I would suggest Royales. But that's something
> that
> > has to be an act of the PMC (I think).
> >
> > Chris
> >
> > 
> > Von: Greg Dove 
> > Gesendet: Montag, 14. September 2020 22:18
> > An: Apache Royale Development 
> > Betreff: Re: [DISCUSS] fork/move Apache Flex BlazeDS to Royale?
> >
> > I am not really familiar with any detail of BlazeDS, but this does
> sound
> > like a great idea to me, Chris.
> > If you can 'modernize' a version of BlazeDS that is increasingly more
> > suitable for Royale, sounds like a really good fit for your
> knowledge and
> > experience. I'm not sure we have anyone else who would/could do that.
> > I say 'go for it'!
> > +1 (if it's needed).
> >
> >
> > On Mon, Sep 14, 2020 at 9:04 PM Raúl Núñez 
> wrote:
> >
> > > Hi:
> > >
> > > I totally agree with this update. So +1 :) :)
> > >
> > > Regards!!
> > >
> > > El lun., 14 sept. 2020 a las 10:58, Carlos Rovira (<
> > > carlosrov...@apache.org>)
> > > escribió:
> > >
> > > > Hi Chris,
> > > >
> > > > I'm all for it. We really need BladeDS in Royale, so we should
> keep it
> > > with
> > > > the flow and also improve it for the actual needs. Spring Flex
> > > integration
> > > > is now dead, so bringing that too to keep it alive would be very
> good.
> > > >
> > > > So it's ok for me to leave BladeDS in Flex in its current name
> and
> > > > versioning (and if there's any need in flex in forthcoming years
> let
> > > others
> > > > do the patches they could need), and bring BlazeDS in its
> current state
> > > as
> > > > "RoyaleDS" here and start releasing new improvements for Royale
> with
> > the
> > > > new name.
> > > >
> > > > I think that also will make Royale stronger since we already
> support
> > the
> > > > main AMF implementation in this project.
> > > >
> > > > So +1
> > > >
> > > >
> > > > El lun., 14 sept. 2020 a las 10:44, Christofer Dutz (<
> > > > christofer.d...@c-ware.de>) escribió:
> > > >
> > > > > Hi all,
> > > > >
> > > > > currently I’m using Apache Flex BlazeDS as backend for my
> Royale
> > > > > applications.
> > > > >
> > > > > This has somewhat become a little old and I do need to do
> quite some
> > > > > tweaking to get it working with Royale and especially with new
> > Spring,
> > > > > Spring-Boot and Spring-Security.
> > > > > So I guess doing some update of that and re-releasing does
> sound
> > like a
> > > > > good idea.
> > > > >
> > > > > But I think it would be better to do a clean cut and optimize
> it for
> > > > usage
> > > > > with Royale.
> > > > >
> > > > > I’d even like to call it something “RoyaleDS” to make the link
> > Rolyale
> > > +
> > > > > RoyaleDS a little more obvious than the old Flex + BlazeDS
> pair.
> > > > >
> > > > > What do you think?
> > > > >
> > > > > Right now the Flex project seems like we’re keeping the lights
> on in
> > an
> > > > > empty building and I doubt things will improve soon. Starting
> to move
> > > the
> > > > > things we want to keep on maintaining to Royale sounds like a
> good
> > > thing
> > > > to
> > > > > to.
> > > > > Perhaps even a stripped down version of the mavenizer.
> > > > >
> > > > > Chris
> > > > >
> > > >
> > > >
> > > > --
> > > > Carlos Rovira
> > > > http://about.me/carlosrovira
> > > >
> > >
> >
>
>
> --
>
> Piotr Zarzycki
>
>

-- 

Piotr Zarzycki


Re: [DISCUSS] fork/move Apache Flex BlazeDS to Royale?

2020-09-15 Thread Christofer Dutz
Lol ... good catch .. stupid phone __ 

Note to myself: Don't write emails on your phone during breakfast ...

That should have been "RoyaleDS" __

Chris

Am 15.09.20, 08:59 schrieb "Piotr Zarzycki" :

Chris,

Why Royales ? Do you suggest to have more than one project there ?

wt., 15 wrz 2020 o 08:52 Christofer Dutz 
napisał(a):

> Hi all,
>
> Well if we want to do this, I would suggest a new git repository. For that
> we should pick a name. I would suggest Royales. But that's something that
> has to be an act of the PMC (I think).
>
> Chris
>
> 
> Von: Greg Dove 
> Gesendet: Montag, 14. September 2020 22:18
> An: Apache Royale Development 
> Betreff: Re: [DISCUSS] fork/move Apache Flex BlazeDS to Royale?
>
> I am not really familiar with any detail of BlazeDS, but this does sound
> like a great idea to me, Chris.
> If you can 'modernize' a version of BlazeDS that is increasingly more
> suitable for Royale, sounds like a really good fit for your knowledge and
> experience. I'm not sure we have anyone else who would/could do that.
> I say 'go for it'!
> +1 (if it's needed).
>
>
> On Mon, Sep 14, 2020 at 9:04 PM Raúl Núñez  wrote:
>
> > Hi:
> >
> > I totally agree with this update. So +1 :) :)
> >
> > Regards!!
> >
> > El lun., 14 sept. 2020 a las 10:58, Carlos Rovira (<
> > carlosrov...@apache.org>)
> > escribió:
> >
> > > Hi Chris,
> > >
> > > I'm all for it. We really need BladeDS in Royale, so we should keep it
> > with
> > > the flow and also improve it for the actual needs. Spring Flex
> > integration
> > > is now dead, so bringing that too to keep it alive would be very good.
> > >
> > > So it's ok for me to leave BladeDS in Flex in its current name and
> > > versioning (and if there's any need in flex in forthcoming years let
> > others
> > > do the patches they could need), and bring BlazeDS in its current 
state
> > as
> > > "RoyaleDS" here and start releasing new improvements for Royale with
> the
> > > new name.
> > >
> > > I think that also will make Royale stronger since we already support
> the
> > > main AMF implementation in this project.
> > >
> > > So +1
> > >
> > >
> > > El lun., 14 sept. 2020 a las 10:44, Christofer Dutz (<
> > > christofer.d...@c-ware.de>) escribió:
> > >
> > > > Hi all,
> > > >
> > > > currently I’m using Apache Flex BlazeDS as backend for my Royale
> > > > applications.
> > > >
> > > > This has somewhat become a little old and I do need to do quite some
> > > > tweaking to get it working with Royale and especially with new
> Spring,
> > > > Spring-Boot and Spring-Security.
> > > > So I guess doing some update of that and re-releasing does sound
> like a
> > > > good idea.
> > > >
> > > > But I think it would be better to do a clean cut and optimize it for
> > > usage
> > > > with Royale.
> > > >
> > > > I’d even like to call it something “RoyaleDS” to make the link
> Rolyale
> > +
> > > > RoyaleDS a little more obvious than the old Flex + BlazeDS pair.
> > > >
> > > > What do you think?
> > > >
> > > > Right now the Flex project seems like we’re keeping the lights on in
> an
> > > > empty building and I doubt things will improve soon. Starting to 
move
> > the
> > > > things we want to keep on maintaining to Royale sounds like a good
> > thing
> > > to
> > > > to.
> > > > Perhaps even a stripped down version of the mavenizer.
> > > >
> > > > Chris
> > > >
> > >
> > >
> > > --
> > > Carlos Rovira
> > > http://about.me/carlosrovira
> > >
> >
>


-- 

Piotr Zarzycki