Exemple #1
0
 public void onSensorPlug(String IDLector) {
   // consola.out.echo("Lector conectado");
   try {
     // Start capturing from plugged sensor.
     com.griaule.grfingerjava.GrFingerJava.startCapture(IDLector, this, this);
   } catch (com.griaule.grfingerjava.GrFingerJavaException e) {
     // write error to log
     Dialogos.error("Error al iniciar captura de huella dactilar", e);
   }
   this.IDLector = IDLector;
   super.setLectorActivo(true);
 }
Exemple #2
0
  public void onImageAcquired(String IDLector, com.griaule.grfingerjava.FingerprintImage imagen) {

    try {
      // this.lblHuella.setIcon(new ImageIcon(imagen));

      this.matchContext = new MatchingContext();
      this.template = this.matchContext.extract(imagen);
      this.byteTemplate = this.template.getData();

      // consola.out.echo("Lector huella: imagen adquirida");
    } catch (GrFingerJavaException gr) {
      Dialogos.error("Error al procesar huella dactilar.", gr);
    }
  }
    public boolean stopCellEditing() {
      Object descrip = null, costo = null;
      JTextField campo = ((JTextField) this.getComponent());
      String codigo = campo.getText();
      if (codigo == "") {
        return false;
      }
      descrip =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('codigo = \""
                  + codigo
                  + "\"').descripcion");
      costo =
          Almacenes.groovyPort(
              "omoikane.principal.Articulos.getArticulo('select * from articulos,precios where articulos.codigo = \""
                  + codigo
                  + "\" "
                  + "and articulos.id_articulo = precios.id_articulo and precios.id_almacen = '+omoikane.principal.Principal.config.idAlmacen[0].text()).costo");

      if (descrip == null) {
        Dialogos.lanzarAlerta("El artículo que capturó no exíste");
        campo.setText("");
        return false;
      } else {
        tablaPrincipal.setValueAt(
            descrip, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 1);
        tablaPrincipal.setValueAt(
            costo, tablaPrincipal.getEditingRow(), tablaPrincipal.getEditingColumn() + 2);
        return super.stopCellEditing();
      }
    }
Exemple #4
0
  public void setParameters(
      int identifyThreshold,
      int identifyRotationTolerance,
      int verifyThreshold,
      int verifyRotationTolorance) {
    try {
      matchContext.setIdentificationThreshold(identifyThreshold);
      matchContext.setIdentificationRotationTolerance(identifyRotationTolerance);
      matchContext.setVerificationRotationTolerance(verifyRotationTolorance);
      matchContext.setVerificationThreshold(verifyThreshold);

    } catch (Exception e) {
      // write error to log
      Dialogos.error("Error al establecer parámetros del SDK de huellas", e);
    }
  }
  public void init(Object parent) {

    glass = new BlurGlass();
    glass.setLayout(null);

    this.setLayout(null);

    setOpaque(false);
    // getContentPane().setOpaque(false);
    this.getLayeredPane().setOpaque(false);
    this.getRootPane().setOpaque(false);
    // putClientProperty("Synthetica.opaque", Boolean.FALSE);

    JParent = parent;
    glass.setOpaque(false);

    MouseInputAdapter adapter = new MouseInputAdapter() {};
    glass.addMouseListener(adapter);
    glass.addMouseMotionListener(adapter);

    try {
      if (parent instanceof JFrame) {
        layer = ((JFrame) parent).getLayeredPane();
      } else if (parent instanceof JInternalFrame) {
        layer = ((JInternalFrame) parent).getLayeredPane();
      }
      glass.setBounds(layer.getBounds());

    } catch (NullPointerException err) {
      Dialogos.error("Error interno en Dialogo interno modal", err);
    }

    try {
      glass.add(this);
      layer.add(glass, JLayeredPane.DEFAULT_LAYER);
    } catch (NullPointerException err) {
      Dialogos.error("Error interno en dialogo modal interno", err);
    }
  }
