You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Piotr Zarzycki <pi...@gmail.com> on 2017/12/04 21:53:23 UTC

List, MDL Table - How to remove all content

Hi Guys,

I have faced an issue where solution seems to be not so easy. I have MDL
Table (issue affects also List) with some rows.

If I simply assign to dataProvider = null it doesn't remove all content. It
is because in our DataItemRendererFactoryForArrayData and other type of
that class we have in listeners of  "dataProviderChanged" this code [1].
Basically if we assign null to dataProvider we are not cleaning up item
renderers, but should we ?

Maybe there should be separate bead which allow to do such operations ?

Thoughts ?

[1] *https://paste.apache.org/6qVy <https://paste.apache.org/6qVy>*

Thanks,
-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: List, MDL Table - How to remove all content

Posted by Piotr Zarzycki <pi...@gmail.com>.
I will wait for your changes to do not duplicate anything. I'm using right
now DynamicItemsRendererFactoryForArrayList to handle adding to the MDL
Table. Do you think that you will finish those beads this week ?

Thanks, Piotr

2017-12-05 17:15 GMT+01:00 Peter Ent <pe...@adobe.com.invalid>:

> If you remove everything from the ArrayList, the ArrayList dispatches
> ITEM_REMOVED for each item (if you have 1000 items you will get 1000
> events). ArrayList should probably not do that and instead, dispatch a
> single COLLECTION_CHANGED event once completed.
>
> But the RemoveItemBead will in fact, handle each ITEM_REMOVED event and
> eventually clear out the list. To be more efficient, another bead should
> be made since DataItemRendererFactoryForArrayList does not listen to
> COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
> enhanced version of that).
>
> I have also been toying with just updating
> DynamicItemsRenderFactoryForArrayList to make it handle all the cases and
> forget the individual beads. You can pay little by using the
> DataItemRendererFactoryForArrayList bead if you just want to display a
> static list or pay it all and use DynamicItemsRendererFactoryForArrayList
> even though you may only be inserting and never removing items.
>
> —peter
>
>
>
> On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>
> >However those two beads are for remove single items? What if I remove
> >everything from the ArrayList?
> >
> >On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
> >wrote:
> >
> >> Those two beads will handle remove/add, so will I be able to use it for
> >> list?
> >>
> >> It look like all your upcoming changes is something which I need for.
> >>
> >> I'm look forward to your commit!
> >>
> >> Thanks, Piotr
> >>
> >> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
> >>
> >>> I am working on an AddItemBead and RemoveItemBead. These beads assume
> >>>the
> >>> dataProvider in the model are ArrayList since that collection
> >>>dispatches
> >>> CollectionEvents with itemAdded and itemRemoved events. So these beads
> >>> will either add an item to the DataGroup or remove one. Then they will
> >>> adjust the model's selectedItem and selectedIndex accordingly.
> >>>
> >>> These will be beads of the DataItemRendererFactoryForArrayList and not
> >>> beads on the List itself. I'm having to change
> >>> DataItemRendererFactoryForArrayList to make things more public since
> it
> >>> isn't trivial to add or remove an itemRenderer.
> >>>
> >>> —peter
> >>>
> >>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
> >>>wrote:
> >>>
> >>> >Hi Peter,
> >>> >
> >>> >I see that and there is question whether I can put that code as a
> >>> separate
> >>> >bead to our repo and whether you are not going to do this?
> >>> >You have started other thread about Tree Grid and beads mentioned by
> >>>you
> >>> >seems to be the answer. Let me know before I create something.
> >>> >
> >>> >Thanks, Piotr
> >>> >
> >>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
> >>> >
> >>> >> I think some of this changes when you are running in the browser.
> >>>Does
> >>> >>our
> >>> >> framework code really need to know if an item is visible or not to
> >>> >>remove
> >>> >> it? You want it gone from the DOM so you need to remove it and the
> >>> >>browser
> >>> >> takes care of the visuals. Depending on the CSS for that container,
> >>> >>things
> >>> >> would probably just sort themselves out - no need to fool with
> >>> >>scrollbars
> >>> >> either as they are the responsibility of the browser. On the browser
> >>> >> platform, adding a remove function would not, I think, be as costly
> >>>as
> >>> >>it
> >>> >> would on the Flash platform.
> >>> >>
> >>> >> Now the selectedItem and selectedIndex are, of course, Royale
> >>>things so
> >>> >> that would need to be considered. But that's the same as for adding
> >>>or
> >>> >> inserting an item into a list. Again, the browser should take care
> >>>of
> >>> >>the
> >>> >> visuals once the item is added to the DOM. If the item has been
> >>>tagged
> >>> >> properly for CSS, you wouldn't even need to trigger the Royale
> >>>layout.
> >>> >>
> >>> >> As a side note, the reason the Group does not have a default layout
> >>>is
> >>> >>to
> >>> >> allow you to make a DIV (the Group), put stuff into it, and style
> >>>it so
> >>> >> that the "layout" is handled in CSS. This way added, removing,
> >>>changing
> >>> >>is
> >>> >> left up the browser with no need for Royale code support since the
> >>> >>browser
> >>> >> has all the code already and your Royale payload can be smaller. You
> >>> >>only
> >>> >> need to "pay" if you want a layout that cannot be accomplished with
> >>> CSS.
> >>> >>
> >>> >> Supporting virtualized list is a completely different matter. HTML
> >>> >>doesn't
> >>> >> support that and then what Alex says really comes into play there.
> >>> >>
> >>> >> Back the question about removing all the rows. The DataGroup has a
> >>> >> function to remove all of the itemRenderers. You need to trigger
> >>>that
> >>> >> somehow - either in your own code or perhaps a bead. Then clean up
> >>>the
> >>> >> selectedItem/selectedIndex in the model.
> >>> >>
> >>> >> ‹peter
> >>> >>
> >>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID>
> wrote:
> >>> >>
> >>> >> >In general, removing stuff should be PAYG.  Not every app needs to
> >>> >>remove
> >>> >> >things, and removal is often way more expensive than adding.
> >>> >> >
> >>> >> >For example, when an item is added to a sophisticated list, the
> >>> various
> >>> >> >beads have to do these things:
> >>> >> >1) figure out if the item is on screen and a new renderer needs to
> >>>be
> >>> >> >added.
> >>> >> >2) figure out if the item was added before the selectedIndex so the
> >>> >> >selectedIndex needs to be updated
> >>> >> >3) update the scrollbar (if any).
> >>> >> >
> >>> >> >When removing, the various beads have more to do:
> >>> >> >1) figure out if the item is on screen and its renderer needs to be
> >>> >> >removed.
> >>> >> >2) figure out if the renderer removed is on the last visible page
> >>>of
> >>> >>the
> >>> >> >list and scrollbars are up and the item that will take up the
> >>>removed
> >>> >> >renderer needs to come from a lower index in the data provider
> >>> >> >3) figure out if the item was added before the selectedIndex so the
> >>> >> >selectedIndex needs to be updated
> >>> >> >4) figure out if the item removed was the selectedIndex and thus
> >>> decide
> >>> >> >what to do about selectedIndex and selectedItem
> >>> >> >5) update the scrollbar (if any).
> >>> >> >
> >>> >> >HTH,
> >>> >> >-Alex
> >>> >> >
> >>> >> >
> >>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
> >>> >> >
> >>> >> >>I need to think about this for a bit because I¹m fiddling with
> >>>this
> >>> >>bit
> >>> >> >>of code in List. I¹ll get back to you in my tomorrow.
> >>> >> >>
> >>> >> >>Peter
> >>> >> >>
> >>> >> >>
> >>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
> >>> >><pi...@gmail.com>
> >>> >> >>>wrote:
> >>> >> >>> Hi Guys,
> >>> >> >>>
> >>> >> >>> I have faced an issue where solution seems to be not so easy. I
> >>> have
> >>> >> >>>MDL
> >>> >> >>> Table (issue affects also List) with some rows.
> >>> >> >>>
> >>> >> >>> If I simply assign to dataProvider = null it doesn't remove all
> >>> >> >>>content. It
> >>> >> >>> is because in our DataItemRendererFactoryForArrayData and other
> >>> >>type of
> >>> >> >>> that class we have in listeners of  "dataProviderChanged" this
> >>>code
> >>> >> >>>[1].
> >>> >> >>> Basically if we assign null to dataProvider we are not cleaning
> >>>up
> >>> >>item
> >>> >> >>> renderers, but should we ?
> >>> >> >>>
> >>> >> >>> Maybe there should be separate bead which allow to do such
> >>> >>operations ?
> >>> >> >>>
> >>> >> >>> Thoughts ?
> >>> >> >>>
> >>> >> >>> [1]
> >>> >>
> >>> >>>>>*
> >>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>> >>>>>e
> >>> >> .
> >>> >> >>>a
> >>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >>> >> %7C05ca01d43a8448485bd50
> >>> >> >>>8
> >>> >>
> >>>
> >>>
> >>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C63648021216
> >>>>>>>>449
> >>> >>>>>91
> >>> >> >>>9
> >>> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jA
> KTJVI6RHSocL8%3D&reserved=0
> >>> >>
> >>> >>>>><
> >>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>> >>>>>e
> >>> >> .
> >>> >> >>>a
> >>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >>> >> %7C05ca01d43a8448485bd50
> >>> >> >>>8
> >>> >>
> >>>
> >>>
> >>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C63648021216
> >>>>>>>>449
> >>> >>>>>91
> >>> >> >>>9
> >>> >>
> >>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
> >>> >> >>>
> >>> >> >>> Thanks,
> >>> >> >>> --
> >>> >> >>>
> >>> >> >>> Piotr Zarzycki
> >>> >> >>>
> >>> >> >>> Patreon:
> >>> >> >>>*
> >>> >>
> >>> https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.pa
> >>> >> >>>t
> >>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >>> >> %7C05ca01d43a844
> >>> >> >>>8
> >>> >>
> >>>
> >>>
> >>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C636
> >>>>>>>>480
> >>> >>>>>21
> >>> >> >>>2
> >>> >>
> >>>
> >>>
> >>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
> BDevLzt8WoPS4%3D&rese
> >>>>>>>>rve
> >>> >>>>>d=
> >>> >> >>>0
> >>> >> >>>
> >>> >> >>><
> >>> >>
> >>> https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.pa
> >>> >> >>>t
> >>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >>> >> %7C05ca01d43a844
> >>> >> >>>8
> >>> >>
> >>>
> >>>
> >>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C636
> >>>>>>>>480
> >>> >>>>>21
> >>> >> >>>2
> >>> >>
> >>>
> >>>
> >>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
> BDevLzt8WoPS4%3D&rese
> >>>>>>>>rve
> >>> >>>>>d=
> >>> >> >>>0
> >>> >> >>>>*
> >>> >> >
> >>> >>
> >>> >>
> >>>
> >>>
>
>


-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
Just to give an idea of where this is going.

I've taken DataItemRendererFactorForArrayList and turned it into three
beads:

RefreshItemRenderersBead. This bead listens for dataProviderChanged and
replaced all of the itemRenderers in the IItemRendererParent with fresh
copies. It does this using the AddItemRendererBead.

AddItemRendererBead. This bead has two jobs: it exposes a function to
create a new itemRenderer and it listens for itemAdded on the
model.dataProvider and inserts a new itemRenderer (using the exposed
function). When this bead handles the itemAdded event it also dispatches a
"layoutNeeded" event on the strand.

RemoveItemRendererBead. This bead listens for itemRemoved and removed the
corresponding itemRenderer. Once the itemRenderer is removed it dispatches
"layoutNeeded" on the strand.

<js:List>
    <js:beads>
        <js:RefreshItemRenderersBead />
     </js:beads>
</js:List>

This would add the AddItemRendererBead automatically since
RefreshItemRenderersBead needs it.

I'm not completely happy with the names but that's the best I could come
up with to keep them reasonably short. I guess they could be
RefreshItemRenderersForArrayListData, AddItemRendererForArrayListData, and
RemoveItemRendererForArrayListData.

Its unfortunate that this won't work for Array. While Array does not
dispatch an itemAdded or itemRemoved, the Refresh bead could be used, but
the access to the individual items in Array is the [] operator while
ArrayList it is getItemAt(index). Aside from that, this bead would work
correctly for Array as well and could be the default bead for lists.

I'm wondering if we aren't going about providing data and models the right
way for our list classes. Our beads make a data type assumption about the
dataProvider; perhaps they should not. Might want to re-think this a bit.
Could be easier if the application writer supplied the model via a
standard interface.

—peter 

On 12/5/17, 3:51 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:

>I'm working on three approached trying to decide which is a best fit.
>
>Using the DynamicItemsRendererFactoryForArrayListData and adding handling
>for items removed and changed is the easiest thing to do. We have one
>bead, DataItemRendererFactoryForArrayList that's used for static lists and
>then this dynamic one. There is some overlap of code.
>
>Another approach is to leave DataItemRendererFactoryForArrayList alone and
>just be able to stick on a bead to watch for items being added and one to
>watch for items being removed. Adding a bead requires copying most of the
>bead-adding code from DataItemRendererFactoryForArrayList and putting that
>into the new bead. Then the DataItem… bead would do the wholesale change
>work and if you dynamically added or removed elements to the ArrayList the
>new beads would handle it. But even to do this, DataItemRenderer… bead
>needs to make some functions public because it knows how to get to them
>(eg, its itemRendererFactory and the DataGroup) from its strand.
>
>Another approach to basically rewrite DataItemRendererFactoryForArrayList
>and have beads that do full replacement, add/insert, remove item, handle
>item changes. This separates functionality and DataItemRenderer… becaomes
>more like a coordinator and supplier of information (like the DataGroup to
>use and itemRendererFactory). There is some duplication of code again, but
>perhaps not as much.
>
>I'm not really happy with any of these ways, but in the spirit of PAYG I'm
>now thinking the last way is better. So it will be a few more days before
>I wrap this up.
>
>—peter
>
>On 12/5/17, 1:40 PM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>
>>Alex,
>>
>>I do understand that, but in the results of that event which are coming
>>from ArrayList I need to do action on object (IItemRendererParent) and
>>remove those item renderers. - This part along with listeners to that
>>event
>>should be done by bead. As I understand Peter is digging in that area. No
>>matter whether his changes directly resolve my problems or not I prefer
>>wait for them.
>>
>>I can always write my own beads and have it as part of the application -
>>That's not the problem.
>>
>>Thanks a lot for the inputs!
>>Piotr
>>
>>
>>2017-12-05 19:35 GMT+01:00 Alex Harui <ah...@adobe.com.invalid>:
>>
>>> In Flex, you can call ArrayList.removeItemAt and generate an
>>>ITEM_REMOVED
>>> for each call, or set the source of the ArrayList which triggers a
>>> different event as well.
>>>
>>> So as Peter is saying, for Royale, there will similarly be two
>>>different
>>> events and two different ways to remove items (individually or all at
>>> once) and you get to choose.  If you only have a few items in the list,
>>> you might want to call itemRemoved several times and attach some cool
>>> remove effect.
>>>
>>> My 2 cents,
>>> -Alex
>>>
>>> On 12/5/17, 8:15 AM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>>>
>>> >If you remove everything from the ArrayList, the ArrayList dispatches
>>> >ITEM_REMOVED for each item (if you have 1000 items you will get 1000
>>> >events). ArrayList should probably not do that and instead, dispatch a
>>> >single COLLECTION_CHANGED event once completed.
>>> >
>>> >But the RemoveItemBead will in fact, handle each ITEM_REMOVED event
>>>and
>>> >eventually clear out the list. To be more efficient, another bead
>>>should
>>> >be made since DataItemRendererFactoryForArrayList does not listen to
>>> >COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
>>> >enhanced version of that).
>>> >
>>> >I have also been toying with just updating
>>> >DynamicItemsRenderFactoryForArrayList to make it handle all the cases
>>>and
>>> >forget the individual beads. You can pay little by using the
>>> >DataItemRendererFactoryForArrayList bead if you just want to display a
>>> >static list or pay it all and use
>>>DynamicItemsRendererFactoryForArrayList
>>> >even though you may only be inserting and never removing items.
>>> >
>>> >—peter
>>> >
>>> >
>>> >
>>> >On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com>
>>>wrote:
>>> >
>>> >>However those two beads are for remove single items? What if I remove
>>> >>everything from the ArrayList?
>>> >>
>>> >>On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
>>> >>wrote:
>>> >>
>>> >>> Those two beads will handle remove/add, so will I be able to use it
>>>for
>>> >>> list?
>>> >>>
>>> >>> It look like all your upcoming changes is something which I need
>>>for.
>>> >>>
>>> >>> I'm look forward to your commit!
>>> >>>
>>> >>> Thanks, Piotr
>>> >>>
>>> >>> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid>
>>>wrote:
>>> >>>
>>> >>>> I am working on an AddItemBead and RemoveItemBead. These beads
>>>assume
>>> >>>>the
>>> >>>> dataProvider in the model are ArrayList since that collection
>>> >>>>dispatches
>>> >>>> CollectionEvents with itemAdded and itemRemoved events. So these
>>>beads
>>> >>>> will either add an item to the DataGroup or remove one. Then they
>>>will
>>> >>>> adjust the model's selectedItem and selectedIndex accordingly.
>>> >>>>
>>> >>>> These will be beads of the DataItemRendererFactoryForArrayList and
>>> not
>>> >>>> beads on the List itself. I'm having to change
>>> >>>> DataItemRendererFactoryForArrayList to make things more public
>>>since
>>> >>>>it
>>> >>>> isn't trivial to add or remove an itemRenderer.
>>> >>>>
>>> >>>> —peter
>>> >>>>
>>> >>>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
>>> >>>>wrote:
>>> >>>>
>>> >>>> >Hi Peter,
>>> >>>> >
>>> >>>> >I see that and there is question whether I can put that code as a
>>> >>>> separate
>>> >>>> >bead to our repo and whether you are not going to do this?
>>> >>>> >You have started other thread about Tree Grid and beads mentioned
>>>by
>>> >>>>you
>>> >>>> >seems to be the answer. Let me know before I create something.
>>> >>>> >
>>> >>>> >Thanks, Piotr
>>> >>>> >
>>> >>>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid>
>>>wrote:
>>> >>>> >
>>> >>>> >> I think some of this changes when you are running in the
>>>browser.
>>> >>>>Does
>>> >>>> >>our
>>> >>>> >> framework code really need to know if an item is visible or not
>>>to
>>> >>>> >>remove
>>> >>>> >> it? You want it gone from the DOM so you need to remove it and
>>>the
>>> >>>> >>browser
>>> >>>> >> takes care of the visuals. Depending on the CSS for that
>>>container,
>>> >>>> >>things
>>> >>>> >> would probably just sort themselves out - no need to fool with
>>> >>>> >>scrollbars
>>> >>>> >> either as they are the responsibility of the browser. On the
>>> >>>>browser
>>> >>>> >> platform, adding a remove function would not, I think, be as
>>>costly
>>> >>>>as
>>> >>>> >>it
>>> >>>> >> would on the Flash platform.
>>> >>>> >>
>>> >>>> >> Now the selectedItem and selectedIndex are, of course, Royale
>>> >>>>things so
>>> >>>> >> that would need to be considered. But that's the same as for
>>>adding
>>> >>>>or
>>> >>>> >> inserting an item into a list. Again, the browser should take
>>>care
>>> >>>>of
>>> >>>> >>the
>>> >>>> >> visuals once the item is added to the DOM. If the item has been
>>> >>>>tagged
>>> >>>> >> properly for CSS, you wouldn't even need to trigger the Royale
>>> >>>>layout.
>>> >>>> >>
>>> >>>> >> As a side note, the reason the Group does not have a default
>>>layout
>>> >>>>is
>>> >>>> >>to
>>> >>>> >> allow you to make a DIV (the Group), put stuff into it, and
>>>style
>>> >>>>it so
>>> >>>> >> that the "layout" is handled in CSS. This way added, removing,
>>> >>>>changing
>>> >>>> >>is
>>> >>>> >> left up the browser with no need for Royale code support since
>>>the
>>> >>>> >>browser
>>> >>>> >> has all the code already and your Royale payload can be
>>>smaller.
>>> >>>>You
>>> >>>> >>only
>>> >>>> >> need to "pay" if you want a layout that cannot be accomplished
>>>with
>>> >>>> CSS.
>>> >>>> >>
>>> >>>> >> Supporting virtualized list is a completely different matter.
>>>HTML
>>> >>>> >>doesn't
>>> >>>> >> support that and then what Alex says really comes into play
>>>there.
>>> >>>> >>
>>> >>>> >> Back the question about removing all the rows. The DataGroup
>>>has a
>>> >>>> >> function to remove all of the itemRenderers. You need to
>>>trigger
>>> >>>>that
>>> >>>> >> somehow - either in your own code or perhaps a bead. Then clean
>>>up
>>> >>>>the
>>> >>>> >> selectedItem/selectedIndex in the model.
>>> >>>> >>
>>> >>>> >> ‹peter
>>> >>>> >>
>>> >>>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID>
>>> >>>>wrote:
>>> >>>> >>
>>> >>>> >> >In general, removing stuff should be PAYG.  Not every app
>>>needs to
>>> >>>> >>remove
>>> >>>> >> >things, and removal is often way more expensive than adding.
>>> >>>> >> >
>>> >>>> >> >For example, when an item is added to a sophisticated list,
>>>the
>>> >>>> various
>>> >>>> >> >beads have to do these things:
>>> >>>> >> >1) figure out if the item is on screen and a new renderer
>>>needs to
>>> >>>>be
>>> >>>> >> >added.
>>> >>>> >> >2) figure out if the item was added before the selectedIndex
>>>so
>>> >>>>the
>>> >>>> >> >selectedIndex needs to be updated
>>> >>>> >> >3) update the scrollbar (if any).
>>> >>>> >> >
>>> >>>> >> >When removing, the various beads have more to do:
>>> >>>> >> >1) figure out if the item is on screen and its renderer needs
>>>to
>>> >>>>be
>>> >>>> >> >removed.
>>> >>>> >> >2) figure out if the renderer removed is on the last visible
>>>page
>>> >>>>of
>>> >>>> >>the
>>> >>>> >> >list and scrollbars are up and the item that will take up the
>>> >>>>removed
>>> >>>> >> >renderer needs to come from a lower index in the data provider
>>> >>>> >> >3) figure out if the item was added before the selectedIndex
>>>so
>>> >>>>the
>>> >>>> >> >selectedIndex needs to be updated
>>> >>>> >> >4) figure out if the item removed was the selectedIndex and
>>>thus
>>> >>>> decide
>>> >>>> >> >what to do about selectedIndex and selectedItem
>>> >>>> >> >5) update the scrollbar (if any).
>>> >>>> >> >
>>> >>>> >> >HTH,
>>> >>>> >> >-Alex
>>> >>>> >> >
>>> >>>> >> >
>>> >>>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID>
>>>wrote:
>>> >>>> >> >
>>> >>>> >> >>I need to think about this for a bit because I¹m fiddling
>>>with
>>> >>>>this
>>> >>>> >>bit
>>> >>>> >> >>of code in List. I¹ll get back to you in my tomorrow.
>>> >>>> >> >>
>>> >>>> >> >>Peter
>>> >>>> >> >>
>>> >>>> >> >>
>>> >>>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>>> >>>> >><pi...@gmail.com>
>>> >>>> >> >>>wrote:
>>> >>>> >> >>> Hi Guys,
>>> >>>> >> >>>
>>> >>>> >> >>> I have faced an issue where solution seems to be not so
>>>easy. I
>>> >>>> have
>>> >>>> >> >>>MDL
>>> >>>> >> >>> Table (issue affects also List) with some rows.
>>> >>>> >> >>>
>>> >>>> >> >>> If I simply assign to dataProvider = null it doesn't remove
>>>all
>>> >>>> >> >>>content. It
>>> >>>> >> >>> is because in our DataItemRendererFactoryForArrayData and
>>> other
>>> >>>> >>type of
>>> >>>> >> >>> that class we have in listeners of  "dataProviderChanged"
>>>this
>>> >>>>code
>>> >>>> >> >>>[1].
>>> >>>> >> >>> Basically if we assign null to dataProvider we are not
>>>cleaning
>>> >>>>up
>>> >>>> >>item
>>> >>>> >> >>> renderers, but should we ?
>>> >>>> >> >>>
>>> >>>> >> >>> Maybe there should be separate bead which allow to do such
>>> >>>> >>operations ?
>>> >>>> >> >>>
>>> >>>> >> >>> Thoughts ?
>>> >>>> >> >>>
>>> >>>> >> >>> [1]
>>> >>>> >>
>>> >>>> >>>>>*
>>> >>>> 
>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>> >>>> >>>>>e
>>> >>>> >> .
>>> >>>> >> >>>a
>>> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>> >>>> >> %7C05ca01d43a8448485bd50
>>> >>>> >> >>>8
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C6364802121
>>> >>>>>>>>>6
>>> >>>>>>>>>449
>>> >>>> >>>>>91
>>> >>>> >> >>>9
>>> >>>> >>
>>> 
>>>>>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>>> >>>> >>
>>> >>>> >>>>><
>>> >>>> 
>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>> >>>> >>>>>e
>>> >>>> >> .
>>> >>>> >> >>>a
>>> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>> >>>> >> %7C05ca01d43a8448485bd50
>>> >>>> >> >>>8
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C6364802121
>>> >>>>>>>>>6
>>> >>>>>>>>>449
>>> >>>> >>>>>91
>>> >>>> >> >>>9
>>> >>>> >>
>>> 
>>>>>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>>>>>>>>>>>
>>>>>>>>>>*
>>> >>>> >> >>>
>>> >>>> >> >>> Thanks,
>>> >>>> >> >>> --
>>> >>>> >> >>>
>>> >>>> >> >>> Piotr Zarzycki
>>> >>>> >> >>>
>>> >>>> >> >>> Patreon:
>>> >>>> >> >>>*
>>> >>>> >>
>>> >>>>
>>> >>>>https://na01.safelinks.protection.outlook.com/?url=
>>> https%3A%2F%2Fwww.pa
>>> >>>> >> >>>t
>>> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>> >>>> >> %7C05ca01d43a844
>>> >>>> >> >>>8
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C63
>>> >>>>>>>>>6
>>> >>>>>>>>>480
>>> >>>> >>>>>21
>>> >>>> >> >>>2
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
>>> BDevLzt8WoPS4%3D&res
>>> >>>>>>>>>e
>>> >>>>>>>>>rve
>>> >>>> >>>>>d=
>>> >>>> >> >>>0
>>> >>>> >> >>>
>>> >>>> >> >>><
>>> >>>> >>
>>> >>>>
>>> >>>>https://na01.safelinks.protection.outlook.com/?url=
>>> https%3A%2F%2Fwww.pa
>>> >>>> >> >>>t
>>> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>> >>>> >> %7C05ca01d43a844
>>> >>>> >> >>>8
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>>> cee1%7C0%7C0%7C63
>>> >>>>>>>>>6
>>> >>>>>>>>>480
>>> >>>> >>>>>21
>>> >>>> >> >>>2
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
>>> BDevLzt8WoPS4%3D&res
>>> >>>>>>>>>e
>>> >>>>>>>>>rve
>>> >>>> >>>>>d=
>>> >>>> >> >>>0
>>> >>>> >> >>>>*
>>> >>>> >> >
>>> >>>> >>
>>> >>>> >>
>>> >>>>
>>> >>>>
>>> >
>>>
>>>
>>
>>
>>-- 
>>
>>Piotr Zarzycki
>>
>>Patreon: 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>r
>>eon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C58bf3799e7be4fb
>>8
>>162208d53c0fb5f8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648096053
>>8
>>520219&sdata=iH5mF4l5AZguXoOGi2uYAVjzFVKA68BLVjla%2BcuF918%3D&reserved=0
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>r
>>eon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C58bf3799e7be4fb
>>8
>>162208d53c0fb5f8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648096053
>>8
>>520219&sdata=iH5mF4l5AZguXoOGi2uYAVjzFVKA68BLVjla%2BcuF918%3D&reserved=0>
>>*
>


Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
I'm working on three approached trying to decide which is a best fit.

