/*******************************************************************************
 * 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.listeners;
//
//import java.awt.event.ActionEvent;
//import java.awt.event.ActionListener;
//
//import javax.swing.JButton;
//import javax.swing.JDialog;
//
//import lu.tudor.santec.gecamed.core.gui.MainFrame;
//import lu.tudor.santec.gecamed.core.utils.ManagerFactory;
//import lu.tudor.santec.gecamed.letter.gui.LetterPanel;
//import lu.tudor.santec.gecamed.letter.gui.components.LimitedTextArea;
//import lu.tudor.santec.gecamed.patient.ejb.session.beans.IncidentManagerBean;
//import lu.tudor.santec.gecamed.patient.ejb.session.interfaces.IncidentManager;
//import lu.tudor.santec.gecamed.patient.gui.PatientManagerModule;
//import lu.tudor.santec.gecamed.patient.gui.history.table.HistoryTableModel.HistRow;
//
//import com.jgoodies.forms.layout.CellConstraints;
//import com.jgoodies.forms.layout.FormLayout;
//
///*
// * This class shows a dialog for teh input of a description, and changes the desctiprion of a letter to 
// * that input
// */
//
//public class ChangeLetterDescription implements ActionListener {
//	private HistRow row;
//
//	public void actionPerformed(ActionEvent e) {
//		int row_number = LetterPanel.getInstance().getTable().getSelectedRow();
//		if (row_number > -1) {
//			row = LetterPanel.getInstance().getTableData().get(row_number);
//
//			String description = row.getEntry().getTextContent();
//
//			DescriptionDialog dialog = new DescriptionDialog(description);
//
//			if (dialog.hasChanged()) {
//				row.getEntry().setTextContent(
//						dialog.getTDescription().getText());
//				IncidentManager iManager = (IncidentManager) ManagerFactory
//						.getRemote(IncidentManagerBean.class);
//				iManager.saveEntry(row.getEntry(), IncidentManagerBean.LETTER);
//				PatientManagerModule.getInstance().getPatientPanel()
//						.reloadHistory();
//			}
//		}
//	}
//
//}
//
///*
// * Dialog to enter a new description
// */
//
//class DescriptionDialog extends JDialog implements ActionListener {
//	/**
//	 * 
//	 */
//	private static final long serialVersionUID = 1L;
//
//	private LimitedTextArea tDescription;
//
//	private boolean changed = false;
//
//	public DescriptionDialog(String desc) {
//		setLayout(new FormLayout("fill:pref:grow", "fill:pref:grow,15dlu"));
//		tDescription = new LimitedTextArea(300);
//		tDescription.setText(desc);
//		tDescription.setLineWrap(true);
//		this.add(tDescription, new CellConstraints().xy(1, 1));
//		JButton bSave = new JButton("Save");
//		bSave.addActionListener(this);
//		setTitle("LetterTemplateModule.menu.changedescription");
//		setLocationRelativeTo(MainFrame.getInstance());
//		this.add(bSave, new CellConstraints().xy(1, 2));
//		this.setSize(300, 200);
//		setModal(true);
//		this.setVisible(true);
//	}
//
//	public boolean hasChanged() {
//		return changed;
//	}
//
//	public void actionPerformed(ActionEvent e) {
//		changed = true;
//		this.setVisible(false);
//	}
//
//	public LimitedTextArea getTDescription() {
//		return tDescription;
//	}
//
//	public void setTDescription(LimitedTextArea description) {
//		tDescription = description;
//	}
//}
