You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@royale.apache.org by Harbs <ha...@gmail.com> on 2017/11/27 11:40:14 UTC

Re: [royale-asjs] branch develop updated: Fixed event dispatching on tba view change

I’m not sure that viewChanged is the best event to be dispatching here.

It turns out that viewChanged is dispatched in two unrelated cases:
1. When the IViewManagerView is assigned to the ViewManagerBase.
2. When the current view is set by the IViewManagerView.

The way it is, it’s currently difficult to differentiate between the two cases.

It feels like the correct event to be dispatching for case 2 is “currentViewChanged” or “activeViewChanged” or “selectedViewChanged”.

Thoughts?

Harbs

> On Nov 27, 2017, at 1:17 PM, harbs@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> harbs 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 6711a8d  Fixed event dispatching on tba view change
> 6711a8d is described below
> 
> commit 6711a8d137ecca2d4dfaa48f1c0689282157df47
> Author: Harbs <ha...@in-tools.com>
> AuthorDate: Mon Nov 27 13:17:42 2017 +0200
> 
>    Fixed event dispatching on tba view change
> 
>    Removed an extra layoutNeeded
>    Dispatch viewChanged
> ---
> .../org/apache/royale/mobile/beads/TabbedViewManagerView.as      | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/beads/TabbedViewManagerView.as b/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/beads/TabbedViewManagerView.as
> index 64c7b80..bef33ee 100644
> --- a/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/beads/TabbedViewManagerView.as
> +++ b/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/beads/TabbedViewManagerView.as
> @@ -104,6 +104,11 @@ package org.apache.royale.mobile.beads
> 		
> 		private var _currentView:IViewManagerView;
> 		
> +		/**
> +		 * @royaleignorecoercion org.apache.royale.core.UIBase
> +		 * @royaleignorecoercion org.apache.royale.mobile.IViewManagerView
> +		 * @royaleignorecoercion org.apache.royale.mobile.IViewManager
> +		 */
> 		protected function showViewByIndex(index:int):void
> 		{
> 			var model:ViewManagerModel = _strand.getBeadByType(IBeadModel) as ViewManagerModel;
> @@ -117,9 +122,8 @@ package org.apache.royale.mobile.beads
> 			
> 			COMPILE::JS {
> 				if (_currentView) {
> -					UIBase(_currentView).element.style["flex-grow"] = "1";
> +					(_currentView as UIBase).element.style["flex-grow"] = "1";
> 				}
> -				getHost().dispatchEvent(new Event("layoutNeeded"));
> 			}
> 			COMPILE::SWF {
> 				if (UIBase(_currentView).style == null) {
> @@ -131,6 +135,7 @@ package org.apache.royale.mobile.beads
> 			
> 			// Now that the view has changed, refresh the layout on this component.
> 			getHost().dispatchEvent(new Event("layoutNeeded"));
> +			getHost().dispatchEvent(new Event("viewChanged"));
> 		}
> 		protected function insertCurrentView(view:IViewManagerView):void{
> 			getHost().addElementAt(view,(navigationBar ? 1 : 0));
> 
> -- 
> To stop receiving notification emails like this one, please contact
> ['"commits@royale.apache.org" <co...@royale.apache.org>'].


RE: [royale-asjs] branch develop updated: Fixed event dispatching on tba view change

Posted by Idylog - Nicolas Granon <ng...@idylog.com>.
Hi Harbs,

You are right : it is really two different cases.

Why not "viewAdded" (when view is assigned to view manager) and "viewChanged" (or selectedViewChanged) ?

(and maybe "viewRemoved" ?)

If a view is added *and* triggers a "active" view change, both events should fire.

Hope this helps

Nicolas Granon



> -----Message d'origine-----
> De : Harbs [mailto:harbs.lists@gmail.com]
> Envoyé : lundi 27 novembre 2017 12:40
> À : dev@royale.apache.org
> Objet : Re: [royale-asjs] branch develop updated: Fixed event
> dispatching on tba view change
> 
> I’m not sure that viewChanged is the best event to be dispatching here.
> 
> It turns out that viewChanged is dispatched in two unrelated cases:
> 1. When the IViewManagerView is assigned to the ViewManagerBase.
> 2. When the current view is set by the IViewManagerView.
> 
> The way it is, it’s currently difficult to differentiate between the
> two cases.
> 
> It feels like the correct event to be dispatching for case 2 is
> “currentViewChanged” or “activeViewChanged” or “selectedViewChanged”.
> 
> Thoughts?
> 
> Harbs
> 
> > On Nov 27, 2017, at 1:17 PM, harbs@apache.org wrote:
> >
> > This is an automated email from the ASF dual-hosted git repository.
> >
> > harbs 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 6711a8d  Fixed event dispatching on tba view change 6711a8d
> is
> > described below
> >
> > commit 6711a8d137ecca2d4dfaa48f1c0689282157df47
> > Author: Harbs <ha...@in-tools.com>
> > AuthorDate: Mon Nov 27 13:17:42 2017 +0200
> >
> >    Fixed event dispatching on tba view change
> >
> >    Removed an extra layoutNeeded
> >    Dispatch viewChanged
> > ---
> > .../org/apache/royale/mobile/beads/TabbedViewManagerView.as      | 9
> +++++++--
> > 1 file changed, 7 insertions(+), 2 deletions(-)
> >
> > diff --git
> >
> a/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/
> > beads/TabbedViewManagerView.as
> >
> b/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/
> > beads/TabbedViewManagerView.as
> > index 64c7b80..bef33ee 100644
> > ---
> >
> a/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mobile/
> > beads/TabbedViewManagerView.as
> > +++
> b/frameworks/projects/Mobile/src/main/royale/org/apache/royale/mob
> > +++ ile/beads/TabbedViewManagerView.as
> > @@ -104,6 +104,11 @@ package org.apache.royale.mobile.beads
> >
> > 		private var _currentView:IViewManagerView;
> >
> > +		/**
> > +		 * @royaleignorecoercion org.apache.royale.core.UIBase
> > +		 * @royaleignorecoercion
> org.apache.royale.mobile.IViewManagerView
> > +		 * @royaleignorecoercion
> org.apache.royale.mobile.IViewManager
> > +		 */
> > 		protected function showViewByIndex(index:int):void
> > 		{
> > 			var model:ViewManagerModel =
> _strand.getBeadByType(IBeadModel) as
> > ViewManagerModel; @@ -117,9 +122,8 @@ package
> > org.apache.royale.mobile.beads
> >
> > 			COMPILE::JS {
> > 				if (_currentView) {
> > -					UIBase(_currentView).element.style["flex-
> grow"] = "1";
> > +					(_currentView as
> UIBase).element.style["flex-grow"] = "1";
> > 				}
> > -				getHost().dispatchEvent(new
> Event("layoutNeeded"));
> > 			}
> > 			COMPILE::SWF {
> > 				if (UIBase(_currentView).style == null) { @@ -
> 131,6 +135,7 @@
> > package org.apache.royale.mobile.beads
> >
> > 			// Now that the view has changed, refresh the layout
> on this component.
> > 			getHost().dispatchEvent(new Event("layoutNeeded"));
> > +			getHost().dispatchEvent(new Event("viewChanged"));
> > 		}
> > 		protected function
> insertCurrentView(view:IViewManagerView):void{
> > 			getHost().addElementAt(view,(navigationBar ? 1 : 0));
> >
> > --
> > To stop receiving notification emails like this one, please contact
> > ['"commits@royale.apache.org" <co...@royale.apache.org>'].