fixed bug #7113 - correção para manter seleção após mudar página
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@53118 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
a5fc2b1d9c
commit
6615e59fed
|
@ -5,7 +5,9 @@ import java.util.ArrayList;
|
|||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -78,6 +80,15 @@ public class SelecionarServicosGerarController extends MyGenericForwardComposer
|
|||
private Intbox txtID;
|
||||
private Intbox txtNumCorrida;
|
||||
private Timebox hora;
|
||||
private Set<EsquemaCorrida> selected;
|
||||
|
||||
public Set<EsquemaCorrida> getSelected() {
|
||||
return selected;
|
||||
}
|
||||
|
||||
public void setSelected(Set<EsquemaCorrida> selected) {
|
||||
this.selected = selected;
|
||||
}
|
||||
|
||||
public List<ClaseServicio> getLsClase() {
|
||||
return lsClase;
|
||||
|
@ -193,12 +204,14 @@ public class SelecionarServicosGerarController extends MyGenericForwardComposer
|
|||
} catch (InterruptedException ex) {
|
||||
}
|
||||
}
|
||||
selected.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAfterCompose(Component comp) throws Exception {
|
||||
super.doAfterCompose(comp);
|
||||
|
||||
selected = new HashSet<EsquemaCorrida>();
|
||||
|
||||
lsEmpresa = UsuarioLogado.getUsuarioLogado().getEmpresa();
|
||||
lsMarca = marcaService.buscarMarcaPorEmpresa(UsuarioLogado.getUsuarioLogado().getEmpresa());
|
||||
lsClase = claseService.obtenerTodos();
|
||||
|
@ -216,54 +229,79 @@ public class SelecionarServicosGerarController extends MyGenericForwardComposer
|
|||
}
|
||||
|
||||
public void onClick$btnGerar(Event ev) throws InterruptedException {
|
||||
List<Object> list = esquemaCorridaList.getSelectedsItens();
|
||||
|
||||
if (list.isEmpty()) {
|
||||
if (selected.isEmpty()) {
|
||||
Messagebox.show(Labels.getLabel("selecionarServicosGerarController.MSG.selecioneservicos"),
|
||||
Labels.getLabel("selecionarServicosGerarController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<EsquemaCorrida> lsEsquemaCorrida = new ArrayList<EsquemaCorrida>();
|
||||
for (Object o : list) {
|
||||
for (Object o : selected) {
|
||||
EsquemaCorrida esquemaCorrida = (EsquemaCorrida) o;
|
||||
lsEsquemaCorrida.add(esquemaCorrida);
|
||||
}
|
||||
|
||||
Date dataGeracaoInicial = fecGeracaoInicial.getValue();
|
||||
Date dataGeracaoFinal = fecGeracaoFinal.getValue();
|
||||
|
||||
|
||||
if (dataGeracaoInicial.after(dataGeracaoFinal)) {
|
||||
Messagebox.show(Labels.getLabel("selecionarServicosGerarController.MSG.dataInicialMaiorFinal"),
|
||||
Labels.getLabel("selecionarServicosGerarController.window.title"),
|
||||
Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Long cantCorridasGeneradas;
|
||||
try {
|
||||
cantCorridasGeneradas = corridaService.generarCorridasSelecionadas(lsEsquemaCorrida, dataGeracaoInicial, dataGeracaoFinal);
|
||||
|
||||
|
||||
esquemaCorridaList.setData(new ArrayList<EsquemaCorrida>());
|
||||
|
||||
Messagebox.show(Labels.getLabel("selecionarServicosGerarController.MSG.operacaoFinalizar", new Object[] { cantCorridasGeneradas}),
|
||||
|
||||
Messagebox.show(Labels.getLabel("selecionarServicosGerarController.MSG.operacaoFinalizar", new Object[] { cantCorridasGeneradas }),
|
||||
Labels.getLabel("selecionarServicosGerarController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
|
||||
if (ApplicationProperties.getInstance().pafActivo()){
|
||||
|
||||
if (ApplicationProperties.getInstance().pafActivo()) {
|
||||
// log.info("qtdP2=" + fiscalService.gerarRegistroP2_F2(lsEsquemaCorrida, dataGeracaoInicial, dataGeracaoFinal));
|
||||
}
|
||||
|
||||
|
||||
} catch (BusinessException e) {
|
||||
Messagebox.show(e.getLocalizedMessage(),
|
||||
Labels.getLabel("selecionarServicosGerarController.window.title"),
|
||||
Messagebox.OK, Messagebox.INFORMATION);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onSelect$esquemaCorridaList() {
|
||||
int pos = 0;
|
||||
for (Object o : esquemaCorridaList.getData()) {
|
||||
EsquemaCorrida e = (EsquemaCorrida) o;
|
||||
if (esquemaCorridaList.getItemAtIndex(pos).isSelected()) {
|
||||
if (!selected.contains(e)) {
|
||||
selected.add(e);
|
||||
}
|
||||
} else {
|
||||
selected.remove(e);
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
public void onAfterRender$esquemaCorridaList() {
|
||||
if (esquemaCorridaList.getData() != null) {
|
||||
int pos = 0;
|
||||
for (Object o : esquemaCorridaList.getData()) {
|
||||
EsquemaCorrida e = (EsquemaCorrida) o;
|
||||
if (selected.contains(e)) {
|
||||
esquemaCorridaList.addItemToSelection(esquemaCorridaList.getItemAtIndex(pos));
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue