That's correct. The first call to close() is vetoed by the sheet skin so it can run the "roll out" transition. When the transition is done, the sheet skin calls close() on the sheet again, but does not veto it. This allows it to actually close (i.e. be removed from the display).
Using a SheetCloseListener is probably the easiest way to know when a sheet has actually closed, since it won't be called until the transition is done. On Feb 24, 2011, at 1:07 AM, Chris Bartlett wrote: > Bill, > > Everything should work as expected if you add a SheetStateListener and > perform your logic in SheetStateListener#sheetClosed(Sheet), or a provide a > SheetCloseListener to one of the Sheet#open(...) methods. > > Sheet#close() / Sheet#close(boolean) request the closure of the Sheet (which > extends Window), but SheetCloseListener#sheetClosed(Sheet) and > SheetStateListener#sheetClosed(Sheet) will be called when it has actually > been closed. > > You will notice the other methods in SheetStateListener for vetoing a close > request should you need to, for instance if the Sheet requires some data > input from the user which it has not yet received to its satisfaction. > > Chris > > On 24 February 2011 07:18, Bill van Melle <[email protected]> wrote: > I override Sheet.close in my Sheet dialog classes, so that I can take > appropriate action when they are closed or canceled, which happens outside of > my control when user presses Enter or Esc. When I run this in the debugger, > I can see that my close override gets called when the user presses Esc (call > from TerraSheetSkin.keyPressed), and then again when the sheet-closing > animation finishes (from TerraSheetSkin$4.transitionCompleted). If I want to > run some code when the dialog closes, do I have to keep track of this myself > and set a flag or something? Or is there a better place I can hook into all > the places that terminate the dialog but get called only once? >
