I think the right thing to do is return DENY. If the sheet still rolls up in that case, it is probably a bug in TerraSheetSkin.
On Dec 2, 2011, at 3:41 PM, Roger L. Whitcomb wrote: > No, I was returning DEFER. But, as I recall, even if I returned DENY the > rollup still happened. So, TerraFileBrowserSheetSkin registers itself with a > SheetStateListener, then my use of this class also registers a > SheetStateListener. So, when “close” is called, both listeners get called. > TerraFileBrowserSheetSkin gets called first, which calls TerraSheetSkin via > “super.previewSheetClose” (line 268), which will start the close transition > and return Vote.DEFER. Then my listener gets called and will return DEFER > (or DENY). Once the votes are tallied, the non-APPROVE final vote cancels > the close transition (which has already started running) and then brings up > my prompt. > > Roger Whitcomb | Architect, Engineering | [email protected]| Actian > Corp. | 500 Arguello Street | Suite 200 | Redwood City | CA | 94063 | USA | > +1 650-587-5596 | fax: +1 650-587-5550 > > From: Greg Brown [mailto:[email protected]] > Sent: Friday, December 02, 2011 12:17 PM > To: [email protected] > Subject: Re: Question about "previewSheetClose" > > In your listener, are you vetoing the close event? > > On Dec 2, 2011, at 1:15 PM, Roger L. Whitcomb wrote: > > > I need to implement a prompt in my Save As dialogs to confirm if you want to > overwrite an existing file. So, I try to add a SheetStateListener and begin > the prompt in there. That all works, except that the FileBrowserSheet “rolls > up” and then rolls back down with the prompt showing on top of it. The > reason it does that is that my listener is now third in line. First is the > FileBrowserSheet listener which calls “super” (which is Sheet itself) which > starts the close transition and then it sets the selected file. So, my > listener actually gets called twice: once with the previous selected file > (or null) set and once with the correct file. > > So, there are two ugly things: > 1) Visually it doesn’t look good to have the sheet go away and come back with > the overwrite prompt on it. > 2) It is hard to code the logic in my listener to deal with being called > twice. > > What I’m casting around for is a way to make my listener be the “first in > line” or have mine take precedence somehow without (necessarily) having a lot > of knowledge of Pivot internals since they may change over time. I mean that > I *could* remove any existing listeners from the list and make mine the only > one and have mine call the other ones if appropriate, but that seems like a > really bad practice, in general. So, any thoughts as to what’s the “right” > way to handle this? I think similar problems could potentially arise with > other close/state listeners as well, although the visual aspects are most > clearly seen with Sheet since it starts the rollaway transition in > “previewSheetClose”. > > Or am I missing something fundamental here? Thanks. > > > Roger Whitcomb > Architect, Engineering > Actian Corporation > [email protected] > > PHONE +1 650.587.5596 > FAX +1 650.587.5550 > www.actian.com > > <image001.jpg> > > This transmission is confidential and intended solely for the use of the > recipient named above. It may contain confidential, proprietary, or legally > privileged information. If you are not the intended recipient, you are hereby > notified that any unauthorized review, use, disclosure or distribution is > strictly prohibited. If you have received this transmission in error, please > contact the sender by reply e-mail and delete the original transmission and > all copies from your system. > >
