///////////////////////////////////////////////////////////////////////////////
//                   ALL STUDENTS COMPLETE THESE SECTIONS
// Title:            Satisfiability Test
// Files:            ABMatrix.java, CdbTuple.java, Dialog1.java, Frame1.java,
//                   JTableHeaderToolTips.java, Mytest.java, RowNumberHeader.java
// Semester:         Spring 2007
//
// Author:           Hang Yue, yuehang366@gmail.com
// CS Login:         hyue
// Lecturer's Name:  Dr.Peter Revesz
// Lab Section:      (your lab section number)
//
//                   PAIR PROGRAMMERS COMPLETE THIS SECTION
// Pair Partner:     (name of your pair programming partner)
// CS Login:         (partner's login name)
// Lecturer's Name:  (name of your partner's lecturer)
// Lab Section:      (your partner's lab section number)
//
//                   STUDENTS WHO GET HELP FROM ANYONE OTHER THAN THEIR PARTNER
// Credits:          Scot Anderson
//////////////////////////// 80 columns wide //////////////////////////////////
package satisfiablitytest;

import java.io.Serializable;
import javax.swing.*;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;


public class RowNumberHeader extends JTable implements Serializable
{
	/**
	 * for Serializable interface
	 */
	      private static final long serialVersionUID = 5336783793567570867L;
	    /**
	  	 * insert the header including row no. into table by transfering maintable object to Dialog1 class
	  	 */
	      protected JTable mainTable;
	 
	 class RowNumberTableModel extends AbstractTableModel 
	  {
		 /**
		  * for Serializable interface
		  */
		 private static final long serialVersionUID = 5336783767567570867L;
			 
	       RowNumberTableModel()
		   {
		   }
	       public int getRowCount()
	       {
	            return mainTable.getModel().getRowCount();
	       }

	       public int getColumnCount()
	       {
	            return 1;
	       }

	       public Object getValueAt(int row, int column)
	       {
	            return new Integer(row + 1);
	       }
   
	  }


  public int getRowHeight(int row)
  {
       return mainTable.getRowHeight();
  }


  public RowNumberHeader(JTable table)
  {
       mainTable = table;
       setModel(new RowNumberTableModel());
       setPreferredScrollableViewportSize(getMinimumSize());
       LookAndFeel.installBorder(this, "TableHeader.cellBorder");
  }
  
}
