Re: git commit: [flex-asjs] [refs/heads/feature/chart-work] - Updates to MDL.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: git commit: [flex-asjs] [refs/heads/feature/chart-work] - Updates to MDL.

piotrz
Hi Peter,

I'm concerning about changes in DataProviderChangeNotifier.

Since it is no longer emits dataProviderChanged event it can break logic in
some apps which people are working on.

Some time ago when I've changed ArrayList and add itemAdded/removed etc.
events I've created separate bead [1] which handle those cases.

If those changes stay I will remove my bead, but with this changes we will
lost ability to refresh whole collections by users who using this bead and
waiting for dataProviderChanged.

[1]
https://github.com/apache/flex-asjs/blob/develop/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderAddRemoveNotifier.as

Piotr

On Fri, Apr 7, 2017, 23:23 <[hidden email]> wrote:

> Repository: flex-asjs
> Updated Branches:
>   refs/heads/feature/chart-work 02d4118f0 -> 448e9f8e3
>
>
> Updates to MDL.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/flex-asjs/repo
> Commit: http://git-wip-us.apache.org/repos/asf/flex-asjs/commit/448e9f8e
> Tree: http://git-wip-us.apache.org/repos/asf/flex-asjs/tree/448e9f8e
> Diff: http://git-wip-us.apache.org/repos/asf/flex-asjs/diff/448e9f8e
>
> Branch: refs/heads/feature/chart-work
> Commit: 448e9f8e37c41bf296ea44b33a38adf5bdf10f00
> Parents: 02d4118
> Author: Peter Ent <[hidden email]>
> Authored: Fri Apr 7 17:23:26 2017 -0400
> Committer: Peter Ent <[hidden email]>
> Committed: Fri Apr 7 17:23:26 2017 -0400
>
> ----------------------------------------------------------------------
>  .../html/beads/DataProviderChangeNotifier.as    | 61 +++++++++++++++++---
>  .../TabsItemRendererFactoryForArrayListData.as  |  3 +-
>  .../org/apache/flex/mdl/beads/views/TabsView.as |  2 +-
>  .../src/main/resources/defaults.css             |  4 +-
>  4 files changed, 59 insertions(+), 11 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/448e9f8e/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
> ----------------------------------------------------------------------
> diff --git
> a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
> index a24810b..2d647c5 100644
> ---
> a/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
> +++
> b/frameworks/projects/HTML/src/main/flex/org/apache/flex/html/beads/DataProviderChangeNotifier.as
> @@ -26,16 +26,48 @@ package org.apache.flex.html.beads
>         import org.apache.flex.core.UIBase;
>         import org.apache.flex.events.IEventDispatcher;
>         import org.apache.flex.events.Event;
> +       import org.apache.flex.events.CollectionEvent;
>         import org.apache.flex.collections.ArrayList;
>
>         /**
> +        * Dispatched when a new item has been added to the dataProvider
> being watched.
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.8
> +        */
> +       [Event(name="itemAdded",
> type="org.apache.flex.events.CollectionEvent")]
> +
> +       /**
> +        * Dispatched when an item has been removed from the dataProvider
> being watched.
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.8
> +        */
> +       [Event(name="itemRemved",
> type="org.apache.flex.events.CollectionEvent")]
> +
> +       /**
> +        * Dispatched when an item has updated in the dataProvider being
> watched.
> +        *
> +        *  @langversion 3.0
> +        *  @playerversion Flash 10.2
> +        *  @playerversion AIR 2.6
> +        *  @productversion FlexJS 0.8
> +        */
> +       [Event(name="itemUpdated",
> type="org.apache.flex.events.CollectionEvent")]
> +
> +       /**
>          *  The DataProviderChangeNotifier notifies listeners when a
> selection model's
> -        *  ArrayList dataProvider has changed.
> +        *  ArrayList dataProvider has changed. It does this by forwarding
> events on
> +        *  the dataProvider to the model associated with the strand.
>          *
>          *  @langversion 3.0
>          *  @playerversion Flash 10.2
>          *  @playerversion AIR 2.6
> -        *  @productversion FlexJS 0.0
> +        *  @productversion FlexJS 0.8
>          */
>         public class DataProviderChangeNotifier implements IBead, IDocument
>         {
> @@ -45,12 +77,15 @@ package org.apache.flex.html.beads
>                  *  @langversion 3.0
>                  *  @playerversion Flash 10.2
>                  *  @playerversion AIR 2.6
> -                *  @productversion FlexJS 0.0
> +                *  @productversion FlexJS 0.8
>                  */
>                 public function DataProviderChangeNotifier()
>                 {
>                 }
>
> +               /**
> +                * @private
> +                */
>                 protected var _dataProvider:ArrayList;
>
>                 private var _strand:IStrand;
> @@ -61,7 +96,7 @@ package org.apache.flex.html.beads
>                  *  @langversion 3.0
>                  *  @playerversion Flash 10.2
>                  *  @playerversion AIR 2.6
> -                *  @productversion FlexJS 0.0
> +                *  @productversion FlexJS 0.8
>                  */
>                 public function set strand(value:IStrand):void
>                 {
> @@ -76,6 +111,9 @@ package org.apache.flex.html.beads
>                         }
>                 }
>
> +               /**
> +                * @private
> +                */
>                 private function
> destinationChangedHandler(event:Event):void
>                 {
>                         if (_dataProvider == null) {
> @@ -169,8 +207,11 @@ package org.apache.flex.html.beads
>                  */
>                 private function handleItemAdded(event:Event):void
>                 {
> +                       var e:CollectionEvent = event as CollectionEvent;
>                         var selectionModel:ISelectionModel =
> _strand.getBeadByType(ISelectionModel) as ISelectionModel;
> -                       selectionModel.dispatchEvent(new
> Event("dataProviderChanged"));
> +
> +                       var newEvent:Event = e.cloneEvent() as Event;
> +                       selectionModel.dispatchEvent(newEvent);
>                 }
>
>                 /**
> @@ -178,8 +219,11 @@ package org.apache.flex.html.beads
>                  */
>                 private function handleItemRemoved(event:Event):void
>                 {
> +                       var e:CollectionEvent = event as CollectionEvent;
>                         var selectionModel:ISelectionModel =
> _strand.getBeadByType(ISelectionModel) as ISelectionModel;
> -                       selectionModel.dispatchEvent(new
> Event("dataProviderChanged"));
> +
> +                       var newEvent:Event = e.cloneEvent() as Event;
> +                       selectionModel.dispatchEvent(newEvent);
>                 }
>
>                 /**
> @@ -187,8 +231,11 @@ package org.apache.flex.html.beads
>                  */
>                 private function handleItemUpdated(event:Event):void
>                 {
> +                       var e:CollectionEvent = event as CollectionEvent;
>                         var selectionModel:ISelectionModel =
> _strand.getBeadByType(ISelectionModel) as ISelectionModel;
> -                       selectionModel.dispatchEvent(new
> Event("dataProviderChanged"));
> +
> +                       var newEvent:Event = e.cloneEvent() as Event;
> +                       selectionModel.dispatchEvent(newEvent);
>                 }
>         }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/448e9f8e/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
> ----------------------------------------------------------------------
> diff --git
> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
> index c0650b8..defa8e8 100644
> ---
> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
> +++
> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/TabsItemRendererFactoryForArrayListData.as
> @@ -208,7 +208,8 @@ package org.apache.flex.mdl.beads
>              newEvent.itemRenderer = ir;
>              dispatchEvent(newEvent);
>
> -            IEventDispatcher(_strand).dispatchEvent(new
> Event("itemsCreated"));
> +            //??IEventDispatcher(_strand).dispatchEvent(new
> Event("itemsCreated"));
> +                       IEventDispatcher(_strand).dispatchEvent(new
> Event("itemAdded"));
>          }
>      }
>  }
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/448e9f8e/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
> ----------------------------------------------------------------------
> diff --git
> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
> index 112ff7a..3516123 100644
> ---
> a/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
> +++
> b/frameworks/projects/MaterialDesignLite/src/main/flex/org/apache/flex/mdl/beads/views/TabsView.as
> @@ -98,7 +98,7 @@ package org.apache.flex.mdl.beads.views
>              if (!isTabsDynamic())
>              {
>                  _tabBar.addEventListener("itemsCreated",
> tabBarItemsCreatedHandler);
> -                _tabBar.addBead(new
> TabsItemRendererFactoryForArrayListData());
> +                               _tabBar.addEventListener("itemAdded",
> tabBarItemsCreatedHandler);
>              }
>          }
>
>
>
> http://git-wip-us.apache.org/repos/asf/flex-asjs/blob/448e9f8e/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
> ----------------------------------------------------------------------
> diff --git
> a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
> b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
> index eff039f..2c3709e 100644
> ---
> a/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
> +++
> b/frameworks/projects/MaterialDesignLite/src/main/resources/defaults.css
> @@ -115,7 +115,7 @@ Tabs
>      IBeadView: ClassReference("org.apache.flex.mdl.beads.views.TabsView");
>      IBeadModel:
> ClassReference("org.apache.flex.mdl.beads.models.TabArrayModel");
>      IBeadLayout: ClassReference(null);
> -    IDataProviderItemRendererMapper:
> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData");
> +    IDataProviderItemRendererMapper:
> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayListData");
>      IItemRendererClassFactory:
> ClassReference("org.apache.flex.core.ItemRendererClassFactory");
>      IItemRenderer:
> ClassReference("org.apache.flex.mdl.itemRenderers.TabBarPanelItemRenderer");
>  }
> @@ -125,7 +125,7 @@ TabBar
>      IBeadView:
> ClassReference("org.apache.flex.mdl.beads.views.TabBarView");
>      IBeadModel:
> ClassReference("org.apache.flex.mdl.beads.models.TabArrayModel");
>      IBeadLayout: ClassReference(null);
> -    IDataProviderItemRendererMapper:
> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayData");
> +    IDataProviderItemRendererMapper:
> ClassReference("org.apache.flex.mdl.beads.TabsItemRendererFactoryForArrayListData");
>      IItemRendererClassFactory:
> ClassReference("org.apache.flex.core.ItemRendererClassFactory");
>      IItemRenderer:
> ClassReference("org.apache.flex.mdl.itemRenderers.TabBarButtonTabsItemRenderer");
>  }
>
>
Apache Flex PMC
piotrzarzycki21@gmail.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: git commit: [flex-asjs] [refs/heads/feature/chart-work] - Updates to MDL.

