If you created an ArrayCollection in your DataManager, did you set it to
[Bindable]? The AC doesn't care where it is injected or into what
element (as long as it supports it), its just a data wrapper. Is the
menu a separate component that you 'include' in multiple views or are
you creating a new menu in each view? If you share a component Menu,
then you would just need to add a Bindable arraycollection in the
script area of your Menu then (in your EventMap) add an injector to bind
it to the AC in the manager.
For Example:
DataManager: [Bindable] public var sourceData:ArrayCollection;
Menu Component: [Bindable] public var menuData:ArrayCollection;
<Injectors target="{MyMenuComponent}">
<PropertyInjector source="{DataManager}" sourceKey="sourceData"
targetKey="menuData" />
</Injectors>
If you have a menu in 2 different views (not recommended), just create 2
injectors.
DataManager: [Bindable] public var sourceData:ArrayCollection;
View 1: [Bindable] public var menuData:ArrayCollection;
View 2: [Bindable] public var menuData:ArrayCollection;
<Injectors target="{View1}">
<PropertyInjector source="{DataManager}" sourceKey="sourceData"
targetKey="menuData" />
</Injectors>
<Injectors target="{View2}">
<PropertyInjector source="{DataManager}" sourceKey="sourceData"
targetKey="menuData" />
</Injectors>
In any case, you only need one EventMap for an application (unless you
want to break it up to make it smaller cause they can get QUITE long).
You would need multiple injectors (one per view) unless you create a
component out of all shared pieces (which promotes reuse...a true OO
best practice).
Let me know if this helps at all
On 4/20/2010 12:56 PM, md_ars wrote:
Thanks for the reply.
Please check my requirement below and let me know do I need separate
event map for each screen/mxml component? how it will be linked to
main event map.
I created a ArrayCollection in the DataManager that is being populated
in the result event and I want to inject it in the calling module.
-- The main application calling the view which contains the menu bar.
It dispatches the event. Once event is triggered and fetched the data
from database, control should come back to view and menu should be
populated with database value(menu items). The intermediate
ArrayCollection is being populated but not assigning values to the
dataprovider of menu.
Ars
--- In [email protected]
<mailto:flexcoders%40yahoogroups.com>, Wally Kolcz <wko...@...> wrote:
>
> I use Mate on all my projects. I use a lot of injectors to push my data
> to my views by binding them to the manager Class. What is the issue you
> are having? If you are reusing the same element on 2 views, you'd need
> to either put the data binding (ArrayCollection, Object, etc) on the
> component with your menu or push the data to both views to have the
menu
> use it as a datasource.
>
> I particularly like Mate for 2 main reasons. Lower learning curve and
> you don't put any of the framework into your views or models. All is
> managed by custom events and the map. So, if at any time in the future,
> you want to pop it out of the application, its minimal work (just have
> to write connectors for the events).
>
> On 4/19/2010 1:55 PM, md_ars wrote:
> >
> > Hello,
> >
> > We are planning to use MATE framework for our project. We will have
> > two separate applications our main transaction application will have
> > probably over 150 screens and 100 reports. The application is mostly
> > data driven and we are using web-services to display and enter the
> > data. I tested the MATE frame work with one screen and it was easy to
> > implement. Now I am trying with one MENU and two screens and it is
> > getting complicated to use shared classes etc. Is the MATE framework
> > good for our application? If yes what is the best way to implement
> > MATE? With two screens I am already finding tricky to use Injectors.
> > The main code structure of my project looks like as given below.
> >
> > Main -- Contains Application module
> > view
> > Forms -- Contains screens based on panels/vbox or mdi window
> > Events - Contains main event map and following folders
> > Session -- Events triggered from the screens.
> > EventManager -- Parsing the data after session events fetched data
> > through web service.
> > ControlClass -- Common classes used for screens etc.
> >
> > Should I use a common structure of the whole application or should it
> > a separate for each screen? To me it will be too messy to have common
> > structure whereas too tedious for each screen. So far team size is 2
> > and may extend to 3. Please suggest an optimum way.
> >
> > Thanks
> > Ars