/**
 * 
 */
package org.corpus_tools.atomic.grideditor.data;

import org.corpus_tools.atomic.grideditor.data.annotationgrid.AnnotationGrid;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;

/**
 * @author Stephan Druskat
 * 
 * // TODO Add description
 *
 */
public class AnnotationGridDataProvider implements IDataProvider {

	private AnnotationGrid annotationTable;

	public AnnotationGridDataProvider(AnnotationGrid annotationTable) {
		this.annotationTable = annotationTable;
//		System.err.println("CREATE PROVIDER");
	}

	/* (non-Javadoc)
	 * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getDataValue(int, int)
	 */
	@Override
	public Object getDataValue(int columnIndex, int rowIndex) {
		return annotationTable.get(rowIndex, columnIndex);
	}

//	private Object getColumnIndex() {
//		colKeySet = annotationTable.columnKeySet()
//		return null;
//	}

	/* (non-Javadoc)
	 * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#setDataValue(int, int, java.lang.Object)
	 */
	@Override
	public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
		// TODO Auto-generated method stub

	}

	/* (non-Javadoc)
	 * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getColumnCount()
	 */
	@Override
	public int getColumnCount() {
		return annotationTable.getHeaderMap().size();
	}

	/* (non-Javadoc)
	 * @see org.eclipse.nebula.widgets.nattable.data.IDataProvider#getRowCount()
	 */
	@Override
	public int getRowCount() {
		return annotationTable.getRowMap().size();
	}

//	/* (non-Javadoc)
//	 * @see org.eclipse.nebula.widgets.nattable.data.ISpanningDataProvider#getCellByPosition(int, int)
//	 */
//	@Override
//	public DataCell getCellByPosition(int columnPosition, int rowPosition) {
//		// TODO Auto-generated method stub
//		return null;
//	}

	/**
	 * @return the annotationTable
	 */
	public AnnotationGrid getAnnotationTable() {
		return annotationTable;
	}

	/**
	 * @param annotationTable the annotationTable to set
	 */
	public void setAnnotationTable(AnnotationGrid annotationTable) {
		this.annotationTable = annotationTable;
	}

}

@@ -368,21 +368,20 @@
 notation
-Table
+Grid
 ;%0A%0A%09publ
@@ -453,37 +453,36 @@
 %09this.annotation
-Table
+Grid
  = annotationTab
@@ -729,29 +729,28 @@
 n annotation
-Table
+Grid
 .get(rowInde
@@ -833,21 +833,20 @@
 notation
-Table
+Grid
 .columnK
@@ -1294,29 +1294,28 @@
 n annotation
-Table
+Grid
 .getHeaderMa
@@ -1489,21 +1489,20 @@
 notation
-Table
+Grid
 .getRowM
@@ -1829,21 +1829,20 @@
 notation
-Table
+Grid
 %0A%09 */%0A%09p
@@ -1900,29 +1900,28 @@
 n annotation
-Table
+Grid
 ;%0A%09%7D%0A%0A%09/**%0A%09
@@ -1940,21 +1940,20 @@
 notation
-Table
+Grid
  the ann
@@ -1959,21 +1959,20 @@
 notation
-Table
+Grid
  to set%0A
@@ -2059,21 +2059,20 @@
 notation
-Table
+Grid
  = annot

Rename annotationTable to annotationGrid