Using the DynamicItemsRendererFactoryForArrayListData and adding handling
for items removed and changed is the easiest thing to do. We have one
bead, DataItemRendererFactoryForArrayList that's used for static lists and
then this dynamic one. There is some overlap of code.

Another approach is to leave DataItemRendererFactoryForArrayList alone and
just be able to stick on a bead to watch for items being added and one to
watch for items being removed. Adding a bead requires copying most of the
bead-adding code from DataItemRendererFactoryForArrayList and putting that
into the new bead. Then the DataItem… bead would do the wholesale change
work and if you dynamically added or removed elements to the ArrayList the
new beads would handle it. But even to do this, DataItemRenderer… bead
needs to make some functions public because it knows how to get to them
(eg, its itemRendererFactory and the DataGroup) from its strand.

Another approach to basically rewrite DataItemRendererFactoryForArrayList
and have beads that do full replacement, add/insert, remove item, handle
item changes. This separates functionality and DataItemRenderer… becaomes
more like a coordinator and supplier of information (like the DataGroup to
use and itemRendererFactory). There is some duplication of code again, but
perhaps not as much.

I'm not really happy with any of these ways, but in the spirit of PAYG I'm
now thinking the last way is better. So it will be a few more days before
I wrap this up.

—peter

On 12/5/17, 1:40 PM, "Piotr Zarzycki" <pi...@gmail.com> wrote:

>Alex,
>
>I do understand that, but in the results of that event which are coming
>from ArrayList I need to do action on object (IItemRendererParent) and
>remove those item renderers. - This part along with listeners to that
>event
>should be done by bead. As I understand Peter is digging in that area. No
>matter whether his changes directly resolve my problems or not I prefer
>wait for them.
>
>I can always write my own beads and have it as part of the application -
>That's not the problem.
>
>Thanks a lot for the inputs!
>Piotr
>
>
>2017-12-05 19:35 GMT+01:00 Alex Harui <ah...@adobe.com.invalid>:
>
>> In Flex, you can call ArrayList.removeItemAt and generate an
>>ITEM_REMOVED
>> for each call, or set the source of the ArrayList which triggers a
>> different event as well.
>>
>> So as Peter is saying, for Royale, there will similarly be two different
>> events and two different ways to remove items (individually or all at
>> once) and you get to choose.  If you only have a few items in the list,
>> you might want to call itemRemoved several times and attach some cool
>> remove effect.
>>
>> My 2 cents,
>> -Alex
>>
>> On 12/5/17, 8:15 AM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>>
>> >If you remove everything from the ArrayList, the ArrayList dispatches
>> >ITEM_REMOVED for each item (if you have 1000 items you will get 1000
>> >events). ArrayList should probably not do that and instead, dispatch a
>> >single COLLECTION_CHANGED event once completed.
>> >
>> >But the RemoveItemBead will in fact, handle each ITEM_REMOVED event and
>> >eventually clear out the list. To be more efficient, another bead
>>should
>> >be made since DataItemRendererFactoryForArrayList does not listen to
>> >COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
>> >enhanced version of that).
>> >
>> >I have also been toying with just updating
>> >DynamicItemsRenderFactoryForArrayList to make it handle all the cases
>>and
>> >forget the individual beads. You can pay little by using the
>> >DataItemRendererFactoryForArrayList bead if you just want to display a
>> >static list or pay it all and use
>>DynamicItemsRendererFactoryForArrayList
>> >even though you may only be inserting and never removing items.
>> >
>> >—peter
>> >
>> >
>> >
>> >On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com>
>>wrote:
>> >
>> >>However those two beads are for remove single items? What if I remove
>> >>everything from the ArrayList?
>> >>
>> >>On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
>> >>wrote:
>> >>
>> >>> Those two beads will handle remove/add, so will I be able to use it
>>for
>> >>> list?
>> >>>
>> >>> It look like all your upcoming changes is something which I need
>>for.
>> >>>
>> >>> I'm look forward to your commit!
>> >>>
>> >>> Thanks, Piotr
>> >>>
>> >>> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
>> >>>
>> >>>> I am working on an AddItemBead and RemoveItemBead. These beads
>>assume
>> >>>>the
>> >>>> dataProvider in the model are ArrayList since that collection
>> >>>>dispatches
>> >>>> CollectionEvents with itemAdded and itemRemoved events. So these
>>beads
>> >>>> will either add an item to the DataGroup or remove one. Then they
>>will
>> >>>> adjust the model's selectedItem and selectedIndex accordingly.
>> >>>>
>> >>>> These will be beads of the DataItemRendererFactoryForArrayList and
>> not
>> >>>> beads on the List itself. I'm having to change
>> >>>> DataItemRendererFactoryForArrayList to make things more public
>>since
>> >>>>it
>> >>>> isn't trivial to add or remove an itemRenderer.
>> >>>>
>> >>>> —peter
>> >>>>
>> >>>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
>> >>>>wrote:
>> >>>>
>> >>>> >Hi Peter,
>> >>>> >
>> >>>> >I see that and there is question whether I can put that code as a
>> >>>> separate
>> >>>> >bead to our repo and whether you are not going to do this?
>> >>>> >You have started other thread about Tree Grid and beads mentioned
>>by
>> >>>>you
>> >>>> >seems to be the answer. Let me know before I create something.
>> >>>> >
>> >>>> >Thanks, Piotr
>> >>>> >
>> >>>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid>
>>wrote:
>> >>>> >
>> >>>> >> I think some of this changes when you are running in the
>>browser.
>> >>>>Does
>> >>>> >>our
>> >>>> >> framework code really need to know if an item is visible or not
>>to
>> >>>> >>remove
>> >>>> >> it? You want it gone from the DOM so you need to remove it and
>>the
>> >>>> >>browser
>> >>>> >> takes care of the visuals. Depending on the CSS for that
>>container,
>> >>>> >>things
>> >>>> >> would probably just sort themselves out - no need to fool with
>> >>>> >>scrollbars
>> >>>> >> either as they are the responsibility of the browser. On the
>> >>>>browser
>> >>>> >> platform, adding a remove function would not, I think, be as
>>costly
>> >>>>as
>> >>>> >>it
>> >>>> >> would on the Flash platform.
>> >>>> >>
>> >>>> >> Now the selectedItem and selectedIndex are, of course, Royale
>> >>>>things so
>> >>>> >> that would need to be considered. But that's the same as for
>>adding
>> >>>>or
>> >>>> >> inserting an item into a list. Again, the browser should take
>>care
>> >>>>of
>> >>>> >>the
>> >>>> >> visuals once the item is added to the DOM. If the item has been
>> >>>>tagged
>> >>>> >> properly for CSS, you wouldn't even need to trigger the Royale
>> >>>>layout.
>> >>>> >>
>> >>>> >> As a side note, the reason the Group does not have a default
>>layout
>> >>>>is
>> >>>> >>to
>> >>>> >> allow you to make a DIV (the Group), put stuff into it, and
>>style
>> >>>>it so
>> >>>> >> that the "layout" is handled in CSS. This way added, removing,
>> >>>>changing
>> >>>> >>is
>> >>>> >> left up the browser with no need for Royale code support since
>>the
>> >>>> >>browser
>> >>>> >> has all the code already and your Royale payload can be smaller.
>> >>>>You
>> >>>> >>only
>> >>>> >> need to "pay" if you want a layout that cannot be accomplished
>>with
>> >>>> CSS.
>> >>>> >>
>> >>>> >> Supporting virtualized list is a completely different matter.
>>HTML
>> >>>> >>doesn't
>> >>>> >> support that and then what Alex says really comes into play
>>there.
>> >>>> >>
>> >>>> >> Back the question about removing all the rows. The DataGroup
>>has a
>> >>>> >> function to remove all of the itemRenderers. You need to trigger
>> >>>>that
>> >>>> >> somehow - either in your own code or perhaps a bead. Then clean
>>up
>> >>>>the
>> >>>> >> selectedItem/selectedIndex in the model.
>> >>>> >>
>> >>>> >> ‹peter
>> >>>> >>
>> >>>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID>
>> >>>>wrote:
>> >>>> >>
>> >>>> >> >In general, removing stuff should be PAYG.  Not every app
>>needs to
>> >>>> >>remove
>> >>>> >> >things, and removal is often way more expensive than adding.
>> >>>> >> >
>> >>>> >> >For example, when an item is added to a sophisticated list, the
>> >>>> various
>> >>>> >> >beads have to do these things:
>> >>>> >> >1) figure out if the item is on screen and a new renderer
>>needs to
>> >>>>be
>> >>>> >> >added.
>> >>>> >> >2) figure out if the item was added before the selectedIndex so
>> >>>>the
>> >>>> >> >selectedIndex needs to be updated
>> >>>> >> >3) update the scrollbar (if any).
>> >>>> >> >
>> >>>> >> >When removing, the various beads have more to do:
>> >>>> >> >1) figure out if the item is on screen and its renderer needs
>>to
>> >>>>be
>> >>>> >> >removed.
>> >>>> >> >2) figure out if the renderer removed is on the last visible
>>page
>> >>>>of
>> >>>> >>the
>> >>>> >> >list and scrollbars are up and the item that will take up the
>> >>>>removed
>> >>>> >> >renderer needs to come from a lower index in the data provider
>> >>>> >> >3) figure out if the item was added before the selectedIndex so
>> >>>>the
>> >>>> >> >selectedIndex needs to be updated
>> >>>> >> >4) figure out if the item removed was the selectedIndex and
>>thus
>> >>>> decide
>> >>>> >> >what to do about selectedIndex and selectedItem
>> >>>> >> >5) update the scrollbar (if any).
>> >>>> >> >
>> >>>> >> >HTH,
>> >>>> >> >-Alex
>> >>>> >> >
>> >>>> >> >
>> >>>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID>
>>wrote:
>> >>>> >> >
>> >>>> >> >>I need to think about this for a bit because I¹m fiddling with
>> >>>>this
>> >>>> >>bit
>> >>>> >> >>of code in List. I¹ll get back to you in my tomorrow.
>> >>>> >> >>
>> >>>> >> >>Peter
>> >>>> >> >>
>> >>>> >> >>
>> >>>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>> >>>> >><pi...@gmail.com>
>> >>>> >> >>>wrote:
>> >>>> >> >>> Hi Guys,
>> >>>> >> >>>
>> >>>> >> >>> I have faced an issue where solution seems to be not so
>>easy. I
>> >>>> have
>> >>>> >> >>>MDL
>> >>>> >> >>> Table (issue affects also List) with some rows.
>> >>>> >> >>>
>> >>>> >> >>> If I simply assign to dataProvider = null it doesn't remove
>>all
>> >>>> >> >>>content. It
>> >>>> >> >>> is because in our DataItemRendererFactoryForArrayData and
>> other
>> >>>> >>type of
>> >>>> >> >>> that class we have in listeners of  "dataProviderChanged"
>>this
>> >>>>code
>> >>>> >> >>>[1].
>> >>>> >> >>> Basically if we assign null to dataProvider we are not
>>cleaning
>> >>>>up
>> >>>> >>item
>> >>>> >> >>> renderers, but should we ?
>> >>>> >> >>>
>> >>>> >> >>> Maybe there should be separate bead which allow to do such
>> >>>> >>operations ?
>> >>>> >> >>>
>> >>>> >> >>> Thoughts ?
>> >>>> >> >>>
>> >>>> >> >>> [1]
>> >>>> >>
>> >>>> >>>>>*
>> >>>> 
>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>> >>>> >>>>>e
>> >>>> >> .
>> >>>> >> >>>a
>> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> >>>> >> %7C05ca01d43a8448485bd50
>> >>>> >> >>>8
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C0%7C6364802121
>> >>>>>>>>>6
>> >>>>>>>>>449
>> >>>> >>>>>91
>> >>>> >> >>>9
>> >>>> >>
>> >>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>> >>>> >>
>> >>>> >>>>><
>> >>>> 
>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>> >>>> >>>>>e
>> >>>> >> .
>> >>>> >> >>>a
>> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> >>>> >> %7C05ca01d43a8448485bd50
>> >>>> >> >>>8
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C0%7C6364802121
>> >>>>>>>>>6
>> >>>>>>>>>449
>> >>>> >>>>>91
>> >>>> >> >>>9
>> >>>> >>
>> 
>>>>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>
>>>>>>>>>*
>> >>>> >> >>>
>> >>>> >> >>> Thanks,
>> >>>> >> >>> --
>> >>>> >> >>>
>> >>>> >> >>> Piotr Zarzycki
>> >>>> >> >>>
>> >>>> >> >>> Patreon:
>> >>>> >> >>>*
>> >>>> >>
>> >>>>
>> >>>>https://na01.safelinks.protection.outlook.com/?url=
>> https%3A%2F%2Fwww.pa
>> >>>> >> >>>t
>> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> >>>> >> %7C05ca01d43a844
>> >>>> >> >>>8
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C0%7C63
>> >>>>>>>>>6
>> >>>>>>>>>480
>> >>>> >>>>>21
>> >>>> >> >>>2
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
>> BDevLzt8WoPS4%3D&res
>> >>>>>>>>>e
>> >>>>>>>>>rve
>> >>>> >>>>>d=
>> >>>> >> >>>0
>> >>>> >> >>>
>> >>>> >> >>><
>> >>>> >>
>> >>>>
>> >>>>https://na01.safelinks.protection.outlook.com/?url=
>> https%3A%2F%2Fwww.pa
>> >>>> >> >>>t
>> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> >>>> >> %7C05ca01d43a844
>> >>>> >> >>>8
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
>> cee1%7C0%7C0%7C63
>> >>>>>>>>>6
>> >>>>>>>>>480
>> >>>> >>>>>21
>> >>>> >> >>>2
>> >>>> >>
>> >>>>
>> >>>>
>> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
>> BDevLzt8WoPS4%3D&res
>> >>>>>>>>>e
>> >>>>>>>>>rve
>> >>>> >>>>>d=
>> >>>> >> >>>0
>> >>>> >> >>>>*
>> >>>> >> >
>> >>>> >>
>> >>>> >>
>> >>>>
>> >>>>
>> >
>>
>>
>
>
>-- 
>
>Piotr Zarzycki
>
>Patreon: 
>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C58bf3799e7be4fb8
>162208d53c0fb5f8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480960538
>520219&sdata=iH5mF4l5AZguXoOGi2uYAVjzFVKA68BLVjla%2BcuF918%3D&reserved=0
><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patr
>eon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C58bf3799e7be4fb8
>162208d53c0fb5f8%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480960538
>520219&sdata=iH5mF4l5AZguXoOGi2uYAVjzFVKA68BLVjla%2BcuF918%3D&reserved=0>*


