Thanks a lot, this is a very interesting suggestion.
There is indeed a call for improvement here.
However, I don't feel good about adding a 'close' service, next to 'dispose'... their resemblance may be misleading.
What about changing the dispose service implementation itself?
window.dispatchEvent(new WindowEvent(
window, WindowEvent.WINDOW_CLOSING));
=> listeners will get called (including your applicative ones), and the awt Window takes care of disposing.
Thanks again for bringing this to our attention,
Regards,
Pascal
On Jul 13, 2009, at 10:51 AM, Laurent wrote:
Hi,
In my application I have a window with no functional button to close it,
I'm relying on the closing button provided by the window manager. When the
user closes the window I want to display a (bit annoying) confirmation
JOptionPane.
In UISpec4J, the method to close a window when no functional button is
"dispose()" (which call the dispose() method on the actual window). My
problem is that I'm displaying the message window on WindowClosing event
which is not generated when calling dispose().
My solution is to generate a WindowClosing event myself like this:
private void closeWindow(final org.uispec4j.Window window) {
final Container container = window.getAwtComponent();
final WindowEvent event = new WindowEvent((java.awt.Window) container,
WindowEvent.WINDOW_CLOSING);
for (final WindowListener listener :
container.getListeners(WindowListener.class)) {
listener.windowClosing(event);
}
}
I'm wondering if that kind of function should be added in uispec4j
(org.uispec4j.Window.close() for instance). What do you think of it?
Cheers,
Laurent.
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/uispec4j/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/uispec4j/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:uispec4j-digest@yahoogroups.com
mailto:uispec4j-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
uispec4j-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/