You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Maurice Amsellem <ma...@systar.com> on 2013/09/03 00:40:19 UTC

question on modules

Hello,

Does someone know how to get the module instance (ie subclass of spark Module) where a given UI component is defined, in a multi-module application.

Walking up the parent tree does not work if the UI component belongs to a popup.

I also tried using  UIComponent.moduleFactory, and the info() properties  ( currentDomain, mainClassName, etc.) , but without success.

Thanks for your help.

Maurice


Re: question on modules

Posted by xiaoyuandlg <xi...@hotmail.com>.
I've had the same question and didn't make it fixed even after I read through
a  C# UI component tutorial
<http://www.kettic.com/winforms_ui/controls_and_tutorials.shtml>  .



--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/question-on-modules-tp2468p4632.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.

RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
 I am using ModuleLoader, and child has a reference to the module UI root instance (as mentioned in one of numerous emails in this thread).

After reading all your answers and stepping through Parsley and PopupManager again and again with the debugger, 
I realized there was no reason to pass the Module root view as the "parent" when calling PopupManager.addPopup.
So I reverted to the original Parsley Popup tag implementation, which just returns FlexGlobals.topLevelApplication as the default parent.
And it's working just fine, even in  modules!
So I don't need anymore to retrieve the module root UI.

Mea culpa.

Thanks again folks!

Maurice  

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : mardi 3 septembre 2013 08:57
À : users@flex.apache.org
Objet : Re: question on modules



On 9/2/13 11:53 PM, "Maurice Amsellem" <ma...@systar.com> wrote:

>Thanks Alex, these information are enlightening.
>Actually,  I meant having access to the module root UI instance (the 
>subclass of s:Module).
If you used ModuleLoader then the child is that thing.  But if you used ModuleManager, you can create multiple instances of that thing, and that's why the framework doesn't have a back-reference to "the" module root UI instance since there can be more than one.

-Alex

>
>Maurice
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com] Envoyé : mardi 3 septembre 
>2013 05:53 À : users@flex.apache.org Objet : Re: question on modules
>
>This is a common misconception:  modules do not have a "module instance".
>All you are doing is loading a factory from which you can make any 
>number of instances of the classes in the module via the factory.create() method.
> That's why there is no mapping back to a single instance, just the 
>factory.
>
>A popup would not be parented by any module instances since they are 
>hung off of the top-level app's systemManager.  You'll have to build 
>your own map.
>
>-Alex
>
>On 9/2/13 5:24 PM, "Maurice Amsellem" <ma...@systar.com> wrote:
>
>>Actually, from SamplePopup.mxml,
>>parentApplication.sampleModuleLoader.child points to the module...
>>
>>So if I KNOW that the component is in module X , this is how to get it.
>>
>>The problem is that I need a generic mechanism, that would allow me to 
>>get the module instance of any ui component, even if there are several 
>>modules, or even if it belongs to  the top level application.
>>
>>FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 
>>Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and 
>>subclasses), that does not seem to be module aware.
>>Actually,  PopupBase.getParent() always returns 
>>FlexGlobal.topLevelApplication even if the Popup tag belongs to a 
>>module, instead of the module instance.
>>The effect of this is that the context is not computed correctly ( 
>>returns the topLevel application context, instead of the module child 
>>context), Which in turn prevent  FastInject from working inside Popups 
>>that are declared in modules.
>>
>>Regards,
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>>Envoyé : mardi 3 septembre 2013 01:56
>>À : users@flex.apache.org
>>Objet : RE: question on modules
>>
>>I am new to modules, so not sure to understand what you wrote.
>>
>>This is how I am using the module:
>>
>>In main app:
>><s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>
>>
>>The module itself is declared as follows:
>>
>>SampleModule.mxml
>><s:Module>
>> ...
>></s:Module>
>>
>>Then I have somewhere else a popup defined in the module 
>>SamplePopup.mxml <s:TitleWindow ...>
>>   <s:TextInput id="ti" />
>></s:TitleWindow>
>>
>>So what is moduleComponentId in this case ?
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
>>Envoyé : mardi 3 septembre 2013 01:21
>>À : Users@flex
>>Objet : Re: question on modules
>>
>>Would something like either of the following have any effect on the 
>>your pathing for test purposes?
>>
>>(parentApplication.moduleComponentId as 
>>Modulename).ventana.variableName.text = "test";
>>
>>or
>>
>>(parentApplication.moduleComponentId as 
>>Object).ventana.variableName.text = "test";
>>
>>
>>-Mark
>>
>>On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < 
>>mastudillo@austrosoft.com.ec> wrote:
>>
>>> Hi,
>>> When you try to access to a popup trougth a module first you create 
>>>a variable like TitleWindow and second assign the call at this, for
>>>example:
>>>
>>> public var ventana:TitleWindow = new TitleWindow(); function 
>>> Sample() {
>>>                ventana =
>>> PopUpManager.createPopUp(this,**titleWindowSample,true)
>>> as TitleWindow;
>>>                 PopUpManager.centerPopUp(**ventana);
>>> }
>>>
>>> parentApplication.**moduleComponentId.ventana.**variableName.text = 
>>> "";
>>>
>>>
>


Re: question on modules

Posted by Alex Harui <ah...@adobe.com>.

On 9/2/13 11:53 PM, "Maurice Amsellem" <ma...@systar.com> wrote:

>Thanks Alex, these information are enlightening.
>Actually,  I meant having access to the module root UI instance (the
>subclass of s:Module).
If you used ModuleLoader then the child is that thing.  But if you used
ModuleManager, you can create multiple instances of that thing, and that's
why the framework doesn't have a back-reference to "the" module root UI
instance since there can be more than one.

-Alex

>
>Maurice 
>
>-----Message d'origine-----
>De : Alex Harui [mailto:aharui@adobe.com]
>Envoyé : mardi 3 septembre 2013 05:53
>À : users@flex.apache.org
>Objet : Re: question on modules
>
>This is a common misconception:  modules do not have a "module instance".
>All you are doing is loading a factory from which you can make any number
>of instances of the classes in the module via the factory.create() method.
> That's why there is no mapping back to a single instance, just the
>factory.
>
>A popup would not be parented by any module instances since they are hung
>off of the top-level app's systemManager.  You'll have to build your own
>map.
>
>-Alex
>
>On 9/2/13 5:24 PM, "Maurice Amsellem" <ma...@systar.com> wrote:
>
>>Actually, from SamplePopup.mxml,
>>parentApplication.sampleModuleLoader.child points to the module...
>>
>>So if I KNOW that the component is in module X , this is how to get it.
>>
>>The problem is that I need a generic mechanism, that would allow me to
>>get the module instance of any ui component, even if there are several
>>modules, or even if it belongs to  the top level application.
>>
>>FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4
>>Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and
>>subclasses), that does not seem to be module aware.
>>Actually,  PopupBase.getParent() always returns
>>FlexGlobal.topLevelApplication even if the Popup tag belongs to a
>>module, instead of the module instance.
>>The effect of this is that the context is not computed correctly (
>>returns the topLevel application context, instead of the module child
>>context), Which in turn prevent  FastInject from working inside Popups
>>that are declared in modules.
>>
>>Regards,
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>>Envoyé : mardi 3 septembre 2013 01:56
>>À : users@flex.apache.org
>>Objet : RE: question on modules
>>
>>I am new to modules, so not sure to understand what you wrote.
>>
>>This is how I am using the module:
>>
>>In main app:
>><s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>
>>
>>The module itself is declared as follows:
>>
>>SampleModule.mxml
>><s:Module>
>> ...
>></s:Module>
>>
>>Then I have somewhere else a popup defined in the module
>>SamplePopup.mxml <s:TitleWindow ...>
>>   <s:TextInput id="ti" />
>></s:TitleWindow>
>>
>>So what is moduleComponentId in this case ?
>>
>>Maurice
>>
>>-----Message d'origine-----
>>De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
>>Envoyé : mardi 3 septembre 2013 01:21
>>À : Users@flex
>>Objet : Re: question on modules
>>
>>Would something like either of the following have any effect on the
>>your pathing for test purposes?
>>
>>(parentApplication.moduleComponentId as
>>Modulename).ventana.variableName.text = "test";
>>
>>or
>>
>>(parentApplication.moduleComponentId as
>>Object).ventana.variableName.text = "test";
>>
>>
>>-Mark
>>
>>On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
>>mastudillo@austrosoft.com.ec> wrote:
>>
>>> Hi,
>>> When you try to access to a popup trougth a module first you create a
>>>variable like TitleWindow and second assign the call at this, for
>>>example:
>>>
>>> public var ventana:TitleWindow = new TitleWindow(); function Sample()
>>> {
>>>                ventana =
>>> PopUpManager.createPopUp(this,**titleWindowSample,true)
>>> as TitleWindow;
>>>                 PopUpManager.centerPopUp(**ventana);
>>> }
>>>
>>> parentApplication.**moduleComponentId.ventana.**variableName.text =
>>> "";
>>>
>>>
>


RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
Thanks Alex, these information are enlightening.
Actually,  I meant having access to the module root UI instance (the subclass of s:Module).

Maurice 

-----Message d'origine-----
De : Alex Harui [mailto:aharui@adobe.com] 
Envoyé : mardi 3 septembre 2013 05:53
À : users@flex.apache.org
Objet : Re: question on modules

This is a common misconception:  modules do not have a "module instance".
All you are doing is loading a factory from which you can make any number of instances of the classes in the module via the factory.create() method.
 That's why there is no mapping back to a single instance, just the factory.

A popup would not be parented by any module instances since they are hung off of the top-level app's systemManager.  You'll have to build your own map.

-Alex

On 9/2/13 5:24 PM, "Maurice Amsellem" <ma...@systar.com> wrote:

>Actually, from SamplePopup.mxml,
>parentApplication.sampleModuleLoader.child points to the module...
>
>So if I KNOW that the component is in module X , this is how to get it.
>
>The problem is that I need a generic mechanism, that would allow me to 
>get the module instance of any ui component, even if there are several 
>modules, or even if it belongs to  the top level application.
>
>FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 
>Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and 
>subclasses), that does not seem to be module aware.
>Actually,  PopupBase.getParent() always returns 
>FlexGlobal.topLevelApplication even if the Popup tag belongs to a 
>module, instead of the module instance.
>The effect of this is that the context is not computed correctly ( 
>returns the topLevel application context, instead of the module child 
>context), Which in turn prevent  FastInject from working inside Popups 
>that are declared in modules.
>
>Regards,
>
>Maurice
>
>-----Message d'origine-----
>De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>Envoyé : mardi 3 septembre 2013 01:56
>À : users@flex.apache.org
>Objet : RE: question on modules
>
>I am new to modules, so not sure to understand what you wrote.
>
>This is how I am using the module:
>
>In main app:
><s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>
>
>The module itself is declared as follows:
>
>SampleModule.mxml
><s:Module>
> ...
></s:Module>
>
>Then I have somewhere else a popup defined in the module 
>SamplePopup.mxml <s:TitleWindow ...>
>   <s:TextInput id="ti" />
></s:TitleWindow>
>
>So what is moduleComponentId in this case ?
>
>Maurice
>
>-----Message d'origine-----
>De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
>Envoyé : mardi 3 septembre 2013 01:21
>À : Users@flex
>Objet : Re: question on modules
>
>Would something like either of the following have any effect on the 
>your pathing for test purposes?
>
>(parentApplication.moduleComponentId as 
>Modulename).ventana.variableName.text = "test";
>
>or
>
>(parentApplication.moduleComponentId as 
>Object).ventana.variableName.text = "test";
>
>
>-Mark
>
>On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < 
>mastudillo@austrosoft.com.ec> wrote:
>
>> Hi,
>> When you try to access to a popup trougth a module first you create a  
>>variable like TitleWindow and second assign the call at this, for
>>example:
>>
>> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
>> {
>>                ventana =
>> PopUpManager.createPopUp(this,**titleWindowSample,true)
>> as TitleWindow;
>>                 PopUpManager.centerPopUp(**ventana);
>> }
>>
>> parentApplication.**moduleComponentId.ventana.**variableName.text = 
>> "";
>>
>>


