package smart_gs.reasoning_web.swingui;

import java.awt.Component;
import java.util.ArrayList;
import java.util.EventObject;
import java.util.List;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellEditor;

import reasoning_web.logical.Connection;
import reasoning_web.logical.inter_face.RWElement;
import smart_gs.debugprint.Debugprint;
import smart_gs.logical.GSResource;
import smart_gs.logical.Region;
import smart_gs.reasoning_web.logical.GSConnection;
import smart_gs.reasoning_web.logical.GS_RWElement;
import smart_gs.reasoning_web.logical.GS_RWRepository;
import smart_gs.reasoning_web.swingui.view.View;

public abstract class ResourceTable extends JTable {
	
	public ResourceTable(ResourceTableModel model) {
		this.setModel(model);
		this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
	}


	public int getSelectedResourceIndex() {
		return this.getSelectedRow();
	}
	
	@Override
	public boolean isCellEditable(int row, int column) {
		return false;
		
		//If a region's name (title) is to be editable from the table, use the following.
		//You must implement a way to get the result of the edition of a cell.
//	    if (row == RegionTableModel.NAME) {
//	    	return true;
//		} else {
//			return false;
//		}
	}
	
	public ResourceTableModel getResourceTableModel() {
		return (ResourceTableModel)this.getModel();
	}
	
	
	
	
	
	
	class MarkupTableModelListener implements TableModelListener {

		@Override
		public void tableChanged(TableModelEvent e) {
			// TODO Auto-generated method stub
			
		}
		
	}

	class ConnectionTableModelListener implements TableModelListener {

		@Override
		public void tableChanged(TableModelEvent e) {
			// TODO Auto-generated method stub
			
		}
		
	}



}