flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: Filter function to ArrayList?
Date Fri, 30 Dec 2016 05:52:08 GMT
Sounds good.  I may not be able to really review this until we get back to
a regular schedule on Jan 3.  Right now I get only get a few minutes here
and there.  Thanks for working on it.

A couple of thoughts in-line...


On 12/29/16, 3:27 PM, "JoelProminic" <joel@prominic.net> wrote:

>I started some work on this feature.  I created a JIRA issue here:
>I created a simple implementation, FilteredArrayList, that is just a
>subclass of ArrayList.
>I created an IFilter interface to define the filter, rather than the
>Function used by ArrayCollection.  I originally tried to use a Function,
>I found that it did not convert properly in the Javascript application.
>This solution maintains a second ArrayList that represents the elements
>match the given filter.  The ArrayList functions are overridden to update
>this list as appropriate.
>I confirmed that I could use FilteredArrayList with a DataGrid.  See
>TestFilteredArrayList.zip in JIRA for an example project.  Note that the
>changes will not be updated to DataGrid until you click "Refresh"
>Some notes:
>- This is a proof of concept.  The class needs some more robustness and
>testing before it is ready for "production"
>- I used the filtered list for the {{getItemAt}} and {{length}}
>- For other functions that use a specific index (addItemAt, removeItemAt,
>updateItemAt), I used the index of the parent class.  This could be a bit
>unintuitive for some cases

It might be reasonable to make a read-only versions of the classes and
APIs that don't have these "write" methods so that basic implementations
can avoid the whole topic of what index means when writing.
>- I have not implemented getItemIndex, itemUpdated, itemUpdatedAt, and
>- There is no way to read items directly from the underlying list, for
>- I have not yet created a specialized interface for this class (i.e.
>IFilteredArrayList).  I haven't seen an advantage to this, yet.

If any, the advantage would be that folks will implement different
versions with different strategies for the "write" methods.

>- I have not added any events to the functions.
>I have attached an example application as TestFilteredArrayList.zip to the
>JIRA issue.  The FilteredArrayList implementation is in:
>- src/collections/FilteredArrayList.as
>- src/collections/IFilter.as
>Joel Anderson
>My Apache Flex community contribution is working on the open source
>Moonshine-IDE.com for FlexJS.
>View this message in context:
>Sent from the Apache Flex Development mailing list archive at Nabble.com.

View raw message