I am new for GWT. I would like to know, is it possible to set the cell table content from the GWT Presenter? Is it OK to set the cell table data from the view itself and still following the MVP Pattern?
2 Answers
3
votes
Don't confuse with GWT presenter and it's pattern. As you know that GWT presenter is contract to communicate between View and Model. it's good to write server dispatch code and event bus code in presenter and setting of data for GWT widgets in View itself.
After fetching celltable data from model to presenter, using dispatch.execute
method. In onSuccess
method, call a method which set data in celltable.
Define one method which set celltable data in View Interface
public interface MyView extends View { void setCellTableData(List<Data> dataList); }
it will implemented in view class, write a code that set data of celltable there.
In presenter, onSuccess method set data like
dispatch.execute(new GetDataAction(), new AsyncCallback<GetDataActionResult>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(List<Data> result) { getView().setCellTableData(result); } }; });