Exemple #6
0
  public void cerrar() {
    synchronized (focoCerrar) {
      try {
        focoCerrar.wait();
      } catch (InterruptedException ie) {
        Dialogos.error("Error al cerrar capturador de huella", ie);
      }
      try {
        com.griaule.grfingerjava.GrFingerJava.finalizeCapture();
        // com.griaule.grfingerjava.GrFingerJava.stopCapture(IDLector);

        if (matchContext != null) {
          matchContext.destroy();
        }

        // Main.entornoBase.pantalla.getLayeredPane().grabFocus();

        parent.setActivo(false);
      } catch (GrFingerJavaException gr) {
        Dialogos.error("Error al finalizar lector de huella.", gr);
      }
    }
  }
Exemple #7
0
  public Huellas(JInternalDialog2 parent) {
    this.setVisible(true);
    this.setBounds(0, 0, 500, 500);
    this.parent = parent;

    // getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
    // "cerrar");
    // getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),
    // "cerrar");
    // getActionMap().put("cerrar" , new adminAcciones(this, adminAcciones.CERRAR));
    // this.btnCancelar.getActionMap().put("cerrar", new adminAcciones(this, adminAcciones.CERRAR));
    // this.btnCancelar.addActionListener(new adminAcciones(this, adminAcciones.CERRAR));

    // this.btnCancelar.getActionMap().put("cerrar", new adminAcciones(this, adminAcciones.CERRAR));

    try {
      System.out.println(System.getProperty("user.dir"));
      String grFingerNativeDirectory = (new File(".")).getAbsolutePath();

      File directory = new File(grFingerNativeDirectory);

      GrFingerJava.setNativeLibrariesDirectory(directory);
      GrFingerJava.setLicenseDirectory(directory);
      // com.griaule.grfingerjava.GrFingerJava.setNativeLibrariesDirectory();
      System.out.println("Carpeta dependencias griaule: " + grFingerNativeDirectory);

      matchContext = new MatchingContext();
      GrFingerJava.initializeCapture(this);
      System.out.println("Lector Huella inicializada");

    } catch (Exception GrEx) {
      System.out.println("Error griaule: " + GrEx.getMessage());
      Dialogos.error("Error al inicializar SDK lector", GrEx);
    }
    HiloParaCerrar HPC = new HiloParaCerrar(this);
    HPC.start();
  }
  public void fadeIn() {
    final float acel = 0.1f;
    generarFondo(this);
    super.setVisible(true);

    try {
      while (BlurGlass.this.getAlpha() + acel <= 1.0f) {
        SwingUtilities.invokeAndWait(
            new Runnable() {
              public void run() {
                BlurGlass.this.setAlpha(BlurGlass.this.getAlpha() + acel);
              }
            });
        Thread.sleep(50);
      }
    } catch (Exception e) {
      Dialogos.error("Error en fadein", e);
    }
  }
  public void calculaSumas() {
    try {
      TableModel tm = this.tablaPrincipal.getModel();
      int tamTabla = tm.getRowCount();
      double costo, cantidad, totalFila, sumaTotal;
      sumaTotal = 0.0;

      for (int i = 0; i < tamTabla; i++) {
        if (tm.getValueAt(i, 2) != null && tm.getValueAt(i, 3) != null) {
          costo = Double.valueOf(String.valueOf(tm.getValueAt(i, 2)));
          cantidad = Double.valueOf(String.valueOf(tm.getValueAt(i, 3)));
          totalFila = costo * cantidad;

          tm.setValueAt(totalFila, i, 4);
          sumaTotal += totalFila;
        }
      }

      txtSumaTotal.setText(String.valueOf(sumaTotal));
    } catch (Exception e) {
      Dialogos.lanzarAlerta("Cantidades invalidas, puede que algun numero este mal escrito");
    }
  }
  public void fadeOut() {
    super.setVisible(true);

    try {
      final float desacel = 0.1f;
      while (BlurGlass.this.getAlpha() - desacel >= 0.0f) {
        SwingUtilities.invokeLater(
            new Runnable() {
              public void run() {
                BlurGlass.this.setAlpha(BlurGlass.this.getAlpha() - desacel);
              }
            });
        Thread.sleep(50);
      }
      BlurGlass.this.setAlpha(0.0f);
    } catch (Exception e) {
      Dialogos.error("Error en fadeout", e);
    }
    // super.setVisible(false);
    // BlurGlass.this.setAlpha(0.2f);
    // setAlpha(0.2f);
    super.setVisible(false);
  }