google-code-export / mvp4g

Automatically exported from code.google.com/p/mvp4g
1 stars 0 forks source link

Decouple the presenter from the view implementation #88

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if the presenter was not coupled to a view implementation and 
instead referenced the interface for a view. This way you could  have one 
presenter supporting multiple views. The question would then be how do you link 
the view implementation with the presenter?

Original issue reported on code.google.com by grant.j....@gmail.com on 16 Jun 2011 at 6:26

GoogleCodeExporter commented 9 years ago
Sorry, meant to raise this as an enhancement not a defect!

Original comment by grant.j....@gmail.com on 16 Jun 2011 at 6:27

GoogleCodeExporter commented 9 years ago
There is a way not to reference the view inside the presenter. You can if you 
want use the view interface for @Presenter:

@Presenter(view = IOneView.class)
public class OnePresenter extends BasePresenter<OneEventBus, IOneView> {...}

then you can use GIN to configure which view implementation to use:

public class Mvp4gGinModule extends AbstractGinModule {

    @Override
    protected void configure() {
        bind( IOneView.class ).to( OneViewImpl.class );
        ...
    }
}

and then configure mvp4g to use this gin module.

Would this code resolve the issue?

Original comment by plcoir...@gmail.com on 16 Jun 2011 at 11:58

GoogleCodeExporter commented 9 years ago
Certainly would, thanks :-)

Original comment by grant.j....@gmail.com on 18 Jun 2011 at 7:25

GoogleCodeExporter commented 9 years ago
Thanks, I will close the issue then.

Original comment by plcoir...@gmail.com on 21 Jun 2011 at 12:30