/*
 * Created on 2005-5-13
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package org.huihoo.god4j;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;

import org.huihoo.god4j.actions.Close;
import org.huihoo.god4j.actions.Quit;


public class WindowAdapterEx extends WindowAdapter
{
	public WindowAdapterEx()
	{
		GOD4JFactory.getGOD4J().setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
	}
	
	/**
	 * Invoked when a window is in the process of being closed.
	 * The close operation can be overridden at this point.
	 */
	public void windowClosing(WindowEvent e)
	{
		if(Close.closeDocumentIfPossible())
		{
			Quit.savePreferencesToFile();
			System.exit(0);
		}
	}
	
	/**
	 * Invoked when a window is activated.
	 */
	public void windowActivated(WindowEvent e) 
	{
		
	}
}
