gwtgwt-editors

Is it possible to have two different EditorDrivers simultaneously editing the same object?


In my app, I have a presenter (Presenter1) which I use to kick off an Editor (EditorView1) which edits a Foo object. This MVP setup is akin to what is described in this answer, https://stackoverflow.com/a/10699346/565863

Now, let's say that I need to create another view (EditorView2 which is kicked off by Presenter2) which also edits a Foo object, but needs to make use of EditorView1.
EditorView1 would be supplied to EditorView2 by Presenter1.

This approach seems sloppy and error prone. Is there another way to do this?


Solution

  • As I was writing this question, I realized a much more clean approach.

    The problem with what is described above is that I was intent on re-using the first Presenter, Presenter1.

    It would be much cleaner to abstract out the Editor portion of the EditorView1 code into a re-usable Editor widget (Editor1) which could be used by both EditorView1 and EditorView2. Now, I have one presenter, one view, and one EditorDriver. There is no need to juggle nested presenters or multiple EditorDrivers.