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
WindowListener
implementation for implementing the auto release mechanism supported by builders.The results produced by a
Builder
usually 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 theBuilderData
object 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 theautoRelease
property ofBuilderData
has to be set to true.This class implements the functionality for automatically releasing a
BuilderData
object when a window (i.e. the main window produced by the builder script) is closed. It does not rely on a concreteBuilder
implementation and thus can be used with arbitrary implementations. Concrete implementations of theBuilder
interface 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
BuilderData
object 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 ofAutoReleaseListener
and sets theBuilderData
object to be released automatically.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
windowActivated(WindowEvent event)
Window activated event.void
windowClosed(WindowEvent event)
The window was closed.void
windowClosing(WindowEvent event)
Window closing event.void
windowDeactivated(WindowEvent event)
Window deactivated event.void
windowDeiconified(WindowEvent event)
Window deiconified event.void
windowIconified(WindowEvent event)
Window iconified event.void
windowOpened(WindowEvent event)
Window opened event.
-
-
-
Constructor Detail
-
AutoReleaseListener
public AutoReleaseListener(BuilderData data)
Creates a new instance ofAutoReleaseListener
and sets theBuilderData
object to be released automatically. This object must be fully initialized.- Parameters:
data
- theBuilderData
object (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:
windowActivated
in interfaceWindowListener
- Parameters:
event
- the event
-
windowClosed
public void windowClosed(WindowEvent event)
The window was closed. This will cause theBuilderData
object to be released.- Specified by:
windowClosed
in interfaceWindowListener
- Parameters:
event
- the event
-
windowDeactivated
public void windowDeactivated(WindowEvent event)
Window deactivated event. This is just a dummy implementation.- Specified by:
windowDeactivated
in interfaceWindowListener
- Parameters:
event
- the event
-
windowDeiconified
public void windowDeiconified(WindowEvent event)
Window deiconified event. This is just a dummy implementation.- Specified by:
windowDeiconified
in interfaceWindowListener
- Parameters:
event
- the event
-
windowIconified
public void windowIconified(WindowEvent event)
Window iconified event. This is just a dummy implementation.- Specified by:
windowIconified
in interfaceWindowListener
- Parameters:
event
- the event
-
windowOpened
public void windowOpened(WindowEvent event)
Window opened event. This is just a dummy implementation.- Specified by:
windowOpened
in interfaceWindowListener
- Parameters:
event
- the event
-
windowClosing
public void windowClosing(WindowEvent event)
Window closing event. This is just a dummy implementation.- Specified by:
windowClosing
in interfaceWindowListener
- Parameters:
event
- the event
-
-