/** * This method is abstraction of fetching. If needed we can create an * abstract parent class with this method as abstract and ResultHandlerModel * will be DAOResultHandlerModel that will implement only this method and * corresponding DAO injection. * * In case of need of this higher abstraction we can easily divide this * class. * * @param page * A page that should be fetched. * @param callback A callback indicating if fetching was successful. */ private void fetchPage(Page page, final ICallback<Void> callback) { dataLoader.load(page, new ICallback<PagedResult<List<E>>>() { public void onFailure(Throwable caught) { callback.onFailure(caught); } public void onSuccess(PagedResult<List<E>> result) { setPagedResult(result); callback.onSuccess(null); } }); }
@SuppressWarnings("unchecked") @Override public void bindingBecameBound(BindingHolder binding) { if(callback instanceof BoundListAsyncCallback && widget instanceof FocusWidget) { ((BoundListAsyncCallback) callback).setWasEnabled(((FocusWidget) widget).isEnabled()); } if (widget instanceof FocusWidget && !((FocusWidget) widget).isEnabled()) { ((FocusWidget) widget).setEnabled(false); } loader.load(Page.ALL_RESULTS_PAGE, callback); } }