public void loadData( final Integer documentId, String returnPlace, final CheckDataCallback callback) { try { returnState = new PlaceState(returnPlace); } catch (RemoteAppException ex) { returnState = new PlaceState(ShowRentalPlace.PLACE); returnState.addArg(ShowRentalPlace.ARG_MODULE, ShowRentalPlace.ARG_DOCUMENTS_MODULE); } if (documentId == null) { callback.onInvalidData("Document inconnu."); return; } dispatch.execute( new GetTextDocumentContentAction(documentId), new BasicAsyncCallback<GetTextDocumentContentResult>(getEventBus()) { @Override public void onSuccess(GetTextDocumentContentResult result) { if (result.getTextDocument() == null) { callback.onInvalidData("Document inconnu."); return; } ShowDocumentPlace.this.documentId = documentId; ShowDocumentPlace.this.rentalId = result.getTextDocument().getRentalId(); getView().setPlaceTitle(result.getTextDocument().getName()); getView().getContentContainer().setHTML(result.getTextDocument().getContent()); callback.onValidData(); } }); }
@Override protected void onBind() { getView().getBackToRentalControl().addClickHandler(this); getView().getDownloadControl().addClickHandler(this); PlaceState state = new PlaceState(PLACE); state.addArg(ARG_DOCUMENT_ID, this.documentId + ""); getEventBus().fireEvent(new PlaceChangedEvent(state)); }