1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146
|
/*
* 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.
*/
/**
*
* @author W.S.I
*/
import java.awt.Dimension;
import static java.awt.Frame.MAXIMIZED_BOTH;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.util.Arrays;
import javax.swing.DefaultListCellRenderer;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.zip.GZIPInputStream;
import static javax.management.Query.value;
import static javax.management.Query.value;
import static javax.management.Query.value;
import javax.swing.DefaultListModel;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JProgressBar;
import javax.swing.JTable;
import javax.swing.ListModel;
import javax.swing.SwingWorker;
import javax.swing.event.ListSelectionEvent;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.swing.table.DefaultTableModel;
import javax.swing.text.BadLocationException;
import org.apache.poi.EncryptedDocumentException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.jdom2.JDOMException;
/*
* 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.
*/
/**
*
* @author W.S.I
*/
public class Fenetre3 extends javax.swing.JFrame {
JFileChooser chooser = new JFileChooser();
ArrayList<String> resultt ;
String lastPathList;
String pathload;
ArrayList<String> lisfun=new ArrayList<>();
int sommesuc=0,sommeechec=0,sommefailed=0;
JFrame frame1 = new JFrame();
ArrayList<String> lis=new ArrayList<String>();
ArrayList<String> listrep=new ArrayList<String>();
javax.swing.JTable jTable1;
javax.swing.JTextArea jTextArea2;
ArrayList<String>listnam=new ArrayList<String>();
File fil;
JProgressBar progressBar = new JProgressBar();
ArrayList<String> lisnom=new ArrayList<String>();
ArrayList<String> lisnp=new ArrayList<String>();
ArrayList<String>lisnomedit=new ArrayList<String>();
Icon icone=new ImageIcon("recherch.png");
DefaultTableModel model = new DefaultTableModel();
ArrayList<String> lisnomexcel=new ArrayList<String>();
String pathret;
ArrayList<String> listepath=new ArrayList<String>();
ArrayList<String>listname=new ArrayList<String>();
ListModel<File> modell;
ArrayList<String>listnomtextarea=new ArrayList<String>();
/**
* Creates new form Fenetre
*/
String choosertitle;
Exemple ex;
/**
* Creates new form Fenetre
*/
public Fenetre3() {
this.ex=new Exemple(this);
initComponents();
setIcon();
//pour la dimension de la fenetre soit la meme pour l'ecran
setExtendedState(MAXIMIZED_BOTH);
setPreferredSize(new Dimension(640, 640));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 640, 470);
}
//classe import
/**
* 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">
private void initComponents() {
jButton5 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jPanel2 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
jPanel10 = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea2 = new javax.swing.JTextArea();
jPanel9 = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jPanel8 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jPanel7 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
jPanel6 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList<>();
jPanel5 = new javax.swing.JPanel();
recherch = new javax.swing.JTextField();
jPanel4 = new javax.swing.JPanel();
path = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jButton4 = new javax.swing.JButton();
jPanel11 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Analyseur de traces 3G");
getContentPane().setLayout(null);
jPanel1.setBackground(new java.awt.Color(153, 153, 153));
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel1.setLayout(null);
jPanel2.setBackground(new java.awt.Color(153, 153, 153));
jPanel2.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel3.setBackground(new java.awt.Color(153, 153, 153));
jPanel3.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel3.setLayout(null);
jPanel10.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel10.setLayout(new java.awt.BorderLayout());
jTextArea2.setColumns(20);
jTextArea2.setFont(new java.awt.Font("Consolas", 0, 13));
jTextArea2.setRows(5);
jScrollPane4.setViewportView(jTextArea2);
jPanel10.add(jScrollPane4, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel10);
jPanel10.setBounds(260, 430, 700, 210);
jPanel9.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel9.setLayout(new java.awt.BorderLayout());
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Consolas", 0, 13));
jTextArea1.setRows(5);
jScrollPane3.setViewportView(jTextArea1);
jPanel9.add(jScrollPane3, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel9);
jPanel9.setBounds(260, 60, 700, 360);
jPanel8.setBackground(new java.awt.Color(153, 153, 153));
jPanel8.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel8.setLayout(new java.awt.BorderLayout());
jLabel1.setBackground(new java.awt.Color(153, 153, 153));
jLabel1.setText(" ");
jPanel8.add(jLabel1, java.awt.BorderLayout.CENTER);
progressBar.setVisible(false);
jPanel8.add(progressBar);
jPanel3.add(jPanel8);
jPanel8.setBounds(10, 650, 250, 25);
jPanel7.setBackground(new java.awt.Color(250, 250, 250));
jPanel7.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel7.setLayout(new java.awt.BorderLayout());
jTable1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Not case", "Succeed", "Failed"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
});
jScrollPane2.setViewportView(jTable1);
jPanel7.add(jScrollPane2, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel7);
jPanel7.setBounds(970, 60, 370, 580);
jPanel6.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel6.setLayout(new java.awt.BorderLayout());
jList1.setCellRenderer(new DefaultListCellRenderer() {
public java.awt.Component getListCellRendererComponent(JList<?> jlist, Object value, int index, boolean selected, boolean focused) {
if ( value instanceof File ) {
value = ((File)value).getName(); // on ne veut afficher que le nom du dossier
}
return super.getListCellRendererComponent(jlist, value, index, selected, focused);
};
});
jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
jList1ValueChanged(evt);
}
private void jList1ValueChanged(ListSelectionEvent evt) {
if ( evt.getValueIsAdjusting() ) {
ListListener lis=new ListListener();
lis.execute();
}
}
});
jList1.setCellRenderer(new DefaultListCellRenderer() {
public java.awt.Component getListCellRendererComponent(JList<?> jlist, Object value, int index, boolean selected, boolean focused) {
if ( value instanceof File ) {
value = ((File)value).getName(); // on ne veut afficher que le nom du dossier
}
return super.getListCellRendererComponent(jlist, value, index, selected, focused);
};
});
jScrollPane1.setViewportView(jList1);
jPanel6.add(jScrollPane1, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel6);
jPanel6.setBounds(10, 110, 240, 530);
jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel5.setLayout(new java.awt.BorderLayout());
recherch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
recherchActionPerformed(evt);
}
});
recherch.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
recherchKeyReleased(evt);
}
private void recherchKeyReleased(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
lancerRecherche1(recherch.getText());
// Recherch rch=new Recherch();
// rch.execute();
}
});
jPanel5.add(recherch, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel5);
jPanel5.setBounds(10, 60, 210, 40);
//jPanel5.setBounds(10, 60, 260, 40);
jPanel4.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel4.setLayout(new java.awt.BorderLayout());
path.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1ActionPerformed(evt);
}
});
jPanel4.add(path, java.awt.BorderLayout.CENTER);
jPanel3.add(jPanel4);
jPanel4.setBounds(10, 10, 1190, 40);
jButton1.setText("Import");
jPanel3.add(jButton1);
jButton1.setBounds(1210, 10, 130, 40);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jButton1ActionPerformed(evt);
} catch (IOException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
jButton2.setText("Analyze");
jPanel3.add(jButton2);
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
try {
jButton2ActionPerformed(evt);
} catch (FileNotFoundException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
} catch (BadLocationException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (IOException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
} catch (EncryptedDocumentException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvalidFormatException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
jButton2.setBounds(1240, 650, 100, 30);
jButton3.setText("Load");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
try {
jButton3ActionPerformed(evt);
} catch (IOException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
} catch (InvalidFormatException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
} catch (JDOMException ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
}
});
jPanel3.add(jButton3);
jButton3.setBounds(1120, 650, 110, 30);
jButton4.setText("Display editor");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jPanel3.add(jButton4);
// 970, 60, 370, 580);
jButton4.setBounds(970, 650, 138, 30);
jPanel11.setBackground(new java.awt.Color(255, 255, 255));
jPanel11.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel11.setLayout(null);
jLabel2.setIcon(new javax.swing.ImageIcon("C:\\Users\\W.S.I\\Documents\\NetBeansProjects\\PFE_test\\src\\1623.png")); // NOI18N
jPanel11.add(jLabel2);
jLabel2.setBounds(0, 0, 30, 40);
jPanel3.add(jPanel11);
jPanel11.setBounds(220, 60, 30, 40);
jButton5.setText("Solutions");
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
}
});
jPanel3.add(jButton5);
jButton5.setBounds(820, 650, 140, 30);
jPanel2.add(jPanel3, java.awt.BorderLayout.CENTER);
jPanel1.add(jPanel2);
jPanel2.setBounds(5, 5, 1390, 730);
getContentPane().add(jPanel1);
jPanel1.setBounds(0, 0, 1400, 740);
pack();
setLocationRelativeTo(null);
}// </editor-fold>
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void recherchActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
public void jButton1ActionPerformed(java.awt.event.ActionEvent evt) throws IOException {
// public ArrayList<String> jButton1ActionPerformed(java.awt.event.ActionEvent evt) throws IOException {
// TODO add your handling code here:
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle(choosertitle);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
//
if (chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) {
System.out.println("getCurrentDirectory(): "
+ chooser.getCurrentDirectory());
System.out.println("getSelectedFile() : "
+ chooser.getSelectedFile());
Import imp= new Import();
imp.execute();
} else {
System.out.println("No Selection ");
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) throws IOException, FileNotFoundException, EncryptedDocumentException, InvalidFormatException, BadLocationException {
DefaultTableModel model1=getmodel();
getmodel().getDataVector().removeAllElements();
Worker work=new Worker();
work.execute();
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// if()
DefaultTableModel model1=getmodel();
getmodel().getDataVector().removeAllElements();
if(getPathret()==null){JOptionPane.showMessageDialog(Fenetre3.this, "Veillez importer la liste d'appels pour pouvoir faire l'analyse !","Info",
JOptionPane.INFORMATION_MESSAGE);}
else{
frame1.getContentPane().removeAll();
frame1.getContentPane().add(new Exemple(this));
frame1.pack();
frame1.setLocationRelativeTo(null);
frame1.setTitle("Editeur graphique");
frame1.setVisible(true);
} }
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) throws IOException, FileNotFoundException, InvalidFormatException, JDOMException {
// TODO add your handling code here:
JFileChooser fileChooser = new JFileChooser();
ArrayList<String> lisnom2=new ArrayList<>();
lisnom2.clear();
lisnomedit.clear();
if(fileChooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION){
FileNameExtensionFilter filter = new FileNameExtensionFilter("Fichier de trace ","txt");
fileChooser.addChoosableFileFilter(filter);
File fichier = fileChooser.getSelectedFile();
pathload= fileChooser.getSelectedFile().toString();
FileReader file = null;
try{
InputStream flux=new FileInputStream(fileChooser.getSelectedFile().toString());
InputStreamReader lecture=new InputStreamReader(flux);
BufferedReader buff=new BufferedReader(lecture);
String ligne;
while ((ligne=buff.readLine())!=null ){
lisnom2.add(ligne);
}
buff.close();
}
catch (Exception e){
System.out.println(e.toString());
}
for(int i=0;i<lisnom2.size();i++)
{
String nom=lisnom2.get(i);
if(!nom.equals("")){lisnomedit.add(nom);}else{System.out.println("cc");}}
System.out.println(lisnomedit);
ReadExeLS reedexel=new ReadExeLS();
lisnomexcel=reedexel.ReadEx(lisnomedit);//nom abrege
lisfun=reedexel.getListefunction();
String path2= System.getProperty("user.home").concat("\\").concat("sena.txt");
System.out.println(path2);
Saveeditor inst2=new Saveeditor();
inst2.save(lisnomedit, path2);
file = new FileReader(path2);
BufferedReader br=new BufferedReader(file);
try {
jTextArea2.read(br,null);
} catch (IOException e) {
e.printStackTrace();
}
}
}
/**
* @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 <a href="http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html" target="_blank">http://download.oracle.com/javase/tu...feel/plaf.html</a>
*/
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(Fenetre3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Fenetre3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Fenetre3.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Fenetre3.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 Fenetre3().setVisible(false);
SplashJDialog splash = new SplashJDialog(new Fenetre3());
(new Thread(splash)).start();
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JList<File> jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel9;
private javax.swing.JPanel jPanel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField path;
private javax.swing.JTextField recherch;
// End of variables declaration
private void setIcon() {
//To change body of generated methods, choose Tools | Templates.
setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("nokia_icon.png")));
}
private static void decompressGzipFile(String gzipFile, String newFile) {
try {
FileInputStream fis = new FileInputStream(gzipFile);
GZIPInputStream gis = new GZIPInputStream(fis);
FileOutputStream fos = new FileOutputStream(newFile);
byte[] buffer = new byte[1024];
int len;
while((len = gis.read(buffer)) != -1){
fos.write(buffer, 0, len);
}
//close resources
fos.close();
gis.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public String getPathret() {
return pathret;
}
public ArrayList<String> getListnam() {
return listnam;
}
public ArrayList<String> getListrep() {
return listrep;
}
private void lancerRecherche1(String text) {
//To change body of generated methods, choose Tools | Templates.
String chaine=recherch.getText();
System.out.println(chaine);
DefaultListModel model3 = new DefaultListModel<>();
int i=0;
if(chaine!=null&&!chaine.equals("")){
ListModel<File> modell=jList1.getModel();
while(i<modell.getSize()){
File fil= modell.getElementAt(i);
String text1=fil.getName();
if(chaine.contains(text1)){
System.out.println(text1);
DefaultListModel model2 = new DefaultListModel<>();
model2.addElement(fil);
jList1.setModel(model2);
i=modell.getSize();}else{i++;}}}else {
System.out.println("cccc");
String pathlist = chooser.getSelectedFile().toString();
System.out.println(pathlist);
File fil2 = new File(pathlist);
File[] listefile1 = fil2.listFiles();
if( listefile1!=null) {
for(File file : listefile1) {
model3.addElement(file);
}}
jList1.setModel(model3);}}
public JFrame getFrame1() {
return frame1;
}
public ListModel<File> getModell() {
return modell;
}
public ArrayList<String> getListepath() {
return listepath;
}
public ArrayList<String> getListname() {
return listname;
}
public DefaultTableModel getmodel()
{
DefaultTableModel model=(DefaultTableModel) jTable1.getModel();
return model;
}
public class Import extends SwingWorker<Void,Void>{
protected Void doInBackground() throws Exception{
progressBar.setIndeterminate(true);
progressBar.setVisible(true);
path.setText(chooser.getSelectedFile().toString());
String pathlist = chooser.getSelectedFile().toString();
File fil = new File(pathlist);
File[] listefile = fil.listFiles();
pathret=chooser.getSelectedFile().toString();
path.setText(chooser.getSelectedFile().toString());
DefaultListModel model = new DefaultListModel<>();
if( listefile!=null) {
for(File file : listefile) {
model.addElement(file);
listname.add(file.getName());
}
}
jList1.setModel(model);
modell=jList1.getModel();
return null;
}
public void done(){
progressBar.setVisible(false);
}
}
public class ListListener extends SwingWorker<Void,Void>{
protected Void doInBackground()throws Exception{
progressBar.setIndeterminate(true);
progressBar.setVisible(true);
Main senre=new Main();
Long start = System.currentTimeMillis();
File selectedFile = jList1.getSelectedValue(); // je récupère le File sélectionné dans la JList
File[] files = selectedFile.listFiles();
String select=selectedFile.toString();// je cherche les fichiers (et que les fichiers) qui s'y trouvent
char c='\\';
String d=Character.toString(c);
String pathfilesena=selectedFile.toString().concat(d).concat("CallflowSenario.txt");
if ( files!=null ) {
int i = 0;
while( i <files.length) {
if(files[i].getName().startsWith("RNCCN")== true){
String pathfich=files[i].getAbsolutePath();
if(files[i].getName().endsWith(".xml.gz")){
String newFile= pathfich.replace(".gz", "");
i=files.length;decompressGzipFile(pathfich, newFile);
try {
senre.mainMethod(newFile,pathfilesena);
} catch (Exception ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
FileReader file = null;
try{
file = new FileReader(pathfilesena);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BufferedReader br=new BufferedReader(file);
try {
jTextArea1.read(br,null);
System.out.println("Analyse de senario en " + (System.currentTimeMillis() - start) + " mses");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}}else if((files[i].getName().endsWith(".xml"))){
String pathfich1=files[i].getAbsolutePath();
i=files.length; try {
senre.mainMethod(pathfich1,pathfilesena);
} catch (Exception ex) {
Logger.getLogger(Fenetre3.class.getName()).log(Level.SEVERE, null, ex);
}
FileReader file = null;
try{
file = new FileReader(pathfilesena);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BufferedReader br=new BufferedReader(file);
try {
jTextArea1.read(br,null);
System.out.println("Analyse de senario en " + (System.currentTimeMillis() - start) + " mses");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
br.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}}else{
i++;}}
else{i++;}
}}
else {
System.out.println("Aucun fichier.");
}
return null;
}
public void done(){progressBar.setVisible(false);}
}
public String getPathload() {
return pathload;
}
public class Worker extends SwingWorker<Void, Void>{
//@Override
protected Void doInBackground() throws Exception {
if(getPathret()==null){JOptionPane.showMessageDialog(Fenetre3.this, "Veillez importer la liste d'appels pour pouvoir faire l'analyse !","Info",
JOptionPane.INFORMATION_MESSAGE);}
else{
String path1=getPathload();
System.out.println(path1);
String chaine="";
ArrayList lisnom=getLisnomedit();
progressBar.setIndeterminate(true);
progressBar.setVisible(true);
save1(lisnom, getPathret());
}
//To change body of generated methods, choose Tools | Templates.
return null;
}
// @Override
public void done(){
progressBar.setVisible(false);
}
}
public void save1(ArrayList<String> liste,String pathtoExplore) throws IOException, JDOMException, FileNotFoundException, EncryptedDocumentException, InvalidFormatException{
ArrayList<String>nom=new ArrayList<String>();
//System.out.println(liste);
ArrayList<String> result1= getListname();
ArrayList<String> result=getListepath();//listepath
ListModel<File> model2=getModell();//listrepaertoire
for(int i=0;i<model2.getSize();i++){
sommesuc=0;sommefailed=0;sommeechec=0;
Lister_path diskFileExplorer = new Lister_path(model2.getElementAt(i).toString(),true);
ArrayList<String> list= diskFileExplorer.Lister_path();
for(int j=0;j<list.size();j++){
result.add(list.get(j));}}
int l=0,row=0,i=0,h=0;
DefaultTableModel tableModel= getmodel();
while(i< result.size()&& l<result1.size() && h<model2.getSize()){
String nompath=result.get(i);
System.out.println(result1.get(l));
Reader_xml read=new Reader_xml();
ArrayList<String> listabreg= read.getName(nompath);
ArrayList<String> listfunction= read.getfunction(nompath);
System.out.println(listabreg);
System.out.println(liste);
ReadExeLS reedexel=new ReadExeLS();
ArrayList<String> lisn=reedexel.ReadEx(liste);
ArrayList<String> lisfun1=reedexel.getListefunction();
System.out.println(lisn);
// System.out.println(lisfun);
int j=0,k=0, S=0;
while(k<lisn.size()&&j<listabreg.size()&&k<lisfun1.size()&&j<listfunction.size()){
if(k==0){
if(!(lisn.get(k).equalsIgnoreCase(listabreg.get(j))&&lisfun1.get(k).equalsIgnoreCase(listfunction.get(j)))){
j++;if(j==listabreg.size()){k=lisn.size();tableModel.addRow(new String[] {"","",""});
tableModel.setValueAt(result1.get(l), row, 0);
sommeechec++;System.out.println(sommeechec); l++;row++;i++;h++;
}else{System.out.println(S);}
}else{S++;k++;j=0; }}
else{
if((lisn.get(k)).equalsIgnoreCase(listabreg.get(j))&&(lisfun1.get(k).equalsIgnoreCase(listfunction.get(j)))){
S++;k++;j=0;
System.out.println(S);}else{System.out.println(S);j++;if(j==listabreg.size()){j=0;k++;}else{System.out.println(S);}}}
}
if(S==lisn.size()){
tableModel.addRow(new String[] {"","",""});
tableModel.setValueAt(result1.get(l), row, 1);
sommesuc++;
l++;row++; i++;h++;}
else if(S>0&&S<lisn.size()){
tableModel.addRow(new String[] {"","",""});
tableModel.setValueAt(result1.get(l), row, 2);
lisnom.add(model2.getElementAt(h).toString());
// lisnom.add(result1.get(l));
lisnp.add(result.get(i));
sommefailed++;
l++;row++;i++;h++;} else{System.out.println(S);}
System.out.println(lisnom);
System.out.println(lisnp);
System.out.println("lllllll");
System.out.println(sommeechec);
System.out.println(sommefailed);
System.out.println(sommesuc);
} new StatistiqueDialog();}
public int getSommesuc() {
return sommesuc;
}
public int getSommeechec() {
return sommeechec;
}
public int getSommefailed() {
return sommefailed;
}
public class StatistiqueDialog extends javax.swing.JDialog {
private Task task;
/**
* Creates new form StatistiqueDialog
*/
public StatistiqueDialog() {
initComponents();
task = new Task();
task.execute();
this.setVisible(true);
}
/**
* 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">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Résultats d'analyse : Statistiques");
setPreferredSize(new java.awt.Dimension(450, 360));
getContentPane().setLayout(null);
jPanel1.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
jPanel1.setPreferredSize(new java.awt.Dimension(450, 360));
jPanel1.setLayout(new java.awt.BorderLayout());
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
jTextArea1.setRows(5);
jTextArea1.setSelectionColor(new java.awt.Color(255, 255, 255));
jScrollPane1.setViewportView(jTextArea1);
jPanel1.add(jScrollPane1, java.awt.BorderLayout.CENTER);
getContentPane().add(jPanel1);
jPanel1.setBounds(0, 0, 430, 290);
jButton1.setText("Fermer");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1);
jButton1.setBounds(10, 290, 90, 30);
pack();
}// </editor-fold>
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
task.cancel(true);
StatistiqueDialog.this.dispose();
}
/**
* @param args the command line arguments
*/
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JButton jButton5;
// End of variables declaration
class Task extends SwingWorker<Void, Void>{
@Override
protected Void doInBackground() throws Exception {
return null;
}
public void done(){
jTextArea1.setText("Number of calls not case :"+getSommeechec()+"\n"+"Number of calls:"+getSommesuc()+"\n"+"Number of failed calls:"+getSommefailed());
}
}
}
public ArrayList<String> getLisnom() {
return lisnom;
}
public ArrayList<String> getLisnp() {
return lisnp;
}
public ArrayList<String> getLisnomedit() {
return lisnomedit;
}
public ArrayList<String> getLisnomexcel() {
return lisnomexcel;
}
public ArrayList<String> getLisfun() {
return lisfun;
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) { //bouton Solution1
// TODO add your handling code here:
Solution1 sol= new Solution1(this,getEx());
}
public Exemple getEx() {
return this.ex;
}
} |
Partager