Package net.sf.jguiraffe.gui.app
Interface ApplicationShutdownListener
-
- All Superinterfaces:
EventListener
public interface ApplicationShutdownListener extends EventListener
Definition of an interface for listeners that want to be notified when the application terminates.
Objects implementing this interface can register itself at the global
Application
object. They will then receive a notification before this application terminates. So it is possible to perform some clean up before the final shutdown.A shutdown listeners has also the opportunity of canceling the shutdown process. An example would be an application that shows a message box asking whether the user really wants to exit. If the user here enters "No", the shutdown must be aborted.
- Version:
- $Id: ApplicationShutdownListener.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
canShutdown(Application app)
Checks if a shutdown is possible.void
shutdown(Application app)
Notifies this listener that the associated application terminates now.
-
-
-
Method Detail
-
canShutdown
boolean canShutdown(Application app)
Checks if a shutdown is possible. This method is called by the application in the beginning of the shutdown phase for all registered listeners. Only if all listeners return true, shutdown process will be continued.- Parameters:
app
- the associated application- Returns:
- a flag if this listeners allows a shutdown
-
shutdown
void shutdown(Application app)
Notifies this listener that the associated application terminates now. This method is called for all registered listeners after a call tocanShutdown()
was successful, i.e. none of the listeners canceled the process. An implementation could e.g. ensure that all changes have been saved or perform clean up.- Parameters:
app
- the associated application
-
-