fixes bug #8206
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@63968 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
73416411ac
commit
cc3a1c3ee0
|
@ -105,6 +105,8 @@ public class EditarConexionController extends MyGenericForwardComposer {
|
||||||
private Label lblConexaoFixa4;
|
private Label lblConexaoFixa4;
|
||||||
|
|
||||||
private List<Ruta> lsRutas;
|
private List<Ruta> lsRutas;
|
||||||
|
private List<Conexion> conexoesRemovidas;
|
||||||
|
private List<ConexionConf> conexoesConfRemovidas;
|
||||||
|
|
||||||
public ConexionCtrl getConexionCtrl() {
|
public ConexionCtrl getConexionCtrl() {
|
||||||
return conexionCtrl;
|
return conexionCtrl;
|
||||||
|
@ -119,6 +121,8 @@ public class EditarConexionController extends MyGenericForwardComposer {
|
||||||
super.doAfterCompose(comp);
|
super.doAfterCompose(comp);
|
||||||
|
|
||||||
lsRutas = rutaService.obtenerTodos();
|
lsRutas = rutaService.obtenerTodos();
|
||||||
|
conexoesRemovidas = new ArrayList<Conexion>();
|
||||||
|
conexoesConfRemovidas = new ArrayList<ConexionConf>();
|
||||||
|
|
||||||
conexionesList = (MyListbox) Executions.getCurrent().getArg().get("conexionesList");
|
conexionesList = (MyListbox) Executions.getCurrent().getArg().get("conexionesList");
|
||||||
|
|
||||||
|
@ -635,42 +639,53 @@ public class EditarConexionController extends MyGenericForwardComposer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClick$btnRemoverConexao(Event ev) throws Exception {
|
public void onClick$btnRemoverConexao(Event ev) throws Exception {
|
||||||
int resp = Messagebox.show(
|
Conexion conexao = (Conexion) conexionesEditarList.getSelected();
|
||||||
Labels.getLabel("editarConexionController.MSG.borrarConexionPergunta"),
|
if (conexao != null) {
|
||||||
Labels.getLabel("editarConexionController.window.title"),
|
int resp = Messagebox.show(
|
||||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
Labels.getLabel("editarConexionController.MSG.borrarConexionPergunta"),
|
||||||
|
Labels.getLabel("editarConexionController.window.title"),
|
||||||
|
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||||
|
|
||||||
if (resp == Messagebox.YES) {
|
if (resp == Messagebox.YES) {
|
||||||
Conexion conexionDeletar = (Conexion) conexionesEditarList.getSelected();
|
|
||||||
|
|
||||||
if (conexionDeletar != null) {
|
removerConexoes(conexao.getNumgrupo());
|
||||||
// procurando conexions do mesmo grupo e setando acitvo false
|
|
||||||
List<Integer> removerLista = new ArrayList<Integer>();
|
|
||||||
for (int i = 0; i < lsConexiones.size(); i++) {
|
|
||||||
Conexion conexion = lsConexiones.get(i);
|
|
||||||
if (conexion.getNumgrupo().equals(conexionDeletar.getNumgrupo())) {
|
|
||||||
conexionService.borrar(conexion);
|
|
||||||
|
|
||||||
removerLista.add(i);
|
ConexionConf conexionConfRemovida = getConexaoConf(conexao.getNumgrupo());
|
||||||
}
|
conexoesConfRemovidas.add(conexionConfRemovida);
|
||||||
}
|
lsConexionesConf.remove(conexionConfRemovida);
|
||||||
|
|
||||||
// removendo da lista
|
}
|
||||||
if (conexionCtrl != null) {
|
|
||||||
lsConexiones = conexionService.buscarPorConexionCtrl(conexionCtrl.getConexionctrlId());
|
} else {
|
||||||
conexionesEditarList.setData(lsConexiones);
|
Messagebox.show(Labels.getLabel("editarConexionController.MSG.selecionarConexion"),
|
||||||
} else {
|
Labels.getLabel("editarConexionController.window.title"),
|
||||||
lsConexiones = new ArrayList<Conexion>();
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
conexionesEditarList.setData(lsConexiones);
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Messagebox.show(Labels.getLabel("editarConexionController.MSG.selecionarConexion"),
|
private void removerConexoes(Integer numgrupo) {
|
||||||
Labels.getLabel("editarConexionController.window.title"),
|
List<Conexion> conexiones = new ArrayList<Conexion>();
|
||||||
Messagebox.OK, Messagebox.INFORMATION);
|
conexiones.addAll(lsConexiones);
|
||||||
|
|
||||||
|
for (Conexion conexion : conexiones) {
|
||||||
|
if (conexion.getNumgrupo() == numgrupo) {
|
||||||
|
conexoesRemovidas.add(conexion);
|
||||||
|
|
||||||
|
lsConexiones.remove(conexion);
|
||||||
|
conexionesEditarList.removeItem(conexion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ConexionConf getConexaoConf(Integer numgrupo) {
|
||||||
|
for (ConexionConf conexionConf : lsConexionesConf) {
|
||||||
|
if (conexionConf.getGrupo() == numgrupo) {
|
||||||
|
return conexionConf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void onClick$btnSalvar(Event ev) throws Exception {
|
public void onClick$btnSalvar(Event ev) throws Exception {
|
||||||
Parada origem = null;
|
Parada origem = null;
|
||||||
Parada destino = null;
|
Parada destino = null;
|
||||||
|
@ -734,6 +749,8 @@ public class EditarConexionController extends MyGenericForwardComposer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apagarConexoesRemovidas();
|
||||||
|
|
||||||
Messagebox.show(Labels.getLabel("editarConexionController.MSG.suscribirOK"),
|
Messagebox.show(Labels.getLabel("editarConexionController.MSG.suscribirOK"),
|
||||||
Labels.getLabel("editarConexionController.window.title"),
|
Labels.getLabel("editarConexionController.window.title"),
|
||||||
Messagebox.OK, Messagebox.INFORMATION);
|
Messagebox.OK, Messagebox.INFORMATION);
|
||||||
|
@ -741,6 +758,18 @@ public class EditarConexionController extends MyGenericForwardComposer {
|
||||||
closeWindow();
|
closeWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void apagarConexoesRemovidas() {
|
||||||
|
for (ConexionConf conexionConf : conexoesConfRemovidas) {
|
||||||
|
if (conexionConf != null) {
|
||||||
|
conexionConfService.borrar(conexionConf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
conexionService.borrar(conexoesRemovidas);
|
||||||
|
|
||||||
|
conexoesRemovidas.clear();
|
||||||
|
conexoesConfRemovidas.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public void onClick$btnApagar(Event ev) throws Exception {
|
public void onClick$btnApagar(Event ev) throws Exception {
|
||||||
int resp = Messagebox.show(
|
int resp = Messagebox.show(
|
||||||
Labels.getLabel("editarConexionController.MSG.borrarConexionCtrlPergunta"),
|
Labels.getLabel("editarConexionController.MSG.borrarConexionCtrlPergunta"),
|
||||||
|
|
Loading…
Reference in New Issue