Re: List, MDL Table - How to remove all content

Posted by Piotr Zarzycki <pi...@gmail.com>.
Alex,

I do understand that, but in the results of that event which are coming
from ArrayList I need to do action on object (IItemRendererParent) and
remove those item renderers. - This part along with listeners to that event
should be done by bead. As I understand Peter is digging in that area. No
matter whether his changes directly resolve my problems or not I prefer
wait for them.

I can always write my own beads and have it as part of the application -
That's not the problem.

Thanks a lot for the inputs!
Piotr


2017-12-05 19:35 GMT+01:00 Alex Harui <ah...@adobe.com.invalid>:

> In Flex, you can call ArrayList.removeItemAt and generate an ITEM_REMOVED
> for each call, or set the source of the ArrayList which triggers a
> different event as well.
>
> So as Peter is saying, for Royale, there will similarly be two different
> events and two different ways to remove items (individually or all at
> once) and you get to choose.  If you only have a few items in the list,
> you might want to call itemRemoved several times and attach some cool
> remove effect.
>
> My 2 cents,
> -Alex
>
> On 12/5/17, 8:15 AM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>
> >If you remove everything from the ArrayList, the ArrayList dispatches
> >ITEM_REMOVED for each item (if you have 1000 items you will get 1000
> >events). ArrayList should probably not do that and instead, dispatch a
> >single COLLECTION_CHANGED event once completed.
> >
> >But the RemoveItemBead will in fact, handle each ITEM_REMOVED event and
> >eventually clear out the list. To be more efficient, another bead should
> >be made since DataItemRendererFactoryForArrayList does not listen to
> >COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
> >enhanced version of that).
> >
> >I have also been toying with just updating
> >DynamicItemsRenderFactoryForArrayList to make it handle all the cases and
> >forget the individual beads. You can pay little by using the
> >DataItemRendererFactoryForArrayList bead if you just want to display a
> >static list or pay it all and use DynamicItemsRendererFactoryForArrayList
> >even though you may only be inserting and never removing items.
> >
> >—peter
> >
> >
> >
> >On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
> >
> >>However those two beads are for remove single items? What if I remove
> >>everything from the ArrayList?
> >>
> >>On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
> >>wrote:
> >>
> >>> Those two beads will handle remove/add, so will I be able to use it for
> >>> list?
> >>>
> >>> It look like all your upcoming changes is something which I need for.
> >>>
> >>> I'm look forward to your commit!
> >>>
> >>> Thanks, Piotr
> >>>
> >>> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
> >>>
> >>>> I am working on an AddItemBead and RemoveItemBead. These beads assume
> >>>>the
> >>>> dataProvider in the model are ArrayList since that collection
> >>>>dispatches
> >>>> CollectionEvents with itemAdded and itemRemoved events. So these beads
> >>>> will either add an item to the DataGroup or remove one. Then they will
> >>>> adjust the model's selectedItem and selectedIndex accordingly.
> >>>>
> >>>> These will be beads of the DataItemRendererFactoryForArrayList and
> not
> >>>> beads on the List itself. I'm having to change
> >>>> DataItemRendererFactoryForArrayList to make things more public since
> >>>>it
> >>>> isn't trivial to add or remove an itemRenderer.
> >>>>
> >>>> —peter
> >>>>
> >>>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
> >>>>wrote:
> >>>>
> >>>> >Hi Peter,
> >>>> >
> >>>> >I see that and there is question whether I can put that code as a
> >>>> separate
> >>>> >bead to our repo and whether you are not going to do this?
> >>>> >You have started other thread about Tree Grid and beads mentioned by
> >>>>you
> >>>> >seems to be the answer. Let me know before I create something.
> >>>> >
> >>>> >Thanks, Piotr
> >>>> >
> >>>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
> >>>> >
> >>>> >> I think some of this changes when you are running in the browser.
> >>>>Does
> >>>> >>our
> >>>> >> framework code really need to know if an item is visible or not to
> >>>> >>remove
> >>>> >> it? You want it gone from the DOM so you need to remove it and the
> >>>> >>browser
> >>>> >> takes care of the visuals. Depending on the CSS for that container,
> >>>> >>things
> >>>> >> would probably just sort themselves out - no need to fool with
> >>>> >>scrollbars
> >>>> >> either as they are the responsibility of the browser. On the
> >>>>browser
> >>>> >> platform, adding a remove function would not, I think, be as costly
> >>>>as
> >>>> >>it
> >>>> >> would on the Flash platform.
> >>>> >>
> >>>> >> Now the selectedItem and selectedIndex are, of course, Royale
> >>>>things so
> >>>> >> that would need to be considered. But that's the same as for adding
> >>>>or
> >>>> >> inserting an item into a list. Again, the browser should take care
> >>>>of
> >>>> >>the
> >>>> >> visuals once the item is added to the DOM. If the item has been
> >>>>tagged
> >>>> >> properly for CSS, you wouldn't even need to trigger the Royale
> >>>>layout.
> >>>> >>
> >>>> >> As a side note, the reason the Group does not have a default layout
> >>>>is
> >>>> >>to
> >>>> >> allow you to make a DIV (the Group), put stuff into it, and style
> >>>>it so
> >>>> >> that the "layout" is handled in CSS. This way added, removing,
> >>>>changing
> >>>> >>is
> >>>> >> left up the browser with no need for Royale code support since the
> >>>> >>browser
> >>>> >> has all the code already and your Royale payload can be smaller.
> >>>>You
> >>>> >>only
> >>>> >> need to "pay" if you want a layout that cannot be accomplished with
> >>>> CSS.
> >>>> >>
> >>>> >> Supporting virtualized list is a completely different matter. HTML
> >>>> >>doesn't
> >>>> >> support that and then what Alex says really comes into play there.
> >>>> >>
> >>>> >> Back the question about removing all the rows. The DataGroup has a
> >>>> >> function to remove all of the itemRenderers. You need to trigger
> >>>>that
> >>>> >> somehow - either in your own code or perhaps a bead. Then clean up
> >>>>the
> >>>> >> selectedItem/selectedIndex in the model.
> >>>> >>
> >>>> >> ‹peter
> >>>> >>
> >>>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID>
> >>>>wrote:
> >>>> >>
> >>>> >> >In general, removing stuff should be PAYG.  Not every app needs to
> >>>> >>remove
> >>>> >> >things, and removal is often way more expensive than adding.
> >>>> >> >
> >>>> >> >For example, when an item is added to a sophisticated list, the
> >>>> various
> >>>> >> >beads have to do these things:
> >>>> >> >1) figure out if the item is on screen and a new renderer needs to
> >>>>be
> >>>> >> >added.
> >>>> >> >2) figure out if the item was added before the selectedIndex so
> >>>>the
> >>>> >> >selectedIndex needs to be updated
> >>>> >> >3) update the scrollbar (if any).
> >>>> >> >
> >>>> >> >When removing, the various beads have more to do:
> >>>> >> >1) figure out if the item is on screen and its renderer needs to
> >>>>be
> >>>> >> >removed.
> >>>> >> >2) figure out if the renderer removed is on the last visible page
> >>>>of
> >>>> >>the
> >>>> >> >list and scrollbars are up and the item that will take up the
> >>>>removed
> >>>> >> >renderer needs to come from a lower index in the data provider
> >>>> >> >3) figure out if the item was added before the selectedIndex so
> >>>>the
> >>>> >> >selectedIndex needs to be updated
> >>>> >> >4) figure out if the item removed was the selectedIndex and thus
> >>>> decide
> >>>> >> >what to do about selectedIndex and selectedItem
> >>>> >> >5) update the scrollbar (if any).
> >>>> >> >
> >>>> >> >HTH,
> >>>> >> >-Alex
> >>>> >> >
> >>>> >> >
> >>>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
> >>>> >> >
> >>>> >> >>I need to think about this for a bit because I¹m fiddling with
> >>>>this
> >>>> >>bit
> >>>> >> >>of code in List. I¹ll get back to you in my tomorrow.
> >>>> >> >>
> >>>> >> >>Peter
> >>>> >> >>
> >>>> >> >>
> >>>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
> >>>> >><pi...@gmail.com>
> >>>> >> >>>wrote:
> >>>> >> >>> Hi Guys,
> >>>> >> >>>
> >>>> >> >>> I have faced an issue where solution seems to be not so easy. I
> >>>> have
> >>>> >> >>>MDL
> >>>> >> >>> Table (issue affects also List) with some rows.
> >>>> >> >>>
> >>>> >> >>> If I simply assign to dataProvider = null it doesn't remove all
> >>>> >> >>>content. It
> >>>> >> >>> is because in our DataItemRendererFactoryForArrayData and
> other
> >>>> >>type of
> >>>> >> >>> that class we have in listeners of  "dataProviderChanged" this
> >>>>code
> >>>> >> >>>[1].
> >>>> >> >>> Basically if we assign null to dataProvider we are not cleaning
> >>>>up
> >>>> >>item
> >>>> >> >>> renderers, but should we ?
> >>>> >> >>>
> >>>> >> >>> Maybe there should be separate bead which allow to do such
> >>>> >>operations ?
> >>>> >> >>>
> >>>> >> >>> Thoughts ?
> >>>> >> >>>
> >>>> >> >>> [1]
> >>>> >>
> >>>> >>>>>*
> >>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>>> >>>>>e
> >>>> >> .
> >>>> >> >>>a
> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >>>> >> %7C05ca01d43a8448485bd50
> >>>> >> >>>8
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C6364802121
> >>>>>>>>>6
> >>>>>>>>>449
> >>>> >>>>>91
> >>>> >> >>>9
> >>>> >>
> >>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
> >>>> >>
> >>>> >>>>><
> >>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>>> >>>>>e
> >>>> >> .
> >>>> >> >>>a
> >>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >>>> >> %7C05ca01d43a8448485bd50
> >>>> >> >>>8
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C6364802121
> >>>>>>>>>6
> >>>>>>>>>449
> >>>> >>>>>91
> >>>> >> >>>9
> >>>> >>
> >>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
> >>>> >> >>>
> >>>> >> >>> Thanks,
> >>>> >> >>> --
> >>>> >> >>>
> >>>> >> >>> Piotr Zarzycki
> >>>> >> >>>
> >>>> >> >>> Patreon:
> >>>> >> >>>*
> >>>> >>
> >>>>
> >>>>https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.pa
> >>>> >> >>>t
> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >>>> >> %7C05ca01d43a844
> >>>> >> >>>8
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C63
> >>>>>>>>>6
> >>>>>>>>>480
> >>>> >>>>>21
> >>>> >> >>>2
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
> BDevLzt8WoPS4%3D&res
> >>>>>>>>>e
> >>>>>>>>>rve
> >>>> >>>>>d=
> >>>> >> >>>0
> >>>> >> >>>
> >>>> >> >>><
> >>>> >>
> >>>>
> >>>>https://na01.safelinks.protection.outlook.com/?url=
> https%3A%2F%2Fwww.pa
> >>>> >> >>>t
> >>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >>>> >> %7C05ca01d43a844
> >>>> >> >>>8
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178de
> cee1%7C0%7C0%7C63
> >>>>>>>>>6
> >>>>>>>>>480
> >>>> >>>>>21
> >>>> >> >>>2
> >>>> >>
> >>>>
> >>>>
> >>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiM
> BDevLzt8WoPS4%3D&res
> >>>>>>>>>e
> >>>>>>>>>rve
> >>>> >>>>>d=
> >>>> >> >>>0
> >>>> >> >>>>*
> >>>> >> >
> >>>> >>
> >>>> >>
> >>>>
> >>>>
> >
>
>


