Confused on how some event processing is handled...

I’m missing something fundamental in the event processing sequence. I’m not sure what the ‘best’ way is to trigger certain types of events without direct user interaction (hitting a button for example). I’m not sure this is a Vaadin issue directly - I suspect I’m not getting the browser/server event processing correct. I could use a hint as to how to make this work, or a pointer to some documentation or examples…

My situation is more or less this:

  1. User creates a display page with some information on it.

  2. User wants to save the information, so they hit the ‘save’ button.
    The save routine copies the information into a file (or database).

  3. The problem occurs when the user has not chosen a file (ie. this is the ‘first’ save for this information). When I detect that there is no output file, I bring up a ‘choose your output location’ dialog window. Since this is a child window, the save routine keeps running (basically it exits without saving anything, and I set a state variable telling me to wait until an output file is available).

So far so good. But now when the user chooses an output file, how do trigger an event that will either tell the user to hit the save button again, or to automatically restart the save routine. I could probably just call the save routine in the dialog, but I’m not sure that is the best way to lay out my code - or is it?

This can’t be an unusual situation - but as I said, I’m not completely familiar with the event processing loop, so I could use some pointers here…

Thanks in advance,


Your question seems to have slipped the notice - did you figure out a solution yet?

I’d probably add the file selection option to the page itself since I like to know where I’m saving things before I click ‘save’. Calling the save routine in the dialog is certainly an option as well, and not a bad one if the situation is really so simple as you made it sound (i.e. no need to jump through too many hoops to manage that). You could also trigger an event for the parent window to handle, and have the save routine called from there (could easily be more complicated than the previous option in your situation).

I ended up separating the save function into a different page, and I built a small state machine that let me figure out when the user had chosen a file correctly, and decided to actually do the save or to cancel etc. I’m not sure it is the ‘best’ solution possible, but it is relatively straightforward, and seems to work…