Class AutoReleaseListener
- java.lang.Object
-
- net.sf.jguiraffe.gui.builder.AutoReleaseListener
-
- All Implemented Interfaces:
EventListener,WindowListener
public class AutoReleaseListener extends Object implements WindowListener
A specialized
WindowListenerimplementation for implementing the auto release mechanism supported by builders.The results produced by a
Builderusually need to be released when they are no longer needed to free the resources used by them. This can be done manually by invoking theBuilder.release(BuilderData)method with theBuilderDataobject used for specifying the parameters of the builder operation.When a window is generated by a builder script, there is an alternative: it is possible to let the framework perform the
release()invocation automatically when the window is closed. This is often useful, for instance when a dialog window is created from a builder script: when the user closes the dialog all resources associated with it (including beans defined in the script) are no more needed and can be released. To enable this mechanism theautoReleaseproperty ofBuilderDatahas to be set to true.This class implements the functionality for automatically releasing a
BuilderDataobject when a window (i.e. the main window produced by the builder script) is closed. It does not rely on a concreteBuilderimplementation and thus can be used with arbitrary implementations. Concrete implementations of theBuilderinterface only need to create an instance and register it at the main window of the builder results.Client code typically will not have to use this class directly. The framework will create and initialize and instance behind the scenes when a
BuilderDataobject configured appropriately is passed to aBuilder.- Version:
- $Id: AutoReleaseListener.java 205 2012-01-29 18:29:57Z oheger $
- Author:
- Oliver Heger
-
-
Constructor Summary
Constructors Constructor Description AutoReleaseListener(BuilderData data)Creates a new instance ofAutoReleaseListenerand sets theBuilderDataobject to be released automatically.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidwindowActivated(WindowEvent event)Window activated event.voidwindowClosed(WindowEvent event)The window was closed.voidwindowClosing(WindowEvent event)Window closing event.voidwindowDeactivated(WindowEvent event)Window deactivated event.voidwindowDeiconified(WindowEvent event)Window deiconified event.voidwindowIconified(WindowEvent event)Window iconified event.voidwindowOpened(WindowEvent event)Window opened event.
-
-
-
Constructor Detail
-
AutoReleaseListener
public AutoReleaseListener(BuilderData data)
Creates a new instance ofAutoReleaseListenerand sets theBuilderDataobject to be released automatically. This object must be fully initialized.- Parameters:
data- theBuilderDataobject (must not be null)- Throws:
IllegalArgumentException- if the data object is null or properties required are not set
-
-
Method Detail
-
windowActivated
public void windowActivated(WindowEvent event)
Window activated event. This is just a dummy implementation.- Specified by:
windowActivatedin interfaceWindowListener- Parameters:
event- the event
-
windowClosed
public void windowClosed(WindowEvent event)
The window was closed. This will cause theBuilderDataobject to be released.- Specified by:
windowClosedin interfaceWindowListener- Parameters:
event- the event
-
windowDeactivated
public void windowDeactivated(WindowEvent event)
Window deactivated event. This is just a dummy implementation.- Specified by:
windowDeactivatedin interfaceWindowListener- Parameters:
event- the event
-
windowDeiconified
public void windowDeiconified(WindowEvent event)
Window deiconified event. This is just a dummy implementation.- Specified by:
windowDeiconifiedin interfaceWindowListener- Parameters:
event- the event
-
windowIconified
public void windowIconified(WindowEvent event)
Window iconified event. This is just a dummy implementation.- Specified by:
windowIconifiedin interfaceWindowListener- Parameters:
event- the event
-
windowOpened
public void windowOpened(WindowEvent event)
Window opened event. This is just a dummy implementation.- Specified by:
windowOpenedin interfaceWindowListener- Parameters:
event- the event
-
windowClosing
public void windowClosing(WindowEvent event)
Window closing event. This is just a dummy implementation.- Specified by:
windowClosingin interfaceWindowListener- Parameters:
event- the event
-
-