Several classes with same base class and mediator
Hi, I'm new to this and english isn't my first language so sorry if the answer is posted before - I just don't know what to search for.
So insted of explaining i'll just show an example and you'll probably know what I mean.
I have a couple of classes (Shopspage and Eventspage) that extends Basicpage.
I would like both of them to have a BAsicpageMediator.
This works I think:
mediatorMap.mapView(Shopspage, BasicpageMediator, Basicpage);
mediatorMap.mapView(Eventspage, BasicpageMediator, Basicpage);
..but I can't do:
´
mediatorMap.mapView(Basicpage, BasicpageMediator);
´
...so that each page that extends Basicpage gets a BasicpageMediator.
Is there a way to do this so I won't have to map every single page that extends Basicpage (in the event I have A LOT of pages)
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | 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
1 Posted by ZackPierce on 09 Nov, 2010 07:46 PM
Sorry, manual mapping each of those views is probably the only way to go with "out of the box" Robotlegs.
This is because the mediator mappings make use of the fully qualified class names to map mediators to views. Since view sub-classes have unique class names, they are not automatically associated with the same mediators as their parents in the class hierarchy.
It might be a neat convenience utility to have a sub-class-matching-capable MediatorMap, though it would be relatively performance-expensive in its "check to see what mediator to create, if any, for this view" code.
Support Staff 2 Posted by creynders on 10 Nov, 2010 08:11 AM
You can use the ViewInterfaceMediatorMap utility from piercer:
https://github.com/piercer/robotlegs-extensions-ViewIntefaceMediato...
It enables you to map an interface to a mediator. This also works with inheriting interfaces. It works like a charm and I REALLY hope it makes it into the core of the next RL release.
3 Posted by TFLX on 10 Nov, 2010 09:44 AM
Thanks both of you....
4 Posted by Abel de Beer on 10 Nov, 2010 09:55 AM
Slightly off-topic: somehow I assumed ZackPierce == piercer (github user). True? :)
5 Posted by ZackPierce on 10 Nov, 2010 04:25 PM
Different chap. :)
Excellent link, though.
Stray closed this discussion on 10 Feb, 2011 06:10 PM.