///*******************************************************************************
// * This file is part of GECAMed.
// * 
// * GECAMed is free software: you can redistribute it and/or modify
// * it under the terms of the GNU Lesser General Public License (L-GPL) as published by
// * the Free Software Foundation, either version 3 of the License, or
// * (at your option) any later version.
// * 
// * GECAMed is distributed in the hope that it will be useful,
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// * GNU Lesser General Public License for more details.
// * 
// * You should have received a copy of the GNU Lesser General Public License (L-GPL)
// * along with GECAMed.  If not, see <http://www.gnu.org/licenses/>.
// * 
// * GECAMed is Copyrighted by the Centre de Recherche Public Henri Tudor (http://www.tudor.lu)
// * (c) CRP Henri Tudor, Luxembourg, 2008
// *******************************************************************************/
//package lu.tudor.santec.gecamed.letter.gui.dialogs;
//
//import java.awt.Color;
//import java.awt.event.ActionEvent;
//import java.awt.event.ActionListener;
//
//import javax.swing.JButton;
//import javax.swing.JDialog;
//import javax.swing.JFileChooser;
//import javax.swing.JLabel;
//import javax.swing.JPanel;
//
//import lu.tudor.santec.gecamed.core.gui.GECAMedColors;
//import lu.tudor.santec.gecamed.core.gui.GECAMedIconNames;
//import lu.tudor.santec.gecamed.core.gui.GECAMedModule;
//import lu.tudor.santec.gecamed.core.gui.MainFrame;
//import lu.tudor.santec.gecamed.core.utils.controller.utils.FileUtils;
//import lu.tudor.santec.i18n.Translatrix;
//import ooo.connector.BootstrapSocketConnector;
//
//import org.apache.log4j.Level;
//import org.apache.log4j.Logger;
//
//import com.jgoodies.forms.layout.CellConstraints;
//import com.jgoodies.forms.layout.FormLayout;
//
//public class WriterInstallationSelector extends JDialog {
//
//    	/**
//	 * static logger for this class
//	 */
//	private static Logger logger = Logger
//		.getLogger(WriterInstallationSelector.class.getName());
//    
//	private static final long serialVersionUID = 1L;
//	private String path;
//
//	public WriterInstallationSelector() {
//		super(MainFrame.getInstance(), true);
//		setTitle(Translatrix.getTranslationString("LetterTemplateModule.dialog.selectinstallation.title"));
//		setSize(500,150);
//		
//		CellConstraints cc = new CellConstraints();
//		JPanel contentPanel = new JPanel();
//		contentPanel.setLayout(new FormLayout("fill:pref:grow,pref,20dlu","30dlu,30dlu"));
//		contentPanel.setBackground(GECAMedColors.c_GECAMedBackground);
//		
//		JLabel lHelpText = new JLabel(Translatrix.getTranslationString("LetterTemplateModule.dialog.selectinstallation.help"));
//		
//		final JLabel lIcon = new JLabel();
//		lIcon.setIcon(GECAMedModule.getMediumIcon(GECAMedIconNames.CANCEL));
//		
//		final JLabel lPath = new JLabel();
//		
//		final JFileChooser chooser = new JFileChooser();
//		chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
//		JButton bSelect = new JButton("Select");
//		bSelect.addActionListener(new ActionListener() {
//
//			public void actionPerformed(ActionEvent e) {
//				int returnVal = chooser
//						.showOpenDialog(WriterInstallationSelector.this);
//				if (returnVal == JFileChooser.APPROVE_OPTION) {
//					try {
//						BootstrapSocketConnector
//								.bootstrap(FileUtils.adeptInstallPath(chooser
//										.getSelectedFile().getPath()));
//						path = FileUtils.adeptInstallPath(chooser
//								.getSelectedFile().getPath());
//						lPath.setText(chooser
//								.getSelectedFile().getPath());
//						lPath.setForeground(new Color(83,193,99));
//						lIcon.setIcon(GECAMedModule.getMediumIcon(GECAMedIconNames.OK));
//					} catch (Exception ex) {
//					    
//						lIcon.setIcon(GECAMedModule.getMediumIcon(GECAMedIconNames.CANCEL));
//						lPath.setText(chooser
//								.getSelectedFile().getPath());
//						lPath.setForeground(Color.RED);
//						logger.log(Level.WARN, "No openoffice found", ex);
//					}
//				}
//			}
//		});
//				
//		contentPanel.add(lHelpText, cc.xyw(1, 1, 3));
//		contentPanel.add(lPath, cc.xy(1,2));
//		contentPanel.add(bSelect,cc.xy(2, 2));
//		contentPanel.add(lIcon, cc.xy(3,2));
//		setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
//		add(contentPanel);
//		setVisible(true);
//	}
//
//	@Override
//	public void dispose() {
//		this.setVisible(false);
//		
//	}
//	public void disposeDialog(){
//		super.dispose();
//	}
//
//	public String getPath() {
//		return path;
//	}
//}
