You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flex.apache.org by Oleg Konovalov <ol...@gmail.com> on 2013/10/30 02:09:11 UTC

Getting SuperTabNavigator child

Hi,

I have several components (Box with DataGrids) added as children to
SuperTabNavigator.
Need to get a handle to such child component to refresh its DataGrid's data
(or possibly to close it and open another one like that with new data).

So how can I get a handle to the child of SuperTabNavigator?

-- 
Thank you in advance,
Oleg.

RE: Getting SuperTabNavigator child

Posted by Maurice Amsellem <ma...@systar.com>.
>You won't get an answer from the flexlib issues list or mailing list.

You are correct.  

I quickly checked that the last reported issue was on Jan. 2013 and mistakenly assumed the project was still active, but didn't notice that the last *accepted* issue was back on Mar. 2010.

Yet another "ghost" flex site :-(

Sorry for the confusion.

Regards,

Maurice 

-----Message d'origine-----
De : Doug McCune [mailto:doug@dougmccune.com] 
Envoyé : mercredi 30 octobre 2013 17:52
À : dev@flex.apache.org
Cc : flex-dev@incubator.apache.org
Objet : Re: Getting SuperTabNavigator child

You won't get an answer from the flexlib issues list or mailing list.
SuperTabNavigator is just an extended TabNavigator. There's nothing different about accessing its children rather than the children of a normal mx TabNavigator.


On Wed, Oct 30, 2013 at 1:33 AM, Maurice Amsellem < maurice.amsellem@systar.com> wrote:

> Hi Oleg,
>
> SuperTabNavigator is not part of core Flex SDK, but rather is part of 
> flexlib library.
>
> You can get more easily an answer if you post directly to flexlib issues:
>
> https://code.google.com/p/flexlib/issues/list
>
>  Maurice
>
> -----Message d'origine-----
> De : Oleg Konovalov [mailto:olegkon@gmail.com] Envoyé : mercredi 30 
> octobre 2013 02:09 À : flex-dev@incubator.apache.org Objet : Getting 
> SuperTabNavigator child
>
> Hi,
>
> I have several components (Box with DataGrids) added as children to 
> SuperTabNavigator.
> Need to get a handle to such child component to refresh its DataGrid's 
> data (or possibly to close it and open another one like that with new data).
>
> So how can I get a handle to the child of SuperTabNavigator?
>
> --
> Thank you in advance,
> Oleg.
>

Re: Getting SuperTabNavigator child

Posted by Doug McCune <do...@dougmccune.com>.
You won't get an answer from the flexlib issues list or mailing list.
SuperTabNavigator is just an extended TabNavigator. There's nothing
different about accessing its children rather than the children of a normal
mx TabNavigator.


On Wed, Oct 30, 2013 at 1:33 AM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> Hi Oleg,
>
> SuperTabNavigator is not part of core Flex SDK, but rather is part of
> flexlib library.
>
> You can get more easily an answer if you post directly to flexlib issues:
>
> https://code.google.com/p/flexlib/issues/list
>
>  Maurice
>
> -----Message d'origine-----
> De : Oleg Konovalov [mailto:olegkon@gmail.com]
> Envoyé : mercredi 30 octobre 2013 02:09
> À : flex-dev@incubator.apache.org
> Objet : Getting SuperTabNavigator child
>
> Hi,
>
> I have several components (Box with DataGrids) added as children to
> SuperTabNavigator.
> Need to get a handle to such child component to refresh its DataGrid's
> data (or possibly to close it and open another one like that with new data).
>
> So how can I get a handle to the child of SuperTabNavigator?
>
> --
> Thank you in advance,
> Oleg.
>

RE: Getting SuperTabNavigator child

Posted by Maurice Amsellem <ma...@systar.com>.
Hi Oleg,

SuperTabNavigator is not part of core Flex SDK, but rather is part of flexlib library.

You can get more easily an answer if you post directly to flexlib issues:

https://code.google.com/p/flexlib/issues/list

 Maurice 

-----Message d'origine-----
De : Oleg Konovalov [mailto:olegkon@gmail.com] 
Envoyé : mercredi 30 octobre 2013 02:09
À : flex-dev@incubator.apache.org
Objet : Getting SuperTabNavigator child

Hi,

I have several components (Box with DataGrids) added as children to SuperTabNavigator.
Need to get a handle to such child component to refresh its DataGrid's data (or possibly to close it and open another one like that with new data).

So how can I get a handle to the child of SuperTabNavigator?

--
Thank you in advance,
Oleg.

RE: Getting SuperTabNavigator child

Posted by David Coleman <da...@hotmail.com>.
Instead of directly accessing the children, which could lead to complex code which would be prone to failure and difficult to modify, try using a Facade object, implemented as either a singleton or using injection (if you happen to be using a framework which supports it).  I recommend a singleton facade for this purpose, since it is more decoupled.  you can reference it as a simple IEventDispatcher, eliminating the need to bind your child components to a specific class definition.

listen for an event such as UPDATE_SUPER_TAB_CHILD_DATA:String = "updateSuperTabChildData";

define the event to have "tabChildId:String" property in the constructor.  then you match the event.id against this.id and you determine if you need to act on the event and listen for it in all children.

If there are too many children for this quick/dirty approach to be effective you can use a more complex subscriber pattern, and use a singleton bus and have the child "register" itself as a subscriber, providing a unique id (or recycling subscriberObject.id - which would be the exact component you are trying to locate below).  then you can have a method in the bus class with the prototype:
    public function updateChildData(childID:String):void {
        for each(var child:IVisualElement in subscribers) {
            if(child.id == childID) {
                child.dispatchEvent(new Event("updateYourData"));
                break;
            }
        }
    }

There are lots of ways to do it, but navigating from the top down to a specific child is not recommended since the children may or may not be fully constructed.  I recommend that to ensure full subscription that you either use an ActionScript class and instantiate and add them during the existing flex lifecycle of the parent object, or if you must use an mxml for some reason, expose an "initDataHandlers" public method and still create them in actionscript and initDataHandlers on the child object and then add them as children of the super grid.

I'm sure that one of or a combination of these recommendations will get you right where you want to be.

Good luck.
David

> Date: Tue, 29 Oct 2013 21:09:11 -0400
> Subject: Getting SuperTabNavigator child
> From: olegkon@gmail.com
> To: flex-dev@incubator.apache.org
> 
> Hi,
> 
> I have several components (Box with DataGrids) added as children to
> SuperTabNavigator.
> Need to get a handle to such child component to refresh its DataGrid's data
> (or possibly to close it and open another one like that with new data).
> 
> So how can I get a handle to the child of SuperTabNavigator?
> 
> -- 
> Thank you in advance,
> Oleg.