-- 

Piotr Zarzycki

Patreon: *https://www.patreon.com/piotrzarzycki
<https://www.patreon.com/piotrzarzycki>*

Re: List, MDL Table - How to remove all content

Posted by Alex Harui <ah...@adobe.com.INVALID>.
In Flex, you can call ArrayList.removeItemAt and generate an ITEM_REMOVED
for each call, or set the source of the ArrayList which triggers a
different event as well.

So as Peter is saying, for Royale, there will similarly be two different
events and two different ways to remove items (individually or all at
once) and you get to choose.  If you only have a few items in the list,
you might want to call itemRemoved several times and attach some cool
remove effect.

My 2 cents,
-Alex

On 12/5/17, 8:15 AM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:

>If you remove everything from the ArrayList, the ArrayList dispatches
>ITEM_REMOVED for each item (if you have 1000 items you will get 1000
>events). ArrayList should probably not do that and instead, dispatch a
>single COLLECTION_CHANGED event once completed.
>
>But the RemoveItemBead will in fact, handle each ITEM_REMOVED event and
>eventually clear out the list. To be more efficient, another bead should
>be made since DataItemRendererFactoryForArrayList does not listen to
>COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
>enhanced version of that).
>
>I have also been toying with just updating
>DynamicItemsRenderFactoryForArrayList to make it handle all the cases and
>forget the individual beads. You can pay little by using the
>DataItemRendererFactoryForArrayList bead if you just want to display a
>static list or pay it all and use DynamicItemsRendererFactoryForArrayList
>even though you may only be inserting and never removing items.
>
>—peter
>
>
>
>On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>
>>However those two beads are for remove single items? What if I remove
>>everything from the ArrayList?
>>
>>On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
>>wrote:
>>
>>> Those two beads will handle remove/add, so will I be able to use it for
>>> list?
>>>
>>> It look like all your upcoming changes is something which I need for.
>>>
>>> I'm look forward to your commit!
>>>
>>> Thanks, Piotr
>>>
>>> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
>>>
>>>> I am working on an AddItemBead and RemoveItemBead. These beads assume
>>>>the
>>>> dataProvider in the model are ArrayList since that collection
>>>>dispatches
>>>> CollectionEvents with itemAdded and itemRemoved events. So these beads
>>>> will either add an item to the DataGroup or remove one. Then they will
>>>> adjust the model's selectedItem and selectedIndex accordingly.
>>>>
>>>> These will be beads of the DataItemRendererFactoryForArrayList and not
>>>> beads on the List itself. I'm having to change
>>>> DataItemRendererFactoryForArrayList to make things more public since
>>>>it
>>>> isn't trivial to add or remove an itemRenderer.
>>>>
>>>> —peter
>>>>
>>>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
>>>>wrote:
>>>>
>>>> >Hi Peter,
>>>> >
>>>> >I see that and there is question whether I can put that code as a
>>>> separate
>>>> >bead to our repo and whether you are not going to do this?
>>>> >You have started other thread about Tree Grid and beads mentioned by
>>>>you
>>>> >seems to be the answer. Let me know before I create something.
>>>> >
>>>> >Thanks, Piotr
>>>> >
>>>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
>>>> >
>>>> >> I think some of this changes when you are running in the browser.
>>>>Does
>>>> >>our
>>>> >> framework code really need to know if an item is visible or not to
>>>> >>remove
>>>> >> it? You want it gone from the DOM so you need to remove it and the
>>>> >>browser
>>>> >> takes care of the visuals. Depending on the CSS for that container,
>>>> >>things
>>>> >> would probably just sort themselves out - no need to fool with
>>>> >>scrollbars
>>>> >> either as they are the responsibility of the browser. On the
>>>>browser
>>>> >> platform, adding a remove function would not, I think, be as costly
>>>>as
>>>> >>it
>>>> >> would on the Flash platform.
>>>> >>
>>>> >> Now the selectedItem and selectedIndex are, of course, Royale
>>>>things so
>>>> >> that would need to be considered. But that's the same as for adding
>>>>or
>>>> >> inserting an item into a list. Again, the browser should take care
>>>>of
>>>> >>the
>>>> >> visuals once the item is added to the DOM. If the item has been
>>>>tagged
>>>> >> properly for CSS, you wouldn't even need to trigger the Royale
>>>>layout.
>>>> >>
>>>> >> As a side note, the reason the Group does not have a default layout
>>>>is
>>>> >>to
>>>> >> allow you to make a DIV (the Group), put stuff into it, and style
>>>>it so
>>>> >> that the "layout" is handled in CSS. This way added, removing,
>>>>changing
>>>> >>is
>>>> >> left up the browser with no need for Royale code support since the
>>>> >>browser
>>>> >> has all the code already and your Royale payload can be smaller.
>>>>You
>>>> >>only
>>>> >> need to "pay" if you want a layout that cannot be accomplished with
>>>> CSS.
>>>> >>
>>>> >> Supporting virtualized list is a completely different matter. HTML
>>>> >>doesn't
>>>> >> support that and then what Alex says really comes into play there.
>>>> >>
>>>> >> Back the question about removing all the rows. The DataGroup has a
>>>> >> function to remove all of the itemRenderers. You need to trigger
>>>>that
>>>> >> somehow - either in your own code or perhaps a bead. Then clean up
>>>>the
>>>> >> selectedItem/selectedIndex in the model.
>>>> >>
>>>> >> ‹peter
>>>> >>
>>>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID>
>>>>wrote:
>>>> >>
>>>> >> >In general, removing stuff should be PAYG.  Not every app needs to
>>>> >>remove
>>>> >> >things, and removal is often way more expensive than adding.
>>>> >> >
>>>> >> >For example, when an item is added to a sophisticated list, the
>>>> various
>>>> >> >beads have to do these things:
>>>> >> >1) figure out if the item is on screen and a new renderer needs to
>>>>be
>>>> >> >added.
>>>> >> >2) figure out if the item was added before the selectedIndex so
>>>>the
>>>> >> >selectedIndex needs to be updated
>>>> >> >3) update the scrollbar (if any).
>>>> >> >
>>>> >> >When removing, the various beads have more to do:
>>>> >> >1) figure out if the item is on screen and its renderer needs to
>>>>be
>>>> >> >removed.
>>>> >> >2) figure out if the renderer removed is on the last visible page
>>>>of
>>>> >>the
>>>> >> >list and scrollbars are up and the item that will take up the
>>>>removed
>>>> >> >renderer needs to come from a lower index in the data provider
>>>> >> >3) figure out if the item was added before the selectedIndex so
>>>>the
>>>> >> >selectedIndex needs to be updated
>>>> >> >4) figure out if the item removed was the selectedIndex and thus
>>>> decide
>>>> >> >what to do about selectedIndex and selectedItem
>>>> >> >5) update the scrollbar (if any).
>>>> >> >
>>>> >> >HTH,
>>>> >> >-Alex
>>>> >> >
>>>> >> >
>>>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>>>> >> >
>>>> >> >>I need to think about this for a bit because I¹m fiddling with
>>>>this
>>>> >>bit
>>>> >> >>of code in List. I¹ll get back to you in my tomorrow.
>>>> >> >>
>>>> >> >>Peter
>>>> >> >>
>>>> >> >>
>>>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>>>> >><pi...@gmail.com>
>>>> >> >>>wrote:
>>>> >> >>> Hi Guys,
>>>> >> >>>
>>>> >> >>> I have faced an issue where solution seems to be not so easy. I
>>>> have
>>>> >> >>>MDL
>>>> >> >>> Table (issue affects also List) with some rows.
>>>> >> >>>
>>>> >> >>> If I simply assign to dataProvider = null it doesn't remove all
>>>> >> >>>content. It
>>>> >> >>> is because in our DataItemRendererFactoryForArrayData and other
>>>> >>type of
>>>> >> >>> that class we have in listeners of  "dataProviderChanged" this
>>>>code
>>>> >> >>>[1].
>>>> >> >>> Basically if we assign null to dataProvider we are not cleaning
>>>>up
>>>> >>item
>>>> >> >>> renderers, but should we ?
>>>> >> >>>
>>>> >> >>> Maybe there should be separate bead which allow to do such
>>>> >>operations ?
>>>> >> >>>
>>>> >> >>> Thoughts ?
>>>> >> >>>
>>>> >> >>> [1]
>>>> >>
>>>> >>>>>*
>>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>>> >>>>>e
>>>> >> .
>>>> >> >>>a
>>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>>> >> %7C05ca01d43a8448485bd50
>>>> >> >>>8
>>>> >>
>>>>
>>>> 
>>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121
>>>>>>>>>6
>>>>>>>>>449
>>>> >>>>>91
>>>> >> >>>9
>>>> >> 
>>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>>>> >>
>>>> >>>>><
>>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>>> >>>>>e
>>>> >> .
>>>> >> >>>a
>>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>>> >> %7C05ca01d43a8448485bd50
>>>> >> >>>8
>>>> >>
>>>>
>>>> 
>>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121
>>>>>>>>>6
>>>>>>>>>449
>>>> >>>>>91
>>>> >> >>>9
>>>> >> 
>>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>>>> >> >>>
>>>> >> >>> Thanks,
>>>> >> >>> --
>>>> >> >>>
>>>> >> >>> Piotr Zarzycki
>>>> >> >>>
>>>> >> >>> Patreon:
>>>> >> >>>*
>>>> >>
>>>> 
>>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>>> >> >>>t
>>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>>> >> %7C05ca01d43a844
>>>> >> >>>8
>>>> >>
>>>>
>>>> 
>>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63
>>>>>>>>>6
>>>>>>>>>480
>>>> >>>>>21
>>>> >> >>>2
>>>> >>
>>>>
>>>> 
>>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&res
>>>>>>>>>e
>>>>>>>>>rve
>>>> >>>>>d=
>>>> >> >>>0
>>>> >> >>>
>>>> >> >>><
>>>> >>
>>>> 
>>>>https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>>> >> >>>t
>>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>>> >> %7C05ca01d43a844
>>>> >> >>>8
>>>> >>
>>>>
>>>> 
>>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63
>>>>>>>>>6
>>>>>>>>>480
>>>> >>>>>21
>>>> >> >>>2
>>>> >>
>>>>
>>>> 
>>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&res
>>>>>>>>>e
>>>>>>>>>rve
>>>> >>>>>d=
>>>> >> >>>0
>>>> >> >>>>*
>>>> >> >
>>>> >>
>>>> >>
>>>>
>>>>
>


Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
If you remove everything from the ArrayList, the ArrayList dispatches
ITEM_REMOVED for each item (if you have 1000 items you will get 1000
events). ArrayList should probably not do that and instead, dispatch a
single COLLECTION_CHANGED event once completed.

But the RemoveItemBead will in fact, handle each ITEM_REMOVED event and
eventually clear out the list. To be more efficient, another bead should
be made since DataItemRendererFactoryForArrayList does not listen to
COLLECTION_CHANGED (perhaps it should or perhaps we need a new PAYG
enhanced version of that).

I have also been toying with just updating
DynamicItemsRenderFactoryForArrayList to make it handle all the cases and
forget the individual beads. You can pay little by using the
DataItemRendererFactoryForArrayList bead if you just want to display a
static list or pay it all and use DynamicItemsRendererFactoryForArrayList
even though you may only be inserting and never removing items.