RE: question on modules

Posted by OmPrakash Muppirala <bi...@gmail.com>.
You could perhaps have each module implement an interface. That way you can
test the module instances (using 'is') and get the one you are interested
in.

Thanks,
Om
On Sep 2, 2013 5:24 PM, "Maurice Amsellem" <ma...@systar.com>
wrote:

> Actually, from SamplePopup.mxml,
>  parentApplication.sampleModuleLoader.child points to the module...
>
> So if I KNOW that the component is in module X , this is how to get it.
>
> The problem is that I need a generic mechanism, that would allow me to get
> the module instance of any ui component, even if there are several modules,
> or even if it belongs to  the top level application.
>
> FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4
> Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses),
> that does not seem to be module aware.
> Actually,  PopupBase.getParent() always returns
> FlexGlobal.topLevelApplication even if the Popup tag belongs to a module,
> instead of the module instance.
> The effect of this is that the context is not computed correctly ( returns
> the topLevel application context, instead of the module child context),
> Which in turn prevent  FastInject from working inside Popups that are
> declared in modules.
>
> Regards,
>
> Maurice
>
> -----Message d'origine-----
> De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
> Envoyé : mardi 3 septembre 2013 01:56
> À : users@flex.apache.org
> Objet : RE: question on modules
>
> I am new to modules, so not sure to understand what you wrote.
>
> This is how I am using the module:
>
> In main app:
> <s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>
>
> The module itself is declared as follows:
>
> SampleModule.mxml
> <s:Module>
>  ...
> </s:Module>
>
> Then I have somewhere else a popup defined in the module SamplePopup.mxml
> <s:TitleWindow ...>
>    <s:TextInput id="ti" />
> </s:TitleWindow>
>
> So what is moduleComponentId in this case ?
>
> Maurice
>
> -----Message d'origine-----
> De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
> Envoyé : mardi 3 septembre 2013 01:21
> À : Users@flex
> Objet : Re: question on modules
>
> Would something like either of the following have any effect on the your
> pathing for test purposes?
>
> (parentApplication.moduleComponentId as
> Modulename).ventana.variableName.text = "test";
>
> or
>
> (parentApplication.moduleComponentId as Object).ventana.variableName.text
> = "test";
>
>
> -Mark
>
> On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
> mastudillo@austrosoft.com.ec> wrote:
>
> > Hi,
> > When you try to access to a popup trougth a module first you create a
> > variable like TitleWindow and second assign the call at this, for
> example:
> >
> > public var ventana:TitleWindow = new TitleWindow(); function Sample()
> > {
> >                ventana =
> > PopUpManager.createPopUp(this,**titleWindowSample,true)
> > as TitleWindow;
> >                 PopUpManager.centerPopUp(**ventana);
> > }
> >
> > parentApplication.**moduleComponentId.ventana.**variableName.text =
> > "";
> >
> >
>

RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
Exactly, that's what the Popup wrapper is all about.

It implements IMXMLObject, so it knows the document where it is defined and uses that information to retrieve the context (since, as you say, the popup itself is not added to the the context).  

In the example below, Popup will use CallerClass to retrieve the context.
The issue was when CallerClass was itself opened as a popup (that is, a popup opened from within another popup).

<CallerClass>
   <parsley:Popup  open="{someBindableFlag}">
       <MyTitleWindow/>  
    </parsley:Popup>

It's like magic and make it really simple to use.

Maurice 
-----Message d'origine-----
De : Frédéric THOMAS [mailto:webdoublefx@hotmail.com] 
Envoyé : mardi 3 septembre 2013 13:22
À : users@flex.apache.org
Objet : RE: question on modules

Usually, Parsley:PopUp can only detect the context of a Class if this one has been added to a context, generally its module context in case it stands in a module, when you use fast inject instead of configure, the class is not added to the context, so Parsley:PopUp should return its closer above context, am I wrong ?

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 12:18
À : users@flex.apache.org
Objet : RE: question on modules

