/*
 * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package net.java.sip.communicator.impl.gui.main.message.menu;

import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuItem;

import net.java.sip.communicator.impl.gui.main.customcontrols.AntialiasedMenuItem;
import net.java.sip.communicator.impl.gui.main.i18n.Messages;
import net.java.sip.communicator.impl.gui.main.message.ChatWindow;
import net.java.sip.communicator.impl.gui.main.utils.AntialiasingManager;
import net.java.sip.communicator.impl.gui.main.utils.ImageLoader;

public class FileMenu extends JMenu 
	implements ActionListener{

	private AntialiasedMenuItem saveMenuItem 
						= new AntialiasedMenuItem(Messages.getString("save")
									, new ImageIcon(ImageLoader.getImage(ImageLoader.SAVE_ICON)));

	private AntialiasedMenuItem printMenuItem 
						= new AntialiasedMenuItem(Messages.getString("print")
									, new ImageIcon(ImageLoader.getImage(ImageLoader.PRINT_ICON)));
	
	private AntialiasedMenuItem closeMenuItem 
						= new AntialiasedMenuItem(Messages.getString("close")
									, new ImageIcon(ImageLoader.getImage(ImageLoader.CLOSE_ICON)));
	
	private AntialiasedMenuItem quitMenuItem 
						= new AntialiasedMenuItem(Messages.getString("quit")
									, new ImageIcon(ImageLoader.getImage(ImageLoader.QUIT_ICON)));
	
	private ChatWindow parentWindow;
	
	public FileMenu(ChatWindow parentWindow){
		
		super(Messages.getString("file"));
	
		this.parentWindow = parentWindow;
		
		this.add(saveMenuItem);
		this.add(printMenuItem);
		
		this.addSeparator();
		
		this.add(closeMenuItem);
		this.add(quitMenuItem);
		
		this.saveMenuItem.setName("save");
		this.printMenuItem.setName("print");
		this.closeMenuItem.setName("close");
		this.quitMenuItem.setName("quit");
		
		this.saveMenuItem.addActionListener(this);
		this.printMenuItem.addActionListener(this);
		this.closeMenuItem.addActionListener(this);
		this.quitMenuItem.addActionListener(this);
	}
	
	public void paint(Graphics g){
		
		AntialiasingManager.activateAntialiasing(g);
	
		super.paint(g);
	}

	public void actionPerformed(ActionEvent e) {
		
		JMenuItem menuItem = (JMenuItem)e.getSource();
		String itemText = menuItem.getName();
		
		if (itemText.equalsIgnoreCase("save")){
			
		} else if (itemText.equalsIgnoreCase("print")){
			
		} else if (itemText.equalsIgnoreCase("close")){
			
			this.parentWindow.setVisible(false);
			this.parentWindow.dispose();
			
		} else if (itemText.equalsIgnoreCase("quit")){		
			
			this.parentWindow.setVisible(false);
			this.parentWindow.dispose();
			this.parentWindow.getMainFrame().setVisible(false);
			this.parentWindow.getMainFrame().dispose();			
	        System.exit(0);
		}
		
	}
}

@@ -857,36 +857,32 @@
 m saveMenuItem %0A
-%09%09%09%09
 %09%09= new Antialia
@@ -916,29 +916,24 @@
 ing(%22save%22)%0A
-%09%09%09%09%09
 %09%09%09%09, new Im
@@ -1024,36 +1024,32 @@
  printMenuItem %0A
-%09%09%09%09
 %09%09= new Antialia
@@ -1084,29 +1084,24 @@
 ng(%22print%22)%0A
-%09%09%09%09%09
 %09%09%09%09, new Im
@@ -1194,36 +1194,32 @@
  closeMenuItem %0A
-%09%09%09%09
 %09%09= new Antialia
@@ -1258,21 +1258,16 @@
 close%22)%0A
-%09%09%09%09%09
 %09%09%09%09, ne
@@ -1332,184 +1332,8 @@
 ;%0A%09%0A
-%09private AntialiasedMenuItem quitMenuItem %0A%09%09%09%09%09%09= new AntialiasedMenuItem(Messages.getString(%22quit%22)%0A%09%09%09%09%09%09%09%09%09, new ImageIcon(ImageLoader.getImage(ImageLoader.QUIT_ICON)));%0A%09%0A
 %09pri
@@ -1603,32 +1603,8 @@
 ;%0A%09%09
-this.add(quitMenuItem);%0A
 %09%09%0A%09
@@ -1723,43 +1723,8 @@
 ;%0A%09%09
-this.quitMenuItem.setName(%22quit%22);%0A
 %09%09%0A%09
@@ -1863,53 +1863,8 @@
 s);%0A
-%09%09this.quitMenuItem.addActionListener(this);%0A
 %09%7D%0A%09

Quit menu item removed from Chat Window file menu.