Exemplo n.º 1
0
        public void tableChanged(javax.swing.event.TableModelEvent tme) {
          DefaultTableModel tm = (DefaultTableModel) tme.getSource();
          int col = tme.getColumn();
          int row = tme.getFirstRow();
          String valCel = (String) tm.getValueAt(tme.getFirstRow(), 0);

          if (tme.getType() == 0 && (col == 2 || col == 3)) {
            calculaSumas();
          }
        }
 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;
   }
 }
Exemplo n.º 4
0
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == table) {
     if (e.getClickCount() == 2) // 더블클릭
     {
       int row = table.getSelectedRow();
       String no = model.getValueAt(row, 0).toString();
       bp.setPoster(Integer.parseInt(no));
       bp.repaint();
       Book book = bm.bookDetail(Integer.parseInt(no));
       la1.setText("번호:" + no);
       la2.setText("제목:" + book.getTitle());
       la3.setText("저자:" + book.getAuthor());
       la4.setText("출판사:" + book.getPublisher());
       la5.setText("가격:" + book.getPrice());
     }
   } else if (e.getSource() == b) {
     getData();
   }
 }
Exemplo n.º 5
0
 @Override
 public void mouseClicked(MouseEvent e) {
   // TODO Auto-generated method stub
   if (e.getSource() == table) {
     if (e.getClickCount() == 2) {
       int row = table.getSelectedRow();
       String sabun = model.getValueAt(row, 0).toString();
       EmpDAO dao = new EmpDAO();
       EmpDTO d = dao.empDetailData(Integer.parseInt(sabun));
       String msg =
           "사번:"
               + d.getEmpno()
               + "\n"
               + "이름:"
               + d.getEname()
               + "\n"
               + "직위:"
               + d.getJob()
               + "\n"
               + "사수번호:"
               + d.getMgr()
               + "\n"
               + "입사일:"
               + d.getHiredate().toString()
               + "\n"
               + "급여:"
               + d.getSal()
               + "\n"
               + "성과급:"
               + d.getComm()
               + "\n"
               + "부서번호:"
               + d.getDeptno();
       JOptionPane.showMessageDialog(this, msg);
     }
   }
 }
 private void doLaunch() throws IOException {
   // kicks off the launch after confirm and check if not null, two possibilities. Select Folder
   // sets flag and does folder. All others just makes a list.
   int reply =
       JOptionPane.showConfirmDialog(
           null, "Are you sure you want to launch?", "Launch?", JOptionPane.YES_NO_OPTION);
   if (reply == JOptionPane.YES_OPTION) {
     int numRow = table.getRowCount();
     if (numRow < 1) {
       JOptionPane.showMessageDialog(frame, "You need to select tests to launch.");
       return;
     }
     if (selFoFl == 0) {
       try (BufferedWriter bw =
           new BufferedWriter(
               new FileWriter(
                   "C:\\Projects\\testSeleniumFramework\\framework\\runSelectedTests.bat"))) {
         if (numRow < 2) {
           pullS = table.getValueAt(0, 0).toString();
         }
         if (numRow > 1) {
           for (int i = 0; i < numRow; i++) {
             Object o = table.getValueAt(i, 0);
             pullS += ",";
             pullS += o.toString();
           }
         }
         if (pullS.contains("null,")) {
           pullS = pullS.substring(5);
         }
         if (pullS.startsWith(",")) {
           pullS = pullS.substring(1);
         }
         // String lineC ="";
         if (flagF == 1) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + pullS
                   + "\"";
         }
         if (flagF == 2) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + pullS
                   + " Y\"";
         }
         if (flagF == 3) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + pullS
                   + " ONLYFAIL\"";
         }
         bw.write(
             "Echo \"Launching tests..."
                 + "\r\ncd C:\\Projects\\testSeleniumFramework\r\n"
                 + lineC
                 + "\r\n");
       }
       pullS = "";
       Process p =
           Runtime.getRuntime()
               .exec(
                   "cmd /c start C:\\Projects\\testSeleniumFramework\\framework\\runSelectedTests.bat");
     }
     if (selFoFl == 1) {
       try (BufferedWriter bw =
           new BufferedWriter(
               new FileWriter(
                   "C:\\Projects\\testSeleniumFramework\\framework\\runSelectedTests.bat"))) {
         // String lineC = "";
         if (flagF == 1) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + dtm.getValueAt(0, 1).toString()
                   + "\\\"";
         }
         if (flagF == 2) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + dtm.getValueAt(0, 1).toString()
                   + "\\ Y\"";
         }
         if (flagF == 3) {
           lineC =
               "mvn clean test exec:java -Dconcordion.output.dir=\""
                   + placeS
                   + "\" -Dexec.args=\""
                   + dtm.getValueAt(0, 1).toString()
                   + "\\ ONLYFAIL\"";
         }
         bw.write(
             "Echo \"Launching tests..."
                 + "\r\ncd C:\\Projects\\testSeleniumFramework\r\n"
                 + lineC
                 + "\r\n");
       }
       pullS = "";
       Process p =
           Runtime.getRuntime()
               .exec(
                   "cmd /c start C:\\Projects\\testSeleniumFramework\\framework\\runSelectedTests.bat");
     }
   } else {
   }
 }