Real-life examples of populating a GWT CellTable using a pure MVP pattern?

We use the GWT-Presenter framework and try to use CellTable to build an updated grid. It seems that some of the GWT constructs for CellTable do not make it easy to break the logic into pure presentation and presenter code.

Examples: 1) Inside the View constructor, a CellTable is defined, and each column is created by anonymous inner classes that extend the Column class to provide the onValue () method. 2) The FieldUpdater interface must be implemented to provide logic for execution when the user changes the data in the cell. This seems to work best with the Presenter onBind () method, but FieldUpdaters often need access to the cell or column that belongs to the view. CellTable has no access methods for accessing columns or cells, so it seems the only way for Presenter is to get a lot of member variables for me in the view and accessories on my display interface.

Can anyone provide some good examples for working with CellTable in the GWT-Presenter or comparable MVPs

+4
source share
2 answers

Are you trying to avoid binding the Model class to the View? I tried to do this for cellTable, but it became inconvenient for me to maintain the code, so I decided to leave a couple of the Model class with View. You can avoid this connection by using some general arguments when creating a view.

-Saket

+1
source

I think the main point of GWT MVP is that the presenters (actions in 2.1) are independent of the implementation of the View, so you can easily share mock views for easy testing.

In addition, it’s normal to have presentations that depend on presentations (= methods of calling the presenter), but not vice versa (well, yes, but through the interface).

I usually just keep the Presenter link inside the View, so that FieldUpdater and inner classes can call methods in Presenter. You can put these methods into an interface, but that doesn't make sense, since there is only one version of this type of Presenter.

Or, if you want things to be more untied, just ask View to send the GWT event that Presenter is listening to.

+3
source

Source: https://habr.com/ru/post/1333687/


All Articles