Beispiel #1
0
 public void getData() {
   for (int i = model.getRowCount() - 1; i >= 0; i--) {
     model.removeRow(i);
   }
   ArrayList<Book> list = bm.bookAllData();
   for (Book book : list) {
     String[] data = {String.valueOf(book.getNo()), book.getTitle(), book.getAuthor()};
     model.addRow(data);
   }
 }
Beispiel #2
0
 public void getFindData() {
   for (int i = model.getRowCount() - 1; i >= 0; i--) {
     model.removeRow(i);
   }
   String pub = box.getSelectedItem().toString();
   ArrayList<Book> list = bm.bookFindData(pub);
   tf.setText(pub);
   for (Book book : list) {
     String[] data = {String.valueOf(book.getNo()), book.getTitle(), book.getAuthor()};
     model.addRow(data);
   }
 }
Beispiel #3
0
 public void getFindData(String column, String fdata) {
   for (int i = model.getRowCount() - 1; i >= 0; i--) {
     model.removeRow(i);
   }
   EmpDAO dao = new EmpDAO();
   ArrayList<EmpDTO> list = dao.empFindData(column, fdata);
   for (EmpDTO d : list) {
     String[] data = {
       String.valueOf(d.getEmpno()),
       d.getEname(),
       d.getJob(),
       d.getHiredate().toString(),
       String.valueOf(d.getDeptno())
     };
     model.addRow(data);
   }
 }
 private void openFile() {
   // opens a single file chooser (can select multiple), does not traverse folders.
   this.copyList = new ArrayList();
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setMultiSelectionEnabled(true);
   fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
   FileNameExtensionFilter filterhtml = new FileNameExtensionFilter("HTML File (.html)", "html");
   fc.addChoosableFileFilter(filterhtml);
   fc.setFileFilter(filterhtml);
   int result = fc.showOpenDialog(FrontEnd.this);
   dir = fc.getCurrentDirectory();
   dirImp = dir.toString();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       for (File file1 : fc.getSelectedFiles()) {
         fileImp = file1.toString();
         boolean exists = false;
         for (int i = 0; i < table.getRowCount(); i++) {
           dir = fc.getCurrentDirectory();
           dirImp = dir.toString();
           String copyC = dtm.getValueAt(i, 0).toString();
           if (duplC.isSelected()) {
             if (fileImp.endsWith(copyC)) {
               exists = true;
               break;
             }
           }
         }
         if (!exists) {
           addRow();
           dtm.setValueAt(fileImp.substring(67), curRow, 0);
           dtm.setValueAt(dirImp.substring(67), curRow, 1);
           curRow++;
           if (headC == 1) {
             if (fileImp.substring(67).endsWith(dirImp.substring(67) + ".html")) {
               curRow--;
               dtm.removeRow(curRow);
             }
           }
         }
       }
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }
 private void openFolder() {
   // opens all htmls in a folder other than the one with same name as folder
   final JFileChooser fc = new JFileChooser(currentPath);
   fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
   int result = fc.showOpenDialog(FrontEnd.this);
   file = fc.getSelectedFiles();
   dir = fc.getSelectedFile();
   switch (result) {
     case JFileChooser.APPROVE_OPTION:
       dirImp = dir.toString();
       File[] filesInDirectory = dir.listFiles();
       for (File file1 : filesInDirectory) {
         String fileS = file1.toString();
         fileS.substring(fileS.lastIndexOf('.') + 1);
         if (fileS.contains("html")) {
           fileImp = file1.toString();
           boolean exists = false;
           for (int i = 0; i < table.getRowCount(); i++) {
             String copyC = dtm.getValueAt(i, 0).toString();
             if (duplC.isSelected()) {
               if (fileImp.contains(copyC)) {
                 exists = true;
                 break;
               }
             }
           }
           if (!exists) {
             addRow();
             dtm.setValueAt(fileImp.substring(67), curRow, 0);
             dtm.setValueAt(dirImp.substring(67), curRow, 1);
             curRow++;
             if (headC == 1) {
               if (fileImp.substring(67).endsWith(dirImp.substring(67) + ".html")) {
                 curRow--;
                 dtm.removeRow(curRow);
               }
             }
           }
         }
       }
     case JFileChooser.CANCEL_OPTION:
       break;
   }
 }