1 | |
package br.mia.test.view.tabelas; |
2 | |
|
3 | |
import java.util.List; |
4 | |
|
5 | |
import javax.swing.table.AbstractTableModel; |
6 | |
|
7 | |
import br.mia.test.model.Build; |
8 | |
|
9 | 0 | public class TabelaModeloBuild extends AbstractTableModel { |
10 | 0 | |
11 | |
private List<Build> builds; |
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
private static final long serialVersionUID = 1L; |
17 | |
|
18 | |
|
19 | |
|
20 | |
public String getColumnName(int arg0) { |
21 | |
|
22 | 0 | String[] nomes = { "Nome" }; |
23 | 0 | |
24 | 0 | return nomes[arg0]; |
25 | 0 | } |
26 | |
|
27 | |
public int getColumnCount() { |
28 | 0 | return 1; |
29 | 0 | } |
30 | |
|
31 | |
public int getRowCount() { |
32 | 0 | if (this.builds != null) { |
33 | 0 | return this.builds.size(); |
34 | 0 | } |
35 | 0 | return 0; |
36 | 0 | } |
37 | |
|
38 | |
public Object getValueAt(int arg0, int arg1) { |
39 | 0 | if (arg1 == 0) { |
40 | 0 | Build build=(Build) this.builds.get(arg0); |
41 | 0 | return build.getNome(); |
42 | 0 | } |
43 | |
|
44 | 0 | return "Nenhum"; |
45 | 0 | } |
46 | |
|
47 | |
@SuppressWarnings("unchecked") |
48 | |
public Class getColumnClass(int c) { |
49 | 0 | return getValueAt(0, c).getClass(); |
50 | 0 | } |
51 | |
|
52 | |
public boolean isCellEditable(int arg0, int arg1) { |
53 | |
|
54 | 0 | return true; |
55 | 0 | } |
56 | |
|
57 | |
public List<Build> getBuilds() { |
58 | 0 | return builds; |
59 | 0 | } |
60 | |
|
61 | |
public void setBuilds(List<Build> builds2) { |
62 | 0 | this.builds = builds2; |
63 | 0 | } |
64 | 0 | |
65 | |
} |