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(); } }
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); }
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); } } }
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 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 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 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(); }