That's what parsley Popup tag is supposed to do for me (call context.viewManager.addViewRoot and addPopup).  
Anyway, I reverted to the original implementation of parsley Popup, and popup injections are now working fine, even in modules.

Thanks again for the help.

Maurice
-----Message d'origine-----
De : Frédéric THOMAS [mailto:webdoublefx@hotmail.com] Envoyé : mardi 3 septembre 2013 02:49 À : users@flex.apache.org Objet : RE: question on modules

Not sure I understood what you want at the end but if you want to open a popup contains in a module, either you know the popup class and call it via a static show function and inside the show function, you add "
context.viewManager.addViewRoot(yourPopupInstance);" before calling "
PopUpManager.addPopUp" or you don't know the popup class and you can create an event/command in the module that call it in the same way I described before.

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 02:24
À : users@flex.apache.org
Objet : RE: question on modules

Actually, from SamplePopup.mxml,  parentApplication.sampleModuleLoader.child
points to the module...

So if I KNOW that the component is in module X , this is how to get it.

The problem is that I need a generic mechanism, that would allow me to get the module instance of any ui component, even if there are several modules, or even if it belongs to  the top level application.

FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses), that does not seem to be module aware.
Actually,  PopupBase.getParent() always returns FlexGlobal.topLevelApplication even if the Popup tag belongs to a module, instead of the module instance.
The effect of this is that the context is not computed correctly ( returns the topLevel application context, instead of the module child context), Which in turn prevent  FastInject from working inside Popups that are declared in modules.

Regards,

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 01:56
À : users@flex.apache.org
Objet : RE: question on modules

I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module SamplePopup.mxml <s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text = "test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana =
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

RE: question on modules

Posted by Frédéric THOMAS <we...@hotmail.com>.
Usually, Parsley:PopUp can only detect the context of a Class if this one
has been added to a context, generally its module context in case it stands
in a module, when you use fast inject instead of configure, the class is not
added to the context, so Parsley:PopUp should return its closer above
context, am I wrong ?

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : mardi 3 septembre 2013 12:18
À : users@flex.apache.org
Objet : RE: question on modules

That's what parsley Popup tag is supposed to do for me (call
context.viewManager.addViewRoot and addPopup).  
Anyway, I reverted to the original implementation of parsley Popup, and
popup injections are now working fine, even in modules.

Thanks again for the help.

Maurice
-----Message d'origine-----
De : Frédéric THOMAS [mailto:webdoublefx@hotmail.com] Envoyé : mardi 3
septembre 2013 02:49 À : users@flex.apache.org Objet : RE: question on
modules

Not sure I understood what you want at the end but if you want to open a
popup contains in a module, either you know the popup class and call it via
a static show function and inside the show function, you add "
context.viewManager.addViewRoot(yourPopupInstance);" before calling "
PopUpManager.addPopUp" or you don't know the popup class and you can create
an event/command in the module that call it in the same way I described
before.

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 02:24
À : users@flex.apache.org
Objet : RE: question on modules

Actually, from SamplePopup.mxml,  parentApplication.sampleModuleLoader.child
points to the module...

So if I KNOW that the component is in module X , this is how to get it.

The problem is that I need a generic mechanism, that would allow me to get
the module instance of any ui component, even if there are several modules,
or even if it belongs to  the top level application.

FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 Popup
tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses), that does
not seem to be module aware.
Actually,  PopupBase.getParent() always returns
FlexGlobal.topLevelApplication even if the Popup tag belongs to a module,
instead of the module instance.
The effect of this is that the context is not computed correctly ( returns
the topLevel application context, instead of the module child context),
Which in turn prevent  FastInject from working inside Popups that are
declared in modules.

Regards,

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 01:56
À : users@flex.apache.org
Objet : RE: question on modules

I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module SamplePopup.mxml
<s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your
pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text =
"test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana =
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
That's what parsley Popup tag is supposed to do for me (call context.viewManager.addViewRoot and addPopup).  
Anyway, I reverted to the original implementation of parsley Popup, and popup injections are now working fine, even in modules.