piotrz
Additionally I was going on Sunday change this area a bit.

DataProviderChangeNotifier - was suppose to stay without changes

DataProviderAddRemoveNotifier - I was going to add there updateEvent and change its name to DataProviderItemsChangedNotifier

Create another bead DataProviderCollectionChangedNotifier which will react only on collectionChanged event from ArrayList.

But you were fast with your changes. Let me know what do you think. :)

Piotr
Apache Flex PMC
piotrzarzycki21@gmail.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: git commit: [flex-asjs] [refs/heads/feature/chart-work] - Updates to MDL.

piotrz
Peter,

I just tested your changes. They are breaking the cases where I would like to change whole data provider once everything is renderer. I'm going to get back to the previous version and implement beads as I wrote above, late I will deeply look into the Tabs problems.

Thanks,
Piotr
Apache Flex PMC
piotrzarzycki21@gmail.com
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: git commit: [flex-asjs] [refs/heads/feature/chart-work] - Updates to MDL.

Peter Ent
I don't need to have DataProviderChangeNotifier do what I made it do. I
was thinking that using the same event was causing the problem in the MDL
tabs because that event causes all of the item renderers to be thrown
away.

‹peter

On 4/9/17, 9:47 AM, "piotrz" <[hidden email]> wrote:

>Peter,
>
>I just tested your changes. They are breaking the cases where I would like
>to change whole data provider once everything is renderer. I'm going to
>get
>back to the previous version and implement beads as I wrote above, late I
>will deeply look into the Tabs problems.
>
>Thanks,
>Piotr
>
>
>
>-----
>Apache Flex PMC
>[hidden email]
>--
>View this message in context:
>https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fapache-fle
>x-development.2333347.n4.nabble.com%2FRe-git-commit-flex-asjs-refs-heads-f
>eature-chart-work-Updates-to-MDL-tp61043p61062.html&data=02%7C01%7C%7C67f6
>2c2e6d78473cc45c08d47f50565e%7Cfa7b1b5a7b34438794aed2c178decee1%7C0%7C0%7C
>636273430404170114&sdata=4eDrhNX%2BaPt0UDNbmmEybSlhOWqTLvOJKQeMZrERQhk%3D&
>reserved=0
>Sent from the Apache Flex Development mailing list archive at Nabble.com.

Loading...