Views, Mediators and inheritance

JeffW.'s Avatar


21 Jul, 2013 10:00 AM

hello again!

I'm sure I did something like this long time ago in RL1 but I cannot find it anymore, so here's my question.
I have 2 views and 2 mediators. Each view is mapped to its own mediator. They use a lot of the same code, so I'd like to make both mediators inherit from a base mediator and both views from a base view.

So I map the base view to the base mediator
and each sub view to its own mediator
I inject the base view into the base mediator
and each sub view in its own sub mediator

The sub views extend the base view
and the sub mediators extend the base mediator

But I get an error, that the Injector is missing a mapping to handle injection into property [...public var baseView...] of object [sub mediator class]

Any idea how I should address this?


  1. Support Staff 1 Posted by Shaun Smith on 21 Jul, 2013 02:43 PM

    Shaun Smith's Avatar

    So, only maps a single type for injection into the mediator - the type that you pass to map().

    If you need more types injected (which you do, because you end up with 2 injection points in your concrete mediator), you can use mediatorMap.mapMatcher(). For example:

      new TypeMatcher().allOf(BaseView, SubView)

    Now, when an instance of your view lands on stage the mediator map knows how to map that view for injection into the mediator.

  2. 2 Posted by JeffW. on 22 Jul, 2013 09:44 AM

    JeffW.'s Avatar

    Thank you, Shaun. Haven't had the time to try it but it looks like this is what I need.

  3. JeffW. closed this discussion on 25 Jul, 2013 05:22 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac