Actually, I have that exact setup now, the only difference is in my onSuccess method I really wasn't doing anything. So in the client code I showed you above, I should take the logic regading the window.open and put it in the onSuccess method and that should avoid prematurely loading the window? I think that solution is much, much better then my idea!!! I'm gonna try that now. Thanks a bunch. :)
On Wed, Feb 1, 2012 at 1:41 PM, Mark <[email protected]> wrote: > The whole idea between AJAX is asynchronous operation, the client > continues working while the server does work. There's no telling how > long the server will take to do its work so a Timer is not the best > option. Since you want the client to react when the server finishes > you need to pass the workload to the server method and pass an > AsyncCallback object. In that object you put your Window.open() call > in the onSuccess() method. > > Hope this helps. > > On Feb 1, 1:52 pm, Joshua Carey <[email protected]> wrote: > > I have a gwt application that calls a gwt servlet (from my presenter > class) > > to write a PDF file to disk, then in my presenter class I display the > newly > > created PDF using Window.open("my.pdf");. The problem is that the > > window.open executes before the pdf is finished writing to disk. I would > > like to know if there is a way to stall any further statements from > > occurring until the pdf is finished writing. Or is there a way to use > some > > sort of timer object that waits 5 seconds or more while the PDF is being > > created? It would be nice to prompt the user a message box that says > > "please wait while PDF is retrieved" and then when the PDF is finished > > writing, we could automatically close the message box and execute the > > window.open("my.pdf") command. Here is the lines of code in the > presenter > > class: > > > > ButtonCell genericButtonCellType = new ButtonCell(); > > FieldUpdater<EOMDocument, String> previewUpdater = new > > FieldUpdater<EOMDocument, String>() > > { > > @Override > > public void update(int index, EOMDocument object, String value) > > { > > if (object.getByteBlob() == null) { > > Window.alert("Sorry but the PDF you are requesting from the database is > > empty. Please select another PDF to view!");} else { > > > > eventBus.writePdf(object.getByteBlob(), object.getIdocNumber()); > > String blobURL = GWT.getHostPageBaseURL() + "sp_pdf/" + > > object.getPreviewBlobPath(); > > Window.open(blobURL, "Search And Preview - PDF Review", null); > > > > } > > } > > }; > > > > Thanks for the help. > > > > Joshua > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
