Exemplo n.º 1
0
 public void drawListRow(ListField listField, Graphics g, int index, int y, int w) {
   String sColapsado = "";
   Item item = (Item) get(listField, index);
   if (listField.getSelectedIndex() == index) {
     g.setColor(Color.WHITE);
     g.setBackgroundColor(Estilos.getBGSelected());
   } else {
     if (item.isCabecera()) {
       g.setColor(Estilos.getColorInterlinea(0));
       g.setBackgroundColor(Estilos.getBGInterlinea(0));
     } else {
       g.setColor(Estilos.getColorInterlinea(1));
       g.setBackgroundColor(Estilos.getBGInterlinea(1));
     }
     g.clear();
   }
   if (item.isCabecera()) {
     if (item.isColapsado()) {
       sColapsado = Characters.BLACK_RIGHT_POINTING_TRIANGLE + " ";
     } else {
       sColapsado = Characters.BLACK_DOWN_POINTING_TRIANGLE + " ";
     }
   } else {
     sColapsado = Characters.SPACE + "";
   }
   g.drawText(sColapsado + item.getDescripcion(), 0, y, DrawStyle.LEFT, w);
   g.drawText(item.getValor(), 0, y, DrawStyle.RIGHT, w);
 }
Exemplo n.º 2
0
 private int getCategoria(int index) {
   int i, j, n = 0, m = 0, avance = 0;
   j = _listaConsulResumen.getSize();
   for (i = 0; i < j; i++) {
     Item item = (Item) get(_listaConsulResumen, i);
     if (item.isCabecera()) {
       if (item.isColapsado()) m++;
       else n++;
       avance = ((9 * n) + (1 * m));
       if (avance > index) {
         break;
       }
     }
   }
   int elemento = avance - (9 - index);
   int estado = -1;
   switch (elemento) {
     case 4:
       estado = 0;
       break;
     case 5:
       estado = 1;
       break;
     case 6:
       estado = 2;
       break;
     case 7:
       estado = 3;
       break;
     case 9:
       estado = 4;
       break;
   }
   return estado;
 }
Exemplo n.º 3
0
  protected boolean navigationClick(int status, int time) {
    Field field = this.getFieldWithFocus();
    if (field == _listaConsulResumen) {
      int index = _listaConsulResumen.getSelectedIndex();
      Item item = (Item) get(_listaConsulResumen, index);
      if (item.isCabecera()) {
        item.setColapsado(!item.isColapsado());
        llenaLista();
        _listaConsulResumen.setSelectedIndex(index);
        return true;
      } else {
        item = (Item) jerarquia.elementAt(item.getIndexPadre());
        int op = getCategoria(index);
        if (op >= 0) {
          int cant = Integer.parseInt(((Item) get(_listaConsulResumen, index)).getValor());
          if (cant > 0) {
            String campana =
                item.getDescripcion().substring(4) + item.getDescripcion().substring(1, 3);
            progress.setTitle("Buscando... ");
            progress.open();
            progress.close();
            try {
              Estilos.pushScreen(new ConsultaSeccion(campana, "", "", "", "", "" + op));
            } catch (Exception e) {

            }
          }
        }
        return true;
      }
    }
    return super.navigationClick(status, time);
  }
Exemplo n.º 4
0
 public void run() {
   int index = _listaConsulResumen.getSelectedIndex();
   Item item = (Item) get(_listaConsulResumen, index);
   if (!item.isCabecera()) {
     item = (Item) jerarquia.elementAt(item.getIndexPadre());
   }
   UiApplication.getUiApplication()
       .pushScreen(new FacturacionDetalle(item.getDescripcion()));
 }