| 1 | |
package br.mia.test.controler; |
| 2 | |
|
| 3 | |
import java.io.IOException; |
| 4 | |
import java.sql.SQLException; |
| 5 | |
import java.util.ArrayList; |
| 6 | |
import java.util.List; |
| 7 | |
|
| 8 | |
import javax.swing.JTextField; |
| 9 | |
|
| 10 | |
import org.jgraph.JGraph; |
| 11 | |
import org.jgraph.graph.DefaultGraphCell; |
| 12 | |
|
| 13 | |
import br.mia.test.model.CasoUso; |
| 14 | |
import br.mia.test.view.graph.IGraphPane; |
| 15 | |
|
| 16 | 0 | public abstract class AbstractControlerPane |
| 17 | |
{ |
| 18 | |
Object[] selecionados; |
| 19 | |
|
| 20 | |
List<DefaultGraphCell> novos; |
| 21 | |
|
| 22 | |
public void inicializar(JGraph graph) { |
| 23 | 0 | selecionados = graph.getSelectionCells(); |
| 24 | |
|
| 25 | 0 | novos = new ArrayList<DefaultGraphCell>(); |
| 26 | |
|
| 27 | 0 | } |
| 28 | |
|
| 29 | |
public abstract void deletarEspecifico(Object[] celulas, CasoUso useCase, |
| 30 | |
List<DefaultGraphCell> remocao) throws InstantiationException, |
| 31 | |
IllegalAccessException, ClassNotFoundException, SQLException, |
| 32 | |
IOException; |
| 33 | |
|
| 34 | |
public abstract void ligarValorEspecifico(Object[] celulas, |
| 35 | |
List<DefaultGraphCell> adicao) throws InstantiationException, |
| 36 | |
IllegalAccessException, ClassNotFoundException, SQLException, |
| 37 | |
IOException; |
| 38 | |
|
| 39 | |
public abstract void ligarRegraEspecifico(Object[] celulas, |
| 40 | |
List<DefaultGraphCell> adicao); |
| 41 | |
|
| 42 | |
public abstract void ligarDadoEspecifico(Object[] celulas, |
| 43 | |
List<DefaultGraphCell> adicao); |
| 44 | |
|
| 45 | |
public abstract void criarLinkEspecifico(Object[] celulas, |
| 46 | |
List<DefaultGraphCell> adicao); |
| 47 | |
|
| 48 | |
public abstract void definirProbabilidadeEspecifico(Object[] celulas, |
| 49 | |
CasoUso useCase, List<DefaultGraphCell> adicao); |
| 50 | |
|
| 51 | |
public abstract void aplicarFiltroValidoEspecifico(Object[] celulas, |
| 52 | |
CasoUso useCase, List<DefaultGraphCell> adicao, JGraph graph) |
| 53 | |
throws SQLException, InstantiationException, |
| 54 | |
IllegalAccessException, ClassNotFoundException, IOException; |
| 55 | |
|
| 56 | |
public abstract void atualizarStepEspecifico(Object[] celulas); |
| 57 | |
|
| 58 | |
public abstract void inserirValorEspecifico(List<JTextField> fields, |
| 59 | |
List<DefaultGraphCell> adicao); |
| 60 | |
|
| 61 | |
public void inserirValor(List<JTextField> fields, JGraph graph, |
| 62 | |
IGraphPane graphPane) { |
| 63 | 0 | this.inicializar(graph); |
| 64 | 0 | this.inserirValorEspecifico(fields, this.novos); |
| 65 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 66 | |
|
| 67 | 0 | } |
| 68 | |
|
| 69 | |
public abstract void retiraFiltrosEspecifico(Object[] celulas, |
| 70 | |
List<DefaultGraphCell> adicao) throws SQLException, |
| 71 | |
InstantiationException, IllegalAccessException, |
| 72 | |
ClassNotFoundException, IOException; |
| 73 | |
|
| 74 | |
public void retiraFiltros(JGraph graph, IGraphPane graphPane) |
| 75 | |
throws SQLException, InstantiationException, |
| 76 | |
IllegalAccessException, ClassNotFoundException, IOException { |
| 77 | 0 | this.inicializar(graph); |
| 78 | 0 | this.retiraFiltrosEspecifico(this.selecionados, this.novos); |
| 79 | 0 | this.finalizarRemover(graph, graphPane); |
| 80 | |
|
| 81 | 0 | } |
| 82 | |
|
| 83 | |
public void definirProbabilidade(JGraph graph, CasoUso useCase) { |
| 84 | 0 | this.inicializar(graph); |
| 85 | 0 | this.definirProbabilidadeEspecifico(this.selecionados, useCase, |
| 86 | 0 | this.novos); |
| 87 | 0 | } |
| 88 | |
|
| 89 | |
public void aplicaFiltroValido(JGraph graph, IGraphPane graphPane, |
| 90 | |
CasoUso useCase) throws SQLException, InstantiationException, |
| 91 | |
IllegalAccessException, ClassNotFoundException, IOException { |
| 92 | 0 | this.inicializar(graph); |
| 93 | 0 | this.aplicarFiltroValidoEspecifico(this.selecionados, useCase, |
| 94 | 0 | this.novos, graph); |
| 95 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 96 | |
|
| 97 | 0 | } |
| 98 | |
|
| 99 | |
public void ligarDado(JGraph graph, IGraphPane graphPane) { |
| 100 | 0 | this.inicializar(graph); |
| 101 | 0 | this.ligarDadoEspecifico(this.selecionados, this.novos); |
| 102 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 103 | |
|
| 104 | 0 | } |
| 105 | |
|
| 106 | |
public void atualizarStep(JGraph graph) { |
| 107 | 0 | this.inicializar(graph); |
| 108 | 0 | this.atualizarStepEspecifico(this.selecionados); |
| 109 | |
|
| 110 | 0 | } |
| 111 | |
|
| 112 | |
public void deletar(JGraph graph, IGraphPane graphPane, CasoUso useCase) |
| 113 | |
throws InstantiationException, IllegalAccessException, |
| 114 | |
ClassNotFoundException, SQLException, IOException { |
| 115 | 0 | this.inicializar(graph); |
| 116 | 0 | this.deletarEspecifico(this.selecionados, useCase, this.novos); |
| 117 | 0 | this.finalizarRemover(graph, graphPane); |
| 118 | |
|
| 119 | 0 | } |
| 120 | |
|
| 121 | |
public void ligarRegra(JGraph graph, IGraphPane graphPane) { |
| 122 | 0 | this.inicializar(graph); |
| 123 | 0 | this.ligarRegraEspecifico(this.selecionados, this.novos); |
| 124 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 125 | |
|
| 126 | 0 | } |
| 127 | |
|
| 128 | |
public void ligarValor(JGraph graph, IGraphPane graphPane) |
| 129 | |
throws InstantiationException, IllegalAccessException, |
| 130 | |
ClassNotFoundException, SQLException, IOException { |
| 131 | 0 | this.inicializar(graph); |
| 132 | 0 | this.ligarValorEspecifico(this.selecionados, this.novos); |
| 133 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 134 | |
|
| 135 | 0 | } |
| 136 | |
|
| 137 | |
public void criaLink(JGraph graph, IGraphPane graphPane) { |
| 138 | 0 | this.inicializar(graph); |
| 139 | 0 | this.criarLinkEspecifico(this.selecionados, this.novos); |
| 140 | 0 | this.finalizarAdicionar(graph, graphPane); |
| 141 | 0 | } |
| 142 | |
|
| 143 | |
public void finalizarRemover(JGraph graph, IGraphPane graphPane) { |
| 144 | 0 | graph.getGraphLayoutCache().remove(novos.toArray()); |
| 145 | 0 | graphPane.getCelulas().removeAll(novos); |
| 146 | 0 | } |
| 147 | |
|
| 148 | |
public void finalizarAdicionar(JGraph graph, IGraphPane graphPane) { |
| 149 | 0 | graph.getGraphLayoutCache().insert(novos.toArray()); |
| 150 | 0 | graphPane.getCelulas().addAll(novos); |
| 151 | 0 | } |
| 152 | |
} |