-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathEmployeeTableModel.java
More file actions
46 lines (35 loc) · 907 Bytes
/
EmployeeTableModel.java
File metadata and controls
46 lines (35 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;
public class EmployeeTableModel extends AbstractTableModel {
ArrayList<EmployeeDTO> empList ;
private String columns[]={"Id","Name","Salary"};
public EmployeeTableModel(ArrayList<EmployeeDTO> empList) {
this.empList = empList;
}
@Override
public int getRowCount() {
// TODO Auto-generated method stub
return empList.size();
}
@Override
public int getColumnCount() {
// TODO Auto-generated method stub
return columns.length;
}
public String getColumnName(int col) {
return columns[col];
}
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
EmployeeDTO empObject = empList.get(rowIndex);
switch(columnIndex){
case 0:
return empObject.getId();
case 1:
return empObject.getName();
case 2:
return empObject.getSalary();
}
return null;
}
}