/*
 * TimeTable.java
 *
 * Created on 26. listopad 2000, 17:46
 */

package timetable.gui;

import javax.swing.*;
import javax.swing.table.*;
/**
 *
 * @author  Administrator
 * @version 
 */
public class TimeTableTable extends DNDTable {
    public TimeTableModel dataModel;
    public JScrollPane scrollPane;
    static int ROW_HEIGHT =55 ,COLUMN_WIDTH= 55;

    /** Creates new TimeTable */
    public TimeTableTable(TimeTableModel dataModel,JScrollPane scrollPane,DNDTableEngine DNDengine) {
        super(dataModel);
        this.dataModel=dataModel;
        this.dataModel.setTable(this);
        this.scrollPane=scrollPane;
        this.setDNDTableEngine(DNDengine);
        
        scrollPane.setViewportView(this);

        this.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        
        javax.swing.table.TableColumn tableColumn;
        for (int c=0;c<dataModel.getColumnCount();c++) {
	    tableColumn = getColumn(dataModel.getColumnName(c));
            tableColumn.setCellRenderer(dataModel);
            if (c==0) tableColumn.setPreferredWidth(30); else tableColumn.setPreferredWidth(COLUMN_WIDTH);
  	    tableColumn.setCellEditor(dataModel); 
        }
        setRowHeight(ROW_HEIGHT);
    }
    
    public TimeTableModel getTTModel() {
        return this.dataModel;
    }
    
        /** override metody ktera zaznamenava zmenu aktivniho radku */
        public void valueChanged(javax.swing.event.ListSelectionEvent e)
        {
          super.valueChanged(e);
/*          if (dataModel==null) return;
          dataModel.selectedRow = getSelectedRow();
          dataModel.selectedColumn = getSelectedColumn();*/
        }
     

}
