Hi,
I have a method that triggers a form that does not always run. The form has
a Timer class to control the time it appears and disappears. In addition to
this, for some time the warning was displayed in the debug console (Ljava /
util / ArrayList; Z) V 'formTotals
My code:
private void formaTotales(ArrayList aCompra2, boolean comparacion) {
double sub1 = 0d;
double sub2 = 0d;
double imp1 = 0d;
double imp2 = 0d;
double tot1 = 0d;
double tot2 = 0d;
int cnLista = 0;
int cnCompra = 0;
try {
for (int i = 0; i < aCompra2.size(); i++) {
Compra2 cP2 = (Compra2) aCompra2.get(i);
double tmp1 = 0d;
double tmp2 = 0d;
if (comparacion) {
tmp1 = cP2.getCantidad() * cP2.getPrecioComparacion();
} else {
cnLista++;
tmp1 = cP2.getCantidad() * cP2.getPrecio();
if (cP2.getIncluir() == 1) {
tmp2 = cP2.getCantidad() * cP2.getPrecio();
cnCompra++;
}
}
sub1 = sub1 + tmp1;
sub2 = sub2 + tmp2;
if (cP2.getImpuesto() == 1) {
imp1 = imp1 + tmp1 * iU.getImpuesto1();
imp1 = imp1 + tmp1 * iU.getImpuesto2();
imp2 = imp2 + tmp2 * iU.getImpuesto1();
imp2 = imp2 + tmp2 * iU.getImpuesto2();
}
}
tot1 = sub1 + imp1;
tot2 = sub2 + imp2;
String tt = idioma.getTotal() + ": 0.00";
if (tot1 > 0d) {
tt = idioma.getTotal() + ": " + redondear(tot1, 2);
if (tot2 > 0d) {
tt = idioma.getTotal() + ": " + redondear(tot2, 2) +
" / " + redondear(tot1, 2);
}
}
Label lbSub = new Label(idioma.getSubTotal() + ": ");
Label lbImp = new Label(idioma.getImpuesto() + ": ");
Label lbTot = new Label(idioma.getTotal() + ": ");
Label lbComprado = new Label(idioma.getComprado());
Label lbLista = new Label(idioma.getEnLista());
Label lbcComprado = new Label("(" + cnCompra + ")");
Label lbcLista = new Label("(" + cnLista + ")");
lbSub.setUIID("MultiLine2");
lbImp.setUIID("MultiLine2");
lbTot.setUIID("MultiLine2");
lbComprado.setUIID("MultiLine2");
lbLista.setUIID("MultiLine2");
Label lbS1 = new Label(redondear(sub1, 2));
Label lbI1 = new Label(redondear(imp1, 2));
Label lbT1 = new Label(redondear(tot1, 2));
Label lbS2 = new Label(redondear(sub2, 2));
Label lbI2 = new Label(redondear(imp2, 2));
Label lbT2 = new Label(redondear(tot2, 2));
lbS1.setUIID("LabelItemBig");
lbI1.setUIID("LabelItemBig");
lbT1.setUIID("LabelItemBig");
lbS2.setUIID("LabelItemBig");
lbI2.setUIID("LabelItemBig");
lbT2.setUIID("LabelItemBig");
lbcLista.setUIID("MultiLine2");
lbcComprado.setUIID("MultiLine2");
Container cnL = new Container(new GridLayout(5, 1)).add(new
Label("")).add(lbSub).add(lbImp).add(lbTot).add(new Label(""));
Container cn1 = new Container(new GridLayout(5,
1)).add(lbLista).add(lbS1).add(lbI1).add(lbT1).add(lbcLista);
Container cn2 = new Container(new GridLayout(5,
1)).add(lbComprado).add(lbS2).add(lbI2).add(lbT2).add(lbcComprado);
Container cnT = new Container();
if (tot2 > 0d) {
cnT.setLayout(new GridLayout(1, 3));
cnT.add(cnL);
cnT.add(cn2);
cnT.add(cn1);
} else {
cnT.setLayout(new GridLayout(1, 2));
cnT.add(cnL);
cnT.add(cn1);
}
Dialog dlg = new Dialog(new BorderLayout());
dlg.add(BorderLayout.CENTER, cnT);
dlg.setTransitionInAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_VERTICAL,
true, 500));
UITimer timer = new UITimer(() -> {
dlg.dispose();
});
timer.schedule(3000, false, dlg);
dlg.show((Display.getInstance().getDisplayHeight() / 4) * 3, 0,
0, 0);
} catch (Exception err) {
Dialog.show("Error", err.getMessage(), "Continuar", null);
}
}
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/f53f30c2-a2c2-4491-8de4-9fe29895f9fc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.