—peter



On 12/5/17, 10:17 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:

>However those two beads are for remove single items? What if I remove
>everything from the ArrayList?
>
>On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com>
>wrote:
>
>> Those two beads will handle remove/add, so will I be able to use it for
>> list?
>>
>> It look like all your upcoming changes is something which I need for.
>>
>> I'm look forward to your commit!
>>
>> Thanks, Piotr
>>
>> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
>>
>>> I am working on an AddItemBead and RemoveItemBead. These beads assume
>>>the
>>> dataProvider in the model are ArrayList since that collection
>>>dispatches
>>> CollectionEvents with itemAdded and itemRemoved events. So these beads
>>> will either add an item to the DataGroup or remove one. Then they will
>>> adjust the model's selectedItem and selectedIndex accordingly.
>>>
>>> These will be beads of the DataItemRendererFactoryForArrayList and not
>>> beads on the List itself. I'm having to change
>>> DataItemRendererFactoryForArrayList to make things more public since it
>>> isn't trivial to add or remove an itemRenderer.
>>>
>>> —peter
>>>
>>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com>
>>>wrote:
>>>
>>> >Hi Peter,
>>> >
>>> >I see that and there is question whether I can put that code as a
>>> separate
>>> >bead to our repo and whether you are not going to do this?
>>> >You have started other thread about Tree Grid and beads mentioned by
>>>you
>>> >seems to be the answer. Let me know before I create something.
>>> >
>>> >Thanks, Piotr
>>> >
>>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
>>> >
>>> >> I think some of this changes when you are running in the browser.
>>>Does
>>> >>our
>>> >> framework code really need to know if an item is visible or not to
>>> >>remove
>>> >> it? You want it gone from the DOM so you need to remove it and the
>>> >>browser
>>> >> takes care of the visuals. Depending on the CSS for that container,
>>> >>things
>>> >> would probably just sort themselves out - no need to fool with
>>> >>scrollbars
>>> >> either as they are the responsibility of the browser. On the browser
>>> >> platform, adding a remove function would not, I think, be as costly
>>>as
>>> >>it
>>> >> would on the Flash platform.
>>> >>
>>> >> Now the selectedItem and selectedIndex are, of course, Royale
>>>things so
>>> >> that would need to be considered. But that's the same as for adding
>>>or
>>> >> inserting an item into a list. Again, the browser should take care
>>>of
>>> >>the
>>> >> visuals once the item is added to the DOM. If the item has been
>>>tagged
>>> >> properly for CSS, you wouldn't even need to trigger the Royale
>>>layout.
>>> >>
>>> >> As a side note, the reason the Group does not have a default layout
>>>is
>>> >>to
>>> >> allow you to make a DIV (the Group), put stuff into it, and style
>>>it so
>>> >> that the "layout" is handled in CSS. This way added, removing,
>>>changing
>>> >>is
>>> >> left up the browser with no need for Royale code support since the
>>> >>browser
>>> >> has all the code already and your Royale payload can be smaller. You
>>> >>only
>>> >> need to "pay" if you want a layout that cannot be accomplished with
>>> CSS.
>>> >>
>>> >> Supporting virtualized list is a completely different matter. HTML
>>> >>doesn't
>>> >> support that and then what Alex says really comes into play there.
>>> >>
>>> >> Back the question about removing all the rows. The DataGroup has a
>>> >> function to remove all of the itemRenderers. You need to trigger
>>>that
>>> >> somehow - either in your own code or perhaps a bead. Then clean up
>>>the
>>> >> selectedItem/selectedIndex in the model.
>>> >>
>>> >> ‹peter
>>> >>
>>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
>>> >>
>>> >> >In general, removing stuff should be PAYG.  Not every app needs to
>>> >>remove
>>> >> >things, and removal is often way more expensive than adding.
>>> >> >
>>> >> >For example, when an item is added to a sophisticated list, the
>>> various
>>> >> >beads have to do these things:
>>> >> >1) figure out if the item is on screen and a new renderer needs to
>>>be
>>> >> >added.
>>> >> >2) figure out if the item was added before the selectedIndex so the
>>> >> >selectedIndex needs to be updated
>>> >> >3) update the scrollbar (if any).
>>> >> >
>>> >> >When removing, the various beads have more to do:
>>> >> >1) figure out if the item is on screen and its renderer needs to be
>>> >> >removed.
>>> >> >2) figure out if the renderer removed is on the last visible page
>>>of
>>> >>the
>>> >> >list and scrollbars are up and the item that will take up the
>>>removed
>>> >> >renderer needs to come from a lower index in the data provider
>>> >> >3) figure out if the item was added before the selectedIndex so the
>>> >> >selectedIndex needs to be updated
>>> >> >4) figure out if the item removed was the selectedIndex and thus
>>> decide
>>> >> >what to do about selectedIndex and selectedItem
>>> >> >5) update the scrollbar (if any).
>>> >> >
>>> >> >HTH,
>>> >> >-Alex
>>> >> >
>>> >> >
>>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>>> >> >
>>> >> >>I need to think about this for a bit because I¹m fiddling with
>>>this
>>> >>bit
>>> >> >>of code in List. I¹ll get back to you in my tomorrow.
>>> >> >>
>>> >> >>Peter
>>> >> >>
>>> >> >>
>>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>>> >><pi...@gmail.com>
>>> >> >>>wrote:
>>> >> >>> Hi Guys,
>>> >> >>>
>>> >> >>> I have faced an issue where solution seems to be not so easy. I
>>> have
>>> >> >>>MDL
>>> >> >>> Table (issue affects also List) with some rows.
>>> >> >>>
>>> >> >>> If I simply assign to dataProvider = null it doesn't remove all
>>> >> >>>content. It
>>> >> >>> is because in our DataItemRendererFactoryForArrayData and other
>>> >>type of
>>> >> >>> that class we have in listeners of  "dataProviderChanged" this
>>>code
>>> >> >>>[1].
>>> >> >>> Basically if we assign null to dataProvider we are not cleaning
>>>up
>>> >>item
>>> >> >>> renderers, but should we ?
>>> >> >>>
>>> >> >>> Maybe there should be separate bead which allow to do such
>>> >>operations ?
>>> >> >>>
>>> >> >>> Thoughts ?
>>> >> >>>
>>> >> >>> [1]
>>> >>
>>> >>>>>*
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>> >>>>>e
>>> >> .
>>> >> >>>a
>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>> >> %7C05ca01d43a8448485bd50
>>> >> >>>8
>>> >>
>>>
>>> 
>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216
>>>>>>>>449
>>> >>>>>91
>>> >> >>>9
>>> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>>> >>
>>> >>>>><
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>> >>>>>e
>>> >> .
>>> >> >>>a
>>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>>> >> %7C05ca01d43a8448485bd50
>>> >> >>>8
>>> >>
>>>
>>> 
>>>>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216
>>>>>>>>449
>>> >>>>>91
>>> >> >>>9
>>> >> 
>>>>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>>> >> >>>
>>> >> >>> Thanks,
>>> >> >>> --
>>> >> >>>
>>> >> >>> Piotr Zarzycki
>>> >> >>>
>>> >> >>> Patreon:
>>> >> >>>*
>>> >>
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>> >> >>>t
>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>> >> %7C05ca01d43a844
>>> >> >>>8
>>> >>
>>>
>>> 
>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636
>>>>>>>>480
>>> >>>>>21
>>> >> >>>2
>>> >>
>>>
>>> 
>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&rese
>>>>>>>>rve
>>> >>>>>d=
>>> >> >>>0
>>> >> >>>
>>> >> >>><
>>> >>
>>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>> >> >>>t
>>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>>> >> %7C05ca01d43a844
>>> >> >>>8
>>> >>
>>>
>>> 
>>>>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636
>>>>>>>>480
>>> >>>>>21
>>> >> >>>2
>>> >>
>>>
>>> 
>>>>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&rese
>>>>>>>>rve
>>> >>>>>d=
>>> >> >>>0
>>> >> >>>>*
>>> >> >
>>> >>
>>> >>
>>>
>>>


Re: List, MDL Table - How to remove all content

Posted by Piotr Zarzycki <pi...@gmail.com>.
However those two beads are for remove single items? What if I remove
everything from the ArrayList?

On Tue, Dec 5, 2017, 16:16 Piotr Zarzycki <pi...@gmail.com> wrote:

> Those two beads will handle remove/add, so will I be able to use it for
> list?
>
> It look like all your upcoming changes is something which I need for.
>
> I'm look forward to your commit!
>
> Thanks, Piotr
>
> On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:
>
>> I am working on an AddItemBead and RemoveItemBead. These beads assume the
>> dataProvider in the model are ArrayList since that collection dispatches
>> CollectionEvents with itemAdded and itemRemoved events. So these beads
>> will either add an item to the DataGroup or remove one. Then they will
>> adjust the model's selectedItem and selectedIndex accordingly.
>>
>> These will be beads of the DataItemRendererFactoryForArrayList and not
>> beads on the List itself. I'm having to change
>> DataItemRendererFactoryForArrayList to make things more public since it
>> isn't trivial to add or remove an itemRenderer.
>>
>> —peter
>>
>> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>>
>> >Hi Peter,
>> >
>> >I see that and there is question whether I can put that code as a
>> separate
>> >bead to our repo and whether you are not going to do this?
>> >You have started other thread about Tree Grid and beads mentioned by you
>> >seems to be the answer. Let me know before I create something.
>> >
>> >Thanks, Piotr
>> >
>> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
>> >
>> >> I think some of this changes when you are running in the browser. Does
>> >>our
>> >> framework code really need to know if an item is visible or not to
>> >>remove
>> >> it? You want it gone from the DOM so you need to remove it and the
>> >>browser
>> >> takes care of the visuals. Depending on the CSS for that container,
>> >>things
>> >> would probably just sort themselves out - no need to fool with
>> >>scrollbars
>> >> either as they are the responsibility of the browser. On the browser
>> >> platform, adding a remove function would not, I think, be as costly as
>> >>it
>> >> would on the Flash platform.
>> >>
>> >> Now the selectedItem and selectedIndex are, of course, Royale things so
>> >> that would need to be considered. But that's the same as for adding or
>> >> inserting an item into a list. Again, the browser should take care of
>> >>the
>> >> visuals once the item is added to the DOM. If the item has been tagged
>> >> properly for CSS, you wouldn't even need to trigger the Royale layout.
>> >>
>> >> As a side note, the reason the Group does not have a default layout is
>> >>to
>> >> allow you to make a DIV (the Group), put stuff into it, and style it so
>> >> that the "layout" is handled in CSS. This way added, removing, changing
>> >>is
>> >> left up the browser with no need for Royale code support since the
>> >>browser
>> >> has all the code already and your Royale payload can be smaller. You
>> >>only
>> >> need to "pay" if you want a layout that cannot be accomplished with
>> CSS.
>> >>
>> >> Supporting virtualized list is a completely different matter. HTML
>> >>doesn't
>> >> support that and then what Alex says really comes into play there.
>> >>
>> >> Back the question about removing all the rows. The DataGroup has a
>> >> function to remove all of the itemRenderers. You need to trigger that
>> >> somehow - either in your own code or perhaps a bead. Then clean up the
>> >> selectedItem/selectedIndex in the model.
>> >>
>> >> ‹peter
>> >>
>> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
>> >>
>> >> >In general, removing stuff should be PAYG.  Not every app needs to
>> >>remove
>> >> >things, and removal is often way more expensive than adding.
>> >> >
>> >> >For example, when an item is added to a sophisticated list, the
>> various
>> >> >beads have to do these things:
>> >> >1) figure out if the item is on screen and a new renderer needs to be
>> >> >added.
>> >> >2) figure out if the item was added before the selectedIndex so the
>> >> >selectedIndex needs to be updated
>> >> >3) update the scrollbar (if any).
>> >> >
>> >> >When removing, the various beads have more to do:
>> >> >1) figure out if the item is on screen and its renderer needs to be
>> >> >removed.
>> >> >2) figure out if the renderer removed is on the last visible page of
>> >>the
>> >> >list and scrollbars are up and the item that will take up the removed
>> >> >renderer needs to come from a lower index in the data provider
>> >> >3) figure out if the item was added before the selectedIndex so the
>> >> >selectedIndex needs to be updated
>> >> >4) figure out if the item removed was the selectedIndex and thus
>> decide
>> >> >what to do about selectedIndex and selectedItem
>> >> >5) update the scrollbar (if any).
>> >> >
>> >> >HTH,
>> >> >-Alex
>> >> >
>> >> >
>> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>> >> >
>> >> >>I need to think about this for a bit because I¹m fiddling with this
>> >>bit
>> >> >>of code in List. I¹ll get back to you in my tomorrow.
>> >> >>
>> >> >>Peter
>> >> >>
>> >> >>
>> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>> >><pi...@gmail.com>
>> >> >>>wrote:
>> >> >>> Hi Guys,
>> >> >>>
>> >> >>> I have faced an issue where solution seems to be not so easy. I
>> have
>> >> >>>MDL
>> >> >>> Table (issue affects also List) with some rows.
>> >> >>>
>> >> >>> If I simply assign to dataProvider = null it doesn't remove all
>> >> >>>content. It
>> >> >>> is because in our DataItemRendererFactoryForArrayData and other
>> >>type of
>> >> >>> that class we have in listeners of  "dataProviderChanged" this code
>> >> >>>[1].
>> >> >>> Basically if we assign null to dataProvider we are not cleaning up
>> >>item
>> >> >>> renderers, but should we ?
>> >> >>>
>> >> >>> Maybe there should be separate bead which allow to do such
>> >>operations ?
>> >> >>>
>> >> >>> Thoughts ?
>> >> >>>
>> >> >>> [1]
>> >>
>> >>>>>*
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>> >>>>>e
>> >> .
>> >> >>>a
>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> >> %7C05ca01d43a8448485bd50
>> >> >>>8
>> >>
>>
>> >>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
>> >>>>>91
>> >> >>>9
>> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>> >>
>> >>>>><
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>> >>>>>e
>> >> .
>> >> >>>a
>> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> >> %7C05ca01d43a8448485bd50
>> >> >>>8
>> >>
>>
>> >>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
>> >>>>>91
>> >> >>>9
>> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>> >> >>>
>> >> >>> Thanks,
>> >> >>> --
>> >> >>>
>> >> >>> Piotr Zarzycki
>> >> >>>
>> >> >>> Patreon:
>> >> >>>*
>> >>
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>> >> >>>t
>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> >> %7C05ca01d43a844
>> >> >>>8
>> >>
>>
>> >>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
>> >>>>>21
>> >> >>>2
>> >>
>>
>> >>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
>> >>>>>d=
>> >> >>>0
>> >> >>>
>> >> >>><
>> >>
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>> >> >>>t
>> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> >> %7C05ca01d43a844
>> >> >>>8
>> >>
>>
>> >>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
>> >>>>>21
>> >> >>>2
>> >>
>>
>> >>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
>> >>>>>d=
>> >> >>>0
>> >> >>>>*
>> >> >
>> >>
>> >>
>>
>>

