I have this typed DataRow:
import org.jdesktop.dataset.DataRow;
public class MainDataRow extends DataRow {
private MainDataTable baseDataTable;
protected MainDataRow(MainDataTable dt) {
super(dt);
this.baseDataTable = dt;
}
public int getId() { return (int) super.getValue(baseDataTable.getId()); };
public void setId(int id) { super.setValue(baseDataTable.getColId(), id); };
public int getDelta() { return (int) super.getValue(baseDataTable.getColDelta()); };
public void setDelta(int delta) { super.setValue(baseDataTable.getColDelta(), delta); };
public String getNombre() { return (String) super.getValue(baseDataTable.getColNombre()); };
public void setNombre(String nombre) { super.setValue(baseDataTable.getColNombre(), nombre); };
MainDataTable is well formed and is working fine. Now what I'm trying to do is to append a new row to MainDataTable:
MainDataTable dt = new MainDataTable(ds);
MainDataRow dr = (MainDataRow) dt.appendRow();
I'm getting ClassCastException. Where is the problem? Thanks.
Edit MainDataTable is a typed DataTable with no overriding on appendRow():
public class TypedDataTable<TypeOfRow> extends DataTable {
...
}
public class MainDataTable extends TypedDataTable<MainDataRow> {
...
}