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.
>  

Reply via email to