List of usage examples for com.squareup.okhttp FormEncodingBuilder FormEncodingBuilder
FormEncodingBuilder
From source file:reportes.PantallaReportes.java
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed try {//from w w w . ja va 2 s .c o m String empresa = (String) jComboBox1.getSelectedItem(); String departamento = (String) jComboBox2.getSelectedItem(); String usuario = (String) jComboBox3.getSelectedItem(); RequestBody formBody = new FormEncodingBuilder().add("empresa", empresa) .add("departamento", departamento).add("usuario", usuario).build(); String r = metodoWS("grafAvl", formBody); } catch (Exception ex) { } try { String dotPath = "C:\\release\\bin\\dot.exe"; String fileInputPath = "C:\\graficas\\Avl.dot"; String fileOutputPath = "C:\\graficas\\Avl.png"; String tParam = "-Tjpg"; String tOParam = "-o"; String[] cmd = new String[5]; cmd[0] = dotPath; cmd[1] = tParam; cmd[2] = fileInputPath; cmd[3] = tOParam; cmd[4] = fileOutputPath; Runtime rt = Runtime.getRuntime(); rt.exec(cmd); } catch (Exception ex) { System.out.println("Error: " + ex.getMessage()); } finally { } }
From source file:reportes.PantallaReportes.java
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed try {/*from w w w. j av a 2s . com*/ String empresa = (String) jComboBox1.getSelectedItem(); String departamento = (String) jComboBox2.getSelectedItem(); String usuario = (String) jComboBox3.getSelectedItem(); RequestBody formBody = new FormEncodingBuilder().add("empresa", empresa) .add("departamento", departamento).add("usuario", usuario).build(); String r = metodoWS("devRentasUsuario", formBody); jTextArea1.setText(r); } catch (Exception ex) { } // TODO add your handling code here: }
From source file:reportesedd.Reportes.java
public Reportes(String usuarios, String empresas, String deptos) { initComponents();//from w w w . j av a 2s .co m this.setLocationRelativeTo(null); //AQUI HAY QUE ESPLITEAR LOS STRINGS Y CARGARLOS A LOS COMBOBOX cargarCombosUsuarios(usuarios); cargarCombosEmpresas(empresas); cargarCombosDeptos(deptos); aUsuarios = usuarios; aEmpresas = empresas; aDeptos = deptos; Timer t = new Timer(3000, new ActionListener() { public void actionPerformed(ActionEvent e) { rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String usuarios = Conexion.consultarConString("listarUsuarios", rb); rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String empresas = Conexion.consultarConString("empresas", rb); rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String deptos = Conexion.consultarConString("departamentos", rb); if (!usuarios.equals(aUsuarios)) { jComboBox1.removeAllItems(); cargarCombosUsuarios(usuarios); aUsuarios = usuarios; } if (!empresas.equals(aEmpresas)) { jComboBox2.removeAllItems(); aEmpresas = empresas; cargarCombosEmpresas(empresas); } if (!deptos.equals(aDeptos)) { jComboBox3.removeAllItems(); aDeptos = deptos; cargarCombosDeptos(deptos); } } }); t.start(); //String envio="1"; //Conexion.Conection_Llenar("cadena=135465X,ASDASD,ASDASD,ASDSD,SFSDF,SDFDFS,TYRT"); }
From source file:reportesedd.Reportes.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed v = new Visor(); RequestBody rb = new FormEncodingBuilder().add("p", "algo").build();//agregar parametros InputStream is = Conexion.consultar("graficarMatriz", rb); try {//from w w w . jav a 2s. c om FileOutputStream fos = new FileOutputStream("matriz.jpg"); byte[] array = new byte[1000]; int leido = is.read(array); while (leido > 0) { fos.write(array, 0, leido); leido = is.read(array); } is.close(); fos.close(); String ruta = new File("").getAbsolutePath(); ruta = ruta + "\\matriz.jpg"; ImageIcon image = new ImageIcon(ruta); Icon icono = new ImageIcon(image.getImage().getScaledInstance(image.getIconWidth(), image.getIconHeight(), Image.SCALE_DEFAULT)); v.jLabel1.setText(null); v.jLabel1.setIcon(icono); v.ima = icono; } catch (IOException ex) { } v.setTitle("Matriz Dispersa"); v.setVisible(true); }
From source file:reportesedd.Reportes.java
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed v = new Visor(); String empresa = jTextField1.getText(); RequestBody rb = new FormEncodingBuilder().add("empresa", empresa).build();//agregar parametros InputStream is = Conexion.consultar("reportePorEmpresa", rb); //System.out.println(res); try {//from w ww .j av a 2 s. c o m FileOutputStream fos = new FileOutputStream("activosEMP.jpg"); byte[] array = new byte[1000]; int leido = is.read(array); while (leido > 0) { fos.write(array, 0, leido); leido = is.read(array); } is.close(); fos.close(); String ruta = new File("").getAbsolutePath(); ruta = ruta + "\\activosEMP.jpg"; ImageIcon image = new ImageIcon(ruta); Icon icono = new ImageIcon(image.getImage().getScaledInstance(image.getIconWidth(), image.getIconHeight(), Image.SCALE_DEFAULT)); v.jLabel1.setText(null); v.jLabel1.setIcon(icono); } catch (IOException ex) { } v.setTitle("Activos de Empresa " + empresa); v.setVisible(true); }
From source file:reportesedd.Reportes.java
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed v = new Visor(); String depto = jTextField2.getText(); RequestBody rb = new FormEncodingBuilder().add("departamento", depto).build();//agregar parametros InputStream is = Conexion.consultar("reportePorDepartamento", rb); //System.out.println(res); try {//from www .ja va2 s . c o m FileOutputStream fos = new FileOutputStream("activosDEP.jpg"); byte[] array = new byte[1000]; int leido = is.read(array); while (leido > 0) { fos.write(array, 0, leido); leido = is.read(array); } is.close(); fos.close(); String ruta = new File("").getAbsolutePath(); ruta = ruta + "\\activosDEP.jpg"; ImageIcon image = new ImageIcon(ruta); Icon icono = new ImageIcon(image.getImage().getScaledInstance(image.getIconWidth(), image.getIconHeight(), Image.SCALE_DEFAULT)); v.jLabel1.setText(null); v.jLabel1.setIcon(icono); } catch (IOException ex) { } v.setTitle("Activos de Departamento " + depto); v.setVisible(true); }
From source file:reportesedd.Reportes.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed v = new Visor(); String usuario = this.jComboBox1.getSelectedItem().toString(); String empresa = this.jComboBox2.getSelectedItem().toString(); String depto = this.jComboBox3.getSelectedItem().toString(); RequestBody rb = new FormEncodingBuilder().add("usuario", usuario).add("empresa", empresa) .add("departamento", depto).build();//agregar parametros InputStream is = Conexion.consultar("graficarAVL", rb); try {// w w w . j a va 2 s. co m FileOutputStream fos = new FileOutputStream("avl.jpg"); byte[] array = new byte[1000]; int leido = is.read(array); while (leido > 0) { fos.write(array, 0, leido); leido = is.read(array); } is.close(); fos.close(); String ruta = new File("").getAbsolutePath(); ruta = ruta + "\\avl.jpg"; ImageIcon image = new ImageIcon(ruta); Icon icono = new ImageIcon(image.getImage().getScaledInstance(image.getIconWidth(), image.getIconHeight(), Image.SCALE_DEFAULT)); v.jLabel1.setText(null); v.jLabel1.setIcon(icono); } catch (IOException ex) { } v.setTitle("AVL"); v.setVisible(true); }
From source file:reportesedd.ReportesEDD.java
public static void main(String[] args) { // TODO code application logic here rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String usuarios = Conexion.consultarConString("listarUsuarios", rb); rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String empresas = Conexion.consultarConString("empresas", rb); rb = new FormEncodingBuilder().add("p", "p").build();//agregar parametros String deptos = Conexion.consultarConString("departamentos", rb); Reportes r = new Reportes(usuarios, empresas, deptos); r.setVisible(true);/*from www. ja v a 2s.c o m*/ }
From source file:servlets.add.java
private static boolean agregarProd(String user, String empresa, String depto, String id, String nombre, String desc) {//w w w.j a v a 2 s .c om RequestBody rb = new FormEncodingBuilder().add("nombreA", nombre).add("usuario", user) .add("departamento", depto).add("empresa", empresa).add("descripcion", desc).add("id", id).build(); String res = Conexion.consultar("insertarActivo", rb); System.out.println(res); if (res.equals("insertado")) { return true; } else { return false; } }
From source file:servlets.delete.java
private static boolean eliminarActivo(String user, String empresa, String depto, String id) { System.out.println("Voy a eliminar el id: " + id); RequestBody rb = new FormEncodingBuilder().add("usuario", user).add("departamento", depto) .add("empresa", empresa).add("id", id).build(); String res = Conexion.consultar("eliminarActivo", rb); System.out.println(res);/*from w w w .j av a2 s. com*/ if (res.equals("eliminado")) { return true; } else { return false; } }