Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Interfaz; import Logica.Funciones; import Logica.ManejadorDeListas; import static Logica.ManejadorDeListas.cargaListaActividadReciente; import Logica.Tickets; import com.toedter.calendar.JCalendar; import java.util.ArrayList; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.category.DefaultCategoryDataset; import org.jfree.data.general.DefaultPieDataset; /** * * @author root */ public class VnServidorReportes extends javax.swing.JFrame { private ServidorVentana ventanaPadre; public static DefaultCategoryDataset dataset = new DefaultCategoryDataset(); /** * Creates new form VnServidorReportes */ public VnServidorReportes(ServidorVentana ventanaPadre) { initComponents(); setLocationRelativeTo(null); //cargaListaActividadReciente(); this.ventanaPadre = ventanaPadre; dataset.setValue(9, "Atendidos", "Reporte de Tickets"); dataset.setValue(10, "Aun EN Atencion", "Reporte de Tickets"); dataset.setValue(70, "Pendientes", "Reporte de Tickets"); dataset.setValue(25, "Sin Categorizar", "Reporte de Tickets"); JFreeChart chart = ChartFactory.createBarChart("", "", "Cantidad", dataset, PlotOrientation.VERTICAL, rootPaneCheckingEnabled, rootPaneCheckingEnabled, rootPaneCheckingEnabled); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setBounds(0, 0, 250, 170); this.pnGraficoNumTikets.add(chartPanel); } public VnServidorReportes() { initComponents(); setLocationRelativeTo(null); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTabbedPane2 = new javax.swing.JTabbedPane(); jPanel4 = new javax.swing.JPanel(); jPanel6 = new javax.swing.JPanel(); lblTiketsAtendidos = new javax.swing.JLabel(); lblTicketsPendientes = new javax.swing.JLabel(); lblTicketsSinCategorizar = new javax.swing.JLabel(); lblTicketsEnSistema = new javax.swing.JLabel(); lblTicketsEnAtencion = new javax.swing.JLabel(); pnGraficoNumTikets = new javax.swing.JPanel(); btnVolverPrincipal = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); ListaActividadReciente = new java.awt.List(); jPanel5 = new javax.swing.JPanel(); jLabel2 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); cbTipoBusqueda = new javax.swing.JComboBox(); jCheckBox1 = new javax.swing.JCheckBox(); jButton2 = new javax.swing.JButton(); jScrollPane4 = new javax.swing.JScrollPane(); jList4 = new javax.swing.JList(); jlReportes = new java.awt.List(); jButton1 = new javax.swing.JButton(); calendariodesde = new com.toedter.calendar.JDateChooser(); calendariohasta = new com.toedter.calendar.JDateChooser(); jLabel3 = new javax.swing.JLabel(); tiempopromedio = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); jTabbedPane2.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jTabbedPane2.setPreferredSize(new java.awt.Dimension(800, 500)); jTabbedPane2.setRequestFocusEnabled(false); jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Status General ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri Light", 0, 14), new java.awt.Color(255, 153, 0))); // NOI18N lblTiketsAtendidos.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N lblTiketsAtendidos.setText("TIkets Atendidos "); lblTicketsPendientes.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N lblTicketsPendientes.setText("Tikets Pendientes"); lblTicketsSinCategorizar.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N lblTicketsSinCategorizar.setText("Tikets Sin Categorizar"); lblTicketsEnSistema.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N lblTicketsEnSistema.setText("Total Tikets en Sistema"); lblTicketsEnAtencion.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N lblTicketsEnAtencion.setText("Tikets Aun En Atencion"); javax.swing.GroupLayout pnGraficoNumTiketsLayout = new javax.swing.GroupLayout(pnGraficoNumTikets); pnGraficoNumTikets.setLayout(pnGraficoNumTiketsLayout); pnGraficoNumTiketsLayout.setHorizontalGroup(pnGraficoNumTiketsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 302, Short.MAX_VALUE)); pnGraficoNumTiketsLayout.setVerticalGroup(pnGraficoNumTiketsLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 0, Short.MAX_VALUE)); btnVolverPrincipal.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N btnVolverPrincipal.setText("Volver"); btnVolverPrincipal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnVolverPrincipalActionPerformed(evt); } }); javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6); jPanel6.setLayout(jPanel6Layout); jPanel6Layout.setHorizontalGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lblTicketsEnSistema, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTiketsAtendidos, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)) .addComponent(lblTicketsEnAtencion, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblTicketsPendientes, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblTicketsSinCategorizar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 236, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(btnVolverPrincipal, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(pnGraficoNumTikets, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel6Layout.createSequentialGroup().addComponent(lblTiketsAtendidos) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTicketsEnAtencion) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTicketsPendientes) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTicketsSinCategorizar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTicketsEnSistema) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 114, Short.MAX_VALUE) .addComponent(btnVolverPrincipal).addContainerGap()) .addComponent(pnGraficoNumTikets, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Actividad Reciente", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Calibri Light", 0, 18), new java.awt.Color(255, 102, 0))); // NOI18N ListaActividadReciente.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { ListaActividadRecienteItemStateChanged(evt); } }); ListaActividadReciente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ListaActividadRecienteActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent( ListaActividadReciente, javax.swing.GroupLayout.DEFAULT_SIZE, 409, Short.MAX_VALUE)); jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ListaActividadReciente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup(jPanel4Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup().addContainerGap() .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); jPanel4Layout.setVerticalGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); jTabbedPane2.addTab("Estado", jPanel4); jLabel2.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jLabel2.setText(" hasta:"); jLabel1.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jLabel1.setText("Buscar Tickets desde:"); cbTipoBusqueda.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N cbTipoBusqueda.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Todos", "Fernando", "Junior", "Luis" })); cbTipoBusqueda.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbTipoBusquedaActionPerformed(evt); } }); jCheckBox1.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jCheckBox1.setText("Buscar Desde el Origen de los tiempos"); jCheckBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jCheckBox1ActionPerformed(evt); } }); jButton2.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jButton2.setText("Buscar"); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); jList4.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane4.setViewportView(jList4); jlReportes.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jlReportesItemStateChanged(evt); } }); jlReportes.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jlReportesActionPerformed(evt); } }); jButton1.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jButton1.setText("Volver"); jLabel3.setFont(new java.awt.Font("Calibri Light", 0, 14)); // NOI18N jLabel3.setText("Tiempo promedio de atencion:"); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(calendariohasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cbTipoBusqueda, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jCheckBox1, javax.swing.GroupLayout.DEFAULT_SIZE, 311, Short.MAX_VALUE)) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(calendariodesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jButton1) .addGroup(jPanel5Layout.createSequentialGroup().addComponent(jLabel3) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tiempopromedio, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jlReportes, javax.swing.GroupLayout.DEFAULT_SIZE, 691, Short.MAX_VALUE) .addContainerGap())); jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup().addGap(49, 49, 49) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(calendariodesde, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel2).addComponent(calendariohasta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jCheckBox1).addGap(34, 34, 34) .addComponent(cbTipoBusqueda, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tiempopromedio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton2) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jButton1).addGap(21, 21, 21)) .addGroup(jPanel5Layout.createSequentialGroup().addContainerGap().addComponent(jlReportes, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap())); jTabbedPane2.addTab("Rendimiento", jPanel5); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTabbedPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 1037, Short.MAX_VALUE)); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addContainerGap() .addComponent(jTabbedPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 336, Short.MAX_VALUE) .addContainerGap())); pack(); }// </editor-fold>//GEN-END:initComponents private void btnVolverPrincipalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVolverPrincipalActionPerformed this.ventanaPadre.setVisible(true); this.dispose(); // cargaListaActividadReciente(); }//GEN-LAST:event_btnVolverPrincipalActionPerformed public String getFechahasta(){ String ao = Integer.toString(calendariohasta.getCalendar().get(java.util.Calendar.YEAR)); String mes = Integer.toString(calendariohasta.getCalendar().get(java.util.Calendar.MONTH) + 1); String dia = Integer.toString(calendariohasta.getCalendar().get(java.util.Calendar.DATE)); String resultado=""; if(Integer.parseInt(mes)<10&&Integer.parseInt(dia)<10){ resultado="0"+dia+"/"+"0"+mes+"/"+ao; } else if(Integer.parseInt(mes)<10){ resultado=dia+"/"+"0"+mes+"/"+ao; }else if(Integer.parseInt(dia)<10){ resultado="0"+dia+"/"+mes+"/"+ao; } else{ resultado=dia+"/"+mes+"/"+ao; } // date.getCalendar().getTime().getDay() return resultado; } public String getFechadesde(){ String ao = Integer.toString(calendariodesde.getCalendar().get(java.util.Calendar.YEAR)); String mes = Integer.toString(calendariodesde.getCalendar().get(java.util.Calendar.MONTH) + 1); String dia = Integer.toString(calendariodesde.getCalendar().get(java.util.Calendar.DATE)); String resultado=""; if(Integer.parseInt(mes)<10&&Integer.parseInt(dia)<10){ resultado="0"+dia+"/"+"0"+mes+"/"+ao; } else if(Integer.parseInt(mes)<10){ resultado=dia+"/"+"0"+mes+"/"+ao; }else if(Integer.parseInt(dia)<10){ resultado="0"+dia+"/"+mes+"/"+ao; } else{ resultado=dia+"/"+mes+"/"+ao; } // date.getCalendar().getTime().getDay() return resultado; } private void ListaActividadRecienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ListaActividadRecienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_ListaActividadRecienteActionPerformed private void ListaActividadRecienteItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_ListaActividadRecienteItemStateChanged // TODO add your handling code here: }//GEN-LAST:event_ListaActividadRecienteItemStateChanged private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed jlReportes.removeAll(); ArrayList temp; String busqueda = (String) cbTipoBusqueda.getSelectedItem(); if (this.jCheckBox1.isSelected()) { temp = this.filtroNombre(ManejadorDeListas.MegaLista); } else { temp = this.filtroNombre(ManejadorDeListas.ticketEntreFecha(this.getFechadesde(), this.getFechahasta(), ManejadorDeListas.MegaLista)); } this.setTiempoPromedio(temp); llenarJList(temp); System.out.println(temp.size() + " este es el tama;o de lalista"); jlReportes.repaint(); }//GEN-LAST:event_jButton2ActionPerformed public void setTiempoPromedio(ArrayList lista) { int res = 0; for (int i = 0; i < lista.size(); i++) { Tickets temp = (Tickets) lista.get(i); res = res + this.getDuracion(temp.getTiempoSegundos()); } if (lista.isEmpty()) { return; } res = res / lista.size(); this.tiempopromedio.setText(res + ""); } public ArrayList filtroNombre(ArrayList lista) { String nombre = (String) cbTipoBusqueda.getSelectedItem(); System.out.println(nombre); ArrayList temp = new ArrayList(); if (nombre.equals("Todos")) { return lista; } Tickets tickete; for (int i = 0; i < lista.size(); i++) { tickete = (Tickets) lista.get(i); if (tickete.getID_EMPLEADO().equals(nombre)) { temp.add(tickete); } } return temp; } public void llenarJList(ArrayList lista) { for (int i = 0; i < lista.size(); i++) { Tickets temp = (Tickets) lista.get(i); jlReportes.add(temp.getAsunto()); } } private void jlReportesItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jlReportesItemStateChanged }//GEN-LAST:event_jlReportesItemStateChanged private void jlReportesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jlReportesActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jlReportesActionPerformed private void jCheckBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBox1ActionPerformed }//GEN-LAST:event_jCheckBox1ActionPerformed private void cbTipoBusquedaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbTipoBusquedaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_cbTipoBusquedaActionPerformed public int getTiempoHoras(String tiempo) { int resultado = 0; String res = ""; for (int i = 0; i < tiempo.length(); i++) { if (tiempo.charAt(i) == ':') { //res=""; return Integer.parseInt(res) * 60 * 60; //continue; } res = res + tiempo.charAt(i); } return -1; } public int getTiempoMinutos(String tiempo) { int resultado = 0; String res = ""; boolean bandera = false; for (int i = 0; i < tiempo.length(); i++) { if (tiempo.charAt(i) == ':' && !bandera) { res = ""; bandera = true; continue; } if (tiempo.charAt(i) == ':' && bandera) { return Integer.parseInt(res) * 60; } res = res + tiempo.charAt(i); } return -1; } public int getTiempoSegundos(String tiempo) { int resultado = 0; String res = ""; int contador = 0; for (int i = 0; i < tiempo.length(); i++) { if (tiempo.charAt(i) == ':' && contador != 2) { res = ""; contador++; continue; } if (tiempo.charAt(i) == ':' && contador == 2) { return Integer.parseInt(res); } res = res + tiempo.charAt(i); } return -1; } public int getDuracion(String tiempo) { return getTiempoMinutos(tiempo) + getTiempoSegundos(tiempo) + getTiempoHoras(tiempo); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(VnServidorReportes.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(VnServidorReportes.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(VnServidorReportes.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(VnServidorReportes.class.getName()) .log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new VnServidorReportes().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables public static java.awt.List ListaActividadReciente; private javax.swing.JButton btnVolverPrincipal; private com.toedter.calendar.JDateChooser calendariodesde; private com.toedter.calendar.JDateChooser calendariohasta; public static javax.swing.JComboBox cbTipoBusqueda; private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JCheckBox jCheckBox1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JList jList4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JPanel jPanel6; private javax.swing.JScrollPane jScrollPane4; private javax.swing.JTabbedPane jTabbedPane2; public static java.awt.List jlReportes; public static javax.swing.JLabel lblTicketsEnAtencion; public static javax.swing.JLabel lblTicketsEnSistema; public static javax.swing.JLabel lblTicketsPendientes; public static javax.swing.JLabel lblTicketsSinCategorizar; public static javax.swing.JLabel lblTiketsAtendidos; private javax.swing.JPanel pnGraficoNumTikets; private javax.swing.JLabel tiempopromedio; // End of variables declaration//GEN-END:variables }