| 1 | |
package br.mia.test.view.tabelas; |
| 2 | |
|
| 3 | |
import java.util.List; |
| 4 | |
|
| 5 | |
import javax.swing.JTable; |
| 6 | |
import javax.swing.table.AbstractTableModel; |
| 7 | |
|
| 8 | |
import br.mia.test.controler.ControladorErro; |
| 9 | |
import br.mia.test.model.Projeto; |
| 10 | |
|
| 11 | 0 | public class TabelaModeloProjetoDetalhe extends AbstractTableModel { |
| 12 | 0 | |
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
private static final long serialVersionUID = 1L; |
| 17 | |
|
| 18 | |
private List<Projeto> projetos; |
| 19 | |
|
| 20 | |
private JTable tabelaProjeto; |
| 21 | |
|
| 22 | |
public JTable getTabelaProjeto() { |
| 23 | 0 | return tabelaProjeto; |
| 24 | 0 | } |
| 25 | |
|
| 26 | |
public void setTabelaProjeto(JTable tabelaProjeto) { |
| 27 | 0 | this.tabelaProjeto = tabelaProjeto; |
| 28 | 0 | } |
| 29 | 0 | |
| 30 | |
public int getRowCount() { |
| 31 | |
|
| 32 | 0 | return 2; |
| 33 | 0 | } |
| 34 | |
|
| 35 | |
public List<Projeto> getProjetos() { |
| 36 | 0 | return projetos; |
| 37 | 0 | } |
| 38 | |
|
| 39 | |
public void setProjetos(List<Projeto> list) { |
| 40 | 0 | this.projetos = list; |
| 41 | 0 | } |
| 42 | 0 | |
| 43 | |
public int getColumnCount() { |
| 44 | 0 | return 1; |
| 45 | 0 | } |
| 46 | |
|
| 47 | |
public Object getValueAt(int rowIndex, int columnIndex) { |
| 48 | |
|
| 49 | 0 | int select = this.tabelaProjeto.getSelectedRow(); |
| 50 | 0 | if (select >= 0) { |
| 51 | 0 | Projeto projeto = (Projeto) this.projetos.get(select); |
| 52 | 0 | |
| 53 | |
try { |
| 54 | |
|
| 55 | 0 | if (rowIndex == 0) { |
| 56 | 0 | |
| 57 | 0 | return "Total de Casos de teste " |
| 58 | 0 | + projeto.getNumeroCasosTeste(); |
| 59 | 0 | |
| 60 | |
} |
| 61 | 0 | if (rowIndex == 1) { |
| 62 | 0 | try { |
| 63 | |
|
| 64 | 0 | return "Total de Casos de Testes Executados " |
| 65 | 0 | + projeto.getNumeroCasosTesteExecutados(); |
| 66 | 0 | } catch (Exception e) { |
| 67 | 0 | ControladorErro.trata(e, this); |
| 68 | 0 | } |
| 69 | |
|
| 70 | |
} |
| 71 | 0 | } catch (Exception e) { |
| 72 | 0 | ControladorErro.trata(e, this); |
| 73 | 0 | } |
| 74 | |
} |
| 75 | 0 | return -1; |
| 76 | 0 | } |
| 77 | |
|
| 78 | |
@Override |
| 79 | |
public String getColumnName(int column) { |
| 80 | 0 | return "Indicadores"; |
| 81 | 0 | } |
| 82 | |
|
| 83 | |
} |