Fixed bugs

This commit is contained in:
Anthony committed 2018-05-31 19:40:10 -04:00
1 parent 8134d11a8c
commit 47289d240e
2 files changed
+25 -1

No files matched your search

@@ -30,6 +30,14 @@ public class MRowModel {
return row; return row;
} }
public Object getItem(int index) {
try {
return row.get(index);
} catch (Exception e) {
return null;
}
}
@Override @Override
public String toString() { public String toString() {
return row.toString(); return row.toString();
@@ -14,7 +14,7 @@ import java.util.List;
public class MTableModel { public class MTableModel {
private List<String> column; private List<String> column;
private MRowsModel rows; private MRowsModel rows;
private String tableName;
public MTableModel() { public MTableModel() {
@@ -22,6 +22,12 @@ public class MTableModel {
this.rows = new MRowsModel(); this.rows = new MRowsModel();
} }
public MTableModel(String tableName) {
this.column = new LinkedList<>();
this.rows = new MRowsModel();
this.tableName = tableName;
}
public MTableModel(String... columns) { public MTableModel(String... columns) {
this.column = new LinkedList<>(); this.column = new LinkedList<>();
this.rows = new MRowsModel(); this.rows = new MRowsModel();
@@ -44,7 +50,17 @@ public class MTableModel {
} }
public List<Object> getRow(int index) { public List<Object> getRow(int index) {
if (getNbRows() != 0)
return rows.getRowModel(index).getRow(); return rows.getRowModel(index).getRow();
return null;
}
public MRowModel getRowModel(int rowIndex) {
if (getNbRows() != 0)
return rows.getRowModel(rowIndex);
return new MRowModel();
} }
public List<String> getColumns() { public List<String> getColumns() {