Hi Carlos, Thanks for explanation, just wanted to make sure, cause that's what I thought in case of the reason why it is duplicated.
Piotr niedz., 19 sie 2018 o 22:23 Carlos Rovira <[email protected]> napisał(a): > Hi Piotr, > yes. As you remember, I did a huge refactor that made all of us invest many > time in discussions. That discussions make some things solve and approved > some others, but while I think we talked about a refactor in our way to > 1.0, we left in that point. I propose to make that refactor, but I don't > saw a clear point to go forward at that time. So while I'm a huge advocate > of no code duplication, as well, a point is even more important to me: not > make Jewel dependent from the *actual* Basic library. I think many beads > in Basic can be usable cross Royale, but they need to be in a common > library not Basic (what I called "Foundation.swc" through the discussion. > Or separate the Basic UI set to another lib. As well that classes need a > refactor of packages and maybe names. In Jewel package organization is very > important, and I think that should be in all Royale code to ease > development for our users. As Harbs said, actually is very hard for others > that come to know what we have, and where find it. > > But instead, I work as well to change the package names to old structure to > release 0.9.3, instead of going from that point to something more final, > for me a step back, but ok to release 0.9.3, but no one has started the > release process of 0.9.3... > > I hope, some time in the future, we can remove the duplicated code and > refactor things before reach 1.0. But maybe is not the right time, since I > see Alex very productive with emulation branch, and maybe a refactor not > could be a problem for him when trying to merge and could result in more > unwanted work. As well I'm finishing some key components, since in few > days/weeks we'll start a Royale project, so I need to finish those > components before I can invest time in refactor. So I hope if we release > 0.9.3 by September, I can propose to start the refactor with Jewel almost > finished and emulation branch integrated by October? But anyway, as well I > hope all people understand that a refactor will implied changes in many > names and packages, and that could bring many discussions to the table that > can as well make us lose many time on that front, while Royale need (as any > other code) need that to be a 1.0 that can live long time without huge > modifications that affect many users code bases... > > > > > > > > El dom., 19 ago. 2018 a las 9:56, Piotr Zarzycki (< > [email protected]>) > escribió: > > > Carlos, > > > > So you did exact copy of beads from Basic? > > > > Thanks, > > Piotr > > > > On Sat, Aug 18, 2018, 7:45 PM <[email protected]> wrote: > > > > > This is an automated email from the ASF dual-hosted git repository. > > > > > > carlosrovira pushed a commit to branch develop > > > in repository https://gitbox.apache.org/repos/asf/royale-asjs.git > > > > > > > > > The following commit(s) were added to refs/heads/develop by this push: > > > new 967fd9b remove item handling code in favor of use of beads > > > 967fd9b is described below > > > > > > commit 967fd9b8a6873514a83c66084e8aa4a015f48c7d > > > Author: Carlos Rovira <[email protected]> > > > AuthorDate: Sat Aug 18 19:45:51 2018 +0200 > > > > > > remove item handling code in favor of use of beads > > > --- > > > .../src/main/royale/ListPlayGround.mxml | 2 +- > > > .../DataItemRendererFactoryForCollectionView.as | 131 > > > +++++++++++---------- > > > .../TableItemRendererFactoryForCollectionView.as | 29 +++-- > > > 3 files changed, 83 insertions(+), 79 deletions(-) > > > > > > diff --git > > > a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml > > > b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml > > > index 8b603eb..63eb8d3 100644 > > > --- a/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml > > > +++ b/examples/royale/JewelExample/src/main/royale/ListPlayGround.mxml > > > @@ -50,7 +50,7 @@ limitations under the License. > > > > > > public function removeAllData():void > > > { > > > - simple.removeAll(); > > > + (list.dataProvider as > > > ArrayList).removeAll(); > > > } > > > ]]> > > > </fx:Script> > > > diff --git > > > > > > a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForCollectionView.as > > > > > > b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForCollectionView.as > > > index 544b013..4a47ec8 100644 > > > --- > > > > > > a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForCollectionView.as > > > +++ > > > > > > b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/DataItemRendererFactoryForCollectionView.as > > > @@ -163,11 +163,12 @@ package > org.apache.royale.jewel.beads.itemRenderers > > > if (!dp) > > > return; > > > > > > + // remove this and better add beads when needed > > > // listen for individual items being added in > the > > > future. > > > - var dped:IEventDispatcher = dp as > > IEventDispatcher; > > > - > dped.addEventListener(CollectionEvent.ITEM_ADDED, > > > itemAddedHandler); > > > - > > > dped.addEventListener(CollectionEvent.ITEM_REMOVED, > itemRemovedHandler); > > > - > > > dped.addEventListener(CollectionEvent.ITEM_UPDATED, > itemUpdatedHandler); > > > + // var dped:IEventDispatcher = dp as > > > IEventDispatcher; > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_ADDED, itemAddedHandler); > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_REMOVED, > itemRemovedHandler); > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_UPDATED, > itemUpdatedHandler); > > > > > > dataGroup.removeAllItemRenderers(); > > > > > > @@ -192,37 +193,37 @@ package > org.apache.royale.jewel.beads.itemRenderers > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > * @royaleignorecoercion > > > org.apache.royale.events.IEventDispatcher > > > */ > > > - protected function > > > itemAddedHandler(event:CollectionEvent):void > > > - { > > > - if (!dataProviderModel) > > > - return; > > > - var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > - if (!dp) > > > - return; > > > + // protected function > > > itemAddedHandler(event:CollectionEvent):void > > > + // { > > > + // if (!dataProviderModel) > > > + // return; > > > + // var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > + // if (!dp) > > > + // return; > > > > > > - var presentationModel:IListPresentationModel = > > > _strand.getBeadByType(IListPresentationModel) as > IListPresentationModel; > > > - var ir:ISelectableItemRenderer = > > > itemRendererFactory.createItemRenderer(dataGroup) as > > > ISelectableItemRenderer; > > > - labelField = dataProviderModel.labelField; > > > + // var presentationModel:IListPresentationModel = > > > _strand.getBeadByType(IListPresentationModel) as > IListPresentationModel; > > > + // var ir:ISelectableItemRenderer = > > > itemRendererFactory.createItemRenderer(dataGroup) as > > > ISelectableItemRenderer; > > > + // labelField = dataProviderModel.labelField; > > > > > > - fillRenderer(event.index, event.item, ir, > > > presentationModel); > > > + // fillRenderer(event.index, event.item, ir, > > > presentationModel); > > > > > > - // update the index values in the itemRenderers > > to > > > correspond to their shifted positions. > > > - var n:int = dataGroup.numElements; > > > - for (var i:int = event.index; i < n; i++) > > > - { > > > - ir = dataGroup.getElementAt(i) as > > > ISelectableItemRenderer; > > > - ir.index = i; > > > + // // update the index values in the itemRenderers > > to > > > correspond to their shifted positions. > > > + // var n:int = dataGroup.numElements; > > > + // for (var i:int = event.index; i < n; i++) > > > + // { > > > + // ir = dataGroup.getElementAt(i) as > > > ISelectableItemRenderer; > > > + // ir.index = i; > > > > > > - // could let the IR know its index has > > > been changed (eg, it might change its > > > - // UI based on the index). Instead > > (PAYG), > > > allow another bead to detect > > > - // this event and do this as not every > IR > > > will need to be updated. > > > - //var ubase:UIItemRendererBase = ir as > > > UIItemRendererBase; > > > - //if (ubase) ubase.updateRenderer() > > > - } > > > + // // could let the IR know its index has > > > been changed (eg, it might change its > > > + // // UI based on the index). Instead > > (PAYG), > > > allow another bead to detect > > > + // // this event and do this as not every > IR > > > will need to be updated. > > > + // //var ubase:UIItemRendererBase = ir as > > > UIItemRendererBase; > > > + // //if (ubase) ubase.updateRenderer() > > > + // } > > > > > > - (_strand as IEventDispatcher).dispatchEvent(new > > > Event("itemsCreated")); > > > - (_strand as IEventDispatcher).dispatchEvent(new > > > Event("layoutNeeded")); > > > - } > > > + // (_strand as IEventDispatcher).dispatchEvent(new > > > Event("itemsCreated")); > > > + // (_strand as IEventDispatcher).dispatchEvent(new > > > Event("layoutNeeded")); > > > + // } > > > > > > /** > > > * @private > > > @@ -231,52 +232,52 @@ package > org.apache.royale.jewel.beads.itemRenderers > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > * @royaleignorecoercion > > > org.apache.royale.events.IEventDispatcher > > > */ > > > - protected function > > > itemRemovedHandler(event:CollectionEvent):void > > > - { > > > - if (!dataProviderModel) > > > - return; > > > - var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > - if (!dp) > > > - return; > > > + // protected function > > > itemRemovedHandler(event:CollectionEvent):void > > > + // { > > > + // if (!dataProviderModel) > > > + // return; > > > + // var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > + // if (!dp) > > > + // return; > > > > > > - var ir:ISelectableItemRenderer = > > > dataGroup.getElementAt(event.index) as ISelectableItemRenderer; > > > - dataGroup.removeItemRenderer(ir); > > > + // var ir:ISelectableItemRenderer = > > > dataGroup.getElementAt(event.index) as ISelectableItemRenderer; > > > + // dataGroup.removeItemRenderer(ir); > > > > > > - // adjust the itemRenderers' index to adjust > for > > > the shift > > > - var n:int = dataGroup.numElements; > > > - for (var i:int = event.index; i < n; i++) > > > - { > > > - ir = dataGroup.getElementAt(i) as > > > ISelectableItemRenderer; > > > - ir.index = i; > > > + // // adjust the itemRenderers' index to adjust > for > > > the shift > > > + // var n:int = dataGroup.numElements; > > > + // for (var i:int = event.index; i < n; i++) > > > + // { > > > + // ir = dataGroup.getElementAt(i) as > > > ISelectableItemRenderer; > > > + // ir.index = i; > > > > > > - // could let the IR know its index has > > > been changed (eg, it might change its > > > - // UI based on the index). Instead > > (PAYG), > > > allow another bead to detect > > > - // this event and do this as not every > IR > > > will need to be updated. > > > - //var ubase:UIItemRendererBase = ir as > > > UIItemRendererBase; > > > - //if (ubase) ubase.updateRenderer() > > > - } > > > + // // could let the IR know its index has > > > been changed (eg, it might change its > > > + // // UI based on the index). Instead > > (PAYG), > > > allow another bead to detect > > > + // // this event and do this as not every > IR > > > will need to be updated. > > > + // //var ubase:UIItemRendererBase = ir as > > > UIItemRendererBase; > > > + // //if (ubase) ubase.updateRenderer() > > > + // } > > > > > > - (_strand as IEventDispatcher).dispatchEvent(new > > > Event("layoutNeeded")); > > > - } > > > + // (_strand as IEventDispatcher).dispatchEvent(new > > > Event("layoutNeeded")); > > > + // } > > > > > > /** > > > * @private > > > * @royaleignorecoercion > > > org.apache.royale.collections.ICollectionView > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > */ > > > - protected function > > > itemUpdatedHandler(event:CollectionEvent):void > > > - { > > > - if (!dataProviderModel) > > > - return; > > > - var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > - if (!dp) > > > - return; > > > + // protected function > > > itemUpdatedHandler(event:CollectionEvent):void > > > + // { > > > + // if (!dataProviderModel) > > > + // return; > > > + // var dp:ICollectionView = > > > dataProviderModel.dataProvider as ICollectionView; > > > + // if (!dp) > > > + // return; > > > > > > - // update the given renderer with (possibly) > new > > > information so it can change its > > > - // appearence or whatever. > > > - var ir:ISelectableItemRenderer = > > > dataGroup.getElementAt(event.index) as ISelectableItemRenderer; > > > - setData(ir, event.item, event.index); > > > - } > > > + // // update the given renderer with (possibly) > new > > > information so it can change its > > > + // // appearence or whatever. > > > + // var ir:ISelectableItemRenderer = > > > dataGroup.getElementAt(event.index) as ISelectableItemRenderer; > > > + // setData(ir, event.item, event.index); > > > + // } > > > > > > /** > > > * @private > > > diff --git > > > > > > a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/TableItemRendererFactoryForCollectionView.as > > > > > > b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/TableItemRendererFactoryForCollectionView.as > > > index da09088..e064583 100644 > > > --- > > > > > > a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/TableItemRendererFactoryForCollectionView.as > > > +++ > > > > > > b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/itemRenderers/TableItemRendererFactoryForCollectionView.as > > > @@ -176,11 +176,13 @@ package > org.apache.royale.jewel.beads.itemRenderers > > > if (!dp) > > > return; > > > > > > + // remove this and better add beads when needed > > > // listen for individual items being added in > the > > > future. > > > - var dped:IEventDispatcher = dp as > > IEventDispatcher; > > > - > dped.addEventListener(CollectionEvent.ITEM_ADDED, > > > itemAddedHandler); > > > - > > > dped.addEventListener(CollectionEvent.ITEM_REMOVED, > itemRemovedHandler); > > > - > > > dped.addEventListener(CollectionEvent.ITEM_UPDATED, > itemUpdatedHandler); > > > + // var dped:IEventDispatcher = dp as > > > IEventDispatcher; > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_ADDED, itemAddedHandler); > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_REMOVED, > itemRemovedHandler); > > > + // > > > dped.addEventListener(CollectionEvent.ITEM_UPDATED, > itemUpdatedHandler); > > > + > > > > > > // THEAD - remove header items > > > removeElements(view.thead); > > > @@ -207,6 +209,7 @@ package org.apache.royale.jewel.beads.itemRenderers > > > > > > if(column.itemRenderer != null) > > > { > > > + trace("create ir: " + > > > column.itemRenderer); > > > ir = column.itemRenderer.newInstance() as > > > ITextItemRenderer; > > > } else > > > { > > > @@ -324,9 +327,9 @@ package org.apache.royale.jewel.beads.itemRenderers > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > * @royaleignorecoercion > > > org.apache.royale.events.IEventDispatcher > > > */ > > > - protected function > > > itemAddedHandler(event:CollectionEvent):void > > > - { > > > - } > > > + // protected function > > > itemAddedHandler(event:CollectionEvent):void > > > + // { > > > + // } > > > > > > /** > > > * @private > > > @@ -335,17 +338,17 @@ package > org.apache.royale.jewel.beads.itemRenderers > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > * @royaleignorecoercion > > > org.apache.royale.events.IEventDispatcher > > > */ > > > - protected function > > > itemRemovedHandler(event:CollectionEvent):void > > > - { > > > - } > > > + // protected function > > > itemRemovedHandler(event:CollectionEvent):void > > > + // { > > > + // } > > > > > > /** > > > * @private > > > * @royaleignorecoercion > > > org.apache.royale.collections.ICollectionView > > > * @royaleignorecoercion > > > org.apache.royale.core.ISelectableItemRenderer > > > */ > > > - protected function > > > itemUpdatedHandler(event:CollectionEvent):void > > > - { > > > - } > > > + // protected function > > > itemUpdatedHandler(event:CollectionEvent):void > > > + // { > > > + // } > > > } > > > } > > > \ No newline at end of file > > > > > > > > > > -- > > Carlos Rovira > > http://about.me/carlosrovira > > > > > > > > > -- Piotr Zarzycki Patreon: *https://www.patreon.com/piotrzarzycki <https://www.patreon.com/piotrzarzycki>*