Thanks again for the help.

Maurice 
-----Message d'origine-----
De : Frédéric THOMAS [mailto:webdoublefx@hotmail.com] 
Envoyé : mardi 3 septembre 2013 02:49
À : users@flex.apache.org
Objet : RE: question on modules

Not sure I understood what you want at the end but if you want to open a popup contains in a module, either you know the popup class and call it via a static show function and inside the show function, you add "
context.viewManager.addViewRoot(yourPopupInstance);" before calling "
PopUpManager.addPopUp" or you don't know the popup class and you can create an event/command in the module that call it in the same way I described before.

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 02:24
À : users@flex.apache.org
Objet : RE: question on modules

Actually, from SamplePopup.mxml,  parentApplication.sampleModuleLoader.child
points to the module...

So if I KNOW that the component is in module X , this is how to get it.

The problem is that I need a generic mechanism, that would allow me to get the module instance of any ui component, even if there are several modules, or even if it belongs to  the top level application.

FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses), that does not seem to be module aware.
Actually,  PopupBase.getParent() always returns FlexGlobal.topLevelApplication even if the Popup tag belongs to a module, instead of the module instance.
The effect of this is that the context is not computed correctly ( returns the topLevel application context, instead of the module child context), Which in turn prevent  FastInject from working inside Popups that are declared in modules.

Regards,

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 01:56
À : users@flex.apache.org
Objet : RE: question on modules

I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module SamplePopup.mxml <s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text = "test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana =
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

RE: question on modules

Posted by Frédéric THOMAS <we...@hotmail.com>.
Not sure I understood what you want at the end but if you want to open a
popup contains in a module, either you know the popup class and call it via
a static show function and inside the show function, you add "
context.viewManager.addViewRoot(yourPopupInstance);" before calling "
PopUpManager.addPopUp" or you don't know the popup class and you can create
an event/command in the module that call it in the same way I described
before.

-Fred

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : mardi 3 septembre 2013 02:24
À : users@flex.apache.org
Objet : RE: question on modules

Actually, from SamplePopup.mxml,  parentApplication.sampleModuleLoader.child
points to the module...

So if I KNOW that the component is in module X , this is how to get it.

The problem is that I need a generic mechanism, that would allow me to get
the module instance of any ui component, even if there are several modules,
or even if it belongs to  the top level application.

FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 Popup
tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses), that does
not seem to be module aware.
Actually,  PopupBase.getParent() always returns
FlexGlobal.topLevelApplication even if the Popup tag belongs to a module,
instead of the module instance.
The effect of this is that the context is not computed correctly ( returns
the topLevel application context, instead of the module child context),
Which in turn prevent  FastInject from working inside Popups that are
declared in modules.

Regards,

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
Envoyé : mardi 3 septembre 2013 01:56
À : users@flex.apache.org
Objet : RE: question on modules

I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module SamplePopup.mxml
<s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your
pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text =
"test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana =
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

Re: question on modules

Posted by Alex Harui <ah...@adobe.com>.
This is a common misconception:  modules do not have a "module instance".
All you are doing is loading a factory from which you can make any number
of instances of the classes in the module via the factory.create() method.
 That's why there is no mapping back to a single instance, just the
factory.

A popup would not be parented by any module instances since they are hung
off of the top-level app's systemManager.  You'll have to build your own
map.

-Alex

On 9/2/13 5:24 PM, "Maurice Amsellem" <ma...@systar.com> wrote:

>Actually, from SamplePopup.mxml,
>parentApplication.sampleModuleLoader.child points to the module...
>
>So if I KNOW that the component is in module X , this is how to get it.
>
>The problem is that I need a generic mechanism, that would allow me to
>get the module instance of any ui component, even if there are several
>modules, or even if it belongs to  the top level application.
>
>FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4
>Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses),
>that does not seem to be module aware.
>Actually,  PopupBase.getParent() always returns
>FlexGlobal.topLevelApplication even if the Popup tag belongs to a module,
>instead of the module instance.
>The effect of this is that the context is not computed correctly (
>returns the topLevel application context, instead of the module child
>context), 
>Which in turn prevent  FastInject from working inside Popups that are
>declared in modules.
>
>Regards,
>
>Maurice 
>
>-----Message d'origine-----
>De : Maurice Amsellem [mailto:maurice.amsellem@systar.com]
>Envoyé : mardi 3 septembre 2013 01:56
>À : users@flex.apache.org
>Objet : RE: question on modules
>
>I am new to modules, so not sure to understand what you wrote.
>
>This is how I am using the module:
>
>In main app:
><s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>
>
>The module itself is declared as follows:
>
>SampleModule.mxml
><s:Module>
> ...
></s:Module>
>
>Then I have somewhere else a popup defined in the module SamplePopup.mxml
><s:TitleWindow ...>
>   <s:TextInput id="ti" />
></s:TitleWindow>
>
>So what is moduleComponentId in this case ?
>
>Maurice 
>
>-----Message d'origine-----
>De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
>Envoyé : mardi 3 septembre 2013 01:21
>À : Users@flex
>Objet : Re: question on modules
>
>Would something like either of the following have any effect on the your
>pathing for test purposes?
>
>(parentApplication.moduleComponentId as
>Modulename).ventana.variableName.text = "test";
>
>or
>
>(parentApplication.moduleComponentId as Object).ventana.variableName.text
>= "test";
>
>
>-Mark
>
>On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
>mastudillo@austrosoft.com.ec> wrote:
>
>> Hi,
>> When you try to access to a popup trougth a module first you create a
>> variable like TitleWindow and second assign the call at this, for
>>example:
>>
>> public var ventana:TitleWindow = new TitleWindow(); function Sample()
>> {
>>                ventana =
>> PopUpManager.createPopUp(this,**titleWindowSample,true)
>> as TitleWindow;
>>                 PopUpManager.centerPopUp(**ventana);
>> }
>>
>> parentApplication.**moduleComponentId.ventana.**variableName.text =
>> "";
>>
>>


RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
Actually, from SamplePopup.mxml,  parentApplication.sampleModuleLoader.child points to the module...

So if I KNOW that the component is in module X , this is how to get it.

The problem is that I need a generic mechanism, that would allow me to get the module instance of any ui component, even if there are several modules, or even if it belongs to  the top level application.

FYI, the purpose of this is to fix an issue in Cairngorm3/Parsley 2.4 Popup tag (ie com.adobe.cairngorm.popup.PopupBase class and subclasses), that does not seem to be module aware.
Actually,  PopupBase.getParent() always returns FlexGlobal.topLevelApplication even if the Popup tag belongs to a module, instead of the module instance.
The effect of this is that the context is not computed correctly ( returns the topLevel application context, instead of the module child context), 
Which in turn prevent  FastInject from working inside Popups that are declared in modules.

Regards,

Maurice 

-----Message d'origine-----
De : Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Envoyé : mardi 3 septembre 2013 01:56
À : users@flex.apache.org
Objet : RE: question on modules

I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module SamplePopup.mxml <s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com]
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text = "test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana =
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

RE: question on modules

Posted by Maurice Amsellem <ma...@systar.com>.
I am new to modules, so not sure to understand what you wrote.

This is how I am using the module:

In main app:
<s:ModuleLoader id="sampleModuleLoader"  url="../SampleModule.swf"/>

The module itself is declared as follows:

SampleModule.mxml 
<s:Module>
 ...
</s:Module>

Then I have somewhere else a popup defined in the module
SamplePopup.mxml
<s:TitleWindow ...>
   <s:TextInput id="ti" />
</s:TitleWindow>

So what is moduleComponentId in this case ? 

Maurice 

-----Message d'origine-----
De : Mark Kessler [mailto:kesslerconsulting@gmail.com] 
Envoyé : mardi 3 septembre 2013 01:21
À : Users@flex
Objet : Re: question on modules