Re: List, MDL Table - How to remove all content

Posted by Piotr Zarzycki <pi...@gmail.com>.
Those two beads will handle remove/add, so will I be able to use it for
list?

It look like all your upcoming changes is something which I need for.

I'm look forward to your commit!

Thanks, Piotr

On Tue, Dec 5, 2017, 16:03 Peter Ent <pe...@adobe.com.invalid> wrote:

> I am working on an AddItemBead and RemoveItemBead. These beads assume the
> dataProvider in the model are ArrayList since that collection dispatches
> CollectionEvents with itemAdded and itemRemoved events. So these beads
> will either add an item to the DataGroup or remove one. Then they will
> adjust the model's selectedItem and selectedIndex accordingly.
>
> These will be beads of the DataItemRendererFactoryForArrayList and not
> beads on the List itself. I'm having to change
> DataItemRendererFactoryForArrayList to make things more public since it
> isn't trivial to add or remove an itemRenderer.
>
> —peter
>
> On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:
>
> >Hi Peter,
> >
> >I see that and there is question whether I can put that code as a separate
> >bead to our repo and whether you are not going to do this?
> >You have started other thread about Tree Grid and beads mentioned by you
> >seems to be the answer. Let me know before I create something.
> >
> >Thanks, Piotr
> >
> >On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
> >
> >> I think some of this changes when you are running in the browser. Does
> >>our
> >> framework code really need to know if an item is visible or not to
> >>remove
> >> it? You want it gone from the DOM so you need to remove it and the
> >>browser
> >> takes care of the visuals. Depending on the CSS for that container,
> >>things
> >> would probably just sort themselves out - no need to fool with
> >>scrollbars
> >> either as they are the responsibility of the browser. On the browser
> >> platform, adding a remove function would not, I think, be as costly as
> >>it
> >> would on the Flash platform.
> >>
> >> Now the selectedItem and selectedIndex are, of course, Royale things so
> >> that would need to be considered. But that's the same as for adding or
> >> inserting an item into a list. Again, the browser should take care of
> >>the
> >> visuals once the item is added to the DOM. If the item has been tagged
> >> properly for CSS, you wouldn't even need to trigger the Royale layout.
> >>
> >> As a side note, the reason the Group does not have a default layout is
> >>to
> >> allow you to make a DIV (the Group), put stuff into it, and style it so
> >> that the "layout" is handled in CSS. This way added, removing, changing
> >>is
> >> left up the browser with no need for Royale code support since the
> >>browser
> >> has all the code already and your Royale payload can be smaller. You
> >>only
> >> need to "pay" if you want a layout that cannot be accomplished with CSS.
> >>
> >> Supporting virtualized list is a completely different matter. HTML
> >>doesn't
> >> support that and then what Alex says really comes into play there.
> >>
> >> Back the question about removing all the rows. The DataGroup has a
> >> function to remove all of the itemRenderers. You need to trigger that
> >> somehow - either in your own code or perhaps a bead. Then clean up the
> >> selectedItem/selectedIndex in the model.
> >>
> >> ‹peter
> >>
> >> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
> >>
> >> >In general, removing stuff should be PAYG.  Not every app needs to
> >>remove
> >> >things, and removal is often way more expensive than adding.
> >> >
> >> >For example, when an item is added to a sophisticated list, the various
> >> >beads have to do these things:
> >> >1) figure out if the item is on screen and a new renderer needs to be
> >> >added.
> >> >2) figure out if the item was added before the selectedIndex so the
> >> >selectedIndex needs to be updated
> >> >3) update the scrollbar (if any).
> >> >
> >> >When removing, the various beads have more to do:
> >> >1) figure out if the item is on screen and its renderer needs to be
> >> >removed.
> >> >2) figure out if the renderer removed is on the last visible page of
> >>the
> >> >list and scrollbars are up and the item that will take up the removed
> >> >renderer needs to come from a lower index in the data provider
> >> >3) figure out if the item was added before the selectedIndex so the
> >> >selectedIndex needs to be updated
> >> >4) figure out if the item removed was the selectedIndex and thus decide
> >> >what to do about selectedIndex and selectedItem
> >> >5) update the scrollbar (if any).
> >> >
> >> >HTH,
> >> >-Alex
> >> >
> >> >
> >> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
> >> >
> >> >>I need to think about this for a bit because I¹m fiddling with this
> >>bit
> >> >>of code in List. I¹ll get back to you in my tomorrow.
> >> >>
> >> >>Peter
> >> >>
> >> >>
> >> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
> >><pi...@gmail.com>
> >> >>>wrote:
> >> >>> Hi Guys,
> >> >>>
> >> >>> I have faced an issue where solution seems to be not so easy. I have
> >> >>>MDL
> >> >>> Table (issue affects also List) with some rows.
> >> >>>
> >> >>> If I simply assign to dataProvider = null it doesn't remove all
> >> >>>content. It
> >> >>> is because in our DataItemRendererFactoryForArrayData and other
> >>type of
> >> >>> that class we have in listeners of  "dataProviderChanged" this code
> >> >>>[1].
> >> >>> Basically if we assign null to dataProvider we are not cleaning up
> >>item
> >> >>> renderers, but should we ?
> >> >>>
> >> >>> Maybe there should be separate bead which allow to do such
> >>operations ?
> >> >>>
> >> >>> Thoughts ?
> >> >>>
> >> >>> [1]
> >>
> >>>>>*
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>>>>e
> >> .
> >> >>>a
> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >> %7C05ca01d43a8448485bd50
> >> >>>8
> >>
> >>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
> >>>>>91
> >> >>>9
> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
> >>
> >>>>><
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
> >>>>>e
> >> .
> >> >>>a
> >> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> >> %7C05ca01d43a8448485bd50
> >> >>>8
> >>
> >>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
> >>>>>91
> >> >>>9
> >> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
> >> >>>
> >> >>> Thanks,
> >> >>> --
> >> >>>
> >> >>> Piotr Zarzycki
> >> >>>
> >> >>> Patreon:
> >> >>>*
> >> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
> >> >>>t
> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >> %7C05ca01d43a844
> >> >>>8
> >>
> >>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
> >>>>>21
> >> >>>2
> >>
> >>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
> >>>>>d=
> >> >>>0
> >> >>>
> >> >>><
> >> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
> >> >>>t
> >> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> >> %7C05ca01d43a844
> >> >>>8
> >>
> >>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
> >>>>>21
> >> >>>2
> >>
> >>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
> >>>>>d=
> >> >>>0
> >> >>>>*
> >> >
> >>
> >>
>
>

Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
I am working on an AddItemBead and RemoveItemBead. These beads assume the
dataProvider in the model are ArrayList since that collection dispatches
CollectionEvents with itemAdded and itemRemoved events. So these beads
will either add an item to the DataGroup or remove one. Then they will
adjust the model's selectedItem and selectedIndex accordingly.

These will be beads of the DataItemRendererFactoryForArrayList and not
beads on the List itself. I'm having to change
DataItemRendererFactoryForArrayList to make things more public since it
isn't trivial to add or remove an itemRenderer.

—peter

On 12/5/17, 9:51 AM, "Piotr Zarzycki" <pi...@gmail.com> wrote:

>Hi Peter,
>
>I see that and there is question whether I can put that code as a separate
>bead to our repo and whether you are not going to do this?
>You have started other thread about Tree Grid and beads mentioned by you
>seems to be the answer. Let me know before I create something.
>
>Thanks, Piotr
>
>On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:
>
>> I think some of this changes when you are running in the browser. Does
>>our
>> framework code really need to know if an item is visible or not to
>>remove
>> it? You want it gone from the DOM so you need to remove it and the
>>browser
>> takes care of the visuals. Depending on the CSS for that container,
>>things
>> would probably just sort themselves out - no need to fool with
>>scrollbars
>> either as they are the responsibility of the browser. On the browser
>> platform, adding a remove function would not, I think, be as costly as
>>it
>> would on the Flash platform.
>>
>> Now the selectedItem and selectedIndex are, of course, Royale things so
>> that would need to be considered. But that's the same as for adding or
>> inserting an item into a list. Again, the browser should take care of
>>the
>> visuals once the item is added to the DOM. If the item has been tagged
>> properly for CSS, you wouldn't even need to trigger the Royale layout.
>>
>> As a side note, the reason the Group does not have a default layout is
>>to
>> allow you to make a DIV (the Group), put stuff into it, and style it so
>> that the "layout" is handled in CSS. This way added, removing, changing
>>is
>> left up the browser with no need for Royale code support since the
>>browser
>> has all the code already and your Royale payload can be smaller. You
>>only
>> need to "pay" if you want a layout that cannot be accomplished with CSS.
>>
>> Supporting virtualized list is a completely different matter. HTML
>>doesn't
>> support that and then what Alex says really comes into play there.
>>
>> Back the question about removing all the rows. The DataGroup has a
>> function to remove all of the itemRenderers. You need to trigger that
>> somehow - either in your own code or perhaps a bead. Then clean up the
>> selectedItem/selectedIndex in the model.
>>
>> ‹peter
>>
>> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
>>
>> >In general, removing stuff should be PAYG.  Not every app needs to
>>remove
>> >things, and removal is often way more expensive than adding.
>> >
>> >For example, when an item is added to a sophisticated list, the various
>> >beads have to do these things:
>> >1) figure out if the item is on screen and a new renderer needs to be
>> >added.
>> >2) figure out if the item was added before the selectedIndex so the
>> >selectedIndex needs to be updated
>> >3) update the scrollbar (if any).
>> >
>> >When removing, the various beads have more to do:
>> >1) figure out if the item is on screen and its renderer needs to be
>> >removed.
>> >2) figure out if the renderer removed is on the last visible page of
>>the
>> >list and scrollbars are up and the item that will take up the removed
>> >renderer needs to come from a lower index in the data provider
>> >3) figure out if the item was added before the selectedIndex so the
>> >selectedIndex needs to be updated
>> >4) figure out if the item removed was the selectedIndex and thus decide
>> >what to do about selectedIndex and selectedItem
>> >5) update the scrollbar (if any).
>> >
>> >HTH,
>> >-Alex
>> >
>> >
>> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>> >
>> >>I need to think about this for a bit because I¹m fiddling with this
>>bit
>> >>of code in List. I¹ll get back to you in my tomorrow.
>> >>
>> >>Peter
>> >>
>> >>
>> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki
>><pi...@gmail.com>
>> >>>wrote:
>> >>> Hi Guys,
>> >>>
>> >>> I have faced an issue where solution seems to be not so easy. I have
>> >>>MDL
>> >>> Table (issue affects also List) with some rows.
>> >>>
>> >>> If I simply assign to dataProvider = null it doesn't remove all
>> >>>content. It
>> >>> is because in our DataItemRendererFactoryForArrayData and other
>>type of
>> >>> that class we have in listeners of  "dataProviderChanged" this code
>> >>>[1].
>> >>> Basically if we assign null to dataProvider we are not cleaning up
>>item
>> >>> renderers, but should we ?
>> >>>
>> >>> Maybe there should be separate bead which allow to do such
>>operations ?
>> >>>
>> >>> Thoughts ?
>> >>>
>> >>> [1]
>> 
>>>>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>>>>e
>> .
>> >>>a
>> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> %7C05ca01d43a8448485bd50
>> >>>8
>> 
>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
>>>>>91
>> >>>9
>> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>> 
>>>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpast
>>>>>e
>> .
>> >>>a
>> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
>> %7C05ca01d43a8448485bd50
>> >>>8
>> 
>>>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449
>>>>>91
>> >>>9
>> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>> >>>
>> >>> Thanks,
>> >>> --
>> >>>
>> >>> Piotr Zarzycki
>> >>>
>> >>> Patreon:
>> >>>*
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>> >>>t
>> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> %7C05ca01d43a844
>> >>>8
>> 
>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
>>>>>21
>> >>>2
>> 
>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
>>>>>d=
>> >>>0
>> >>>
>> >>><
>> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>> >>>t
>> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
>> %7C05ca01d43a844
>> >>>8
>> 
>>>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480
>>>>>21
>> >>>2
>> 
>>>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserve
>>>>>d=
>> >>>0
>> >>>>*
>> >
>>
>>


