1 | |
package br.mia.test.view; |
2 | |
|
3 | |
import java.awt.GridBagLayout; |
4 | |
import java.io.IOException; |
5 | |
import java.sql.SQLException; |
6 | |
import java.util.ArrayList; |
7 | |
import java.util.List; |
8 | |
|
9 | |
import javax.swing.JInternalFrame; |
10 | |
import javax.swing.JScrollPane; |
11 | |
import javax.swing.JTable; |
12 | |
import javax.swing.JTextField; |
13 | |
|
14 | |
import br.mia.test.model.PlanoTeste; |
15 | |
import br.mia.test.model.Projeto; |
16 | |
import br.mia.test.model.dao.DAOPlano; |
17 | |
import br.mia.test.view.factory.FabricaView; |
18 | |
import br.mia.test.view.factory.ItemTela; |
19 | |
import br.mia.test.view.observers.ObserverPlano; |
20 | |
import br.mia.test.view.tabelas.TabelaModeloFuncionarios; |
21 | |
import br.mia.test.view.tabelas.TabelaModeloPlano; |
22 | |
|
23 | |
public class TelaPlanoTestes extends JInternalFrame { |
24 | |
|
25 | |
private static final long serialVersionUID = 1L; |
26 | |
|
27 | |
int selectedFlow; |
28 | |
|
29 | |
TabelaModeloFuncionarios modelo; |
30 | |
|
31 | |
JTable tabelaPlano; |
32 | |
|
33 | |
public TelaPlanoTestes(Projeto projeto) throws IOException, |
34 | |
InstantiationException, IllegalAccessException, |
35 | 0 | ClassNotFoundException, SQLException { |
36 | 0 | super("Funcion�rios", true, true, true, true); |
37 | 0 | this.setLayout(new GridBagLayout()); |
38 | 0 | this.setTitle("Planos"); |
39 | 0 | |
40 | 0 | DAOPlano dao = new DAOPlano(); |
41 | 0 | List<PlanoTeste> planos = null; |
42 | 0 | |
43 | 0 | planos = dao.select(projeto); |
44 | 0 | |
45 | 0 | Global global = new Global(); |
46 | 0 | |
47 | 0 | JTextField nome = new JTextField(50); |
48 | 0 | JTextField card = new JTextField(10); |
49 | 0 | |
50 | 0 | TabelaModeloPlano modelo = new TabelaModeloPlano(); |
51 | 0 | modelo.setPlanos(planos); |
52 | 0 | |
53 | 0 | this.tabelaPlano = new JTable(modelo); |
54 | |
|
55 | 0 | |
56 | 0 | this.tabelaPlano.revalidate(); |
57 | 0 | |
58 | 0 | ArrayList<ItemTela> objetos = new ArrayList<ItemTela>(); |
59 | 0 | |
60 | 0 | ObserverPlano observer = new ObserverPlano(); |
61 | 0 | tabelaPlano.addMouseListener(observer); |
62 | 0 | |
63 | 0 | ItemTela item1 = FabricaView.createItemIconeSemLabelReduzido("novo", |
64 | 0 | "Inserir", "Insert", "Plano de Testes", observer); |
65 | 0 | objetos.add(item1); |
66 | 0 | |
67 | 0 | ItemTela item3 = FabricaView.createItemIconeSemLabelReduzido("abrir", |
68 | 0 | "Abrir Plano de Testes", "Edit", "Plano de Testes", observer); |
69 | 0 | objetos.add(item3); |
70 | 0 | |
71 | 0 | ItemTela item2 = FabricaView.createItemIconeSemLabelReduzido("delete", |
72 | 0 | "Deletar", "Delete", "Plano de Testes", observer); |
73 | 0 | objetos.add(item2); |
74 | 0 | |
75 | 0 | ItemTela item5 = FabricaView.createItemIconeSemLabelReduzido("salvar", |
76 | 0 | "Atualizar Plano", "atualizarPlano", "Plano de Testes", observer); |
77 | 0 | objetos.add(item5); |
78 | 0 | |
79 | 0 | ItemTela item4 = FabricaView.createItemTexto(nome, "Nome:", "Delete", |
80 | 0 | "Plano de Testes", observer); |
81 | 0 | objetos.add(item4); |
82 | 0 | |
83 | 0 | FabricaView.createInternal(this, objetos); |
84 | 0 | |
85 | 0 | observer.getTextFields().add(nome); |
86 | 0 | observer.getTextFields().add(card); |
87 | 0 | observer.getTables().add(tabelaPlano); |
88 | 0 | observer.setProjeto(projeto); |
89 | 0 | |
90 | 0 | observer.getModelos().add(modelo); |
91 | 0 | |
92 | 0 | JScrollPane scrollPane1 = new JScrollPane(this.tabelaPlano); |
93 | 0 | scrollPane1.setVisible(true); |
94 | 0 | |
95 | 0 | scrollPane1 |
96 | 0 | .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); |
97 | 0 | scrollPane1 |
98 | 0 | .setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); |
99 | 0 | |
100 | 0 | this.getContentPane().add(scrollPane1, global.getLayout3()); |
101 | 0 | |
102 | 0 | this.setVisible(true); |
103 | 0 | this.pack(); |
104 | 0 | |
105 | 0 | } |
106 | |
|
107 | |
} |