package org.simantics.district.network.ui.table; import java.util.Collection; import org.eclipse.nebula.widgets.nattable.data.IDataProvider; public class TableDataProvider implements IDataProvider { private String[][] data = null; @Override public Object getDataValue(int columnIndex, int rowIndex) { if (data == null) { return null; } else { return data[rowIndex][columnIndex]; } } @Override public void setDataValue(int columnIndex, int rowIndex, Object newValue) { } @Override public int getColumnCount() { if (data == null) { return 10; } else { return data[0].length; } } @Override public int getRowCount() { if (data == null) { return 10; } else { return data.length; } } public boolean isEditable(int columnIndex, int rowIndex) { return false; } public void setDataValues(Collection pasteColumn, int pasteRow, String[][] fullData) { // start always from row index 0 and column index 0 this.data = fullData; } public String[][] getCurrentData() { return data; } }