///*******************************************************************************
// * 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.letterlist;
//
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Vector;
//
//import javax.swing.event.TableModelEvent;
//import javax.swing.event.TableModelListener;
//import javax.swing.table.AbstractTableModel;
//
//import lu.tudor.santec.gecamed.patient.ejb.session.interfaces.IncidentManager;
//import lu.tudor.santec.gecamed.patient.gui.history.table.HistRow;
//import lu.tudor.santec.gecamed.patient.gui.history.table.HistoryTableModel;
//import lu.tudor.santec.gecamed.patient.gui.history.table.filter.HistoryTypeFilter;
//
///*
// *  Table model for table that shows the letters of a patient
// */
//
//public class TableModel extends AbstractTableModel implements TableModelListener{
//
//	/**
//	 * 
//	 */
//	private static final long serialVersionUID = 1L;
//	
//	private static final String[] columnNames = {"Name", "Type", "MimeType", "Description", "CreatedOn", "Createdby", "ModifiedOn" ,"Modifiedby"}; 
//	
//	private HistoryTableModel historyTableModel;
//	private List<HistRow> data;
//	private Vector<String> types = new Vector<String>();
//
////	private LetterPanel panel;
//
//	private HistoryTypeFilter typeFilter;
//
//	
//	
//	
//	
//	/**
//	 * @param historyTableModel
//	 * @param panel
//	 */
//	public TableModel(HistoryTableModel historyTableModel) {
//		/* ================================================== */
////		this.panel = panel ;
//		types.add("letter");
//		
//		this.historyTableModel =  historyTableModel;
//		this.historyTableModel.addTableModelListener(this);
//		data =  new ArrayList<HistRow>();
//		/* ------------------------------------------------------- */
//		// install a type filter
//		/* ------------------------------------------------------- */
//		this.typeFilter = new HistoryTypeFilter();
//		this.typeFilter.setFilter(IncidentManager.LETTER);
//		
//		this.historyTableModel.installFilter(typeFilter, 2);
//		this.historyTableModel.setFilteringEnabled(true, 2);
//		/* ================================================== */
//	}
//
//	public int getColumnCount() {
//		return columnNames.length;
//	}
//
//	public int getRowCount() {
//		if (data == null)
//			return 0;
//		return data.size();
//	}
//
//	public Object getValueAt(int rowIndex, int columnIndex) {
//		switch(columnIndex){
//		case 0: return data.get(rowIndex).getEntry().getFileName();
//		case 1: return data.get(rowIndex).getEntry().getEntryType().getName();
//		case 2: return data.get(rowIndex).getEntry().getEntryType().getName();
//		case 3: return data.get(rowIndex).getEntry().getTextContent();
//		case 4: return data.get(rowIndex).getEntry().getCreated();
//		case 5: return data.get(rowIndex).getEntry().getCreatedBy();
//		case 6: return data.get(rowIndex).getEntry().getModified();
//		case 7: return data.get(rowIndex).getEntry().getModifiedBy();
//		default:return "";
//		}
//	}
//
//	@Override
//	public String getColumnName(int column) {
//		return columnNames[column];
//	}
//
//	public List<HistRow> getData() {
//		return data;
//	}
//
//	public void setData(List<HistRow> data) {
//		this.data = data;
//		fireTableRowsUpdated(0, getRowCount());
//	}
//
//	public void reset() {
//		data =  this.historyTableModel.getHistoryData();
//		System.out.println("TableModel::83");
//		fireTableRowsUpdated(0, getRowCount());
//	}
//	
//	public HistRow getObjectAtRow(int row){
//		return data.get(row);
//	}
//
//	public void tableChanged(TableModelEvent e) {
//		data =  this.historyTableModel.getHistoryData();
//		System.out.println("TableModel::93");
//		fireTableChanged(e);
////		panel.setTableData(data);
//	}
//}