Would something like either of the following have any effect on the your pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text = "test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo < mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a 
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow(); function Sample() 
> {
>                ventana = 
> PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = 
> "";
>
>

Re: question on modules

Posted by Mark Kessler <ke...@gmail.com>.
Would something like either of the following have any effect on the your
pathing for test purposes?

(parentApplication.moduleComponentId as
Modulename).ventana.variableName.text = "test";

or

(parentApplication.moduleComponentId as Object).ventana.variableName.text =
"test";


-Mark

On Mon, Sep 2, 2013 at 6:56 PM, Michael Astudillo <
mastudillo@austrosoft.com.ec> wrote:

> Hi,
> When you try to access to a popup trougth a module first you create a
> variable like TitleWindow and second assign the call at this, for example:
>
> public var ventana:TitleWindow = new TitleWindow();
> function Sample()
> {
>                ventana = PopUpManager.createPopUp(this,**titleWindowSample,true)
> as TitleWindow;
>                 PopUpManager.centerPopUp(**ventana);
> }
>
> parentApplication.**moduleComponentId.ventana.**variableName.text = "";
>
>

Re: question on modules

Posted by Michael Astudillo <ma...@austrosoft.com.ec>.
Hi,
When you try to access to a popup trougth a module first you create a 
variable like TitleWindow and second assign the call at this, for example:

public var ventana:TitleWindow = new TitleWindow();
function Sample()
{
                ventana = 
PopUpManager.createPopUp(this,titleWindowSample,true) as TitleWindow;
                 PopUpManager.centerPopUp(ventana);
}

parentApplication.moduleComponentId.ventana.variableName.text = "";


El 02/09/2013 17:42, Mark Kessler escribió:
> Well if it's not the parentApplication or doesn't have a parent.  You could
> add a property to the child module and have it's parent assign a reference
> to it.
>
>
> -Mark
>
>
> On Mon, Sep 2, 2013 at 6:40 PM, Maurice Amsellem <
> maurice.amsellem@systar.com> wrote:
>
>> Hello,
>>
>> Does someone know how to get the module instance (ie subclass of spark
>> Module) where a given UI component is defined, in a multi-module
>> application.
>>
>> Walking up the parent tree does not work if the UI component belongs to a
>> popup.
>>
>> I also tried using  UIComponent.moduleFactory, and the info() properties
>>   ( currentDomain, mainClassName, etc.) , but without success.
>>
>> Thanks for your help.
>>
>> Maurice
>>
>>


-- 
Saludos Cordiales

Ing. Michael Astudillo
CEO
http://www.austrosoft.com.ec
PBX: 59372 818447
Facebook: http://www.facebook.com/AustroSoft
Twitter: @austrosoftec

  

NOTA SOBRE CONFIDENCIALIDAD:

La información contenida en este e-mail es confidencial y sólo puede ser utilizada por la persona natural o jurídica, a la cual está dirigido. En el evento, que el receptor no sea la persona autorizada cualquier retención, difusión, distribución o copia de éste mensaje está prohibida y será sancionada por la ley".

CONFIDENTIALITY NOTE:
The information contained in this e-mail is confidential and is intended only for the use of the address(es) named above. If you are not the intended recipient of this electronic transmission, you are hereby notified that any dissemination or copying of this transmission is strictly prohibited and will be sanctioned by law".


Re: question on modules

Posted by Mark Kessler <ke...@gmail.com>.
Well if it's not the parentApplication or doesn't have a parent.  You could
add a property to the child module and have it's parent assign a reference
to it.


-Mark


On Mon, Sep 2, 2013 at 6:40 PM, Maurice Amsellem <
maurice.amsellem@systar.com> wrote:

> Hello,
>
> Does someone know how to get the module instance (ie subclass of spark
> Module) where a given UI component is defined, in a multi-module
> application.
>
> Walking up the parent tree does not work if the UI component belongs to a
> popup.
>
> I also tried using  UIComponent.moduleFactory, and the info() properties
>  ( currentDomain, mainClassName, etc.) , but without success.
>
> Thanks for your help.
>
> Maurice
>
>