Re: List, MDL Table - How to remove all content

Posted by Piotr Zarzycki <pi...@gmail.com>.
Hi Peter,

I see that and there is question whether I can put that code as a separate
bead to our repo and whether you are not going to do this?
You have started other thread about Tree Grid and beads mentioned by you
seems to be the answer. Let me know before I create something.

Thanks, Piotr

On Tue, Dec 5, 2017, 15:43 Peter Ent <pe...@adobe.com.invalid> wrote:

> I think some of this changes when you are running in the browser. Does our
> framework code really need to know if an item is visible or not to remove
> it? You want it gone from the DOM so you need to remove it and the browser
> takes care of the visuals. Depending on the CSS for that container, things
> would probably just sort themselves out - no need to fool with scrollbars
> either as they are the responsibility of the browser. On the browser
> platform, adding a remove function would not, I think, be as costly as it
> would on the Flash platform.
>
> Now the selectedItem and selectedIndex are, of course, Royale things so
> that would need to be considered. But that's the same as for adding or
> inserting an item into a list. Again, the browser should take care of the
> visuals once the item is added to the DOM. If the item has been tagged
> properly for CSS, you wouldn't even need to trigger the Royale layout.
>
> As a side note, the reason the Group does not have a default layout is to
> allow you to make a DIV (the Group), put stuff into it, and style it so
> that the "layout" is handled in CSS. This way added, removing, changing is
> left up the browser with no need for Royale code support since the browser
> has all the code already and your Royale payload can be smaller. You only
> need to "pay" if you want a layout that cannot be accomplished with CSS.
>
> Supporting virtualized list is a completely different matter. HTML doesn't
> support that and then what Alex says really comes into play there.
>
> Back the question about removing all the rows. The DataGroup has a
> function to remove all of the itemRenderers. You need to trigger that
> somehow - either in your own code or perhaps a bead. Then clean up the
> selectedItem/selectedIndex in the model.
>
> ‹peter
>
> On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:
>
> >In general, removing stuff should be PAYG.  Not every app needs to remove
> >things, and removal is often way more expensive than adding.
> >
> >For example, when an item is added to a sophisticated list, the various
> >beads have to do these things:
> >1) figure out if the item is on screen and a new renderer needs to be
> >added.
> >2) figure out if the item was added before the selectedIndex so the
> >selectedIndex needs to be updated
> >3) update the scrollbar (if any).
> >
> >When removing, the various beads have more to do:
> >1) figure out if the item is on screen and its renderer needs to be
> >removed.
> >2) figure out if the renderer removed is on the last visible page of the
> >list and scrollbars are up and the item that will take up the removed
> >renderer needs to come from a lower index in the data provider
> >3) figure out if the item was added before the selectedIndex so the
> >selectedIndex needs to be updated
> >4) figure out if the item removed was the selectedIndex and thus decide
> >what to do about selectedIndex and selectedItem
> >5) update the scrollbar (if any).
> >
> >HTH,
> >-Alex
> >
> >
> >On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
> >
> >>I need to think about this for a bit because I¹m fiddling with this bit
> >>of code in List. I¹ll get back to you in my tomorrow.
> >>
> >>Peter
> >>
> >>
> >>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki <pi...@gmail.com>
> >>>wrote:
> >>> Hi Guys,
> >>>
> >>> I have faced an issue where solution seems to be not so easy. I have
> >>>MDL
> >>> Table (issue affects also List) with some rows.
> >>>
> >>> If I simply assign to dataProvider = null it doesn't remove all
> >>>content. It
> >>> is because in our DataItemRendererFactoryForArrayData and other type of
> >>> that class we have in listeners of  "dataProviderChanged" this code
> >>>[1].
> >>> Basically if we assign null to dataProvider we are not cleaning up item
> >>> renderers, but should we ?
> >>>
> >>> Maybe there should be separate bead which allow to do such operations ?
> >>>
> >>> Thoughts ?
> >>>
> >>> [1]
> >>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste
> .
> >>>a
> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> %7C05ca01d43a8448485bd50
> >>>8
> >>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121644991
> >>>9
> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
> >>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste
> .
> >>>a
> >>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com
> %7C05ca01d43a8448485bd50
> >>>8
> >>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121644991
> >>>9
> >>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
> >>>
> >>> Thanks,
> >>> --
> >>>
> >>> Piotr Zarzycki
> >>>
> >>> Patreon:
> >>>*
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
> >>>t
> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> %7C05ca01d43a844
> >>>8
> >>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021
> >>>2
> >>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=
> >>>0
> >>>
> >>><
> https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
> >>>t
> >>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com
> %7C05ca01d43a844
> >>>8
> >>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021
> >>>2
> >>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=
> >>>0
> >>>>*
> >
>
>

Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
I think some of this changes when you are running in the browser. Does our
framework code really need to know if an item is visible or not to remove
it? You want it gone from the DOM so you need to remove it and the browser
takes care of the visuals. Depending on the CSS for that container, things
would probably just sort themselves out - no need to fool with scrollbars
either as they are the responsibility of the browser. On the browser
platform, adding a remove function would not, I think, be as costly as it
would on the Flash platform.

Now the selectedItem and selectedIndex are, of course, Royale things so
that would need to be considered. But that's the same as for adding or
inserting an item into a list. Again, the browser should take care of the
visuals once the item is added to the DOM. If the item has been tagged
properly for CSS, you wouldn't even need to trigger the Royale layout.

As a side note, the reason the Group does not have a default layout is to
allow you to make a DIV (the Group), put stuff into it, and style it so
that the "layout" is handled in CSS. This way added, removing, changing is
left up the browser with no need for Royale code support since the browser
has all the code already and your Royale payload can be smaller. You only
need to "pay" if you want a layout that cannot be accomplished with CSS.

Supporting virtualized list is a completely different matter. HTML doesn't
support that and then what Alex says really comes into play there.

Back the question about removing all the rows. The DataGroup has a
function to remove all of the itemRenderers. You need to trigger that
somehow - either in your own code or perhaps a bead. Then clean up the
selectedItem/selectedIndex in the model.

‹peter 

On 12/5/17, 12:03 AM, "Alex Harui" <ah...@adobe.com.INVALID> wrote:

>In general, removing stuff should be PAYG.  Not every app needs to remove
>things, and removal is often way more expensive than adding.
>
>For example, when an item is added to a sophisticated list, the various
>beads have to do these things:
>1) figure out if the item is on screen and a new renderer needs to be
>added.
>2) figure out if the item was added before the selectedIndex so the
>selectedIndex needs to be updated
>3) update the scrollbar (if any).
>
>When removing, the various beads have more to do:
>1) figure out if the item is on screen and its renderer needs to be
>removed.
>2) figure out if the renderer removed is on the last visible page of the
>list and scrollbars are up and the item that will take up the removed
>renderer needs to come from a lower index in the data provider
>3) figure out if the item was added before the selectedIndex so the
>selectedIndex needs to be updated
>4) figure out if the item removed was the selectedIndex and thus decide
>what to do about selectedIndex and selectedItem
>5) update the scrollbar (if any).
>
>HTH,
>-Alex
>
>
>On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:
>
>>I need to think about this for a bit because I¹m fiddling with this bit
>>of code in List. I¹ll get back to you in my tomorrow.
>>
>>Peter 
>>
>>
>>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki <pi...@gmail.com>
>>>wrote:
>>> Hi Guys,
>>> 
>>> I have faced an issue where solution seems to be not so easy. I have
>>>MDL
>>> Table (issue affects also List) with some rows.
>>> 
>>> If I simply assign to dataProvider = null it doesn't remove all
>>>content. It
>>> is because in our DataItemRendererFactoryForArrayData and other type of
>>> that class we have in listeners of  "dataProviderChanged" this code
>>>[1].
>>> Basically if we assign null to dataProvider we are not cleaning up item
>>> renderers, but should we ?
>>> 
>>> Maybe there should be separate bead which allow to do such operations ?
>>> 
>>> Thoughts ?
>>> 
>>> [1] 
>>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.
>>>a
>>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd50
>>>8
>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121644991
>>>9
>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.
>>>a
>>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd50
>>>8
>>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C6364802121644991
>>>9
>>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>>> 
>>> Thanks,
>>> -- 
>>> 
>>> Piotr Zarzycki
>>> 
>>> Patreon: 
>>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>>t
>>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a844
>>>8
>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021
>>>2
>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=
>>>0
>>> 
>>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pa
>>>t
>>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a844
>>>8
>>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021
>>>2
>>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=
>>>0
>>>>*
>


Re: List, MDL Table - How to remove all content

Posted by Alex Harui <ah...@adobe.com.INVALID>.
In general, removing stuff should be PAYG.  Not every app needs to remove
things, and removal is often way more expensive than adding.

For example, when an item is added to a sophisticated list, the various
beads have to do these things:
1) figure out if the item is on screen and a new renderer needs to be
added.
2) figure out if the item was added before the selectedIndex so the
selectedIndex needs to be updated
3) update the scrollbar (if any).

When removing, the various beads have more to do:
1) figure out if the item is on screen and its renderer needs to be
removed.
2) figure out if the renderer removed is on the last visible page of the
list and scrollbars are up and the item that will take up the removed
renderer needs to come from a lower index in the data provider
3) figure out if the item was added before the selectedIndex so the
selectedIndex needs to be updated
4) figure out if the item removed was the selectedIndex and thus decide
what to do about selectedIndex and selectedItem
5) update the scrollbar (if any).

HTH,
-Alex


On 12/4/17, 5:08 PM, "Peter Ent" <pe...@adobe.com.INVALID> wrote:

>I need to think about this for a bit because I’m fiddling with this bit
>of code in List. I’ll get back to you in my tomorrow.
>
>Peter 
>
>
>> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki <pi...@gmail.com>
>>wrote:
>> Hi Guys,
>> 
>> I have faced an issue where solution seems to be not so easy. I have MDL
>> Table (issue affects also List) with some rows.
>> 
>> If I simply assign to dataProvider = null it doesn't remove all
>>content. It
>> is because in our DataItemRendererFactoryForArrayData and other type of
>> that class we have in listeners of  "dataProviderChanged" this code [1].
>> Basically if we assign null to dataProvider we are not cleaning up item
>> renderers, but should we ?
>> 
>> Maybe there should be separate bead which allow to do such operations ?
>> 
>> Thoughts ?
>> 
>> [1] 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.a
>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508
>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449919
>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.a
>>pache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508
>>d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C63648021216449919
>>9&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
>> 
>> Thanks,
>> -- 
>> 
>> Piotr Zarzycki
>> 
>> Patreon: 
>>*https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448
>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212
>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0
>> 
>><https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.pat
>>reon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448
>>485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212
>>164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0
>>>*


Re: List, MDL Table - How to remove all content

Posted by Peter Ent <pe...@adobe.com.INVALID>.
I need to think about this for a bit because I’m fiddling with this bit of code in List. I’ll get back to you in my tomorrow. 

Peter 


> On Dec 4, 2017, at 4:53 PM, Piotr Zarzycki <pi...@gmail.com> wrote:
> Hi Guys,
> 
> I have faced an issue where solution seems to be not so easy. I have MDL
> Table (issue affects also List) with some rows.
> 
> If I simply assign to dataProvider = null it doesn't remove all content. It
> is because in our DataItemRendererFactoryForArrayData and other type of
> that class we have in listeners of  "dataProviderChanged" this code [1].
> Basically if we assign null to dataProvider we are not cleaning up item
> renderers, but should we ?
> 
> Maybe there should be separate bead which allow to do such operations ?
> 
> Thoughts ?
> 
> [1] *https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212164499199&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0 <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpaste.apache.org%2F6qVy&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212164499199&sdata=6mmrQ1g5CRuRmRyRpSLNil3LUn93jAKTJVI6RHSocL8%3D&reserved=0>*
> 
> Thanks,
> -- 
> 
> Piotr Zarzycki
> 
> Patreon: *https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.patreon.com%2Fpiotrzarzycki&data=02%7C01%7Cpent%40adobe.com%7C05ca01d43a8448485bd508d53b617760%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C636480212164499199&sdata=Lh5NSyP1MPIG6h5X4eG9RW3MWcQMiMBDevLzt8WoPS4%3D&reserved=0>*